0 votes

I'm writing a shader where I'm using the light() function to update the diffuse light. In order to prevent the ambient light from messing with the colors I've set the render_mode flag "ambient_light_disabled".

This works great by itself, but I've noticed that as soon as the material enters the range of a ReflectionProbe the lighting drastically changes. Regardless of what value the roughness is set to. The material lighting seem to change similar to as if it were to receive ambient light.

What causes this behaviour, and is it possible to avoid it?

Example:

shader_type spatial;
render_mode ambient_light_disabled;

void light() {
    DIFFUSE_LIGHT = vec3(0.0, 0.0, 1.0);
}

Results in a perfectly blue color, as expected:

However, when it enters the range of a ReflectionProbe the following happens:

As a comparison, this is what the shader looks like without disabling ambient light:

In this case the shader looks the same whether or not it's within range of the ReflectionProbe.

Update
After some additional testing I found that the shader is indeed affected by the world environment's ambient light while it's within range of a ReflectionProbe. Even though ambient light has been disabled in the shader. The color change is not related to sky reflections.

Not sure if this is a bug or if there is some logical explanation behind it.

Godot version v3.4.2.stable.official
in Engine by (1,083 points)
edited by

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.