Blender
V5.3
source
blender
gpu
shaders
material
gpu_shader_material_refraction.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
7
#include "
gpu_shader_material_interface.bsl.hh
"
8
#include "
gpu_shader_math_vector_safe.bsl.hh
"
9
10
[[
node
]]
11
void
node_bsdf_refraction
(
float4
color,
12
float
roughness,
13
float
ior,
14
float3
N
,
15
float
weight,
16
KernelGlobals
&kg,
17
ShadingData
&sd,
18
Closure
&result)
19
{
20
color =
max
(color,
float4
(0.0f));
21
roughness =
saturate
(roughness);
22
ior =
max
(ior, 1e-5f);
23
N
=
safe_normalize
(
N
);
24
25
ClosureRefraction refraction_data;
26
refraction_data.color = color.rgb * weight;
27
refraction_data.N =
N
;
28
refraction_data.roughness = roughness;
29
refraction_data.ior = ior;
30
31
result =
closure_eval
(kg, sd, refraction_data);
32
}
max
btScalar max
Definition
btHeightfieldTerrainShape.h:79
Closure
#define Closure
Definition
eevee_nodetree_closures_lib.bsl.hh:10
closure_eval
Closure closure_eval(KernelGlobals &kg, ShadingData &sd, ClosureDiffuse diffuse)
Definition
eevee_nodetree_lib.bsl.hh:270
node
#define node
Definition
gpu_shader_cxx_attribute.hh:142
gpu_shader_material_interface.bsl.hh
node_bsdf_refraction
void node_bsdf_refraction(float4 color, float roughness, float ior, float3 N, float weight, KernelGlobals &kg, ShadingData &sd, Closure &result)
Definition
gpu_shader_material_refraction.bsl.hh:11
gpu_shader_math_vector_safe.bsl.hh
safe_normalize
VecT safe_normalize(VecT vector)
Definition
gpu_shader_math_vector_safe.bsl.hh:150
N
#define N
Definition
mball_tessellate.cc:278
saturate
#define saturate(a)
Definition
smaa.cc:319
KernelGlobals
Definition
eevee_nodetree_lib.bsl.hh:141
ShadingData
Definition
eevee_nodetree_lib.bsl.hh:56
float3
Definition
sky_math.h:135
float4
Definition
sky_math.h:224
Generated on
for Blender by
doxygen
1.18.0