Blender V5.0
blender::eevee::Sampling Class Reference

#include <eevee_sampling.hh>

Public Member Functions

 Sampling (Instance &inst, ClampData &clamp_data)
 ~Sampling ()
template<typename PassType>
void bind_resources (PassType &pass)
float rng_get (eSamplingDimension dimension) const
float2 rng_2d_get (eSamplingDimension starting_dimension) const
float3 rng_3d_get (eSamplingDimension starting_dimension) const
bool finished () const
bool finished_viewport () const
bool interactive_mode () const
uint64_t sample_count () const
uint64_t sample_index () const
bool use_clamp_direct () const
bool use_clamp_indirect () const
bool do_render_sync () const
uint64_t dof_ring_count_get () const
uint64_t dof_sample_count_get () const
Sampling
void init (const Scene *scene)
void init (const Object &probe_object)
void end_sync ()
void step ()
void reset ()
bool is_reset () const

Static Public Member Functions

Cumulative Distribution Function (CDF)
static void cdf_from_curvemapping (const CurveMapping &curve, Vector< float > &cdf)
static void cdf_invert (Vector< float > &cdf, Vector< float > &inverted_cdf)

Sampling patterns

void dof_disk_sample_get (float *r_radius, float *r_theta) const
static float3 sample_ball (const float3 &rand)
static float2 sample_disk (const float2 &rand)
static float3 sample_hemisphere (const float2 &rand)
static float3 sample_sphere (const float2 &rand)
static float2 sample_spiral (const float2 &rand)

Detailed Description

Definition at line 25 of file eevee_sampling.hh.

Constructor & Destructor Documentation

◆ Sampling()

blender::eevee::Sampling::Sampling ( Instance & inst,
ClampData & clamp_data )
inline

Definition at line 72 of file eevee_sampling.hh.

◆ ~Sampling()

blender::eevee::Sampling::~Sampling ( )
inline

Definition at line 73 of file eevee_sampling.hh.

Member Function Documentation

◆ bind_resources()

template<typename PassType>
void blender::eevee::Sampling::bind_resources ( PassType & pass)
inline

Definition at line 87 of file eevee_sampling.hh.

References SAMPLING_BUF_SLOT.

◆ cdf_from_curvemapping()

void blender::eevee::Sampling::cdf_from_curvemapping ( const CurveMapping & curve,
Vector< float > & cdf )
static

Creates a discrete cumulative distribution function table from a given curvemapping. Output cdf vector is expected to already be sized according to the wanted resolution.

Definition at line 351 of file eevee_sampling.cc.

References BKE_curvemapping_evaluateF(), BLI_assert, float, blender::Vector< T, InlineBufferCapacity, Allocator >::index_range(), blender::Vector< T, InlineBufferCapacity, Allocator >::last(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), and x.

Referenced by blender::eevee::MotionBlurModule::init().

◆ cdf_invert()

void blender::eevee::Sampling::cdf_invert ( Vector< float > & cdf,
Vector< float > & inverted_cdf )
static

◆ do_render_sync()

bool blender::eevee::Sampling::do_render_sync ( ) const
inline

Definition at line 158 of file eevee_sampling.hh.

◆ dof_disk_sample_get()

void blender::eevee::Sampling::dof_disk_sample_get ( float * r_radius,
float * r_theta ) const

Special RNG for depth of field. Returns radius and theta angle offset to apply to the web sampling pattern.

Definition at line 310 of file eevee_sampling.cc.

References float, and M_PI.

◆ dof_ring_count_get()

uint64_t blender::eevee::Sampling::dof_ring_count_get ( ) const
inline

Returns sample count inside the jittered depth of field web pattern.

Definition at line 210 of file eevee_sampling.hh.

◆ dof_sample_count_get()

uint64_t blender::eevee::Sampling::dof_sample_count_get ( ) const
inline

Returns sample count inside the jittered depth of field web pattern.

Definition at line 218 of file eevee_sampling.hh.

◆ end_sync()

void blender::eevee::Sampling::end_sync ( )

Definition at line 99 of file eevee_sampling.cc.

References SCE_EEVEE_TAA_REPROJECTION.

◆ finished()

bool blender::eevee::Sampling::finished ( ) const
inline

Definition at line 117 of file eevee_sampling.hh.

