• Advertisement
Sign in to follow this  

optimizing calculation of shadowmap coordinates

This topic is 3876 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