Even if related, they don't have the same performance impact. To avoid any performance hit, we replace the Diffuse by a Subsurface Closure for legacy EEVEE and use the subsurface closure only where needed for EEVEE-Next leveraging the random sampling. This increases the compatibility with cycles that doesn't modulate the radius of the subsurface anymore. This change is only present in EEVEE-Next. This commit changes the principled BSDF code so that it is easier to follow the flow of data. For legacy EEVEE, the SSS switch is moved to a `radius == -1` check.
19 lines
462 B
GLSL
19 lines
462 B
GLSL
/* SPDX-FileCopyrightText: 2019-2022 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
void node_bsdf_toon(
|
|
vec4 color, float size, float tsmooth, vec3 N, float weight, out Closure result)
|
|
{
|
|
color = max(color, vec4(0.0));
|
|
N = safe_normalize(N);
|
|
|
|
/* Fallback to diffuse. */
|
|
ClosureDiffuse diffuse_data;
|
|
diffuse_data.weight = weight;
|
|
diffuse_data.color = color.rgb;
|
|
diffuse_data.N = N;
|
|
|
|
result = closure_eval(diffuse_data);
|
|
}
|