Problem with shadowmap

Started by
2 comments, last by Alex Gomez Cortes 4 years, 9 months ago

Hello everyone,

I write this because I need some help in order to achieve a proper shadowmap. I am trying to render some shadows but I am stucked. 

What I do is create a framebuffer and a texture where I will paint the shadowmap. I tell openGL to only take into account the depth information, and the same for the texture.1303614373_Capturacodigoshadowmaps.JPG.2f4c1517550742424a64d3254fbfcfbb.JPG

 

this is the code for generating the framebuffer and the texture.

 

 

1145124935_Capturashadowmap.thumb.JPG.8273939cd4666e0cf9963c874ed57e3f.JPG

 

This is what my shadowmap looks like. I know that the shadowmap texture is grayscaled but I do not think this is good.

 

Thank you for your help!

Advertisement

Often you won't see anything in the shadow-map since the depth buffer isn't linear. But if you have objects placed just in front of the light view, then you might see something. Some OpenGL debuggers might also help in seeing something. Or you can re-scale your depth map values before saving it into a file (that might help to check if values are stored or not).

Apart from this, is your framebuffer complete ?

Test for any OpenGL errors.

Give an explicit internal format to your shadow texture (for example depth_component_24).

Try also a glFinish before taking your screenshot in order to ensure that all work is done before you try to read values back.

On 7/14/2019 at 4:05 AM, _Silence_ said:

Often you won't see anything in the shadow-map since the depth buffer isn't linear. But if you have objects placed just in front of the light view, then you might see something. Some OpenGL debuggers might also help in seeing something. Or you can re-scale your depth map values before saving it into a file (that might help to check if values are stored or not).

Apart from this, is your framebuffer complete ?

Test for any OpenGL errors.

Give an explicit internal format to your shadow texture (for example depth_component_24).

Try also a glFinish before taking your screenshot in order to ensure that all work is done before you try to read values back.

Thanks for your reply!

I'll look forward to get renderDoc to work. I will take another look to my code to see if I missed something, and I will try everything u said. Thanks!

This topic is closed to new replies.

Advertisement