Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Carradine

Member Since 24 Aug 2001
Offline Last Active Nov 22 2014 10:21 AM

Posts I've Made

In Topic: Slope-scale depth bias shadow map in HLSL

08 November 2014 - 03:19 AM

For integer depth buffers:
  Bias = scale * max(|dzdx|,|dzdy|) + offset * 1/2^bits_in_z_format
For floating point depth buffers:
  Bias = scale * max(|dzdx|,|dzdy|) + offset * 2^(exponent(max_z_in_primitive) - mantissa_bits_in_z_format)

 

 

I am a bit confused about something however.  Is this the code I use within my HLSL code for calculating the shadows with the depth map?  Or is this outside of the HLSL code as well?  

 

I assume dx/dy/dz is cameraPos - vertexPos so this would be done in the shader, correct?

 

device.SetRenderState(D3DRS_DEPTHBIAS, offset);
device.SetRenderState(D3DRS_SLOPESCALEDEPTHBIAS, scale);

 

 

Since these are render states outside of the shader, how do they apply to my final shader caculation to finally apply the shadow?  What are they doing to the rendering of the primitives?

 

I think I am just confused what implementations I am supposed to be doing inside and outside the shader for the calculations.


In Topic: Slope-scale depth bias shadow map in HLSL

08 November 2014 - 01:29 AM

Interesting, thanks for the informative information!  I did see that a lot of examples set the render states outside of the shader, but just assumed that there was always an HLSL version which always seems to be more optimal. 


In Topic: Slope-scale depth bias shadow map in HLSL

06 November 2014 - 01:29 PM

So I decided to go a different route which was much simpler and seems to fix most of the issues, which was use the "normal offset" method, and it removed all of the jagged edges off of my terrain shadows, I simply had to add the line 

IN.position = IN.position + (IN.vnormal * normalOffset);

Into my vertex shader for the shadow map render, and tweak the offset value for each cascade shadow map, and I have non-jagged self-shadowed terrain!

 

Of course there is a great deal more work to be done here, but this was a large step forward.


In Topic: Detecting a shadow z-depth collision under terrain polygons

10 September 2014 - 10:25 AM

Thanks, when I woke up this morning I had that realization that the dot product of the normal was what i was looking for, I have been doing to many crazy matrix calculation in my head I ignored the simpler solution :)

 

The issue with underground lighting is that even if the light is above the horizontal plane, there are still exposed polygons past the edges of the world where the light still shines underneath, the terrain at the edges of the world are not "capped" since there is no reason to since the player can never see in that direction.  So for my orthogonal shadow map, I render the scene starting outside the entire terrain world, and look in.  Hope that makes sense!


In Topic: Vantage: Prehistoric Simulation MMO

12 March 2014 - 12:33 PM

Thanks Rendered World, I hope you like the game, it is free to download and play if you wish to check it out!

 

And Norman you are right about how content is implemented. I could make 20 types of cordage and put it into the game, but for now I am just implementing 1 or 2 of each type of object for crafting purposes.  It obviously takes a while to create new meshes and put them into the game, so I rather spend that time getting gameplay mechanics for new items and crafts into the game, and come back later and add the diverse objects later.


PARTNERS