Blender V5.3
eevee_nodetree_lib.bsl.hh File Reference

Go to the source code of this file.

Classes

struct  eevee::Raycast
struct  LightAccumulation
struct  ShadingData
struct  KernelGlobals
struct  Coordinates

Namespaces

namespace  eevee

Functions

void closure_weights_reset (KernelGlobals &kg, ShadingData &sd, float closure_rand)
template<typename T>
void closure_base_copy (ClosureUndetermined &cl, T in_cl)
template void closure_base_copy< ClosureDiffuse > (ClosureUndetermined &, ClosureDiffuse)
template void closure_base_copy< ClosureSubsurface > (ClosureUndetermined &, ClosureSubsurface)
template void closure_base_copy< ClosureTranslucent > (ClosureUndetermined &, ClosureTranslucent)
template void closure_base_copy< ClosureReflection > (ClosureUndetermined &, ClosureReflection)
template void closure_base_copy< ClosureRefraction > (ClosureUndetermined &, ClosureRefraction)
template void closure_base_copy< ClosureThinRefraction > (ClosureUndetermined &, ClosureThinRefraction)
Closure closure_eval (KernelGlobals &kg, ShadingData &sd, ClosureDiffuse diffuse)
Closure closure_eval (KernelGlobals &kg, ShadingData &sd, ClosureSubsurface subsurface)
Closure closure_eval (KernelGlobals &kg, ShadingData &sd, ClosureTranslucent translucent)
Closure closure_eval (KernelGlobals &kg, ShadingData &sd, ClosureReflection reflection)
Closure closure_eval (KernelGlobals &kg, ShadingData &sd, ClosureRefraction refraction)
Closure closure_eval (KernelGlobals &kg, ShadingData &sd, ClosureThinRefraction refraction)
Closure closure_eval (KernelGlobals &, ShadingData &sd, ClosureEmission emission)
Closure closure_eval (KernelGlobals &, ShadingData &sd, ClosureTransparency transparency)
Closure closure_eval (KernelGlobals &, ShadingData &sd, ClosureVolumeScatter volume_scatter)
Closure closure_eval (KernelGlobals &, ShadingData &sd, ClosureVolumeAbsorption volume_absorption)
Closure closure_eval (KernelGlobals &, ShadingData &, ClosureHair)
Closure closure_eval (KernelGlobals &kg, ShadingData &sd, ClosureReflection reflection, ClosureRefraction refraction)
Closure closure_eval (KernelGlobals &kg, ShadingData &sd, ClosureDiffuse diffuse, ClosureReflection reflection)
Closure closure_eval (KernelGlobals &kg, ShadingData &sd, ClosureReflection reflection, ClosureReflection coat)
Closure closure_eval (KernelGlobals &kg, ShadingData &sd, ClosureVolumeScatter volume_scatter, ClosureVolumeAbsorption volume_absorption, ClosureEmission emission)
Closure closure_eval (KernelGlobals &kg, ShadingData &sd, ClosureDiffuse diffuse, ClosureReflection reflection, ClosureReflection coat)
Closure closure_eval (KernelGlobals &kg, ShadingData &sd, ClosureDiffuse diffuse, ClosureReflection reflection, ClosureReflection coat, ClosureRefraction refraction)
Closure closure_add (Closure, Closure)
Closure closure_mix (Closure, Closure, float)
float ambient_occlusion_eval (const KernelGlobals &kg, const ShadingData &sd, float3 normal, float max_distance, const float inverted, const float sample_count)
void raycast_eval (KernelGlobals &kg, const ShadingData &sd, float3 position, float3 direction, float max_distance, bool self_only, bool &is_hit, bool &self_hit, float &hit_distance, float3 &hit_position, float3 &hit_normal)
float3 nodetree_displacement (KernelGlobals &kg, ShadingData &sd)
float4 closure_to_rgba (KernelGlobals &kg, ShadingData &sd, Closure cl)
float f0_from_ior (float eta)
float F0_from_ior (float eta)
float F0_from_f0 (float f0)
template<typename T>
float3 F_brdf_single_scatter (float3 f0, float3 f90, T lut)
template float3 F_brdf_single_scatter< eevee::lut::GGXBrdfData > (float3, float3, eevee::lut::GGXBrdfData)
template float3 F_brdf_single_scatter< eevee::lut::GGXBsdfData > (float3, float3, eevee::lut::GGXBsdfData)
template<typename T>
float3 F_brdf_multi_scatter (float3 f0, float3 f90, T lut)
template float3 F_brdf_multi_scatter< eevee::lut::GGXBrdfData > (float3, float3, eevee::lut::GGXBrdfData)
template float3 F_brdf_multi_scatter< eevee::lut::GGXBsdfData > (float3, float3, eevee::lut::GGXBsdfData)
void brdf_f82_tint_lut (KernelGlobals &kg, float3 F0, float3 F82, float cos_theta, float roughness, bool do_multiscatter, float3 &reflectance)
void bsdf_lut (KernelGlobals &kg, float3 F0, float3 F90, float3 transmission_tint, float cos_theta, float roughness, float ior, bool do_multiscatter, float3 &reflectance, float3 &transmittance)
float2 bsdf_lut (KernelGlobals &kg, float cos_theta, float roughness, float ior, bool do_multiscatter)
float3 brdf_lut (KernelGlobals &kg, float3 F0, float3 F90, float cos_theta, float roughness, bool do_multiscatter)
void output_aov (KernelGlobals &kg, int2 texel, float4 color, float value, uint hash, float holdout, eObjectInfoFlag ob_flag)
Mixed render resolution

