Fix albedo value wraparound in Compatibility render mode

Using the Compatibility renderer results in wrapped albedo values if a custom shader returns albedo values outside the expected range of [0,1].

This commit fixed this issue by clamping the albedo value to [0,1] right after the custom shader is executed.

Fixes #91919
This commit is contained in:
sunfl0w 2024-05-26 17:15:39 +02:00
parent be56cab58c
commit 0e56b64fc4
1 changed files with 3 additions and 0 deletions

View File

@ -1523,6 +1523,9 @@ void main() {
#CODE : FRAGMENT
}
// Keep albedo values in positive number range as negative values "wraparound" into positive numbers resulting in wrong colors
albedo = max(albedo, vec3(0.0));
#ifdef LIGHT_VERTEX_USED
vertex = light_vertex;
#ifdef USE_MULTIVIEW