PDA

View Full Version : lighting changes?



blender
08-17-2002, 09:31 AM
I just have got so that I use lighting and move around the scene, but while I move/look around, lighting goes wrong. When I look directly to a face, it goes completely black.
My normals are quite ok I think and I use gluLookAt(). So, what could cause this kind of behaviour?

-Sorry about being not very specific.

Wingman
08-17-2002, 12:13 PM
Name some more details.

Do your lights have direction/position?

Do you have (ambient) light model?

Maybe you should turn on GL_NORMALIZE:
glEnable (GL_NORMALIZE);

Or calculate everything with your own functions.

What objcets do you use? Simple (cubes...) or more complex?

And btw, are you using fog?

[This message has been edited by Wingman (edited 08-17-2002).]

blender
08-17-2002, 12:23 PM
- Do your lights have direction/position?
yes, I think I solved the problem by turning the 4th position parameter to 1

- Do you have (ambient) light model?
yes

Maybe you should turn on GL_NORMALIZE:
glEnable (GL_NORMALIZE);
didn't change anything, isn't it enabled by default?

-What objcets do you use? Simple (cubes...) or more complex?
complex milkshape models

-And btw, are you using fog?
no

Bob
08-18-2002, 01:56 AM
didn't change anything, isn't it enabled by default?

GL_NORMALIZE is disabled by default.

Wingman
08-18-2002, 05:29 AM
Try to calculate your normals with your own functions (if you don't already).
If it still doesn't work, I don't know what's the problem.
What type of lights are you using?

Miguel_dup1
08-18-2002, 10:01 AM
Ok, I have a question...

Are you updating the position?

If you dont update the position of your light source, your light will be moving with you... It sounds to me that your normals are backwards and that you dont update your light source position every frame...

Something else is that GL_NORMALIZE will not have any kind of visual effect unless you scale you objects, which in turn your normals should be also rescaled... So to avoid rescaling your normals you enable GL_NORMALIZE. I doubt this is the problem.

Try negating your y values of your normal values and update your light source with
glLightfv( GL_LIGHT0, GL_POSITION, m_Light.light_Position );

Wingman, OGL does not compute normal vectors for you, so I take for granted that he has a funtion to compute his normals...

OGL standards require that all states be disabled by default... So GL_NORMALIZE should are disabled by default.


[This message has been edited by mancha (edited 08-18-2002).]