Jump to content
  • Advertisement
WhiskyAndCode

OpenGL Questions About Shadow Mapping

Recommended Posts

Hello everyone.

I was studying and implementing a shadow mapping, then I had some doubts, for example:
In my study (and everyone I saw in the tutorials) the distance is very short, I wanted to know how this is implemented in a biggest scenario, because if I use it as a vision of the sun, I think it would weigh heavily. So, correct me if I'm wrong, should I do my depth map / shadow mapping at a distance near the camera and follow it as I (the camera) walk? example (in scroll side):

question.png.bb85d83f85f66a4977f422de79251a8a.png

question2_fw.png.6c60ed22654a78863b9379beadf17b30.png

question3_fw.png.b6f0ce6c60e10fa4d7d1e3b73307ee99.png

 

another doubt is the best way to add my shadow. Currently I have my framebuffer to implement deferred shading, and all information I save in a separate attachment (position, normal, light ....). But the shadow mapping I apply only in my final shader (combine final). I was wondering if the best way would be the same in my finalCombineShader or is it generating the shadow in a separate attachment as I'm rendering my models? (as I do with the position attachment, normal ...)

This is my final result:

resultFinal.thumb.png.4ce6921116b25ca0ecca722741e97717.png

 

Could someone get me those doubts?

Thank

 

Share this post


Link to post
Share on other sites
Advertisement

Google Cascading Shadow Maps for the first question. Even if you don't want to use cascaded, its got good examples and introductory tutorials. Also the sun isn't a point projection of light, unless you want it to be but should just be directional.

For the second question I think you are asking is post processing a good choice. I would answer to a beginner, only if you are using it for other things like ambient occlusion. You said you are rendering normals so perhaps you are doing your lighting as a post process already. If that's the case then you can do it earlier if you want it will depend on if some things are not actually rendered as part of the shadow mapping. For example, water might not cast a shadow, but you want to know if it is in shadow so you should probably do the shadow test in the post processing when you use the normals for other lighting effects.

Your final pic doesn't look right but its so dark I cant tell.

Share this post


Link to post
Share on other sites
Posted (edited)

Thank u, i'll google about "Cascading Shadow Maps" 😄👍

 

1 hour ago, TeaTreeTim said:

post processing a good choice.

Yeah, well remembered about post processing.

And i'm adding my lights in final using deferred shading. 

About u said "Your final pic doesn't look right but its so dark I cant tell." What u think about doesn't look right ?

 

Edited by WhiskyAndCode

Share this post


Link to post
Share on other sites

If the box is a cube the shadow is a funny angle compared to the trees but it could be my bad. I assume the arrow is pointing to the edge of the shadow map. In some articles it shows how you can cover a larger area with the map and use multiple samples to blur it out so it doesn't look pixelated. From memory NVidia has an article on the different techniques, but you'll have to look through: https://www.nvidia.com/object/doc_shadows.html

 

image.png.2549e3d2d759f23c12104c40fb556da3.png

 

Share this post


Link to post
Share on other sites
55 minutes ago, lawnjelly said:

Here it is lightened up (hope OP doesn't mind):

 pic.thumb.jpg.5ebf485a80b70992ad23dea82c1e48e9.jpg

lol, nice job lol

4 hours ago, TeaTreeTim said:

If the box is a cube the shadow is a funny angle compared to the trees but it could be my bad. I assume the arrow is pointing to the edge of the shadow map. In some articles it shows how you can cover a larger area with the map and use multiple samples to blur it out so it doesn't look pixelated. From memory NVidia has an article on the different techniques, but you'll have to look through: https://www.nvidia.com/object/doc_shadows.html

 

image.png.2549e3d2d759f23c12104c40fb556da3.png

 

oh yeah, I'm using simple shadow (The first technique to learn). Well I'm following the learnopengl tutorial. And before I go on to the next chapter, I make some "experiences" to understand better.
Thank you all for the information. Added Trophies: D

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!