Fix: Cycles rough diffuse rendering with bright input color in OSL

The Oren Nayer diffuse BSDF had a energy compensation term added in a
recent commit[1]. This energy compensation term used the colour input
in it's computation. The colour input was clamped in SVM, but not OSL,
resulting in differences between the two backends. This commit resolves
this issue by clamping the colour in the OSL script to match SVM.

[1] 5e40b9bb5cefdaca2d88bb6316e180b2bdf929db

Pull Request: https://projects.blender.org/blender/blender/pulls/123527
This commit is contained in:
Alaska 2024-06-21 18:54:15 +02:00 committed by Brecht Van Lommel
parent 1be198a4d8
commit 89583e991d

@ -12,5 +12,5 @@ shader node_diffuse_bsdf(color Color = 0.8,
if (Roughness == 0.0)
BSDF = Color * diffuse(Normal);
else
BSDF = Color * oren_nayar_diffuse_bsdf(Normal, Color, Roughness);
BSDF = Color * oren_nayar_diffuse_bsdf(Normal, clamp(Color, 0.0, 1.0), Roughness);
}