Skip to content

Weather Particle Occlusion (#5492)

Implements occlusion for weather particles in a collision-detection-free manner. The idea is simple.

  1. Top down orthographic camera follows player when a weather particle system is alive and renders depth to a texture. This depth has a custom shader attached to simulate blending and deal with the alpha-blending atrocities that exist with vanilla content. It is similar to how shadow casting shaders work, but simpler in that we simply don't do alpha testing. This isn't needed, as we don't need to be anywhere near as precise as a shadow map for this technique.

  2. Particles sample from the depth map, transforming coordinates into common space. Right now I simply compare the current particles depth with the depth sampler and discard the fragment if the comparison fails. This can get a bit more involved in future so that occluded areas aren't so harsh.

The cost for this should be largely upfront, meaning if this feature is enabled and a weather particle system is active you should expect to see a measurable dip in performance, but this should easily scale with different particle systems down the line. The cost is largely in the extra RTT pass we need for depth.

Right now, the MR is in its simplest state and has room for improvement. I plan to experiment with different orthographic projection offsets in 1st/3rd person and supplement this with an occlusion coverage factor to influence weather sound pitches.

Closes #5492 (closed)

Biggest issue:

Boxer placers are not enough for adequate occlusion, since the majority of particles are close to player. If majority of particle are occluded, like in the cantons or long overhangs, this breaks the illusion that box placers give of particles in distance.

Edited by Cody Glassman

Merge request reports