Deferred Engine Playground - download

ah i understand your problem now. I thought all shadows would disappear. I will check it out.

I also went ahead and pushed the old experimental branch with some SDF stuff you can read about on the blog: https://github.com/Kosmonaut3d/DeferredEngine/tree/SDF
https://kosmonautblog.wordpress.com/2017/05/01/signed-distance-field-rendering-journey-pt-1/

3 Likes

I fixed the problem with this commit and i also fixed the SSAO aspect ratio bug.

2 Likes

Hi Kosmonaut,

I’m still playing with directional lights and I found banding when integrating it in several scenes of my game. After some dwelling I realized that the problem also appeared in the DeferredEngine, but only became aparent when switching to Default Material.

It’s very apparent in vertical walls but it’s also happening in the floor

Any ideas of what can be causing this? ZBuffer precision maybe?

Thanks!

Banding is a problem in most 3d engines to some extent (see unity/Unreal/CryEngine) and then have the light be very close to a surface.

It’s a very known issue because of shadowmap precision, you will find a lot of resources on that if you google shadow banding.

A typical way to change this behaviour, is to add a little bias for the shadowmap. You can change it by going into the console (or Gamesettings) and playing around with ShadowBias. Big values will lead to objects looking floaty though.

EDIT: I’ll make a patch that supports the changing of this value a bit better, i noticed the code was not good enough.

1 Like

thanks for the banding explanation, I was aware of the bias and floating objects, however all examples I saw on internet where showing this problem as “shadow acne”, so I wasn’t sure if this was the same problem.

New question :wink:

When you reconstruct the position with the depth buffer, i.e.

float3 currentPos = input.ViewDir * linearDepth;

what space is the resulting currentPos on?

I’m trying to adapt the cascade shadow map example from Tim Jones and requires the positions in world space, but I’m struggling to get that position in world space because I don’t quite understand what space I’m on in the first place.

Thanks again, and sorry for the flurry of questions!

Hi again!

I wasn’t searching for it, but I realized that changing the shadow filtering type of the directional light removed the banding. I think the banding in SoftPCF3x/5x is caused by CalcShadowTermSoftPCF, which apparently is not using the DepthBias.

Hello Kosmonaut,deferred engine is a great work,but sadly I couldn’t build the project.
Here is a ArgumentNullException in Main function calling.
My environment is VS2015 update 3 with MonoGame 3.7.1.189.
I need your help.

@kosmonautgames Are you still about?

Noticed this thread has been dead for months… just seeing what’s up and bumping this for newcomers to take a peak at this gem.

How kind of you. I still lurk around in this forum space, but my own development stopped for quite a while since my free time is limited lately :confused:

I am sad to hear that. Anyway I wish you best of luck, you done amazing work.

Hi,@kosmonautgames the depth buffer in the engine is linearEyeDepth? Do you know how what type depth buffer unity using? Becoz I got some source code from unity, and try to implement it.

how to render volume light for spot light, current ray marching algorithm only work on point light. any idea to modifier?

The shader of the point light raymarching should in theory be usable for the directional light or any other light. It simply steps through the shadow map.

However, if the directional light uses a different algorithm for storing shadows - that has to be adapted when reading the shadow data in the volumetric light shader.