Blender V5.0
eevee_motion_blur.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2022 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
42
43#pragma once
44
45#include "DRW_gpu_wrapper.hh"
46
48#include "eevee_sampling.hh"
49
50#include "draw_pass.hh"
51
52namespace blender::eevee {
53
54using namespace draw;
55
56/* -------------------------------------------------------------------- */
60
63
69 private:
70 Instance &inst_;
71
76 Vector<float> time_steps_;
77
79 int initial_frame_;
80 float initial_subframe_;
82 float frame_time_;
84 int shutter_position_;
86 float shutter_time_;
87
89 bool enabled_ = false;
91 bool motion_blur_fx_enabled_ = false;
93 bool was_navigating_ = false;
94
95 int step_id_ = 0;
96
98 TextureFromPool tiles_tx_;
99
100 gpu::Texture *input_color_tx_ = nullptr;
101 gpu::Texture *output_color_tx_ = nullptr;
102
103 PassSimple motion_blur_ps_ = {"MotionBlur"};
104
105 MotionBlurTileIndirectionBuf tile_indirection_buf_;
106 MotionBlurDataBuf data_;
108 int3 dispatch_flatten_size_ = int3(0);
109 int3 dispatch_dilate_size_ = int3(0);
110 int3 dispatch_gather_size_ = int3(0);
111
112 public:
113 MotionBlurModule(Instance &inst) : inst_(inst) {};
115
116 void init();
117
118 /* Runs after rendering a sample. */
119 void step();
120
121 void sync();
122
123 bool postfx_enabled() const
124 {
125 return motion_blur_fx_enabled_;
126 }
127
128 void render(View &view, gpu::Texture **input_tx, gpu::Texture **output_tx);
129
130 private:
131 float shutter_time_to_scene_time(float time);
132};
133
135
136} // namespace blender::eevee
static AppView * view
A running instance of the engine.
detail::Pass< command::DrawCommandBuf > PassSimple
draw::UniformBuffer< MotionBlurData > MotionBlurDataBuf
draw::StorageBuffer< MotionBlurTileIndirection, true > MotionBlurTileIndirectionBuf
VecBase< int32_t, 3 > int3