38 motion_blur_fx_enabled_ =
false;
45 time_steps_.
resize(steps_count);
49 frame_time_ = initial_frame_ + initial_subframe_;
54 motion_blur_fx_enabled_ =
true;
69 for (
float &
time : time_steps_) {
70 time = this->shutter_time_to_scene_time(
time);
75 if (motion_blur_fx_enabled_) {
82 inst_.set_time(time_steps_[1]);
100 if (motion_blur_fx_enabled_) {
104 inst_.set_time(time_steps_[step_id_]);
108float MotionBlurModule::shutter_time_to_scene_time(
float time)
110 switch (shutter_position_) {
124 time *= shutter_time_;
136 motion_blur_fx_enabled_ =
false;
139 if (!motion_blur_fx_enabled_) {
146 motion_blur_ps_.
init();
156 sub.
bind_ubo(
"motion_blur_buf", data_);
160 sub.
dispatch(&dispatch_flatten_size_);
167 sub.
bind_ssbo(
"tile_indirection_buf", tile_indirection_buf_);
169 sub.
dispatch(&dispatch_dilate_size_);
176 sub.
bind_ubo(
"motion_blur_buf", data_);
177 sub.
bind_ssbo(
"tile_indirection_buf", tile_indirection_buf_);
182 sub.
bind_image(
"out_color_img", &output_color_tx_);
184 sub.
dispatch(&dispatch_gather_size_);
191 if (!motion_blur_fx_enabled_) {
231 input_color_tx_ = *input_tx;
232 output_color_tx_ = *output_tx;
234 dispatch_flatten_size_ =
int3(tiles_extent, 1);
251 *input_tx = output_color_tx_;
252 *output_tx = input_color_tx_;
#define BLI_assert_msg(a, msg)
MINLINE int max_ii(int a, int b)
void GPU_debug_group_end()
void GPU_debug_group_begin(const char *name)
@ GPU_BARRIER_SHADER_STORAGE
@ GPU_BARRIER_TEXTURE_FETCH
@ GPU_BARRIER_SHADER_IMAGE_ACCESS
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
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)
#define MOTION_BLUR_GROUP_SIZE
#define MOTION_BLUR_TILE_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()
float motion_blur_shutter
struct CurveMapping mblur_shutter_curve
float motion_blur_depth_scale