22#include "gpu_shader_codegen_lib.glsl"
48 for (uint i = 0u; i < 3; i++) [[
unroll]] {
73 if (closure_has_transmission(cl_transmit.type) ||
86 kg.
util_tx, to_closure_subsurface(cl_transmit).sss_radius,
thickness.value());
87 ctx.
stack.cl[0].light_shadowed += ctx_tr.
stack.cl[0].light_shadowed * sss_profile;
88 ctx.
stack.cl[0].light_unshadowed += ctx_tr.
stack.cl[0].light_unshadowed * sss_profile;
92 ctx.
stack.cl[0].light_shadowed = ctx_tr.
stack.cl[0].light_shadowed;
93 ctx.
stack.cl[0].light_unshadowed = ctx_tr.
stack.cl[0].light_unshadowed;
100 float clamp_indirect_sh = uni.
uniform_buf.clamp.surface_indirect;
110 for (uint i = 0u; i < 3; i++) [[
unroll]] {
113 average_N += cl.N * cl.weight();
118 const int planar_id = lightprobe_planes.
select_probe(sd.
P, average_N);
120 if (planar_id == -1) {
129 ndc_P_reflected.
y = -ndc_P_reflected.
y;
132 planar_probe_radiance =
147 for (uint i = 0u; i < 3; i++) [[
unroll]] {
151 float3 direct_light = ctx.
stack.cl[i].light_shadowed;
155 if (cl.type == CLOSURE_BSDF_MICROFACET_GGX_REFLECTION_ID) {
156 const float blend =
saturate(to_closure_reflection(cl).roughness * -10.0f + 1.0f) *
158 indirect_light =
mix(indirect_light, planar_probe_radiance, blend);
167 cl.color *= cl.color;
170 radiance_direct += direct_light * cl.color;
171 radiance_indirect += indirect_light * cl.color;
176 float clamp_direct = uni.
uniform_buf.clamp.surface_direct;
177 float clamp_indirect = uni.
uniform_buf.clamp.surface_indirect;
182 radiance_direct *= uni.
uniform_buf.clamp.direct_scale;
183 radiance_indirect *= uni.
uniform_buf.clamp.indirect_scale;
185 radiance = radiance_direct + radiance_indirect + sd.
emission;
191 transmittance =
float3(0.0f);
uint receiver_light_set_get(ObjectInfos object_infos)
ClosureLight closure_light_new(const UtilityTexture &util_tx, ClosureUndetermined cl, float3 V, Thickness thickness)
#define CLOSURE_WEIGHT_CUTOFF
float3 subsurface_transmission(const UtilityTexture &util, float3 sss_radii, float thickness)
float dot(VecOp< float, D >, VecOp< float, D >) RET
TEX_TEMPLATE DataVec textureLod(T, FltCoord, float) RET
VecT safe_normalize(VecT vector)
@ CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID
@ CLOSURE_BSSRDF_BURLEY_ID
@ CLOSURE_BSDF_TRANSLUCENT_ID
float3 brightness_clamp_max(float3 color, float limit)
EvalCtx< true > init_from_reflect_ctx(EvalCtx< false > ctx)
float3 parallax(PlanarProbeData planar, float3 P, float3 N, float3 V)
void forward_lighting_eval(KernelGlobals &kg, const ShadingData &sd, const ViewMatrices view, uint resource_id, Thickness thickness, float2 frag_co, float3 &radiance, float3 &transmittance)
T read(T depth_buffer_value)
SphericalHarmonicL1< float4 > clamp_energy(SphericalHarmonicL1< float4 > sh, float clamp_value)
eevee::LightprobePlaneRenderData lightprobe_planes
eevee::PipelineConstants pipe
eevee::LightEvalIterator light_eval
eevee::LightprobeRenderData lightprobes
float shadow_terminator_normal_offset
float shadow_terminator_geometry_offset
Reservoir< ClosureUndetermined > closure_get(const eevee::PipelineConstants &pipe, uchar i) const
packed_float3 transmittance
ClosureUndetermined closure_get_resolved(const eevee::PipelineConstants &pipe, uchar i, float additional_weight) const
T ndc_to_screen(T ndc_P) const
float3 point_world_to_ndc(float3 P) const
float3 world_incident_vector(float3 P) const
ObjectInfos get(uint resource_id) const
int light_closure_eval_count_reflect
int light_closure_eval_count_transmit
LightEvalConstants constants
void eval_transmission(light::EvalCtx< true > &ctx, float vPz)
void eval_reflection(light::EvalCtx< false > &ctx, float vPz)
SphericalHarmonicL1< float4 > volume_irradiance
sampler2DArray planar_radiance_tx
sampler2DArrayDepth planar_depth_tx
PlanarProbeData(& probe_planar_buf)[PLANAR_PROBE_MAX]
int select_probe(float3 P, float3 N) const
float3 eval(const UtilityTexture &util_tx, LightProbeSample samp, ClosureSubsurface cl, float3, float3, Thickness thickness) const
LightProbeSample load(float2 screen_texel, float3 P, float3 Ng, float3 V) const
bool use_forward_lighting
ClosureStack< is_transmission > stack
float terminator_normal_offset
float terminator_geometry_offset
CCL_NAMESPACE_BEGIN struct Window V