|
We should also assert that the pixels rendered on the poly
implicitly represent volumes from the camera's perspective.
The idea is to take the drawn poly
and define a pseudo volume around it. This volume is defined by the extents of the poly, extruded in the
direction the camera is facing.
For the
following example, the poly is extruded both towards and away from the camera
by some distance D to define the volume.
The original poly defines the mirror-image plane P(mi) and the alpha
channel in each pixel defines to what extent the sub-particle boundary B(sp)
deviates from the P(mi). In practice the volume would be defined as the
poly extruded away from the camera only to make full use of hardware
clipping.
This is due to the fact that
pixels that are rejected due to being occluded will never get calculated for
the near region of the volume.
Fig 2.
Now for each pixel rendered in the particle, we have extents
along all the view rays through those pixels that define the collision information
necessary to remove the visual aliasing caused by a planar particle. There are at least two ways to consider the
information provided by the alpha component of the texture:
- As an average density of microscopic particles over the
range from the front to back of the volume.
I will call this method the average density method.
- As
relative the density that relates to the extent of the microscopic volume along
the ray represented by the pixel. I will
call this the density extent method.
In the shader we will need the
depth of the environment at the given pixel.
This could be passed in as texture information from a previous
render-to-texture stage. I will call
this EnvironmentDepth.
We will need the pixel position of
the original poly that will define our mirror plane. This can be propagated from the vertex shader,
and I will call it ParticleDepth.
We will also need a function to
define the mapping from alpha value to real-world depth do define our deviation
extent, I will call it DeviationExtent.
The deviation extent will likely be constant across the whole poly and
possibly the whole particle effect.
We will use the existing particle
texture unmodified with its colour and alpha values as they were originally
defined.
We will define a global
opacity/transparency function that will be used to relate the maximum particle
density and relates the actual colour transmission through the volume which I
will call VolumeAlpha. This function is
used to define the maximum transparency/opacity the extents of the volume will
allow.
|
I'm also interesting in learning more about "Baked" particle animations like the ones found in WOW. Is there a package out there that allows the particles system to be baked in?
My implementation uses the extinction factor to calculate the alpha value, which is a bit more physically based, and optionally also does a short ray-marching (for shadowing and non-homogeneous media). I called them 'thick particles'.
Unfortunately, from my experience, the default soft particles are usually preferable. At least in scenarios where the improved physical correctness isn't needed - and that includes almost all applications in games. Simply because they essentially do the same thing but are cheaper to render and easier to tweak for artists.