Graphics Reference
In-Depth Information
To ignore the draw order of the particles, we have disabled the depth buffer write in the
output merger stage. If we don't do this, we would have darker or lighter squares around
each particle (the size of the quad). Leaving the depth test enabled allows the particles to
disappear behind other objects in the scene.
The completed project available for this recipe includes the following key mappings:
Key
Action
Backspace
Cycle between available compute shaders
Shift + Backspace
Switch between the blend states
Enter
Cycle between the loaded particle textures
B
Toggle between a light and dark background
+ / - and Shift plus + / -
Increase or decrease the number of particles by 10,000
or 100,000 respectively (also resets the particles)
Mouse right-click
Change attractor location
There's moreā€¦
Our simple snowfall shader could be extended to allow the snow to land on objects within
the scene by generating a top-down orthographic projection of the scene, and then sampling
the resulting depth buffer to compare the particle's Y position against the top of the object
underneath the particle's XZ location.
It is now quite easy to implement a range of particle simulations. For example, if we take the
GerstnerWaveTessendorf function from the previous Simulating ocean waves recipe,
we can make the particles form waves. This is shown in the following screenshot:
Particles with the Gerstner wave function applied.
Search WWH ::




Custom Search