Temporal Shading Experiments

Well following http://hub.jmonkeyengine.org/groups/graphics/forum/topic/pssm-scene-scale-and-point-lights-issues/ I finally started to do some test with the proposed idea.



i hope that in the end a state of the art shadow renderer will come out of this.



Before:

http://www.youtube.com/watch?v=UHBlMGllEVA



After:
http://www.youtube.com/watch?v=bSi27I2ol7o
5 Likes

This is toooooo freaky… I was just looking over this and was about to try the same thing. In Shadow.glsl in the shader library, there are multiple options the getShadow call could have used other forms of rendering the shadows that are in this file… some of them are quite nice looking, but would need a bit of work to help with shadow opacity. Anyways… I’m anxious to see what comes of this!

This is really cool, just, really cool :slight_smile:

Following ftp://ftp.cs.princeton.edu/techreports/2006/749.pdf I think I know how to get a real continous history buffer working,



Also it might be posible to get far superior performance AND quality by using initiall on cache misses a pcf8 generated value, and then for further frames only a single none smoothed value.

Acoording to the paper the hit rate is around 90% between two frames, so this might be able to reduce the high performance burdon of using a high pcf setting, while also getting a quite acceptalbe initial value with this.



The additional rendering cost would be very low, as we are already projecting the shadow maps into the postprocess material.

The currently used framebuffer could be directly abused for the history, as it is already displayed. Only thing to be done is rendering/updateing that cache with the new shadowmap from the prematerial

1 Like

That’s nice.

How does it perform compared to actual shadow renderers?

I don’t get how the frame cache are stored, in textures?

How is the memory?

That’s nice.

How does it perform compared to actual shadow renderers?

I don’t get how the frame cache are stored, in textures?

How is the memory?

@nehon said:
That's nice.
How does it perform compared to actual shadow renderers?
I don't get how the frame cache are stored, in textures?
How is the memory?


Currently i just use 12 framebuffers for the shadowmap that are cycled (so onyl one is updated each frame)
Of course this is more like a cheap trick than an actuall history system, however it looks promising.
VRam is of course 11 textures more.

Quick question/thought:



I assume you are only doing this to the shadow map, correct? Otherwise, it would simulate motion blur the moment you moved the camera. Reason I mention it is, this is how I tried to implement motion blur once I found out you have no access to the previous view matrix in JME.



Ugh… I just saw your last post… ignore me :slight_smile:



Um… nm, don’t ignore me… this will produce a motion blur for shadows as well. This will not work, unfortunately :frowning:

The shadows have motion blur due to no amount of history checking. Normally you would test against the depth on the previso frame (as you mention) and discard if it is not fitting in the current one. With high fps the effect gets less noticeable however. (and temporal shading needs at least 60 fps to look ok)

However… if you are really interested in trying to improve shadow rendering performance while still holding decent quality, this guy has 3 different implementations of shadow mapping (with source) that may get you going in the right direction. Here is a link to the simplest of the 3:



http://fabiensanglard.net/shadowmapping/index.php



Lots of other cool bits on his site as well.