Mixed-resolution particle rendering in T3D
by Lukas Joergensen · 08/06/2014 (11:29 am) · 7 comments
They tricked me!
I thought MixedResolution particle rendering was already implemented!And in some ways it are... You see a lot of the functionality is already in there, but it needs a few changes to actually work!
I've managed to get it working and the performance boost is great!
2 emitters, 1000 particles per second: Highres 27 MSPF // 8.5 MSPF hit MixedRes: 20 MSPF // 1.5 MSPF hit No emitters: 18.5 MSPF
For those of you who doesn't know, MSPF is milliseconds per frame.
WOW such a high performance boost for free????
Well yea... No, not really...
You see, the way this works is that we render the particles to a render target with 1/4 resolution of the main render target such that we significantly reduce the amount of pixels rendered.
This is especially useful if you suffer from overdraw performance issues, which happens when the camera is looking at particles up close such that each particle has to be drawn to each pixel.
However doing this introduces some halo-artifacts because of the lower resolution:

These halo artifacts can only be fixed by doing a high-res render... So what do we do? We do a high-res render! But to improve performance we do it ONLY where these artifacts occur! Well, how do we do that? We use the edge buffer from the EdgeDetect PostFx!
It looks like this:

And then when we composite the high-res and the low-res render, we get the final result!

So what was this I said about it not being free? Well the impact from doing this, is ofc the fact that we render the particles at 1/4 resolution, which makes the particles blurrier:

All of this is also explained at Nvidia's GPU Gems.
This effect gets enabled when you set "HighResOnly" to false, and in stock T3D, it doesn't work at all. I'll be PR'ing a fix soon.
Why are these features not active? :(
I see so many of these unused features which are somewhat implemented in T3D, just not quite "finished". How many more are there?There are more stuff on the particle side of T3D that has these hidden gems. The Particles shader has code that takes a lightmap and it seems to be lighting the particles in a way. Having lit particles could be awesome! Why aren't there any notes on what is needed to finish this? :(
Also the RenderParticleMgr has these:
const bool RenderToParticleTarget = true; const bool RenderToSingleTarget = true;
I don't get it.. It works fine with rendering to a single target, what do we get from setting these to false and what are they supposed to do?
I think we should make an initiative to create a list of all these hidden features when we stumble upon them, and maybe a way to write down notes on the features such that we have a better ground to work from if we want to enable one of these features! Some of them are really great!
Edit: Now has a PR!
About the author
IPS Bundle available at: https://www.winterleafentertainment.com/Products/IPS.aspx
#2
08/06/2014 (1:53 pm)
It's definetly useful for blurry textures like smoke, but we could experiment with stuff like using 1/2 resolution instead of 1/4. Isn't too hard to change on a per-game basis.
#3
08/06/2014 (2:46 pm)
Way to go Lukas!
#5
Ron
08/07/2014 (7:19 am)
Nice find Lukas and yeah... there are TONS of 1/2 finished or just not implemented features throughout T3D. We used to talk about making a list of these when I was on the Steering Committee but, we just never got the time.Ron
#6
08/11/2014 (5:20 am)
LODing particles, excellent idea!
#7
Someone was working on it, got pulled off somewhere else.
Speaking of other features that are hidden or partially implemented.
That is why rendering to texture doesn't work on some objects. So I made this fix a while back:
www.garagegames.com/community/blogs/view/22171
Literally 10 or less lines of code to make it so almost every object can use rendering to texture. The only object I have not gotten to work is terrain because it buffers the texture internally.
Thanks for sharing about particles. This is a very nice find.
08/11/2014 (12:47 pm)
Quote:Why are these features not active?Cause history...
Someone was working on it, got pulled off somewhere else.
Speaking of other features that are hidden or partially implemented.
That is why rendering to texture doesn't work on some objects. So I made this fix a while back:
www.garagegames.com/community/blogs/view/22171
Literally 10 or less lines of code to make it so almost every object can use rendering to texture. The only object I have not gotten to work is terrain because it buffers the texture internally.
Thanks for sharing about particles. This is a very nice find.

Torque Owner Ivan Mandzhukov
Liman3D
This saves tons of fillrate but leads to lower quality due to magnification.