Jump to content
  • Advertisement
Sign in to follow this  


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

I need some help implementing ESM's. I have searched and not found much information except for a few papers that dont help me that much because they are vague.

I believe my problem has to do with building the ESM. The articles that I read said that I have to store the linear depth to my ESM first. I have implemented a working VSM, but want to swtich to a ESM . . .

this is the code for building the ESM

struct VS_to_PS_TerrainShadow{
float4 pos : SV_Position;
float fDepth : fDepth;
VS_to_PS_TerrainShadow VSShadow(VsIn In){
VS_to_PS_TerrainShadow output;
float4 worldPos = mul( float4(In.pos, 1.0f), world );
output.pos = mul(worldPos, viewProj );
output.fDepth = length( lightpos.xyz - worldPos.xyz );
return output;

float4 PSShadow( VS_to_PS_TerrainShadow input ) : SV_Target{
return float4( input.fDepth, 0.0, 0.0f, 1.0f );

I then use a Gaussian blur for the intermediate step on the map

then for the shadowing term, i use

float shadowing = exp(over_darkening_factor * ( occluderdepth - receiverdepth ));

however, another question is what types of numbers are valid for over_darkening_factor? [0, 1) ?

Also, after reading http://pixelstoomany.wordpress.com/category/shadows/exponential-shadow-maps/

It seems that I can use

float shadowing = exp( k* occluderdepth) / exp( k* receiverdepth );


The problem I am having is that everything is in the shadow, I have a large square of black where my shadow frustum is.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!