Blender V5.0
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
37
39 private:
40 Instance &inst_;
42 SubsurfaceData &data_;
44 gpu::Texture *direct_light_tx_;
45 gpu::Texture *indirect_light_tx_;
47 TextureFromPool radiance_tx_;
48 TextureFromPool object_id_tx_;
50 PassSimple setup_ps_ = {"Subsurface.Prepare"};
51 int3 setup_dispatch_size_ = {1, 1, 1};
52
54 PassSimple convolve_ps_ = {"Subsurface.Convolve"};
55 SubsurfaceTileBuf convolve_tile_buf_;
56 DispatchIndirectBuf convolve_dispatch_buf_;
57
58 public:
59 SubsurfaceModule(Instance &inst, SubsurfaceData &data) : inst_(inst), data_(data)
60 {
61 /* Force first update. */
62 data_.sample_len = -1;
63 };
64
66
67 void end_sync();
68
69 /* Process the direct & indirect diffuse light buffers using screen space subsurface scattering.
70 * Result is stored in the direct light texture. */
71 void render(gpu::Texture *direct_diffuse_light_tx,
72 gpu::Texture *indirect_diffuse_light_tx,
73 eClosureBits active_closures,
74 View &view);
75
76 private:
77 void precompute_samples_location();
78
80 static float burley_sample(float d, float x_rand);
81 static float burley_eval(float d, float r);
82 static float burley_pdf(float d, float r);
83};
84
86
87} // namespace blender::eevee
static AppView * view
BMesh const char void * data
A running instance of the engine.
detail::Pass< command::DrawCommandBuf > PassSimple
draw::StorageBuffer< DispatchCommand > DispatchIndirectBuf
Definition draw_pass.hh:70
draw::StorageArrayBuffer< uint, 1024, true > SubsurfaceTileBuf
static float3 burley_eval(float3 d, float r)
VecBase< int32_t, 3 > int3
SubsurfaceModule(Instance &inst, SubsurfaceData &data)