Blender V5.3
eevee_subsurface.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2021 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
18
19#pragma once
20
21#include "draw_pass.hh"
22
24
25namespace blender::eevee {
26
27using namespace draw;
28
29/* -------------------------------------------------------------------- */
33
34class Instance;
35
38
40 private:
41 Instance &inst_;
45 gpu::Texture *direct_light_tx_;
46 gpu::Texture *indirect_light_tx_;
48 TextureFromPool radiance_tx_;
49 TextureFromPool object_id_tx_;
51 PassSimple setup_ps_ = {"Subsurface.Prepare"};
52 int3 setup_dispatch_size_ = {1, 1, 1};
53
55 PassSimple convolve_ps_ = {"Subsurface.Convolve"};
56 SubsurfaceTileBuf convolve_tile_buf_;
57 DispatchIndirectBuf convolve_dispatch_buf_;
58
59 /* Process direct and indirect radiance separately. */
60 bool use_split_radiance_ = false;
61
62 public:
63 SubsurfaceModule(Instance &inst) : inst_(inst)
64 {
65 /* Force first update. */
66 data_.sample_len = -1;
67 };
68
70
71 void end_sync();
72
73 /* Process the direct & indirect diffuse light buffers using screen space subsurface scattering.
74 * Result is stored in the direct light texture. */
75 void render(gpu::Texture *direct_diffuse_light_tx,
76 gpu::Texture *indirect_diffuse_light_tx,
77 eClosureBits active_closures,
78 View &view);
79
80 private:
81 void precompute_samples_location();
82
84 static float burley_sample(float d, float x_rand);
85 static float burley_eval(float d, float r);
86 static float burley_pdf(float d, float r);
87};
88
90
91} // namespace blender::eevee
A running instance of the engine.
detail::Pass< command::DrawCommandBuf > PassSimple
draw::StorageBuffer< DispatchCommand > DispatchIndirectBuf
Definition draw_pass.hh:72
draw::UniformBuffer< SubsurfaceData > SubsurfaceDataBuf
draw::StorageArrayBuffer< uint, 1024, true > SubsurfaceTileBuf
VecBase< int32_t, 3 > int3