Sign in to follow this  
mikeman

3D Particles?

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this