Blender V5.3
eevee_ray_trace_screen_lib.bsl.hh File Reference

Go to the source code of this file.

Classes

struct  ScreenTraceHitData

Functions

void raytrace_clip_ray_to_near_plane (ViewMatrices view, Ray &ray)
ScreenTraceHitData raytrace_screen (ViewMatrices view, RayTraceData rt_data, HiZData hiz_data, sampler2D hiz_tx, float stride_rand, float roughness, const bool allow_self_intersection, Ray ray)
ScreenTraceHitData raytrace_planar (ViewMatrices view, RayTraceData rt_data, sampler2DArrayDepth planar_depth_tx, PlanarProbeData planar, float stride_rand, Ray ray)
Ray raytrace_thickness_ray_amend (Ray ray, ClosureUndetermined cl, float3 V, Thickness thickness)
bool clip_ray (float3 &start, float3 &end, const float3 direction, const float max_distance, const float4 frustum_planes[6])
float raytrace_screen_2 (ViewMatrices view, const float3 vs_origin, const float3 vs_end, const float3 vs_direction, sampler2D depth_tx, const RayTraceData rt_data, const int max_steps, const float jitter, usampler2D ob_id_tx, const uint object_id, float2 &r_hit_uv)
float3 raytrace_sample_screen (ViewMatrices view, sampler2D radiance_tx, RayTraceData raytrace, ScreenTraceHitData hit, float roughness, float2 ss_hit_P)
float3 raytrace_sample_screen (ViewMatrices view, sampler2DArray radiance_tx, RayTraceData raytrace, ScreenTraceHitData hit, float roughness, float2 ss_hit_P, int layer)

Function Documentation

◆ clip_ray()

bool clip_ray ( float3 & start,
float3 & end,
const float3 direction,
const float max_distance,
const float4 frustum_planes[6] )

◆ raytrace_clip_ray_to_near_plane()

void raytrace_clip_ray_to_near_plane ( ViewMatrices view,
Ray & ray )

Screen-space ray-tracing routine.

Based on "Efficient GPU Screen-Space Ray Tracing" by Morgan McGuire & Michael Mara https://jcgt.org/published/0003/04/04/paper.pdf

Many modifications were made for our own usage.

Definition at line 27 of file eevee_ray_trace_screen_lib.bsl.hh.

References abs, Ray::direction, Ray::max_time, ViewMatrices::near(), Ray::origin, raytrace_clip_ray_to_near_plane(), and packed_float3::z.

Referenced by raytrace_clip_ray_to_near_plane(), raytrace_planar(), and raytrace_screen().

◆ raytrace_planar()

◆ raytrace_sample_screen() [1/2]

float3 raytrace_sample_screen ( ViewMatrices view,
sampler2D radiance_tx,
RayTraceData raytrace,
ScreenTraceHitData hit,
float roughness,
float2 ss_hit_P )

Sample the given full-screen frame-buffer at the given hit location. Does a small contact aware blur on incoming radiance.

Definition at line 383 of file eevee_ray_trace_screen_lib.bsl.hh.

References exp2, log2, raytrace_sample_screen(), saturate, textureLod(), ScreenTraceHitData::time, ScreenTraceHitData::v_hit_P, float4::w, and ViewMatrices::winmat.

Referenced by raytrace_sample_screen(), raytrace_sample_screen(), eevee::raytrace::planar::trace(), and eevee::raytrace::screen::trace().

◆ raytrace_sample_screen() [2/2]

float3 raytrace_sample_screen ( ViewMatrices view,
sampler2DArray radiance_tx,
RayTraceData raytrace,
ScreenTraceHitData hit,
float roughness,
float2 ss_hit_P,
int layer )

Sample the given full-screen frame-buffer at the given hit location. Does a small contact aware blur on incoming radiance.

Definition at line 424 of file eevee_ray_trace_screen_lib.bsl.hh.

References exp2, layer, log2, raytrace_sample_screen(), saturate, textureLod(), ScreenTraceHitData::time, ScreenTraceHitData::v_hit_P, float4::w, and ViewMatrices::winmat.

◆ raytrace_screen()

ScreenTraceHitData raytrace_screen ( ViewMatrices view,
RayTraceData rt_data,
HiZData hiz_data,
sampler2D hiz_tx,
float stride_rand,
float roughness,
const bool allow_self_intersection,
Ray ray )

Ray-trace against the given HIZ-buffer height-field.

Parameters
stride_randRandom number in [0..1] range. Offset along the ray to avoid banding artifact when steps are too large.
roughnessDetermine how lower depth mipmaps are used to make the tracing faster. Lower roughness will use lower mipmaps.
allow_self_intersectionIf false, ray-trace will return false if the ray is not covering at least one pixel.
rayView-space ray. Direction pre-multiplied by maximum length.
Returns
True if there is a valid intersection.

Definition at line 61 of file eevee_ray_trace_screen_lib.bsl.hh.

References ScreenSpaceRay::create(), ViewMatrices::depth_screen_to_view(), ViewMatrices::depth_view_to_screen(), Ray::direction, ScreenSpaceRay::direction, float, floor, ScreenThicknessEstimator::init(), ScreenThicknessEstimator::intersect(), length(), log2, max, ScreenSpaceRay::max_time, min, mix, Ray::origin, ScreenSpaceRay::origin, ViewMatrices::point_screen_to_view(), ViewMatrices::point_screen_to_world(), raytrace_clip_ray_to_near_plane(), raytrace_screen(), saturate, ScreenSpaceRay::screen_position_at(), sqrt_fast(), textureLod(), ScreenTraceHitData::time, ScreenTraceHitData::valid, ViewMatrices::winmat, float3::z, and packed_float3::z.

Referenced by raytrace_screen(), and eevee::raytrace::screen::trace().

◆ raytrace_screen_2()

float raytrace_screen_2 ( ViewMatrices view,
const float3 vs_origin,
const float3 vs_end,
const float3 vs_direction,
sampler2D depth_tx,
const RayTraceData rt_data,
const int max_steps,
const float jitter,
usampler2D ob_id_tx,
const uint object_id,
float2 & r_hit_uv )

◆ raytrace_thickness_ray_amend()