39 motion_blur_fx_enabled_ =
false;
44 int steps_count =
max_ii(1, scene->eevee.motion_blur_steps) * 2 + 1;
46 time_steps_.
resize(steps_count);
48 initial_frame_ = scene->r.cfra;
49 initial_subframe_ = scene->r.subframe;
50 frame_time_ = initial_frame_ + initial_subframe_;
51 shutter_position_ = scene->r.motion_blur_position;
52 shutter_time_ = scene->r.motion_blur_shutter;
54 data_.
depth_scale = scene->eevee.motion_blur_depth_scale;
55 motion_blur_fx_enabled_ =
true;
70 for (
float &time : time_steps_) {
71 time = this->shutter_time_to_scene_time(time);
76 if (motion_blur_fx_enabled_) {
83 inst_.set_time(time_steps_[1]);
102 if (motion_blur_fx_enabled_) {
106 inst_.set_time(time_steps_[step_id_]);
110float MotionBlurModule::shutter_time_to_scene_time(
float time)
112 switch (shutter_position_) {
126 time *= shutter_time_;
138 motion_blur_fx_enabled_ =
false;
141 if (!motion_blur_fx_enabled_) {
148 motion_blur_ps_.
init();
158 sub.
bind_ubo(
"motion_blur_buf", data_);
162 sub.
dispatch(&dispatch_flatten_size_);
169 sub.
bind_ssbo(
"tile_indirection_buf", tile_indirection_buf_);
171 sub.
dispatch(&dispatch_dilate_size_);
178 sub.
bind_ubo(
"motion_blur_buf", data_);
179 sub.
bind_ssbo(
"tile_indirection_buf", tile_indirection_buf_);
184 sub.
bind_image(
"out_color_img", &output_color_tx_);
186 sub.
dispatch(&dispatch_gather_size_);
193 if (!motion_blur_fx_enabled_) {
234 output_color_tx_ = *output_tx;
236 dispatch_flatten_size_ =
int3(tiles_extent, 1);
247 if (do_motion_vectors_swizzle) {
254 if (do_motion_vectors_swizzle) {
265 *output_tx = input_color_tx_;
#define BLI_assert_msg(a, msg)
MINLINE int max_ii(int a, int b)
#define MOTION_BLUR_TILE_SIZE
@ GPU_BARRIER_SHADER_STORAGE
@ GPU_BARRIER_TEXTURE_FETCH
@ GPU_BARRIER_SHADER_IMAGE_ACCESS
void GPU_texture_swizzle_set(GPUTexture *texture, const char swizzle[4])
void resize(const int64_t new_size)
void submit(PassSimple &pass, View &view)
void acquire(int2 extent, eGPUTextureFormat format, eGPUTextureUsage usage=GPU_TEXTURE_USAGE_GENERAL)
void bind_texture(const char *name, GPUTexture *texture, GPUSamplerState state=sampler_auto)
void bind_resources(U &resources)
void bind_image(const char *name, GPUTexture *image)
PassBase< DrawCommandBufType > & sub(const char *name)
void dispatch(int group_len)
void barrier(eGPUBarrier type)
void bind_ubo(const char *name, GPUUniformBuf *buffer)
void bind_ssbo(const char *name, GPUStorageBuf *buffer)
void shader_set(GPUShader *shader)
bool overscan_changed() const
bool camera_changed() const
RenderBuffers render_buffers
bool is_image_render() const
bool is_navigating() const
void render(View &view, GPUTexture **input_tx, GPUTexture **output_tx)
eGPUTextureFormat vector_tx_format()
TextureFromPool vector_tx
static void cdf_invert(Vector< float > &cdf, Vector< float > &inverted_cdf)
static void cdf_from_curvemapping(const CurveMapping &curve, Vector< float > &cdf)
bool do_render_sync() const
GPUShader * static_shader_get(eShaderType shader_type)
float step_time_delta_get(eVelocityStep start, eVelocityStep end) const
bool camera_changed_projection() const
void step_sync(eVelocityStep step, float time)
void DRW_stats_group_start(const char *name)
void DRW_stats_group_end()
#define MOTION_BLUR_GROUP_SIZE
void RE_engine_frame_set(RenderEngine *engine, int frame, float subframe)
constexpr GPUSamplerState no_filter
@ MOTION_BLUR_TILE_FLATTEN_RGBA
@ MOTION_BLUR_TILE_FLATTEN_RG
@ MOTION_BLUR_TILE_DILATE
VecBase< T, Size > divide_ceil(const VecBase< T, Size > &a, const VecBase< T, Size > &b)
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
VecBase< int32_t, 3 > int3
static constexpr GPUSamplerState default_sampler()