Update the Glass BSDF to internally use Generalized Schlick fresnel. This allows for easier expansion of certain features in the future. There should be no functional change from the users perspective. Pull Request: https://projects.blender.org/blender/blender/pulls/112701
24 lines
711 B
Plaintext
24 lines
711 B
Plaintext
/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0 */
|
|
|
|
#include "node_fresnel.h"
|
|
#include "stdcycles.h"
|
|
|
|
shader node_glass_bsdf(color Color = 0.8,
|
|
string distribution = "ggx",
|
|
float Roughness = 0.2,
|
|
float IOR = 1.45,
|
|
normal Normal = N,
|
|
output closure color BSDF = 0)
|
|
{
|
|
float r2 = Roughness * Roughness;
|
|
float eta = max(IOR, 1e-5);
|
|
eta = backfacing() ? 1.0 / eta : eta;
|
|
color F0 = F0_from_ior(eta);
|
|
color F90 = color(1.0);
|
|
|
|
BSDF = generalized_schlick_bsdf(
|
|
Normal, vector(0.0), Color, Color, r2, r2, F0, F90, -eta, distribution);
|
|
}
|