Skip to main content
gamedev.net
🔒 Locked

References Soft Particles

Started by wolf Aug 10, 2006 at 2:51 PM 11 replies 6.6k views
Original Post
wolf
wolf
Hi, I would appreciate any good references that describe the implementation of soft particles. I found the description in the DirectX SDK. I tried Google first, but did not get any useful hits ... maybe I used the wrong keywords? Thanks in advance, - Wolf
zedzeek
zedzeek
i havent the sdk so can only guess what soft particles are but i assume

frag_depth = fragcoord.z + texture2d( particle_tex, tc );

ie u alter the depth based on a height/depth component in the particles texture
though u will prolly need a better implentation than a simple addition since the depthbuffer aint linear.
personally i found whilst it does improve the look, it costs to much performance
jamesw
jamesw
Maybe using less but more complicated particles would help the performance, since they use up so much fill rate. Writing to depth disables early z optimizations as I'm sure you know.
griffin2000
griffin2000
I beleive soft particles are a volumetric particle rendering technique. Crytek uses them alot. The had a presentation at Siggraph this year, the didn't really explain how they worked really (either that or I missed it :). The showed how it made for much better interaction with the geometry (it avoided the hard edges you see when normal particles are clipped with the floor plane).

If anyone has a more info than that I'd be interested too.

m4gnus
m4gnus
AFAIK soft particles just get transparent at the intersections with the world geometry. I think this is achieved by rendering the scenes's depth to a texture and when rendering the particles adjust the transparency according to the difference between the particles depth and the one from the scene depth.

regards,
m4gnus
"There are 10 types of people in the world... those who understand binary and those who don't."
griffin2000
griffin2000
Ahh that makes sense. The rest of the presentation was about the various "deffered rendering" style effects they do with a depth texture (the use this for all their atmospheric effects).
wolf
wolf
Quote:
Crytek uses them alot. The had a presentation at Siggraph this year, the didn't really explain how they worked really (either that or I missed it :).

Yep I was sitting in there :-) ...
LeGreg
LeGreg
Quote:
Original post by wolf
Yep I was sitting in there :-) ...


So.. were you sleeping ? :)

Each particle is attached a certain "depth" property (nothing to do with depth write in the pixel shader which kills early-Z etc..), then the pixel shader has the nearest opaque object Z as an input. It then takes the difference between the current particle z and the nearest object z, divide it by the depth property value, clamp it to the one and to zero (for negative values, though they shouldn't be drawn anyway), and then modulate alpha with this value.

This way a particle will have a softer look as it comes closer to an object until it disappears completely at an intersection, preventing rough edges.

LeGreg
wolf
wolf
Quote:
So.. were you sleeping ? :)
:-) thanks for the explanation. I did not expect to deal with this stuff soon at that time ...
zedzeek
zedzeek
Quote:
Original post by LeGreg
Each particle is attached a certain "depth" property (nothing to do with depth write in the pixel shader which kills early-Z etc..), then the pixel shader has the nearest opaque object Z as an input. It then takes the difference between the current particle z and the nearest object z, divide it by the depth property value, clamp it to the one and to zero (for negative values, though they shouldn't be drawn anyway), and then modulate alpha with this value.

cheers for that, seems very simple to do, though i wont do it with my game due to the performance hit, ill keep it in mind though
grunt123
grunt123
Quote:
Original post by LeGreg
Quote:
Original post by wolf
Yep I was sitting in there :-) ...


So.. were you sleeping ? :)

Each particle is attached a certain "depth" property (nothing to do with depth write in the pixel shader which kills early-Z etc..), then the pixel shader has the nearest opaque object Z as an input. It then takes the difference between the current particle z and the nearest object z, divide it by the depth property value, clamp it to the one and to zero (for negative values, though they shouldn't be drawn anyway), and then modulate alpha with this value.

This way a particle will have a softer look as it comes closer to an object until it disappears completely at an intersection, preventing rough edges.

LeGreg


So, i guess that you need to make a depth texture from the depth buffer at the current frame? (depth texture to be fed into ps)

LeGreg
LeGreg
Quote:
Original post by grunt123
So, i guess that you need to make a depth texture from the depth buffer at the current frame? (depth texture to be fed into ps)


Almost all atmospheric effects in their renderer relies on a pixel shader pre pass that draws only Z (or more exactly distance to far plane) to a r32f or argb8 texture.
Only problem is : it doesn't work well with antialiasing. And it doesn't work too well with semi transparent objects either (the prepass only stores one z value per pixel).

LeGreg
Guoshima
Guoshima
interesting .. can the presentation be downloaded somewhere already (and other Siggraph presentations)

Regards,
Kenzo

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.