Blender V5.3
gpu_shader_material_glass.bsl.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2019-2022 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
9
10[[node]]
12 float roughness,
13 float /*anisotropy*/,
14 float /*rotation*/,
15 float ior,
16 float3 N,
17 float3 /*T*/,
18 float weight,
19 float /*thin_film_thickness*/,
20 float /*thin_film_ior*/,
21 const float do_multiscatter,
23 ShadingData &sd,
24 Closure &result)
25{
26 color = max(color, float4(0.0f));
27 roughness = saturate(roughness);
28 ior = max(ior, 1e-5f);
30
31 float3 V = coordinate_impl(kg, sd, sd.P, sd.N).incoming;
32 float NV = dot(N, V);
33
34 float2 bsdf = bsdf_lut(kg, NV, roughness, ior, do_multiscatter != 0.0f);
35
36 ClosureReflection reflection_data;
37 reflection_data.color = color.rgb * (bsdf.x * weight);
38 reflection_data.N = N;
39 reflection_data.roughness = roughness;
40
41 ClosureRefraction refraction_data;
42 refraction_data.color = color.rgb * (bsdf.y * weight);
43 refraction_data.N = N;
44 refraction_data.roughness = roughness;
45 refraction_data.ior = ior;
46
47 result = closure_eval(kg, sd, reflection_data, refraction_data);
48}
btScalar max
void bsdf_lut(KernelGlobals &kg, float3 F0, float3 F90, float3 transmission_tint, float cos_theta, float roughness, float ior, bool do_multiscatter, float3 &reflectance, float3 &transmittance)
Coordinates coordinate_impl(KernelGlobals &kg, const ShadingData &sd, float3 P, float3 N)
Closure closure_eval(KernelGlobals &kg, ShadingData &sd, ClosureDiffuse diffuse)
#define resource_table
float dot(VecOp< float, D >, VecOp< float, D >) RET
void node_bsdf_glass(float4 color, float roughness, float, float, float ior, float3 N, float3, float weight, float, float, const float do_multiscatter, KernelGlobals &kg, ShadingData &sd, Closure &result)
VecT safe_normalize(VecT vector)
#define N
#define saturate(a)
Definition smaa.cc:319
float x
float y
CCL_NAMESPACE_BEGIN struct Window V