Files
test2/source/blender/gpu/shaders/material/gpu_shader_material_glass.glsl
Weizhen Huang be9555d118 EEVEE: change Glass BSDF to match Cycles
changes include:
* Use microfacet normal instead of macronormal. Previously Cycles used
macronormal for Glass BSDF and Transmission component in Principeld
BSDF, leading to artefacts at grazing angles. This has been corrected
in 5f9b518a8b and 89218b66c2. Now change EEVEE to match this behaviour.
* GGX distribution is now darker due to the shadowing-masking term,
while Multiscatter GGX preserves energy. This now matches Cycles too.

Pull Request: https://projects.blender.org/blender/blender/pulls/111687
2023-09-01 10:59:20 +02:00

34 lines
963 B
GLSL

/* SPDX-FileCopyrightText: 2019-2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
void node_bsdf_glass(vec4 color,
float roughness,
float ior,
vec3 N,
float weight,
float do_multiscatter,
out Closure result)
{
N = safe_normalize(N);
vec3 V = cameraVec(g_data.P);
float NV = dot(N, V);
vec2 bsdf = btdf_lut(NV, roughness, ior, do_multiscatter);
ClosureReflection reflection_data;
reflection_data.weight = bsdf.y * weight;
reflection_data.color = color.rgb;
reflection_data.N = N;
reflection_data.roughness = roughness;
ClosureRefraction refraction_data;
refraction_data.weight = bsdf.x * weight;
refraction_data.color = color.rgb;
refraction_data.N = N;
refraction_data.roughness = roughness;
refraction_data.ior = ior;
result = closure_eval(reflection_data, refraction_data);
}