Callbacks image texture sampling.

float texture_lod_bias_get (KernelGlobals &kg)
float derivative_scale_get (KernelGlobals &kg)
Fragment Displacement

Displacement happening in the fragment shader. Can be used in conjunction with a per vertex displacement.

float3 displacement_bump (KernelGlobals &kg, ShadingData &sd)
void fragment_displacement (KernelGlobals &kg, ShadingData &sd)
Coordinate implementations

Callbacks for the texture coordinate node.

Coordinates coordinate_impl (KernelGlobals &kg, const ShadingData &sd, float3 P, float3 N)
Volume Attribute post

TODO(@fclem): These implementation details should concern the DRWContext and not be a fix on the engine side. But as of now, the engines are responsible for loading the attributes.

float attr_load_temperature_post (KernelGlobals &kg, float attr)
float4 attr_load_color_post (KernelGlobals &kg, float4 attr)

Uniform Attributes

TODO(@fclem): These implementation details should concern the DRWContext and not be a fix on the engine side. But as of now, the engines are responsible for loading the attributes.

#define LIGHT_ITER_BEGIN(light_index)
#define LIGHT_ITER_END()
float4 attr_load_uniform (KernelGlobals &kg, const ShadingData &sd, float4, const uint attr_hash)
float4 node_attribute_layer_impl (KernelGlobals &kg, const uint attr_hash)
void scene_time_uniforms (KernelGlobals &kg, float &seconds, float &frame)
void light_iter_init (KernelGlobals &kg, const ShadingData &sd, eevee::light::VisibleLightIterator &iter)
bool light_iter_next (KernelGlobals &kg, eevee::light::VisibleLightIterator &iter)
bool light_iter_should_skip (KernelGlobals &kg, eevee::light::VisibleLightIterator &iter, float3 P)
void node_light_info_impl (KernelGlobals &kg, const int light_index, float4 &color, float &power, float3 &position)
void node_light_evaluation_common_impl (KernelGlobals &kg, int light_index, float3 position, float3 &direction, float &distance, float &mask)
template<bool use_diffuse>
void node_light_evaluation_impl (KernelGlobals &kg, const ShadingData &sd, int light_index, float3 position, float3 normal, float roughness, float &factor)
template void node_light_evaluation_impl< true > (KernelGlobals &, const ShadingData &, int, float3, float3, float, float &)
template void node_light_evaluation_impl< false > (KernelGlobals &, const ShadingData &, int, float3, float3, float, float &)
void node_shadow_raycast_impl (KernelGlobals &kg, const ShadingData &sd, const int light_index, float3 position, float softness, float4 &color)
float4 node_attribute_light_impl (KernelGlobals &kg, const int light_index, uint attr_hash)
bool node_attribute_light_is_sun_impl (KernelGlobals &kg, const int light_index)
bool node_attribute_light_is_point_impl (KernelGlobals &kg, const int light_index)
bool node_attribute_light_is_spot_impl (KernelGlobals &kg, const int light_index)
bool node_attribute_light_is_area_impl (KernelGlobals &kg, const int light_index)
float node_attribute_light_cutoff_distance_impl (KernelGlobals &kg, const int light_index)
void node_light_accumulation_impl (KernelGlobals &kg, ShadingData &sd, const int light_index, float3 diffuse_light, float3 diffuse_color, float3 glossy_light, float3 glossy_color, float3 transmission_light, float3 transmission_color, float weight, Closure &result)

