Jump to content
  • Advertisement
Sign in to follow this  
Topflappen

Self made shadow map

This topic is 2770 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi im currently developing a project in WebGL and now got to the point where it would be nice to create shadows.

Therefor i want to use shadow maps. Unfortunately the basic functions to create a shadow map are missing in webgl so i have to do alot on my own.

I am already able to draw the depth values into my depth texture and project them correctly onto the scene.

My problem is the fragment comparison, when i render the scene normally.

In the fragment shader i can read the depth values out of the depth texture. But to what do i have to compare it to dertermine, wether at this fragement is shadow or not?

hope someone can help me out.

Share this post


Link to post
Share on other sites
Advertisement
You have to take the current fragment and put it in the same view space as the light. So take each of your final vertices (in world space) and put them through the lights view/projection matrix and scale that final coordinate from (-1,1) to (0,1) which is the texture matrix. Look up GLSL shadow mapping, there should be a tutorial somewhere to follow.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!