◆ finished_viewport()

bool blender::eevee::Sampling::finished_viewport ( ) const
inline

Definition at line 123 of file eevee_sampling.hh.

◆ init() [1/2]

void blender::eevee::Sampling::init ( const Object & probe_object)

Definition at line 90 of file eevee_sampling.cc.

References BLI_assert, DRW_object_get_data_for_drawing(), and max_ii().

◆ init() [2/2]

◆ interactive_mode()

bool blender::eevee::Sampling::interactive_mode ( ) const
inline

Definition at line 129 of file eevee_sampling.hh.

Referenced by step().

◆ is_reset()

bool blender::eevee::Sampling::is_reset ( ) const

Definition at line 251 of file eevee_sampling.cc.

References BLI_assert.

◆ reset()

void blender::eevee::Sampling::reset ( )

Definition at line 245 of file eevee_sampling.cc.

References BLI_assert.

◆ rng_2d_get()

float2 blender::eevee::Sampling::rng_2d_get ( eSamplingDimension starting_dimension) const
inline

Definition at line 103 of file eevee_sampling.hh.

◆ rng_3d_get()

float3 blender::eevee::Sampling::rng_3d_get ( eSamplingDimension starting_dimension) const
inline

Definition at line 111 of file eevee_sampling.hh.

◆ rng_get()

float blender::eevee::Sampling::rng_get ( eSamplingDimension dimension) const
inline

Definition at line 95 of file eevee_sampling.hh.

◆ sample_ball()

float3 blender::eevee::Sampling::sample_ball ( const float3 & rand)
static

Special ball distribution: Point are distributed in a way that when they are orthogonally projected into any plane, the resulting distribution is (close to) a uniform disc distribution. rand is 3 random float in the [0..1] range. Returns point in a ball of radius 1 and centered on the origin.

Definition at line 263 of file eevee_sampling.cc.

References cosf, fmaxf, M_PI, sample, sinf, sqrtf, and square_f().

◆ sample_count()

uint64_t blender::eevee::Sampling::sample_count ( ) const
inline

Definition at line 135 of file eevee_sampling.hh.

Referenced by blender::eevee::Film::init().

◆ sample_disk()

float2 blender::eevee::Sampling::sample_disk ( const float2 & rand)
static

Uniform disc distribution. rand is 2 random float in the [0..1] range. Returns point in a disk of radius 1 and centered on the origin.

Definition at line 278 of file eevee_sampling.cc.

References cosf, M_PI, sinf, and sqrtf.

Referenced by blender::eevee::Film::pixel_jitter_get().

◆ sample_hemisphere()

float3 blender::eevee::Sampling::sample_hemisphere ( const float2 & rand)
static

Uniform hemisphere distribution. rand is 2 random float in the [0..1] range. Returns point on a Z positive hemisphere of radius 1 and centered on the origin.

Definition at line 284 of file eevee_sampling.cc.

References cos_theta(), cosf, M_PI, safe_sqrtf(), sin_theta(), sinf, and square_f().

◆ sample_index()

uint64_t blender::eevee::Sampling::sample_index ( ) const
inline

Definition at line 141 of file eevee_sampling.hh.

◆ sample_sphere()

float3 blender::eevee::Sampling::sample_sphere ( const float2 & rand)
static

Uniform sphere distribution. rand is 2 random float in the [0..1] range. Returns point on the sphere of radius 1 and centered on the origin.

Definition at line 292 of file eevee_sampling.cc.

References cos_theta(), cosf, M_PI, safe_sqrtf(), sin_theta(), sinf, and square_f().

Referenced by blender::eevee::IrradianceBake::raylists_build().

◆ sample_spiral()

float2 blender::eevee::Sampling::sample_spiral ( const float2 & rand)
static

Uniform disc distribution using Fibonacci spiral sampling. rand is 2 random float in the [0..1] range. Returns point in a disk of radius 1 and centered on the origin.

Definition at line 300 of file eevee_sampling.cc.

References cosf, M_PI, sinf, and sqrtf.

◆ step()

◆ use_clamp_direct()

bool blender::eevee::Sampling::use_clamp_direct ( ) const
inline

◆ use_clamp_indirect()

bool blender::eevee::Sampling::use_clamp_indirect ( ) const
inline

The documentation for this class was generated from the following files: