Skip to main content
GameDev.net gamedev.net
🔒 Locked

transform&lightning

Started by vesinokkaelain Aug 23, 2000 at 8:01 AM 1 replies 450+ views
Original Post
vesinokkaelain
vesinokkaelain
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
zedzeek
zedzeek
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
baskuenen
baskuenen
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!!!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.