3D Particles?

Started by
5 comments, last by GameDev.net 19 years, 6 months ago
Well, I finally implemented a decent particle system in my engine, and I'm quite pleased with the results. However, there is one thing: I'm using billboarding as usual, and this means that whenever the particles "touch" the geometry, it becomes clear that they are just a quad. I've seen that artifact it in most(if not all) games, so I can live with it, altough sometimes it doesn't look too good. So I've had an idea, I'm sure it's not new but I haven't heard it before: To make the particles more "3D". Besides the particle texture, I also use a texture that holds the z-values of the texels, and I use shaders to correct the depth values when I draw the billboards. It's very primitive for now, but I liked the first results: Without shaders, this shot looks a lot worse, just some textured quads clipped by the walls. So,I was wondering, what is out there for this technique? Is there a paper or something that will help me make it better? Thanks in advance.
Advertisement
Someone told me a couple of years ago that this was called 'nailboarding.' It does seem like a worthwhile pursuit, but I think it requires pretty recent hardware - you need shader model 2 to be able to write output depth.

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

I believe if you google for 'depth sprites' some results will come up. This is one of the primary things I use writing output depth for, although there is a way to do it with GeForce4 class cards I can't remember the details now but I think it involves the texm3x2depth instruction or similar.

Edit:
While this is good n' all I just remembered (and thought it worth mentioning) that writing to output depth in a pixel shader completely disables early z rejection optimisations, so it will be slower.

-Mezz
More interesting would be to use the difference in depth between the particle surface and the current zbuffer value to change the transparency of the particle. Then you'd avoid having a hard edge all together. But I'm not sure if that can actually be done in hardware at the moment.
Z billboards are cool, and the NVIDIA SDK and DirectX SDK both added the technique a few years back.

The major drawback is the extra size of the texture, and the fact that you lose fast Z reject because you're writing to the Z output coordinate.
enum Bool { True, False, FileNotFound };
Thanks for the replies.
Mezz, "depth sprites" returned some results both from ATI and NVidia, thanks for that.

Yes, I agree that the biggest drawback is the loss of early z, but even in my Geforce5200 it didn't slow down much. I mean, we're talking about particles, so we're having a lot of overdraw already and plus they're just textured, not lit or anything, so processing a pixel is fairly cheap. I think, if I implement it, I'll just give the user the option to disable the feature.

Which DX SDK sample had Z billboards a few years back?

This topic is closed to new replies.

Advertisement