Files
test/source/blender/gpu/shaders/material/gpu_shader_material_sheen.glsl
Miguel Pozo 3f778150a9 GPU: Sanitize closure nodes inputs
Ensure all Closures are filled with correct values,
like the principled bsdf node already does.

The main reason is that the new AgX color transform doesn't play well
with negative values (see #113220), but it's probably best to ensure we
use sanitized values in the rendering code as a whole.

Pull Request: https://projects.blender.org/blender/blender/pulls/115059
2023-11-21 20:15:59 +01:00

20 lines
509 B
GLSL

/* SPDX-FileCopyrightText: 2019-2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
void node_bsdf_sheen(vec4 color, float roughness, vec3 N, float weight, out Closure result)
{
color = max(color, vec4(0));
roughness = saturate(roughness);
N = safe_normalize(N);
/* Fallback to diffuse. */
ClosureDiffuse diffuse_data;
diffuse_data.weight = weight;
diffuse_data.color = color.rgb;
diffuse_data.N = N;
diffuse_data.sss_id = 0u;
result = closure_eval(diffuse_data);
}