Home 

VEX 3D Texture Fog shader

This fog shader uses a 3D texture image to generate clouds.

This fog shader uses a 3D texture image to generate clouds. This is done by ray-marching through the 3D texture, computing the illumination at each point and adding up the cloud density to composite on top of the objects behind.

The ray-marching is controlled by the stepsize and maximum steps parameters. Smaller step sizes will result in higher quality clouds. Larger step sizes will render faster.

When computing illumination, turning on object shadows will cause other objects in the scene to cast shadows onto the clouds. Self shadowing will cause the cloud to shadow itself. The appearance of the cloud is controlled by the color, ambient color, density and shadow density parameters. Adaptive step sampling will cause the step-size to be based on the density of the 3d texture map. For sparse areas of the texture, the step size will be larger, while for denser areas of the map, the step size will be smaller. This means that smaller details will be more likely to be picked up properly by adaptive step integration.

The light mask specifies which lights should be considered to illuminate the fog. Group syntax will NOT work with this option, but pattern matching and exclusion masks will.

For example, light*,^light1 will cause all lights beginning with 'light' except light1 to illuminate the fog.

The 3D texture can be filtered. However, filter widths larger than 1 may cause inaccuracies in integration.