Clamp some of the inputs of the Glossy BSDF, Glass BSDF, Sheen BSDF, and Subsurface Scattering nodes to improve consistency between render engines and to avoid unexpected results. * Clamp roughness to 0..1 * Clamp subsurface radius to 0..inf * Clamp colors to 0..inf Pull Request: https://projects.blender.org/blender/blender/pulls/120390
22 lines
680 B
Plaintext
22 lines
680 B
Plaintext
/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0 */
|
|
|
|
#include "node_fresnel.h"
|
|
#include "stdcycles.h"
|
|
|
|
shader node_sheen_bsdf(color Color = 0.8,
|
|
string distribution = "microfiber",
|
|
float Roughness = 0.0,
|
|
normal Normal = N,
|
|
output closure color BSDF = 0)
|
|
{
|
|
color base_color = max(Color, color(0.0));
|
|
float roughness = clamp(Roughness, 0.0, 1.0);
|
|
|
|
if (distribution == "ashikhmin")
|
|
BSDF = base_color * ashikhmin_velvet(Normal, roughness);
|
|
else if (distribution == "microfiber")
|
|
BSDF = base_color * sheen(Normal, roughness);
|
|
}
|