Sign in to follow this  


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( - );
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

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

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

Sign in to follow this