The oren_nayar_diffuse_bsdf closure in OSL had two issues: - It broke when used with roughness of zero - It only used the provided albedo for energy compensation, so it still required the user to multiply with the albedo Therefore, this handles the zero roughness corner case and includes the albedo in the closure weight. This makes no difference when using the closure through the Diffuse or Principled BSDF nodes, only for custom OSL shaders. Pull Request: https://projects.blender.org/blender/blender/pulls/133597
17 lines
468 B
Plaintext
17 lines
468 B
Plaintext
/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0 */
|
|
|
|
#include "stdcycles.h"
|
|
|
|
shader node_diffuse_bsdf(color Color = 0.8,
|
|
float Roughness = 0.0,
|
|
normal Normal = N,
|
|
output closure color BSDF = 0)
|
|
{
|
|
if (Roughness == 0.0)
|
|
BSDF = Color * diffuse(Normal);
|
|
else
|
|
BSDF = oren_nayar_diffuse_bsdf(Normal, clamp(Color, 0.0, 1.0), Roughness);
|
|
}
|