Blender V4.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
19#pragma once
20
21#include "eevee_shader.hh"
23
24namespace blender::eevee {
25
26/* -------------------------------------------------------------------- */
31class Instance;
32
34 private:
35 Instance &inst_;
37 SubsurfaceData &data_;
39 GPUTexture *direct_light_tx_;
40 GPUTexture *indirect_light_tx_;
42 TextureFromPool radiance_tx_;
43 TextureFromPool object_id_tx_;
45 PassSimple setup_ps_ = {"Subsurface.Prepare"};
46 int3 setup_dispatch_size_ = {1, 1, 1};
47
49 PassSimple convolve_ps_ = {"Subsurface.Convolve"};
50 SubsurfaceTileBuf convolve_tile_buf_;
51 DispatchIndirectBuf convolve_dispatch_buf_;
52
53 public:
54 SubsurfaceModule(Instance &inst, SubsurfaceData &data) : inst_(inst), data_(data)
55 {
56 /* Force first update. */
57 data_.sample_len = -1;
58 };
59
61
62 void end_sync();
63
64 /* Process the direct & indirect diffuse light buffers using screen space subsurface scattering.
65 * Result is stored in the direct light texture. */
66 void render(GPUTexture *direct_diffuse_light_tx,
67 GPUTexture *indirect_diffuse_light_tx,
68 eClosureBits active_closures,
69 View &view);
70
71 private:
72 void precompute_samples_location();
73
75 static float burley_sample(float d, float x_rand);
76 static float burley_eval(float d, float r);
77 static float burley_pdf(float d, float r);
78};
79
82} // namespace blender::eevee
A running instance of the engine.
SubsurfaceModule(Instance &inst, SubsurfaceData &data)