-
Radiosity with OpenGL
Hi,
Ive been trying to implement instant radiosity with OpenGL. I wont go through details but what ive been trying to do is :
We have many lightsources and we want to get illumination of a scene with them. Ive been using accumulation buffer ( cos in opengl there is max 8 lights in one go ) and gl spot lights.
Problem was that with glLightfv( Lightn, GL_DIFFUSE, LightIntensity); LightIntensity values are clumped to 1.0 and radiosity can be much bigger then one. Ive tried to do the trick LightIntensity /= 1000 and then with for every call of glAccum do glAccum( GL_ACCUM, 1000 ); unfortunetely that isnt possible without extension i believe.
So in order to make it possible ive started using ARB_color_buffer_float extension with glew.
Ive initialised glew and check if extension was available
GLenum err = glewInit();
if (GLEW_OK != err)
{
/* Problem: glewInit failed, something is seriously wrong. */
fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
}
if( glewIsSupported("GL_ARB_color_buffer_float") )
{
printf("COOL\n");
}
It was working fine.
Then before rendering ive used
glClampColorARB(GL_CLAMP_VERTEX_COLOR_ARB, GL_FALSE);
glClampColorARB(GL_CLAMP_READ_COLOR_ARB, GL_FALSE);
glClampColorARB(GL_CLAMP_FRAGMENT_COLOR_ARB, GL_FALSE);
Program is compiling and works but unfortunetely results are still or
black screen or completly white ( depending on parameters )
Ive tried to simulate basic equation of global illumination with spotlights .Something like this :
glLightfv( OpenGlLights[iLightIndeks], GL_DIFFUSE, LightDiffusse);
glLightfv( OpenGlLights[iLightIndeks], GL_POSITION, LightSpotPosition);
glLightfv( OpenGlLights[iLightIndeks], GL_SPOT_DIRECTION, LightSpotNormal );
glLightf( OpenGlLights[iLightIndeks], GL_SPOT_CUTOFF , light0SpotCutoff);
glLightf( OpenGlLights[iLightIndeks], GL_QUADRATIC_ATTENUATION, 1);
I think that something is wrong with colors clamping.
Any ideas ? How can i check it out(debug and stuff )? (besides basic
knowledge of open gl i dont have experience with extension and more advanced stuff.
Any help will be apprecieted.
Thanks,
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules