Advertisement

transform&lightning

Started by August 23, 2000 08:01 AM
1 comment, last by vesinokkaelain 24 years, 3 months ago
Do i have to do rotations manually to get the rotated z-coords needed for sorting? Does opengl rotate normals or light vectors when calculating lightning? it seems slow... thanks in advance, Mats
nope just subtract the objects position from the cameras position and get the length of that vector ie sqrt(x*x + y*y + z*z)

yes lighting is slow theres a hell of a lot of calculations to do each for each vertice, i recently down my own lighting in software. it was realtime
esp with positional lights u need a sqrt and a devide
Advertisement
quote:
Do i have to do rotations manually to get the
rotated z-coords needed for sorting?


Best to use the matrix at that moment. Transform coords to get the distance.


quote:
Does opengl rotate normals or light vectors
when calculating lightning? it seems slow...


I don''t know exactly, but if OpenGL is any good, or you want to do it yourself, maybe this is the answer:

- Do your translation & rotations to get the matrix
- Invert the matrix to get the inverse
*** Now you have the camera in object space!
- Use the camera pos in object space for backface culling and/or lighting.
- Now you don''t have to transform your normals. Much much faster!!!

This topic is closed to new replies.

Advertisement