Macro Definition Documentation

◆ LIGHT_ITER_BEGIN

#define LIGHT_ITER_BEGIN ( light_index)
Value:
{ \
eevee_light_VisibleLightIterator iter; \
light_iter_init(kg, sd, iter); \
while (light_iter_next(kg, iter)) { \
if (light_iter_should_skip(kg, iter, sd.P)) { \
continue; \
} \
light_index = iter.index;
bool light_iter_next(KernelGlobals &kg, eevee::light::VisibleLightIterator &iter)
bool light_iter_should_skip(KernelGlobals &kg, eevee::light::VisibleLightIterator &iter, float3 P)

Definition at line 1093 of file eevee_nodetree_lib.bsl.hh.

Referenced by LIGHT_ITER_BEGIN().

◆ LIGHT_ITER_END

#define LIGHT_ITER_END ( )
Value:
} \
}

Definition at line 1116 of file eevee_nodetree_lib.bsl.hh.

Referenced by LIGHT_ITER_END().

Function Documentation

◆ ambient_occlusion_eval()

◆ attr_load_color_post()

◆ attr_load_temperature_post()

◆ attr_load_uniform()

◆ brdf_f82_tint_lut()

◆ brdf_lut()

◆ bsdf_lut() [1/2]

float2 bsdf_lut ( KernelGlobals & kg,
float cos_theta,
float roughness,
float ior,
bool do_multiscatter )

Definition at line 806 of file eevee_nodetree_lib.bsl.hh.

References bsdf_lut(), cos_theta(), and F0_from_ior().

◆ bsdf_lut() [2/2]

◆ closure_add()

Closure closure_add ( Closure ,
Closure  )

Definition at line 503 of file eevee_nodetree_lib.bsl.hh.

References Closure, and closure_add().

Referenced by closure_add(), node_add_shader(), and node_eevee_specular().

◆ closure_base_copy()

◆ closure_base_copy< ClosureDiffuse >()

template void closure_base_copy< ClosureDiffuse > ( ClosureUndetermined & ,
ClosureDiffuse  )

References closure_base_copy().

◆ closure_base_copy< ClosureReflection >()

template void closure_base_copy< ClosureReflection > ( ClosureUndetermined & ,
ClosureReflection  )

References closure_base_copy().

◆ closure_base_copy< ClosureRefraction >()

template void closure_base_copy< ClosureRefraction > ( ClosureUndetermined & ,
ClosureRefraction  )

References closure_base_copy().

◆ closure_base_copy< ClosureSubsurface >()

template void closure_base_copy< ClosureSubsurface > ( ClosureUndetermined & ,
ClosureSubsurface  )

References closure_base_copy().

◆ closure_base_copy< ClosureThinRefraction >()

template void closure_base_copy< ClosureThinRefraction > ( ClosureUndetermined & ,
ClosureThinRefraction  )

References closure_base_copy().

◆ closure_base_copy< ClosureTranslucent >()

template void closure_base_copy< ClosureTranslucent > ( ClosureUndetermined & ,
ClosureTranslucent  )

References closure_base_copy().

◆ closure_eval() [1/17]

Closure closure_eval ( KernelGlobals & ,
ShadingData & ,
ClosureHair  )

Definition at line 422 of file eevee_nodetree_lib.bsl.hh.

References Closure, and closure_eval().

◆ closure_eval() [2/17]

Closure closure_eval ( KernelGlobals & ,
ShadingData & sd,
ClosureEmission emission )

Definition at line 394 of file eevee_nodetree_lib.bsl.hh.

References Closure, closure_eval(), and ShadingData::emission.

◆ closure_eval() [3/17]

Closure closure_eval ( KernelGlobals & ,
ShadingData & sd,
ClosureTransparency transparency )

◆ closure_eval() [4/17]

Closure closure_eval ( KernelGlobals & ,
ShadingData & sd,
ClosureVolumeAbsorption volume_absorption )

◆ closure_eval() [5/17]

Closure closure_eval ( KernelGlobals & ,
ShadingData & sd,
ClosureVolumeScatter volume_scatter )

◆ closure_eval() [6/17]

