Hi,
I've seen some shadows optimisations from leadwerks engine, however they don't want to explain me precisly what they've done, so I'm going to try to do this alone.
My goal is to use shadows faster with no rendering difference with my actual system. I think a great thing would be that instead of using 1 shadow map per light, we use 3 render target per light : 1 used for static shadow map (not moving objects), another for dynamic shadow map (moving objects), and the last one would be a Z-buffer from the static shadow map render to produce the dynamic one with Z-sorting (by ouself in the shader). The trick is to render the static shadow map / Z-buffer 1 time, and then only update the dynamic shadow map with moving objects. At the end we merge both static & dynamic maps to produce our shadows.
Here is a little illustration I did :
I would like to know what you think of this system.
Is it better to use idle/moving object lists or just define directly static/dynamic nodes forever so we don't have to check if a node moved from the last frame?
What do you think in term of performance ? Using 3 render target instead of 1 should run slower on the GPU, however if you have a scene of 300 000 polygons and only like 1000 polygones moving you can go up to 300 times faster.
[ cube map :
normal render : 6 * 300 000 = 1 800 000 polys
only moving objects : 6000 polys ]
Did anyone on this forum attempted such a system ?
I think it's called a cache system and it can be also used with reflexion maps. But here I'm only after shadows... for now
Thanks all
[EDIT :](edit2 :Following remark is wrong) I didn't thought, but how can we don't update the static buffer if the camera moves? shadow maps are camera dependent, so this would be an optimisation for non-moving camera only ? That sucks
render target cache system (shadows)
render target cache system (shadows)
Last edited by stefbuet on Thu Sep 23, 2010 9:04 pm, edited 1 time in total.
Yeah and think about the fact of moving lights...even worse.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
Yep but most of my levels will be static exept some physic nodes and probably most of the lights will be static too.
But well, I really didn't think of camera mouvement.
However, if you look at this video :
http://www.youtube.com/watch?v=uG5cdI1Gqu0
You will see that even when moving the camera the engine only render moving objects
But well, I really didn't think of camera mouvement.
However, if you look at this video :
http://www.youtube.com/watch?v=uG5cdI1Gqu0
You will see that even when moving the camera the engine only render moving objects
Huh? Why is camera moving going to affect anything (Lights yes, but not camera...)
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
The depth from the camera will change, but not from the light...
Shadow maps are the depth from the *light* from the *light* point of view. Your view position is irrelevant.
Shadow maps are the depth from the *light* from the *light* point of view. Your view position is irrelevant.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Edit: oh! yep I'm sorry I used 'from light depth' in my shaders, I don't know why I thought I was doing with camera depth...
So, now it's more clear in my head, what do you think guys of this method ? If the light is not moving ? I will give a shot and do some benchmark. Being abble to use caching on static lights and standard method for moving light should be nice.
So, now it's more clear in my head, what do you think guys of this method ? If the light is not moving ? I will give a shot and do some benchmark. Being abble to use caching on static lights and standard method for moving light should be nice.
I'm still confused as to why you'd need a separate buffer for moving objects. You're still capturing the lighting situations at the moment the frame is rendered. Their velocity is completely irrelevant for lighting. If you want to do some per-pixel motion blur, a better idea would be to just have a buffer that contains per-pixel velocity. Still, this has nothing to do with the lighting.
No, it's just about shadows.
If an object is moving, its shadow wont be the same. I don't need any velocity, just need to know if objects moved from the previous frame or not.
The trick is keep old object shadow map data in a first buffer, and draw moving object data in another, then blend both buffer to get the final shadow map so you save static object render time.
For now I'm looking for an idea to get a Z-buffer from static objects only, to be able to do some Z-sorting on the 'moving objects' buffer, and this is dependent of the camera :p
If an object is moving, its shadow wont be the same. I don't need any velocity, just need to know if objects moved from the previous frame or not.
The trick is keep old object shadow map data in a first buffer, and draw moving object data in another, then blend both buffer to get the final shadow map so you save static object render time.
For now I'm looking for an idea to get a Z-buffer from static objects only, to be able to do some Z-sorting on the 'moving objects' buffer, and this is dependent of the camera :p
Yep, the most important thing to keep in mind is doing a depth test when combining the static and moving buffers, everything else is pretty straightforward.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net