Advertisement

Camera position affecting brightness...

Started by September 12, 2000 04:54 PM
0 comments, last by Grasshopper 24 years, 2 months ago
I''m working on a racing game and I find that as I move the position of the camera up into the sky everything on the ground becomes lighter. Is this because the view point is closer to the lights. (the ground is a plane across the x,y axis at z = 0 and the lights are positioned at (0,0,50,1) and (0,0,1,0). What I''m asking basically is how does the view point related the light position affect the brightness of objects in the scene. I need to keep the brightness of the scene relatively constant as I move the camera up and down.
I''m just taking a stab here, but are you setting the light position (using glLightfv(...) ) before applying all your viewing/modelling transforms and drawing?

I''m not 100% sure about this, but I think you need to set the light pos for every frame... ie
    void Render(){    glClear(...); //clear any buffers you use    glLoadIdentity(); // reset modelview matrix    glLightfv(GL_LIGHTX, GL_LIGHT_POSITION, ...); //set the light position    //apply view transforms    for( all your objects )    {        glPushMatrix();        //apply local object transforms        //render object        glPopMatrix();    }    SwapBuffers(...)/glFlush();}    


Hope that was the answer you needed



-------------
I was sick of my crappy sig, so I changed it

This topic is closed to new replies.

Advertisement