35 void Film::init_aovs()
37 Vector<ViewLayerAOV *> aovs;
71 inst_.
info =
"Error: Too many AOVs";
87 Texture &accum_tx = is_value ? value_accum_tx_ : color_accum_tx_;
95 for (
uint candidate_hash : aovs_hash) {
96 if (candidate_hash ==
hash) {
103 accum_tx.ensure_layer_views();
105 int index = aov_index + (is_value ? data_.aov_value_id : data_.aov_color_id);
106 GPUTexture *pass_tx = accum_tx.layer_view(index);
117 void Film::sync_mist()
127 data_.mist_exponent = 2.0f;
130 data_.mist_exponent = 1.0f;
133 data_.mist_exponent = 0.5f;
137 data_.mist_scale = 1.0 / mist_distance;
138 data_.mist_bias = -mist_start / mist_distance;
149 return (
a.extent ==
b.extent) && (
a.offset ==
b.offset) &&
150 (
a.filter_radius ==
b.filter_radius) && (
a.scaling_factor ==
b.scaling_factor) &&
151 (
a.background_opacity ==
b.background_opacity);
195 #define ENABLE_FROM_LEGACY(name_legacy, name_eevee) \
196 SET_FLAG_FROM_TEST(render_passes, \
197 (inst_.view_layer->passflag & SCE_PASS_##name_legacy) != 0, \
198 EEVEE_RENDER_PASS_##name_eevee);
213 #undef ENABLE_FROM_LEGACY
228 output_rect = &fallback_rect;
231 FilmData
data = data_;
240 data.scaling_factor = 1;
247 FilmData &data_prev_ = data_;
265 data_.has_data = (enabled_passes_ & data_passes) != 0;
266 data_.any_render_pass_1 = (enabled_passes_ & color_passes_1) != 0;
267 data_.any_render_pass_2 = (enabled_passes_ & color_passes_2) != 0;
273 data_.display_is_value =
aovs_info.display_is_value;
285 int index = (enabled_passes_ & pass_type) ?
286 (is_value ? data_.value_len : data_.color_len)++ :
289 data_.display_id = index;
290 data_.display_is_value = is_value;
308 data_.aov_color_id = data_.color_len;
309 data_.aov_value_id = data_.value_len;
311 data_.aov_color_len =
aovs_info.color_len;
312 data_.aov_value_len =
aovs_info.value_len;
314 data_.color_len += data_.aov_color_len;
315 data_.value_len += data_.aov_value_len;
329 reset += depth_tx_.ensure_2d(depth_format, data_.extent);
330 reset += combined_tx_.current().ensure_2d(color_format, data_.extent);
331 reset += combined_tx_.next().ensure_2d(color_format, data_.extent);
333 reset += weight_tx_.current().ensure_2d_array(weight_format, weight_extent, 2);
334 reset += weight_tx_.next().ensure_2d_array(weight_format, weight_extent, 2);
335 reset += color_accum_tx_.ensure_2d_array(color_format,
336 (data_.color_len > 0) ? data_.extent :
int2(1),
337 (data_.color_len > 0) ? data_.color_len : 1);
338 reset += value_accum_tx_.ensure_2d_array(float_format,
339 (data_.value_len > 0) ? data_.extent :
int2(1),
340 (data_.value_len > 0) ? data_.value_len : 1);
344 data_.use_history = 0;
345 data_.use_reprojection = 0;
348 color_accum_tx_.clear(
float4(0.0f));
349 value_accum_tx_.clear(
float4(0.0f));
350 combined_tx_.current().clear(
float4(0.0f));
351 weight_tx_.current().clear(
float4(0.0f));
352 depth_tx_.clear(
float4(0.0f));
375 eVelocityStep step_next = inst_.
is_viewport() ? STEP_PREVIOUS : STEP_NEXT;
429 data_.use_reprojection =
false;
430 data_.use_history =
false;
461 return enabled_passes_;
464 void Film::update_sample_table()
468 int filter_radius_ceil =
ceilf(data_.filter_radius);
469 float filter_radius_sqr =
square_f(data_.filter_radius);
471 data_.samples_len = 0;
474 data_.samples[0].texel =
int2(0, 0);
475 data_.samples[0].weight = 1.0f;
476 data_.samples_weight_total = 1.0f;
477 data_.samples_len = 1;
480 else if (data_.filter_radius < 2.20f) {
482 int closest_index = 0;
483 float closest_distance = FLT_MAX;
484 data_.samples_weight_total = 0.0f;
486 for (
int y = -filter_radius_ceil;
y <= filter_radius_ceil;
y++) {
487 for (
int x = -filter_radius_ceil;
x <= filter_radius_ceil;
x++) {
490 if (distance_sqr < filter_radius_sqr) {
495 FilmSample &
sample = data_.samples[data_.samples_len];
497 sample.weight = film_filter_weight(data_.filter_radius, distance_sqr);
498 data_.samples_weight_total +=
sample.weight;
500 if (distance_sqr < closest_distance) {
501 closest_distance = distance_sqr;
502 closest_index = data_.samples_len;
509 if (closest_index != 0) {
510 SWAP(FilmSample, data_.samples[closest_index], data_.samples[0]);
519 data_.samples_len = sample_table.size();
520 data_.samples_weight_total = 0.0f;
523 for (FilmSample &
sample : sample_table) {
534 sample.weight = film_filter_weight(data_.filter_radius, distance_sqr);
535 data_.samples_weight_total +=
sample.weight;
549 float4 clear_color = {0.0f, 0.0f, 0.0f, 0.0f};
550 GPU_framebuffer_clear_color(dfbl->
default_fb, clear_color);
555 update_sample_table();
558 weight_src_tx_ = weight_tx_.current();
559 weight_dst_tx_ = weight_tx_.next();
560 combined_src_tx_ = combined_tx_.current();
561 combined_dst_tx_ = combined_tx_.next();
563 data_.display_only =
false;
573 if (data_.use_history == 0) {
574 data_.use_history = 1;
590 weight_src_tx_ = weight_tx_.current();
591 weight_dst_tx_ = weight_tx_.next();
592 combined_src_tx_ = combined_tx_.current();
593 combined_dst_tx_ = combined_tx_.next();
595 data_.display_only =
true;
611 combined_tx_.current() :
614 (is_value ? value_accum_tx_ : color_accum_tx_);
616 accum_tx.ensure_layer_views();
619 GPUTexture *pass_tx = accum_tx.layer_view(index);
627 for (
auto px :
IndexRange(accum_tx.width() * accum_tx.height())) {
#define BLI_assert_msg(a, msg)
BLI_INLINE unsigned int BLI_hash_string(const char *str)
#define LISTBASE_FOREACH(type, var, list)
void * BLI_findstring(const struct ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE float pow2f(float x)
MINLINE float clamp_f(float value, float min, float max)
MINLINE float square_f(float a)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
bool BLI_rcti_is_empty(const struct rcti *rect)
#define ENUM_OPERATORS(_type, _max)
#define EEVEE_RENDER_PASS_MAX_BIT
@ EEVEE_RENDER_PASS_UNUSED_8
@ EEVEE_RENDER_PASS_NORMAL
@ EEVEE_RENDER_PASS_DIFFUSE_LIGHT
@ EEVEE_RENDER_PASS_VOLUME_LIGHT
@ EEVEE_RENDER_PASS_BLOOM
@ EEVEE_RENDER_PASS_DIFFUSE_COLOR
@ EEVEE_RENDER_PASS_ENVIRONMENT
@ EEVEE_RENDER_PASS_COMBINED
@ EEVEE_RENDER_PASS_SPECULAR_LIGHT
@ EEVEE_RENDER_PASS_VECTOR
@ EEVEE_RENDER_PASS_SPECULAR_COLOR
@ EEVEE_RENDER_PASS_SHADOW
@ SCE_EEVEE_TAA_REPROJECTION
@ WO_MIST_INVERSE_QUADRATIC
#define DRW_shgroup_uniform_block_ref(shgroup, name, ubo)
void GPU_framebuffer_bind(GPUFrameBuffer *fb)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
struct GPUShader GPUShader
void GPU_memory_barrier(eGPUBarrier barrier)
@ GPU_BARRIER_TEXTURE_FETCH
@ GPU_BARRIER_SHADER_IMAGE_ACCESS
@ GPU_BARRIER_TEXTURE_UPDATE
int GPU_texture_height(const GPUTexture *tex)
struct GPUTexture GPUTexture
int GPU_texture_width(const GPUTexture *tex)
void * GPU_texture_read(GPUTexture *tex, eGPUDataFormat data_format, int miplvl)
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Texture
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value NORMAL
const CameraData & data_get() const
bool is_panoramic() const
float2 pixel_jitter_get() const
void accumulate(const DRWView *view)
static bool pass_is_value(eViewLayerEEVEEPassType pass_type)
int pass_id_get(eViewLayerEEVEEPassType pass_type) const
static bool pass_is_float3(eViewLayerEEVEEPassType pass_type)
float * read_pass(eViewLayerEEVEEPassType pass_type)
AOVsInfoDataBuf aovs_info
void init(const int2 &full_extent, const rcti *output_rect)
float * read_aov(ViewLayerAOV *aov)
eViewLayerEEVEEPassType enabled_passes_get() const
static constexpr bool use_box_filter
bool overlays_enabled() const
RenderBuffers render_buffers
bool gpencil_engine_enabled
TextureFromPool combined_tx
TextureFromPool shadow_tx
TextureFromPool specular_color_tx
TextureFromPool environment_tx
TextureFromPool ambient_occlusion_tx
TextureFromPool emission_tx
void acquire(int2 extent, void *owner)
TextureFromPool volume_light_tx
TextureFromPool specular_light_tx
TextureFromPool normal_tx
TextureFromPool vector_tx
TextureFromPool diffuse_light_tx
TextureFromPool diffuse_color_tx
bool interactive_mode() const
static float2 sample_disk(const float2 &rand)
float2 rng_2d_get(eSamplingDimension starting_dimension) const
uint64_t sample_count() const
static float2 sample_spiral(const float2 &rand)
GPUShader * static_shader_get(eShaderType shader_type)
std::array< CameraDataBuf *, 3 > camera_steps
DefaultFramebufferList * DRW_viewport_framebuffer_list_get(void)
DefaultTextureList * DRW_viewport_texture_list_get(void)
void DRW_shgroup_uniform_texture_ref_ex(DRWShadingGroup *shgroup, const char *name, GPUTexture **tex, eGPUSamplerState sampler_state)
void DRW_shgroup_call_compute(DRWShadingGroup *shgroup, int groups_x_len, int groups_y_len, int groups_z_len)
void DRW_shgroup_call_procedural_triangles(DRWShadingGroup *shgroup, Object *ob, uint tri_count)
void DRW_shgroup_barrier(DRWShadingGroup *shgroup, eGPUBarrier type)
DRWShadingGroup * DRW_shgroup_create(struct GPUShader *shader, DRWPass *pass)
void DRW_shgroup_uniform_texture_ref(DRWShadingGroup *shgroup, const char *name, GPUTexture **tex)
DRWPass * DRW_pass_create(const char *name, DRWState state)
void DRW_shgroup_uniform_image_ref(DRWShadingGroup *shgroup, const char *name, GPUTexture **tex)
void DRW_draw_pass(DRWPass *pass)
void DRW_view_set_active(const DRWView *view)
#define ENABLE_FROM_LEGACY(name_legacy, name_eevee)
depth_tx normal_tx diffuse_light_tx specular_light_tx volume_light_tx environment_tx ambient_occlusion_tx aov_value_tx in_weight_img GPU_RGBA16F
depth_tx normal_tx diffuse_light_tx specular_light_tx volume_light_tx environment_tx ambient_occlusion_tx aov_value_tx GPU_R32F
#define FILM_PRECOMP_SAMPLE_MAX
smooth(Type::VEC3, "prev") .smooth(Type CameraData
void GPU_framebuffer_viewport_set(GPUFrameBuffer *gpu_fb, int x, int y, int width, int height)
DO_INLINE void filter(lfVector *V, fmatrix3x3 *S)
ccl_gpu_kernel_postfix ccl_global float int int int int float bool reset
clear internal cached data and reset random seed
ccl_gpu_kernel_postfix ccl_global float int int int int sh
bool operator!=(const CameraData &a, const CameraData &b)
bool operator==(const CameraData &a, const CameraData &b)
vec_base< T, Size > divide_ceil(const vec_base< T, Size > &a, const vec_base< T, Size > &b)
T length_squared(const vec_base< T, Size > &a)
vec_base< float, 4 > float4
bool assign_if_different(T &old_value, T new_value)
vec_base< float, 2 > float2
vec_base< int32_t, 2 > int2
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
struct GPUFrameBuffer * default_fb
struct GPUTexture * color
ColorManagedViewSettings view_settings
float studiolight_background
struct ViewLayerEEVEE eevee