I got idea about
another extension, not described in the article. NVIDIA only mentioned that it is some interesting issue. I just figured out solution
(perhaps this solution could be also used in real-time calculation of shadows created by volume clouds even intersected with light sources like levels of sandwich).
They told they were nearly sure it is not possible to mix additive and blended particles to one off-screen target, but it perhaps
might be possible to mix off-screen particles effects with use more than one off-screen terget.
I think I deduced now the multi pass (or MRT) way to do that that. It needs only 2 passes (2-target MRT) of rendering both kinds of particles.
I have one of them ready:
Lets' call first target "blend target"
-every blend particle uses technique:
Code: Select all
separate_scene_blend src_alpha one_minus_src_alpha one one_minus_src_alpha
-every additive particle uses technique:
Code: Select all
separate_scene_blend one one zero one
so it does not change transparency,
What did jut happen? We calculated a texture that will be alpha-blended on the background. Also for additive ones, we calculate how much they shine on further and closer blended particles - it alters the colour of "blend target".
This is how that layer look like (brightness particles influence ONLY off-screen target),
i put it on the background so we could see what's happening on the picture.
Second target for that extension could be rendered also in downsampled mode (and stenciled too):
Lets' call it "brightness target".
Every blend particle decreases brightness influence of next (closer) particles the more oblique it is (the difference is alredy included in first target, so do not worry
- it is ok) - lets say that we calculate only impact on background - then blend particle is also an "obstacle" between background and additive particles closer to camera.
Every additive particle increaes this brightness - how much? Well, this depends on current alpha level. of "blend target" alpha channel on this level of depth (we could calculate this alpha again if we use multiple passes instead of MRT).
I will have to test this idea, but initially:
-every blend particle uses technique:
Code: Select all
separate_scene_blend zero zero one one_minus_src_alpha
-every additive particle uses technique:
Code: Select all
separate_scene_blend one_minus_dest_alpha one zero one
How do we put these two together?
First we add "brightness target" to background (actually, we have just calculated shadow casted by particle effect!) then we alpha blend the "blend target" on that surface.
Alternative one-pass way would not be as accurete, but it would use a little cheat for additive particles (transforming their alpha channel based on brightness - but it has to be done on level of shader) - I will check that.