Blender V5.3
eevee::film Namespace Reference

Classes

struct  FilmConstants
struct  Film
struct  FilmFragOut
struct  FilmDisplay
struct  ConvertCombined
struct  ConvertDepth
struct  ConvertValue
struct  ConvertColor
struct  ConvertCryptomatte

Functions

float depth_convert_to_scene (const ViewMatrices view, float depth, float2 uv, bool is_panoramic_camera)
ePanoramicFace panoramic_face_index (float3 direction)
float display_depth_amend (float depth)
float4 texelfetch_as_YCoCg_opacity (sampler2D tx, int2 texel)
float luma_weight (const Uniform &uni, float luma)
float4 patch_float_for_16f_storage (float4 color, float dither)
float patch_float_for_16f_storage (float value, float dither)
float4 safe_divide_even_color (float4 a, float4 b)
void fullscreen_vert (const int vert_id, float4 &out_position)
void accumulate_or_display_frag (const FilmDisplay &srt, Film &film, const Uniform &uni, const draw::View &views, FilmFragOut &frag_out, const float4 frag_co, float out_depth)
void display_frag (Film &film, FilmFragOut &frag_out, const Uniform &uni, const draw::View &views, const float4 frag_co, float out_depth)
void accumulate_comp (Film &film, const Uniform &uni, const uint3 global_id)
template<typename ResourceT, bool layered>
void pass_convert (ResourceT &srt, const uint3 global_id)
template void pass_convert< ConvertCombined, false > (ConvertCombined &, const uint3)
template void pass_convert< ConvertDepth, false > (ConvertDepth &, const uint3)
template void pass_convert< ConvertValue, true > (ConvertValue &, const uint3)
template void pass_convert< ConvertColor, true > (ConvertColor &, const uint3)
template void pass_convert< ConvertCryptomatte, true > (ConvertCryptomatte &, const uint3)

Detailed Description

Film accumulation utils functions.

Function Documentation

◆ accumulate_comp()

void eevee::film::accumulate_comp ( Film & film,
const Uniform & uni,
const uint3 global_id )

◆ accumulate_or_display_frag()

void eevee::film::accumulate_or_display_frag ( const FilmDisplay & srt,
Film & film,
const Uniform & uni,
const draw::View & views,
FilmFragOut & frag_out,
const float4 frag_co,
float out_depth )

◆ depth_convert_to_scene()

float eevee::film::depth_convert_to_scene ( const ViewMatrices view,
float depth,
float2 uv,
bool is_panoramic_camera )

◆ display_depth_amend()

float eevee::film::display_depth_amend ( float depth)

Definition at line 52 of file eevee_film.bsl.hh.

References display_depth_amend(), gpu_fwidth(), and saturate.

Referenced by accumulate_or_display_frag(), and display_depth_amend().

◆ display_frag()

void eevee::film::display_frag ( Film & film,
FilmFragOut & frag_out,
const Uniform & uni,
const draw::View & views,
const float4 frag_co,
float out_depth )

display_frag is used to work around iGPU issues.

Caches are not flushed in the eevee_film_frag shader due to unsupported read/write access. We schedule the eevee_film_comp shader instead. Resources are attached read only and does the part that is missing from the eevee_film_frag shader.

Definition at line 1388 of file eevee_film.bsl.hh.

References any(), display_frag(), eevee::cryptomatte::false_color(), frag_coord, frag_depth, gpu_fwidth(), imageLoadFast, out, resource_table, saturate, and texelFetch().

Referenced by display_frag().

◆ fullscreen_vert()

void eevee::film::fullscreen_vert ( const int vert_id,
float4 & out_position )

Definition at line 1310 of file eevee_film.bsl.hh.

References fullscreen_vert(), fullscreen_vertex(), position, vertex, and vertex_id.

Referenced by fullscreen_vert().

◆ luma_weight()

float eevee::film::luma_weight ( const Uniform & uni,
float luma )

◆ panoramic_face_index()

ePanoramicFace eevee::film::panoramic_face_index ( float3 direction)

◆ pass_convert()

◆ pass_convert< ConvertColor, true >()

template void eevee::film::pass_convert< ConvertColor, true > ( ConvertColor & ,
const uint3  )

References pass_convert().

◆ pass_convert< ConvertCombined, false >()

template void eevee::film::pass_convert< ConvertCombined, false > ( ConvertCombined & ,
const uint3  )

References pass_convert().

◆ pass_convert< ConvertCryptomatte, true >()

template void eevee::film::pass_convert< ConvertCryptomatte, true > ( ConvertCryptomatte & ,
const uint3  )

References pass_convert().

◆ pass_convert< ConvertDepth, false >()

template void eevee::film::pass_convert< ConvertDepth, false > ( ConvertDepth & ,
const uint3  )

References pass_convert().

◆ pass_convert< ConvertValue, true >()

template void eevee::film::pass_convert< ConvertValue, true > ( ConvertValue & ,
const uint3  )

References pass_convert().

◆ patch_float_for_16f_storage() [1/2]

float eevee::film::patch_float_for_16f_storage ( float value,
float dither )

Definition at line 97 of file eevee_film.bsl.hh.

References floatBitsToUint, patch_float_for_16f_storage(), and uintBitsToFloat.

◆ patch_float_for_16f_storage() [2/2]

float4 eevee::film::patch_float_for_16f_storage ( float4 color,
float dither )

Round floats mantissa before they get written to a 16 bit float storage to avoid drifting.

Apparently, most (if not all) hardware truncate the mantissa when writing the attribute to a 16 bit float texture. This biases our accumulation drastically (see #126947). Manually rounding the mantissa right before storage (and thus truncation) fixes the issue.

A fixed offset stays biased under repeated accumulation. Drawing a random offset below 1 ULP seems to fix the drift (see #129533).

Definition at line 93 of file eevee_film.bsl.hh.

References floatBitsToUint, patch_float_for_16f_storage(), and uintBitsToFloat.

Referenced by patch_float_for_16f_storage(), patch_float_for_16f_storage(), eevee::film::Film::store_color_ex(), eevee::film::Film::store_combined(), and eevee::film::Film::store_value().

◆ safe_divide_even_color()

float4 eevee::film::safe_divide_even_color ( float4 a,
float4 b )

◆ texelfetch_as_YCoCg_opacity()