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
22 lines
585 B
GLSL
22 lines
585 B
GLSL
/* SPDX-FileCopyrightText: 2019-2022 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
void node_bsdf_refraction(
|
|
vec4 color, float roughness, float ior, vec3 N, float weight, out Closure result)
|
|
{
|
|
color = max(color, vec4(0));
|
|
roughness = saturate(roughness);
|
|
ior = max(ior, 1e-5);
|
|
N = safe_normalize(N);
|
|
|
|
ClosureRefraction refraction_data;
|
|
refraction_data.weight = weight;
|
|
refraction_data.color = color.rgb;
|
|
refraction_data.N = N;
|
|
refraction_data.roughness = roughness;
|
|
refraction_data.ior = ior;
|
|
|
|
result = closure_eval(refraction_data);
|
|
}
|