Skip to content

Issue #4708: Radial Fog

Michael Stopa requested to merge Stomy/openmw:euclidean-fog into master

Built off of @sthalik's work, with support also added to keep fog consistent when looking through the water plane.

Closes #4708 (closed)

Squash-on-merge is enabled.

Older Version

Using @sthalik's original PR (https://github.com/OpenMW/openmw/pull/2042/files) as a base I've added a global shader define to activate euclidean-distance fog calculation, and enabled the GL_NV_fog_distance extension for fixed-function rendering on eligible devices. Radial Frustum clipping is implemented with a colormasked sphere primitive as per @AnyOldName3's recommendation.

The sun glare effect now also acts differently when radial fog is enabled, emulating the existing behavior but by placing the occlusion circle on the clip sphere instead of the far plane.

Original Post (Problems now fixed)

It can sometimes look quite jittery when moving around without distant land, I'm tempted to put the blame on a large farclip distance as indicated in #4987 (closed) but I may have missed something more subtle. It looks much better with higher view distance.

The way the system works on OSG<3.5.6 is also pretty inefficient, as there was no easy way to trigger a rebuild of the sphere. It could also be possible to simply simulate the resizing and movement of the sphere with a transformation on top of the shape but I'm not familiar enough with OSG to know if that would be an improvement.

Currently interferes with Sun glare occlusion query.

Edited by Michael Stopa

Merge request reports