View Full Version : Lighting Problems
08-02-2001, 12:51 AM
Hi, I hope some one can help me.
I have so many diferent solids draw, each one has been draw whit a diferent transformations( translate and rotate ), and i have define a light LIGHT0 but it applay diferent for each solid like if the light has been transformet whit the solid transformation.
I know light is in eyes coordinate but i can put it globaly.
How do I render those solid and makes the like to by apply equal for all, like a real world. ???
semms that you transform the lightpos (this will be first transformed like a vertex, before the calculations take place in eye coords ...)
so 1st do place lights, then transform the rest of the scene to get 'global' lights and set the w value to 1.0 or you get directional lights ...
08-02-2001, 09:27 AM
Thanks, it works i just put lightpos al init, but now when i move the camara, light behivore is like is is on board whit the carama, what i mean is that light not remains at ( 1, 1, 1, 1 ) is is allways lighting the object, i can go to the dark part moving the camara.
When i get this efect, is where light seems to be different for each object.
try this, for setting cam:
//Set cam, glTranslate is in this mode the negative like in modelview
//set other objects, they wount be magnituded to the cam
and dont forget glLoadIdentity(); after glMatrixMode, or you could get some errors
08-03-2001, 06:14 AM
That's not a good idea T2k. You shouldn't do glTranslate, etc. in the projection matrix. You could screw up calculations for things like fog.
Instead, what he should probably do is something like this...
I didn't quite understand what exactly was wanted, but experimentation with where you put the setting of the light position should fix the problem.
08-03-2001, 11:34 AM
I have try both but, ligth stay allways on front of objects, or you can go to the dark part of one object but light for each object semms diferent, i mean is like the light has been transformed by the same transformaion tha was aplly to the object it is lighting.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.