Blender
V5.3
source
blender
draw
engines
eevee
shaders
eevee_bxdf_types.bsl.hh
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2023 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
5
#pragma once
6
7
#include "
eevee_uniform_shared.hh
"
8
12
13
struct
BsdfSample
{
14
packed_float3
direction
;
15
float
pdf
;
16
};
17
18
struct
BsdfEval
{
19
/* BSDF * NL. */
20
float
throughput
;
21
/* Probability of sampling a light direction. */
22
float
pdf
;
23
/* `throughput / pdf`. */
24
float
weight
;
25
};
26
27
/* Approximation types for computing the irradiance (form factor on point) of area lights. */
28
enum class
LTCFormFactorType
:
uchar
{
29
/* Form factor of a horizon-clipped sphere affecting a single-sided surface. */
30
OneSidedCosineSphereClipped
= 0u,
31
/* Form factor of an unclipped sphere affecting a two-sided surface. */
32
TwoSidedCosineSphere
= 1u,
33
};
34
35
struct
ClosureLight
{
36
/* Shading normal. */
37
packed_float3
N
;
38
/* Enum used as index to fetch which light intensity to use [0..3]. */
39
LightingType
type
;
40
/* Output both shadowed and unshadowed for shadow denoising. */
41
packed_float3
light_shadowed
;
42
packed_float3
light_unshadowed
;
43
/* Packed LTC matrix and attenuation data. */
44
uint
ltc_data_packed
[5];
45
};
46
47
/* Represent an approximation of a bunch of rays from a BSDF. */
48
struct
LightProbeRay
{
49
/* Average direction of sampled rays or its approximation.
50
* Magnitude will reduce directionality of spherical harmonic evaluation. */
51
packed_float3
dominant_direction
;
52
/* Perceptual roughness in [0..1] range.
53
* Modulate blur level of spherical probe and blend between sphere probe and spherical harmonic
54
* evaluation at higher roughness. */
55
float
perceptual_roughness
;
56
};
57
58
/* -------------------------------------------------------------------- */
61
62
/* Fresnel monochromatic, perfect mirror */
63
float
F_eta
(
float
eta,
float
cos_theta
)
64
{
65
/* Compute fresnel reflectance without explicitly computing
66
* the refracted direction. */
67
float
c =
abs
(
cos_theta
);
68
float
g = eta * eta - 1.0f + c * c;
69
if
(g > 0.0f) {
70
g =
sqrt
(g);
71
float
A
= (g - c) / (g + c);
72
float
B
= (c * (g + c) - 1.0f) / (c * (g - c) + 1.0f);
73
return
0.5f *
A
*
A
* (1.0f +
B
*
B
);
74
}
75
/* Total internal reflections. */
76
return
1.0f;
77
}
78
A
#define A
cos_theta
ccl_device_inline float cos_theta(const float3 w)
Definition
bsdf_principled_hair_huang.h:86
F_eta
float F_eta(float eta, float cos_theta)
Definition
eevee_bxdf_types.bsl.hh:63
LTCFormFactorType
LTCFormFactorType
Definition
eevee_bxdf_types.bsl.hh:28
LTCFormFactorType::OneSidedCosineSphereClipped
@ OneSidedCosineSphereClipped
Definition
eevee_bxdf_types.bsl.hh:30
LTCFormFactorType::TwoSidedCosineSphere
@ TwoSidedCosineSphere
Definition
eevee_bxdf_types.bsl.hh:32
eevee_uniform_shared.hh
abs
#define abs
Definition
gpu_shader_cxx_builtin.hh:104
sqrt
#define sqrt
Definition
gpu_shader_cxx_builtin.hh:118
uchar
unsigned int uchar
Definition
gpu_shader_cxx_vector.hh:405
B
#define B
Definition
mball_tessellate.cc:276
BsdfEval
Definition
eevee_bxdf_types.bsl.hh:18
BsdfEval::pdf
float pdf
Definition
eevee_bxdf_types.bsl.hh:22
BsdfEval::weight
float weight
Definition
eevee_bxdf_types.bsl.hh:24
BsdfEval::throughput
float throughput
Definition
eevee_bxdf_types.bsl.hh:20
BsdfSample
Definition
eevee_bxdf_types.bsl.hh:13
BsdfSample::pdf
float pdf
Definition
eevee_bxdf_types.bsl.hh:15
BsdfSample::direction
packed_float3 direction
Definition
eevee_bxdf_types.bsl.hh:14
ClosureLight
Definition
eevee_bxdf_types.bsl.hh:35
ClosureLight::light_shadowed
packed_float3 light_shadowed
Definition
eevee_bxdf_types.bsl.hh:41
ClosureLight::N
packed_float3 N
Definition
eevee_bxdf_types.bsl.hh:37
ClosureLight::light_unshadowed
packed_float3 light_unshadowed
Definition
eevee_bxdf_types.bsl.hh:42
ClosureLight::type
LightingType type
Definition
eevee_bxdf_types.bsl.hh:39
ClosureLight::ltc_data_packed
uint ltc_data_packed[5]
Definition
eevee_bxdf_types.bsl.hh:44
LightProbeRay
Definition
eevee_bxdf_types.bsl.hh:48
LightProbeRay::perceptual_roughness
float perceptual_roughness
Definition
eevee_bxdf_types.bsl.hh:55
LightProbeRay::dominant_direction
packed_float3 dominant_direction
Definition
eevee_bxdf_types.bsl.hh:51
packed_float3
Definition
types_float3.h:176
Generated on
for Blender by
doxygen
1.18.0