38 int64_t render_pixel_count = render_extent.x *
int64_t(render_extent.y);
40 extent_[0] = extent_[1] =
ceilf(
sqrtf(1 + (render_pixel_count / 6)));
45 extent_ = render_extent;
65 viewmat = face_matrix_ * cam.
viewmat;
72 main_view_.
sync(viewmat, winmat);
117 float4 clear_color = {0.0f, 0.0f, 0.0f, 1.0f};
149 render_transparent_pass(rbufs);
158 GPUTexture *combined_final_tx = render_postfx(rbufs.
combined_tx);
167void ShadingView::render_transparent_pass(
RenderBuffers &rbufs)
174 float4 clear_color = {0.0f, 0.0f, 0.0f, 1.0f};
181GPUTexture *ShadingView::render_postfx(GPUTexture *
input_tx)
197 GPUTexture *output_tx = postfx_tx_;
206void ShadingView::update_view()
213 if (film.scaling_factor_get() > 1) {
217 float left, right, bottom,
top, near, far;
219 const float2 bottom_left_with_overscan =
float2(left, bottom);
220 const float2 top_right_with_overscan =
float2(right, top);
221 const float2 render_size_with_overscan = top_right_with_overscan - bottom_left_with_overscan;
223 float2 bottom_left = bottom_left_with_overscan;
224 float2 top_right = top_right_with_overscan;
225 float2 render_size = render_size_with_overscan;
228 if (overscan > 0.0f) {
231 const float max_size_original = max_size_with_overscan / (1.0f + 2.0f * overscan);
232 const float overscan_size = (max_size_with_overscan - max_size_original) / 2.0f;
234 bottom_left = bottom_left_with_overscan + overscan_size;
235 top_right = top_right_with_overscan - overscan_size;
237 render_size = top_right - bottom_left;
241 const float2 pixel_size = render_size /
float2(film.film_extent_get());
244 const int2 render_extent = film.render_extent_get() * film.scaling_factor_get();
245 const int overscan_pixels = film.render_overscan_get() * film.scaling_factor_get();
247 const float2 render_bottom_left = bottom_left - pixel_size *
float(overscan_pixels);
248 const float2 render_top_right = render_bottom_left + pixel_size *
float2(render_extent);
253 render_bottom_left.
y,
261 render_bottom_left.
y,
274 jitter_view_.
sync(viewmat, winmat);
279 render_view_.
sync(viewmat, winmat);
290 const auto update_info = inst_.
sphere_probes.world_update_info_pop();
291 if (!update_info.has_value()) {
295 View view = {
"Capture.View"};
298 if (update_info->do_render) {
302 update_info->clipping_distances.x,
303 -update_info->clipping_distances.x,
304 update_info->clipping_distances.x,
305 update_info->clipping_distances.x,
306 update_info->clipping_distances.y);
307 view.sync(view_m4, win_m4);
315 inst_.
sphere_probes.remap_to_octahedral_projection(update_info->atlas_coord,
true);
324 View view = {
"Capture.View"};
325 while (
const auto update_info = inst_.
sphere_probes.probe_update_info_pop()) {
333 int2 extent =
int2(update_info->cube_target_extent);
348 update_info->clipping_distances.x,
349 -update_info->clipping_distances.x,
350 update_info->clipping_distances.x,
351 update_info->clipping_distances.x,
352 update_info->clipping_distances.y);
353 view.sync(view_m4, win_m4);
373 inst_.
sphere_probes.remap_to_octahedral_projection(update_info->atlas_coord,
false);
395 const float radius = inst_.
lookdev.sphere_radius_;
398 -radius, radius, -radius, radius, clip);
400 view_.
sync(view_m4, win_m4);
void window_translate_m4(float winmat[4][4], float perspmat[4][4], float x, float y)
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)
void GPU_debug_group_end()
void GPU_debug_group_begin(const char *name)
#define GPU_ATTACHMENT_TEXTURE(_texture)
#define GPU_ATTACHMENT_TEXTURE_CUBEFACE(_texture, _face)
#define GPU_ATTACHMENT_NONE
void GPU_framebuffer_clear_color_depth(GPUFrameBuffer *fb, const float clear_col[4], float clear_depth)
void GPU_framebuffer_bind(GPUFrameBuffer *framebuffer)
void GPU_framebuffer_clear_color(GPUFrameBuffer *fb, const float clear_col[4])
#define GPU_ATTACHMENT_TEXTURE_LAYER(_texture, _layer)
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)
void acquire(int2 extent, eGPUTextureFormat format, eGPUTextureUsage usage=GPU_TEXTURE_USAGE_GENERAL)
void clear(float4 values)
GPUTexture * layer_view(int layer)
bool is_persp(int view_id=0) const
const float4x4 & winmat(int view_id=0) const
const float4x4 & viewmat(int view_id=0) const
void sync(const float4x4 &view_mat, const float4x4 &win_mat, int view_id=0)
void render_pass(View &view)
const CameraData & data_get() const
int normal_layer_count() const
int closure_layer_count() const
void render(View &main_view, View &render_view, Framebuffer &prepass_fb, Framebuffer &combined_fb, Framebuffer &gbuffer_fb, int2 extent, RayTraceBuffer &rt_buffer_opaque_layer, RayTraceBuffer &rt_buffer_refract_layer)
void render(View &view, Framebuffer &prepass_fb, Framebuffer &combined_fb, Framebuffer &gbuffer_fb, int2 extent)
int closure_layer_count() const
int normal_layer_count() const
void render(View &view, GPUTexture **input_tx, GPUTexture **output_tx, DepthOfFieldBuffer &dof_buffer)
void jitter_apply(float4x4 &winmat, float4x4 &viewmat)
bool postfx_enabled() const
float2 pixel_jitter_get() const
void accumulate(View &view, GPUTexture *combined_final_tx)
int2 render_extent_get() const
void render(View &view, Framebuffer &prepass_fb, Framebuffer &combined_fb, int2 extent)
void debug_draw(View &view, GPUFrameBuffer *view_fb)
void set_source(GPUTexture **texture, int layer=-1)
VolumeProbeModule volume_probes
SphereProbeModule sphere_probes
AmbientOcclusion ambient_occlusion
RenderBuffers render_buffers
DepthOfField depth_of_field
PlanarProbeModule planar_probes
UniformDataModule uniform_data
MotionBlurModule motion_blur
void set_view(View &view, const int2 extent)
void debug_draw(View &view, GPUFrameBuffer *view_fb)
bool postfx_enabled() const
void render(View &view, GPUTexture **input_tx, GPUTexture **output_tx)
DeferredProbePipeline probe
BackgroundPipeline background
DeferredPipeline deferred
void set_view(const draw::View &main_view, int2 main_view_extent)
void viewport_draw(View &view, GPUFrameBuffer *view_fb)
TextureFromPool combined_tx
void acquire(int2 extent)
RenderBuffersInfoData & data
TextureFromPool vector_tx
void debug_draw(View &view, GPUFrameBuffer *view_fb)
void viewport_draw(View &view, GPUFrameBuffer *view_fb)
bool camera_has_motion() const
void draw_compute(View &main_view, int2 extent)
void draw_prepass(View &main_view)
void viewport_draw(View &view, GPUFrameBuffer *view_fb)
void DRW_stats_group_start(const char *name)
void DRW_stats_group_end()
draw_view in_light_buf[] float
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)
MatBase< float, 4, 4 > float4x4
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
void acquire(int2 extent, int data_count, int normal_count)