Im playing around will light volume and they look great… the only thing is I can’t get rid of a 1px (or something) artifact around it… Im sure it comes from my stencil test code… I try to fiddle with it but can’t get rid of these artifacts… does anyone have an idea??? or can point me a better technique than the one Im using? tks in advance!
...
...
...
glDepthMask( GL_FALSE );
glColorMask( GL_FALSE,
GL_FALSE,
GL_FALSE,
GL_FALSE );
glEnable( GL_DEPTH_TEST );
glEnable( GL_STENCIL_TEST );
glClearStencil( 0 );
glClear( GL_STENCIL_BUFFER_BIT );
glEnable( GL_CULL_FACE );
glCullFace( GL_FRONT );
glDepthFunc( GL_GREATER );
glStencilFunc( GL_ALWAYS, 1, 1 );
glStencilOp( GL_KEEP, GL_REPLACE, GL_KEEP );
render_light_volume( tmp );
glCullFace( GL_BACK );
glStencilOp( GL_KEEP, GL_KEEP, GL_REPLACE );
render_light_volume( tmp );
glColorMask( GL_TRUE,
GL_TRUE,
GL_TRUE,
GL_TRUE );
glDepthFunc( GL_ALWAYS );
glStencilFunc( GL_NOTEQUAL, 1, 1 );
glStencilOp( GL_KEEP, GL_KEEP, GL_KEEP );
glDisable( GL_CULL_FACE );
render_light_volume( tmp );
glEnable( GL_CULL_FACE );
glDisable( GL_STENCIL_TEST );
glCullFace( GL_BACK );
glDepthFunc( GL_LEQUAL );
glDepthMask( GL_TRUE );
...
...
...