Closure closure_eval ( KernelGlobals & kg,
ShadingData & sd,
ClosureDiffuse diffuse )

Definition at line 270 of file eevee_nodetree_lib.bsl.hh.

References Closure, closure_base_copy(), eevee::PipelineConstants::closure_bin_count, ShadingData::closure_bins, closure_eval(), closure_select(), KernelGlobals::pipe, static_branch, eevee::PipelineConstants::use_clearcoat, eevee::PipelineConstants::use_diffuse, and eevee::PipelineConstants::use_translucent.

Referenced by closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), closure_eval(), node_background(), node_bsdf_diffuse(), node_bsdf_glass(), node_bsdf_glossy(), node_bsdf_hair(), node_bsdf_hair_principled(), node_bsdf_metallic(), node_bsdf_ray_portal(), node_bsdf_refraction(), node_bsdf_sheen(), node_bsdf_toon(), node_bsdf_translucent(), node_bsdf_transparent(), node_eevee_specular(), node_emission(), node_holdout(), node_subsurface_scattering(), node_volume_absorption(), node_volume_coefficients(), node_volume_principled(), node_volume_scatter(), openpbr_eval_coat(), openpbr_eval_diffuse(), openpbr_eval_emission(), openpbr_eval_subsurface(), openpbr_eval_translucent(), openpbr_eval_transparency(), and principled_eval_gloss().

◆ closure_eval() [7/17]

Closure closure_eval ( KernelGlobals & kg,
ShadingData & sd,
ClosureDiffuse diffuse,
ClosureReflection reflection )

Definition at line 440 of file eevee_nodetree_lib.bsl.hh.

References Closure, and closure_eval().

◆ closure_eval() [8/17]

Closure closure_eval ( KernelGlobals & kg,
ShadingData & sd,
ClosureDiffuse diffuse,
ClosureReflection reflection,
ClosureReflection coat )

Definition at line 475 of file eevee_nodetree_lib.bsl.hh.

References Closure, and closure_eval().

◆ closure_eval() [9/17]

Closure closure_eval ( KernelGlobals & kg,
ShadingData & sd,
ClosureDiffuse diffuse,
ClosureReflection reflection,
ClosureReflection coat,
ClosureRefraction refraction )

Definition at line 488 of file eevee_nodetree_lib.bsl.hh.

References Closure, and closure_eval().

◆ closure_eval() [10/17]

◆ closure_eval() [11/17]

Closure closure_eval ( KernelGlobals & kg,
ShadingData & sd,
ClosureReflection reflection,
ClosureReflection coat )

Definition at line 451 of file eevee_nodetree_lib.bsl.hh.

References Closure, and closure_eval().

◆ closure_eval() [12/17]

Closure closure_eval ( KernelGlobals & kg,
ShadingData & sd,
ClosureReflection reflection,
ClosureRefraction refraction )

Definition at line 429 of file eevee_nodetree_lib.bsl.hh.

References Closure, and closure_eval().

◆ closure_eval() [13/17]

◆ closure_eval() [14/17]

◆ closure_eval() [15/17]

◆ closure_eval() [16/17]

◆ closure_eval() [17/17]

Closure closure_eval ( KernelGlobals & kg,
ShadingData & sd,
ClosureVolumeScatter volume_scatter,
ClosureVolumeAbsorption volume_absorption,
ClosureEmission emission )

Definition at line 462 of file eevee_nodetree_lib.bsl.hh.

References Closure, and closure_eval().

◆ closure_mix()

Closure closure_mix ( Closure ,
Closure ,
float  )

Definition at line 507 of file eevee_nodetree_lib.bsl.hh.

References Closure, and closure_mix().

Referenced by closure_mix(), and node_mix_shader().

◆ closure_to_rgba()

float4 closure_to_rgba ( KernelGlobals & kg,
ShadingData & sd,
Closure cl )

Deferred lighting evaluation: Lighting is evaluated in a separate pass.

Outputs shading parameter per pixel using a randomized set of BSDFs. Some render-pass are written during this pass.

Definition at line 20 of file eevee_surf_deferred.bsl.hh.

References average(), Closure, closure_to_rgba(), closure_weights_reset(), ShadingData::emission, UtilityTexture::fetch(), fract(), ShadingData::frag_co, eevee::PipelineConstants::is_occupancy_pipe, noise(), KernelGlobals::pipe, resource_table, eevee::Sampling::rng_1D_get(), KernelGlobals::sampling, saturate, static_branch, ShadingData::transmittance, UTIL_BLUE_NOISE_LAYER, and KernelGlobals::util_tx.

