38 extent_ = inst_.film.render_extent_get();
39 const CameraData &cam = inst_.camera.data_get();
41 if (inst_.camera.is_panoramic()) {
55 if (inst_.camera.is_panoramic()) {
64 viewmat = face_matrix_ * cam.
viewmat;
71 main_view_.sync(viewmat, winmat);
73 inst_.uniform_data.pipeline.is_main_view_inverted = main_view_.is_inverted();
83 inst_.shadows.set_view(render_view_, extent_);
84 inst_.volume.set_view(main_view_, extent_);
85 inst_.uniform_data.data.push_update();
88 inst_.raytracing.thickness_parameters_setup(render_view_.winmat(), extent_);
89 inst_.uniform_data.raytrace.push_update();
94 inst_.planar_probes.set_view(render_view_, extent_);
105 const bool with_raycast = inst_.pipelines.has_raycast;
114 inst_.pipelines.deferred.header_layer_count(),
115 inst_.pipelines.deferred.closure_layer_count(),
116 inst_.pipelines.deferred.normal_layer_count());
138 combined_fb_, {0.0, 0.0, 0.0, 1.0}, inst_.film.depth.clear_value);
139 inst_.pipelines.background.clear(render_view_);
142 inst_.lights.set_view(render_view_, extent_);
144 inst_.hiz_buffer.set_source(&inst_.render_buffers.depth_tx);
146 inst_.volume.draw_prepass(main_view_);
148 inst_.pipelines.deferred.render(main_view_,
157 inst_.pipelines.background.render(render_view_, combined_fb_);
159 inst_.gbuffer.release();
161 inst_.volume.draw_compute(main_view_, extent_);
163 inst_.volume.draw_resolve(main_view_);
165 inst_.ambient_occlusion.render_pass(render_view_);
167 inst_.pipelines.forward.render(
168 render_view_, rbufs.
depth_tx, prepass_fb_, transparent_fb_, combined_fb_, extent_);
170 inst_.lights.shape_display_draw(render_view_, combined_fb_);
172 inst_.lights.debug_draw(render_view_, combined_fb_);
173 inst_.hiz_buffer.debug_draw(render_view_, combined_fb_);
174 inst_.shadows.debug_draw(render_view_, combined_fb_);
175 inst_.volume_probes.viewport_draw(render_view_, combined_fb_);
176 inst_.sphere_probes.viewport_draw(render_view_, combined_fb_);
177 inst_.planar_probes.viewport_draw(render_view_, combined_fb_);
180 inst_.film.accumulate(jitter_view_, combined_final_tx);
183 postfx_tx_.release();
193 postfx_tx_.
acquire_2d(extent_, gpu::TextureFormat::SFLOAT_16_16_16_16);
204 gpu::Texture *output_tx = postfx_tx_;
213void ShadingView::update_view()
215 const Film &film = inst_.film;
217 float4x4 viewmat = main_view_.viewmat();
218 float4x4 winmat = main_view_.winmat();
220 if (film.scaling_factor_get() > 1) {
224 float left, right, bottom, top, near, far;
226 const float2 bottom_left_with_overscan =
float2(left, bottom);
227 const float2 top_right_with_overscan =
float2(right, top);
228 const float2 render_size_with_overscan = top_right_with_overscan - bottom_left_with_overscan;
230 float2 bottom_left = bottom_left_with_overscan;
231 float2 top_right = top_right_with_overscan;
232 float2 render_size = render_size_with_overscan;
234 float overscan = inst_.camera.overscan();
235 if (overscan > 0.0f) {
238 const float max_size_original = max_size_with_overscan / (1.0f + 2.0f * overscan);
239 const float overscan_size = (max_size_with_overscan - max_size_original) / 2.0f;
241 bottom_left = bottom_left_with_overscan + overscan_size;
242 top_right = top_right_with_overscan - overscan_size;
244 render_size = top_right - bottom_left;
248 const float2 pixel_size = render_size /
float2(film.film_extent_get());
251 const int2 render_extent = film.render_extent_original_get() * film.scaling_factor_get();
252 const int overscan_pixels = film.render_overscan_get() * film.scaling_factor_get();
254 const float2 render_bottom_left = bottom_left - pixel_size *
float(overscan_pixels);
255 const float2 render_top_right = render_bottom_left + pixel_size *
float2(render_extent);
257 if (main_view_.is_persp()) {
260 render_bottom_left.
y,
268 render_bottom_left.
y,
276 float2 jitter = inst_.film.pixel_jitter_get() /
float2(extent_);
281 jitter_view_.sync(viewmat, winmat);
285 inst_.depth_of_field.jitter_apply(winmat, viewmat);
286 render_view_.sync(viewmat, winmat);
297 const auto update_info = inst_.sphere_probes.world_update_info_pop();
298 if (!update_info.has_value()) {
302 View view = {
"Capture.View"};
305 if (update_info->do_render) {
306 inst_.sphere_probes.ensure_cubemap_render_target(update_info->cube_target_extent);
310 inst_.uniform_data.pipeline.push_update();
316 update_info->clipping_distances.x,
317 -update_info->clipping_distances.x,
318 update_info->clipping_distances.x,
319 update_info->clipping_distances.x,
320 update_info->clipping_distances.y);
321 view.
sync(view_m4, win_m4);
327 inst_.pipelines.world.render(view);
331 if (inst_.pipelines.world.use_lightpath_node()) {
333 inst_.sphere_probes.remap_to_octahedral_projection(
337 inst_.sphere_probes.remap_to_octahedral_projection(
342 inst_.sphere_probes.remap_to_octahedral_projection(
347 inst_.volume_probes.update_world_irradiance();
350 inst_.sphere_probes.release_render_target();
353 inst_.uniform_data.pipeline.push_update();
362 View view = {
"Capture.View"};
369 while (
const auto update_info = inst_.sphere_probes.probe_update_info_pop()) {
372 inst_.sphere_probes.ensure_cubemap_render_target(update_info->cube_target_extent);
375 inst_.uniform_data.pipeline.push_update();
377 if (prev_extent != update_info->cube_target_extent) {
379 inst_.raytracing.thickness_parameters_setup(win_m4,
int2(update_info->cube_target_extent));
380 inst_.uniform_data.raytrace.push_update();
383 prev_extent = update_info->cube_target_extent;
385 int2 extent =
int2(update_info->cube_target_extent);
389 const bool with_raycast = inst_.pipelines.has_raycast;
396 inst_.gbuffer.acquire(extent,
397 inst_.pipelines.probe.header_layer_count(),
398 inst_.pipelines.probe.closure_layer_count(),
399 inst_.pipelines.probe.normal_layer_count());
405 update_info->clipping_distances.x,
406 -update_info->clipping_distances.x,
407 update_info->clipping_distances.x,
408 update_info->clipping_distances.x,
409 update_info->clipping_distances.y);
410 view.
sync(view_m4, win_m4);
415 inst_.shadows.set_view(view, extent);
416 inst_.volume.set_view(view, extent);
417 inst_.uniform_data.data.push_update();
433 inst_.pipelines.probe.render(view, prepass_fb, combined_fb_, gbuffer_fb_, extent);
436 inst_.render_buffers.release();
437 inst_.gbuffer.release();
439 inst_.sphere_probes.remap_to_octahedral_projection(update_info->atlas_coord,
true,
false);
442 inst_.sphere_probes.release_render_target();
445 inst_.uniform_data.pipeline.push_update();
457 if (!inst_.lookdev.use_reference_spheres_) {
462 const float radius = inst_.lookdev.sphere_radius_;
463 const float clip = inst_.camera.data_get().clip_near;
465 -radius, radius, -radius, radius, clip);
466 const float4x4 &view_m4 = inst_.camera.data_get().viewmat;
467 view_.sync(view_m4, win_m4);
469 inst_.lookdev.draw(view_);
470 inst_.lookdev.display();
#define GPU_ATTACHMENT_TEXTURE(_texture)
#define GPU_ATTACHMENT_TEXTURE_CUBEFACE(_texture, _face)
#define GPU_ATTACHMENT_NONE
#define GPU_ATTACHMENT_TEXTURE_LAYER(_texture, _layer)
constexpr IndexRange()=default
void ensure(GPUAttachment depth=GPU_ATTACHMENT_NONE, GPUAttachment color1=GPU_ATTACHMENT_NONE, GPUAttachment color2=GPU_ATTACHMENT_NONE, GPUAttachment color3=GPU_ATTACHMENT_NONE, GPUAttachment color4=GPU_ATTACHMENT_NONE, GPUAttachment color5=GPU_ATTACHMENT_NONE, GPUAttachment color6=GPU_ATTACHMENT_NONE, GPUAttachment color7=GPU_ATTACHMENT_NONE, GPUAttachment color8=GPU_ATTACHMENT_NONE)
bool acquire_2d(int2 extent, gpu::TextureFormat format, eGPUTextureUsage usage=GPU_TEXTURE_USAGE_GENERAL, int mip_len=1)
void clear(float4 values)
gpu::Texture * layer_view(int layer)
void sync(const float4x4 &view_mat, const float4x4 &win_mat, int view_id=0)
bool postfx_enabled() const
void render(View &view, gpu::Texture **input_tx, gpu::Texture **output_tx, DepthOfFieldBuffer &dof_buffer)
DepthOfField depth_of_field
MotionBlurModule motion_blur
bool postfx_enabled() const
void render(View &view, gpu::Texture **input_tx, gpu::Texture **output_tx)
TextureFromPool combined_tx
TextureFromPool object_id_tx
TextureFromPool prepass_normal_tx
TextureFromPool vector_tx
void acquire(int2 extent, gpu::TextureFormat raycast_depth_format=depth_format)
void DRW_gsplat_ensure_radiance(draw::Manager &manager, draw::View &view)
float4x4 cubeface_mat(int face)
MatBase< T, 4, 4 > orthographic(T left, T right, T bottom, T top, T near_clip, T far_clip)
Create an orthographic projection matrix using OpenGL coordinate convention: Maps each axis range to ...
MatBase< T, 4, 4 > orthographic_infinite(T left, T right, T bottom, T top)
Create an orthographic projection matrix using OpenGL coordinate convention: Maps each axis range to ...
MatBase< T, 4, 4 > perspective(T left, T right, T bottom, T top, T near_clip, T far_clip)
Create a perspective projection matrix using OpenGL coordinate convention: Maps each axis range to [-...
T reduce_max(const VecBase< T, Size > &a)
MatBase< T, NumCol, NumRow > translate(const MatBase< T, NumCol, NumRow > &mat, const VectorT &translation)
void GPU_framebuffer_bind(gpu::FrameBuffer *fb)
bool GPU_type_matches_ex(GPUDeviceType device, GPUOSType os, GPUDriverType driver, GPUBackendType backend)
bool assign_if_different(T &old_value, T &&new_value)
void projmat_dimensions(const float winmat[4][4], float *r_left, float *r_right, float *r_bottom, float *r_top, float *r_near, float *r_far)
VecBase< uint32_t, 4 > uint4
void window_translate_m4(float winmat[4][4], float perspmat[4][4], float x, float y)
void GPU_framebuffer_clear_color(gpu::FrameBuffer *fb, const double4 clear_col)
MatBase< float, 4, 4 > float4x4
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
void GPU_debug_group_end()
void GPU_texture_clear(gpu::Texture *texture, eGPUDataFormat data_format, const void *data)
void GPU_framebuffer_clear_color_depth(gpu::FrameBuffer *fb, const double4 clear_col, float clear_depth)
void GPU_debug_group_begin(const char *name)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
const c_style_mat & ptr() const
float panoramic_view_overscan
float panoramic_front_face_extent
TextureFromPool header_tx
void acquire(int2 extent, int header_count, int data_count, int normal_count)
TextureFromPool closure_tx
TextureFromPool normal_tx