Jump to content
  • Advertisement
Sign in to follow this  
genesys

optimizing calculation of shadowmap coordinates

This topic is 4055 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! For my shadowmapping, i calculate the texture coordinates for the shadowmap in my vertex shader (since the objects move, i have to do this in every frame): float4 shadowMapPos = mul(Input.Pos, lightViewProj); Out.shadowcoord = shadowMapPos.xy/(shadowMapPos.w*2.0f)+0.5f; Out.shadowcoord.y = 1.0f-Out.shadowcoord.y; Out.lightdist = shadowMapPos.z/shadowMapPos.w; this gives me the position of the vertices in lightViewProjection space and the distance between the vected and the lightsource. I wanted to know, wether there is a more performant way for doing this (i'm using XNA (based on directX) and HLSL) or wether I can optimize my calculation somehow? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
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!