Referenced by closure_to_rgba(), closure_to_rgba(), and node_shader_to_rgba().

◆ closure_weights_reset()

◆ coordinate_impl()

◆ derivative_scale_get()

float derivative_scale_get ( KernelGlobals & kg)

Scale hardware derivatives depending on render resolution. This is because the distance between pixels increases as we lower the resolution. The hardware uses neighboring pixels to compute derivatives and thus the value increases as we lower the resolution. So we compensate by scaling them back to the expected amplitude at full resolution.

Definition at line 861 of file eevee_nodetree_lib.bsl.hh.

References derivative_scale_get(), float, eevee::Uniform::uniform_buf, and KernelGlobals::uniforms.

Referenced by derivative_scale_get(), derivative_scale_get(), displacement_bump(), node_bump(), and node_wireframe_screenspace().

◆ displacement_bump()

◆ F0_from_f0()

float F0_from_f0 ( float f0)

Definition at line 664 of file eevee_nodetree_lib.bsl.hh.

References F0_from_f0(), and square().

Referenced by bsdf_lut(), and F0_from_f0().

◆ F0_from_ior()

◆ f0_from_ior()

float f0_from_ior ( float eta)

Used for packing. This is the reflection coefficient also denoted r. https://en.wikipedia.org/wiki/Fresnel_equations#Complex_amplitude_reflection_and_transmission_coefficients

Definition at line 650 of file eevee_nodetree_lib.bsl.hh.

References f0_from_ior().

Referenced by bsdf_lut(), F0_from_ior(), f0_from_ior(), and f0_from_ior().

◆ F_brdf_multi_scatter()

template<typename T>
float3 F_brdf_multi_scatter ( float3 f0,
float3 f90,
T lut )

◆ F_brdf_multi_scatter< eevee::lut::GGXBrdfData >()

◆ F_brdf_multi_scatter< eevee::lut::GGXBsdfData >()

◆ F_brdf_single_scatter()

template<typename T>
float3 F_brdf_single_scatter ( float3 f0,
float3 f90,
T lut )

Return the fresnel color from a precomputed LUT value.

Definition at line 672 of file eevee_nodetree_lib.bsl.hh.

References F_brdf_single_scatter(), and T.

Referenced by brdf_f82_tint_lut(), brdf_lut(), bsdf_lut(), F_brdf_multi_scatter(), F_brdf_single_scatter(), and F_brdf_single_scatter().

◆ F_brdf_single_scatter< eevee::lut::GGXBrdfData >()

◆ F_brdf_single_scatter< eevee::lut::GGXBsdfData >()

◆ fragment_displacement()

void fragment_displacement ( KernelGlobals & kg,
ShadingData & sd )

◆ light_iter_init()

◆ light_iter_next()

◆ light_iter_should_skip()

◆ node_attribute_layer_impl()

float4 node_attribute_layer_impl ( KernelGlobals & kg,
const uint attr_hash )

◆ node_attribute_light_cutoff_distance_impl()

◆ node_attribute_light_impl()

float4 node_attribute_light_impl ( KernelGlobals & kg,
const int light_index,
uint attr_hash )

◆ node_attribute_light_is_area_impl()

◆ node_attribute_light_is_point_impl()

◆ node_attribute_light_is_spot_impl()

◆ node_attribute_light_is_sun_impl()

◆ node_light_accumulation_impl()

◆ node_light_evaluation_common_impl()

◆ node_light_evaluation_impl()

◆ node_light_evaluation_impl< false >()

template void node_light_evaluation_impl< false > ( KernelGlobals & ,
const ShadingData & ,
int ,
float3 ,
float3 ,
float ,
float &  )

◆ node_light_evaluation_impl< true >()

template void node_light_evaluation_impl< true > ( KernelGlobals & ,
const ShadingData & ,
int ,
float3 ,
float3 ,
float ,
float &  )

◆ node_light_info_impl()

◆ node_shadow_raycast_impl()

◆ nodetree_displacement()

◆ output_aov()

◆ raycast_eval()

◆ scene_time_uniforms()

void scene_time_uniforms ( KernelGlobals & kg,
float & seconds,
float & frame )

◆ texture_lod_bias_get()