Skip to content

FOG writing in shaders fails with Compatibility renderer unless enabled via WorldEnvironment #94183

@Zorochase

Description

@Zorochase

Tested versions

4.2.2, 4.3.beta3

System information

Windows 11, Compatibility

Issue description

Writing to FOG in a shader works fine in Forward+ and Mobile, regardless of whether there is a WorldEnvironment node with fog enabled in the scene. This leads me to believe writing to FOG is intended to entirely override fog from any WorldEnvironment node. However, with the Compatibility renderer, writing to FOG only works if there is a WorldEnvironment node with fog enabled.

Steps to reproduce

Add a node, like a MeshInstance3D, to a scene. Add a ShaderMaterial to it and give that a shader which writes to FOG in the fragment function. If you're using the Forward+ or Mobile renderers, you should see the fog color of the node change. However, with the Compatibility renderer, you'll need to add a WorldEnvironment node, give it an Environment resource, and enable fog; only then will you see the fog color change to what you instructed it to in the shader.

Minimal reproduction project (MRP)

Fog Shader Compatibility Issue MRP.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions