[SOLVED] Fog and AA


photo

Recommended Posts

We are having problems when using Fog (white) with AA on black wires in the scene. It appears that the AA is being done before the Fog is applied, so when the Fog is turned up (see picture) the AA blending has been removed / overridden by the fog white. Is there any material or properties settings that can reduce this problem? Ideally, it would be nice to run the AA post fog (although Im not sure how this could be done from our access).

post-350-0-15223200-1353468933_thumb.png

With Fog - see right hand side wires.

post-350-0-43477700-1353469054_thumb.png

Same view without fog.

 

Any help would be greatly appareciated.

Cheers,

Dave

Link to post

Hi frustum - its ObjectVolumeBox. Not sure how to achieve that with scattering, would it solve this?

Link to post

Scattering is working on per MSAA sample level while the ObjectVolumeBox is working on per pixel level only. You can modify atmosphere scattering parameters to achieve such fog effect also. We can modify ObjectVolumeBox and ObjectVolumeSphere objects to perform fogging on per MSAA sample level but it will hurt performance.

Link to post

Hi frustum. Sounds like scattering is the way to do it. I have been playing with the settings, what do you generally use for fog in scattering? Is there a sample using this method I can examine?

Also, we will need to have 'exclusion' zones for the fog, and we are thinking of using the volume boxes again with a 'depth cutout' type shader to do this. The reason we need this is that in tunnels there generally is no fog when there is fog outside :) .. this is why we were using volumeboxes originally.

Thanks for the assistance.

Cheers,

Dave

Link to post

Just a guess, but I think fog via ObjectSky scattering will be very hard to control (e.g. something like setting a simple "visibility distance" as common in simulators). Also more advanced required features like "fog exclusion zone", "groud fog" or "patchy fog" simulations cannot be handled via scattering.

 

ObjectVolumeBox with volume_cloud_base material might be be the most promissing approach based on my experiences. Unfortunately there were some shader problems with volume_cloud_base material when I tried to achieve these special fog effects, see this old bug report (I really love the now working forum search function !). I don't know if this bug has been fixed since then, if not, this posting might be a good reminder :)

 

The provided screenshot gives a quite realistic example of the "patchy fog" effect. "fog exclusion zones" could be realized by setting corresponding fog texture mask image pixels to zero density. Performance-wise I guess it should also be possible to use one larger ObjectVolumeBox patchy fog instance for lower-resolution fog coverage of larger regions with optional several higher-detail ObjectVolumeBox "insets" aligned to fog mask texel borders (e.g. for more precise fog cut-off at tunnel entraces/exits) via the same technique.

Link to post

We can modify ObjectVolumeBox and ObjectVolumeSphere objects to perform fogging on per MSAA sample level but it will hurt performance.

Maybe it's possible to have this as a user-selectable material option ?

Link to post

Maybe you can also have a look on the volume_cloud_base issue :)

Link to post

Fantastic solve! Thanks everyone for assistance here. I really like the solution (nice tick box for multisample in the material properties). This means we don't need to do any major rework.

Thanks again all!

Cheers,

Dave

Link to post