Lighting and shadow map changes

Published November 02, 2010
Advertisement
Very productive night last night. Modified the way I calculate my Shadow Map Texture Matrix. Split into two parts

Light Class
    const GLfloat bias[] = {0.5, 0.0, 0.0, 0.0,         0.0, 0.5, 0.0, 0.0,        0.0, 0.0, 0.5, 0.0,        0.5, 0.5, 0.5, 1.0 };        glMatrixMode( GL_TEXTURE );    glLoadMatrixf( bias );    glMultMatrixf( projection_matrix );    glMultMatrixf( getCamera_matrix() );

This only gets called if the light is used as a shadow caster.

Draw Mesh.
    glMatrixMode( GL_TEXTURE );    glLoadMatrixf( spot->getShadowmap_matrix() );    glMultMatrixf( obj->getModel_matrix() );    glGetFloatv( GL_TEXTURE_MATRIX, mat );    glMatrixMode( GL_MODELVIEW );

I pass this Matrix to the current shader. Tests are done to improve performance.

I now sort lights by distance to camera, this allows for automatic shadow map switching. At the moment this is just a harsh switch, one day I'll use a fade of some sort.
Previous Entry First vortX GE demo
Next Entry 2nd demo
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement

Latest Entries

vortxGE : Threads

2375 views

C++11 Threads

3074 views

My Business

2232 views

Still Alive

2054 views

vortxEDIT : video

2172 views

vortxGE : Update

6019 views

vortxEDIT : Save

1928 views
Advertisement