Closed mudlee closed 7 years ago
Can you post a link to your code? Your shader code for rendering shadows looks like it works fine, but I would need to see code for the rendering of entities and their shaders to give any help!
Yeah, here it is, thanks for your help! https://bitbucket.org/mudlee/intermettoengine/
If you don't have bitbucket account, I can upload to the drive
Not 100% following the code, but I don't see where you are setting the offset of the shadow map into world coordinates. Try looking at ThinMatrix's tutorial on YouTube or the shadow tutorials here.
Did that :) Also checked the red book and learnopengl.com, several times. So what I do, I create the shadow map as you can see on the images. In the vertex.glsl I create the the vertex's lightviewspace coordinate using the transformationMatrixInstanced (which is actually the modelmatrix), pass through the shader chain into the fragment.glsl. There, I just use the shadowMap texture for sampling by the fs_in.vxLightSpacePosition.xyz;
I have not time to review your code, but I may give sou some ideas. Your depth map is being generated correctly. Maybe you are not passing the depth texture correctly to the dsahder that renders your scene. If you are using several texturews, review is you are using correctly texture units.
Hope it helps.
Had some texture issues, because NanoVG uses texture0, and I had not specified the correct texture bank for the depthsampler. But... I still don't have shadows. Keep searching, try to update this issue as a reference for anyone else facing with this.
OK, after hours debugging, got shadows OMG. If you have the same problem, watch out for these:
Hi. As I mentioned in the last few cases, I write my "engine" using your and lots of other tutorials beside each other, to avoid copy-and-pasting. I watch and read everything and try to implement myself.
However, shadows are tricky. On the attached images you can see my problem. You can see my shadow map at the top left (it looks good), and I see no shadows :( Tried different ortho settings, light positions, turning spot and point lights off, etc.
Could you give me some starting point where should I search for the bug, because I rewatched, reread everything at least 10 times, and everything in the code looks good.