D2X-XL Worklog
Notes on features and problems from the development of D2X-XL, newest first.
Soft Particles |
|
Direct X 10 has brought a feature called "soft particle rendering" in hardware. The effect of soft particle rendering is that translucent particles like e.g. smoke don't get cut off at opaque geometry (like walls), but disappear in a soft transition. This makes effects like smoke or fog look much more natural.
You don't need Direct X to use this feature though: OpenGL has all it takes to implement it yourself. What you need is access to the hardware's depth buffer, containing the distance from the viewer for each pixel rendered. When rendering smoke and the like, you simply compare the distance of a smoke pixel with the distance of the (opaque geometry's) pixel at the same screen location. If the smoke pixel is in front of it, just render it. If it is behind the screen pixel, make it more transparent the further it is behind (and don't render it at all if it's too far away). Some very simple shader magic is required to do the trick. I have already been using it for high quality coronas, and had thought for quite a while about applying it in the transparency renderer too, and that's what I have done now. Here are two screenshots where you can compare smoke with and without particle softening. You clearly see the hard edges where smoke particles intersect with walls in the first picture. In the second picture, the intersections are softened and it looks like the smoke is naturally thinning near walls.
Depending on the amount of smoke and other transparent effects (namely energy sparks), enabling soft particle rendering can cost a few frames,
but the effect is gorgeous. |




