2023-08-24 02:54:59 +02:00
|
|
|
/* SPDX-FileCopyrightText: 2019-2022 Blender Authors
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2021-02-13 18:43:09 +01:00
|
|
|
|
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
|
|
|
void node_subsurface_scattering(vec4 color,
|
|
|
|
float scale,
|
|
|
|
vec3 radius,
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
float ior,
|
|
|
|
float anisotropy,
|
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
|
|
|
vec3 N,
|
2022-04-14 18:47:58 +02:00
|
|
|
float weight,
|
2024-01-09 04:27:30 +01:00
|
|
|
const float do_sss,
|
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
|
|
|
out Closure result)
|
|
|
|
{
|
2023-11-27 11:50:25 +01:00
|
|
|
color = max(color, vec4(0.0));
|
2023-11-30 01:10:12 +01:00
|
|
|
scale = max(scale, 0.0);
|
2023-11-21 20:15:59 +01:00
|
|
|
radius = max(radius, vec3(0));
|
|
|
|
ior = max(ior, 1e-5);
|
2022-04-14 18:47:58 +02:00
|
|
|
N = safe_normalize(N);
|
2021-02-13 18:43:09 +01:00
|
|
|
|
2024-01-09 04:27:30 +01:00
|
|
|
ClosureSubsurface sss_data;
|
|
|
|
sss_data.weight = weight;
|
|
|
|
sss_data.color = color.rgb;
|
|
|
|
sss_data.N = N;
|
|
|
|
sss_data.sss_radius = radius * scale;
|
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
|
|
|
|
2024-01-09 04:27:30 +01:00
|
|
|
#ifdef GPU_SHADER_EEVEE_LEGACY_DEFINES
|
|
|
|
if (do_sss == 0.0) {
|
2024-01-10 17:59:20 +01:00
|
|
|
/* Flag as disabled. */
|
|
|
|
sss_data.sss_radius.b = -1.0;
|
2024-01-09 04:27:30 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
result = closure_eval(sss_data);
|
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
|
|
|
}
|