Blender V5.3
eevee_deferred_eval.bsl.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include "draw_model.bsl.hh"
12#include "draw_view.bsl.hh"
13#include "eevee_closure.bsl.hh"
15#include "eevee_hiz.bsl.hh"
21#include "gpu_shader_codegen_lib.glsl"
24
25namespace eevee::deferred {
26
27struct VertOut {
29};
30
31[[vertex]]
32void fullscreen_vert([[vertex_id]] const int vert_id,
33 [[position]] float4 &out_position,
34 [[out]] VertOut &v_out)
35{
36 fullscreen_vertex(vert_id, out_position, v_out.screen_uv);
37 out_position = reverse_z::transform(out_position);
38}
39
40struct FragOut {
42};
43
44/* -------------------------------------------------------------------- */
47
58 [[resource_table]] Uniform &uni,
59 [[frag_coord]] const float4 frag_co)
60{
61 render_passes.clear_aovs(uni, int2(frag_co.xy));
62}
63
66 LightEvalConstants{.light_closure_count_reflect = 1,
67 .light_closure_count_transmit = 1});
68
70
71/* -------------------------------------------------------------------- */
74
75struct LightEval {
82
83 /* Chaining to next pass. */
85 /* Optimized out if use_split_indirect is false. */
89
90 void write_radiance_direct(uchar layer_index, int2 texel, float3 radiance)
91 {
92 uint data = rgb9e5_encode(radiance);
93 imageStore(direct_radiance_imgs, int3(texel, layer_index), uint4(data));
94 }
95
96 void write_radiance_indirect(uchar layer_index, int2 texel, float3 radiance)
97 {
98 /* TODO(fclem): Layered texture. */
99 if (layer_index == 0u) {
100 imageStore(indirect_radiance_1_img, texel, float4(radiance, 1.0f));
101 }
102 else if (layer_index == 1u) {
103 imageStore(indirect_radiance_2_img, texel, float4(radiance, 1.0f));
104 }
105 else if (layer_index == 2u) {
106 imageStore(indirect_radiance_3_img, texel, float4(radiance, 1.0f));
107 }
108 }
109};
110
111/* Deferred direct light evaluation function.
112 * Load all BSDFs closures and evaluate LTC for each selected lights. */
116 [[resource_table]] const draw::View &views,
117 [[resource_table]] const draw::Infos &infos,
118 [[resource_table]] const Uniform &uni,
119 [[resource_table]] const LightprobeRenderData &lightprobes,
120 [[resource_table]] const HiZ &hiz,
121 [[resource_table]] const UtilityTexture &util_tx,
122 [[resource_table]] const gbuffer::Reader &reader,
123 [[resource_table]] RenderPassOutput &render_passes,
124 [[frag_coord]] const float4 frag_co,
125 [[in]] const VertOut v_out)
126{
127 [[resource_table]] LightEvalData &lrt = lights.inner;
128
129 const int2 texel = int2(frag_co.xy);
130
131 /* Bias the shading point position because of depth buffer precision.
132 * Constant is taken from https://www.terathon.com/gdc07_lengyel.pdf. */
133 constexpr float bias = 2.4e-7f;
134
135 const float depth = texelFetch(hiz.hiz_tx, texel, 0).r - bias;
136 const gbuffer::Layers gbuf = reader.read_layers(texel);
137 const Thickness thickness = reader.read_thickness(gbuf.header, texel);
138 const uchar closure_count = gbuf.header.closure_len();
139
140 const ViewMatrices view = views.get(0);
141
142 const float3 P = view.point_screen_to_world(float3(v_out.screen_uv, depth));
143 const float3 Ng = gbuf.header.geometry_normal(gbuf.surface_N());
144 const float3 V = view.world_incident_vector(P);
145 const float vPz = dot(view.forward(), P) - dot(view.forward(), view.position());
146
148 /* Unroll light stack array assignments to avoid non-constant indexing. */
149 for (uint i = 0u; i < 3; i++) [[unroll]] {
151 ctx.stack.cl[i] = closure_light_new(util_tx, gbuf.layer[i], V);
152 }
153 }
154
155 ctx.P = P;
156 ctx.Ng = Ng;
157 ctx.texel = frag_co.xy;
158 ctx.thickness = thickness;
159 ctx.receiver_light_set = 0;
160 ctx.terminator_normal_offset = 0.0f;
162 ctx.ray_count = srt.shadow_ray_count;
163 ctx.ray_step_count = srt.shadow_ray_step_count;
164 if (gbuf.header.use_object_id()) {
165 uint object_id = reader.read_object_id(texel);
166 ObjectInfos object_infos = infos.get(object_id);
167 ctx.receiver_light_set = receiver_light_set_get(object_infos);
170 }
171
172 /* TODO(fclem): If transmission (no SSS) is present, we could reduce LIGHT_CLOSURE_EVAL_COUNT
173 * by 1 for this evaluation and skip evaluating the transmission closure twice. */
174 lights.eval_reflection(ctx, vPz);
175
176 if (srt.use_transmission) {
178
179 ClosureUndetermined cl_transmit = gbuf.layer[0];
180 ctx_tr.stack.cl[0] = closure_light_new(util_tx, cl_transmit, V, thickness);
181
182 /* NOTE: Only evaluates `stack.cl[0]`. */
183 lights.eval_transmission(ctx_tr, vPz);
184
185 if (cl_transmit.type == CLOSURE_BSSRDF_BURLEY_ID) {
186 /* Apply transmission profile onto transmitted light and sum with reflected light. */
187 float3 sss_profile = subsurface_transmission(
188 util_tx, to_closure_subsurface(cl_transmit).sss_radius, thickness.value());
189 ctx.stack.cl[0].light_shadowed += ctx_tr.stack.cl[0].light_shadowed * sss_profile;
190 ctx.stack.cl[0].light_unshadowed += ctx_tr.stack.cl[0].light_unshadowed * sss_profile;
191 }
192 else {
193 ctx.stack.cl[0].light_shadowed = ctx_tr.stack.cl[0].light_shadowed;
194 ctx.stack.cl[0].light_unshadowed = ctx_tr.stack.cl[0].light_unshadowed;
195 }
196 }
197
198 if (srt.render_pass_shadow_id != -1) {
199 float3 radiance_shadowed = float3(0);
200 float3 radiance_unshadowed = float3(0);
201 for (uint i = 0u; i < 3; i++) [[unroll]] {
203 if (i < closure_count) {
204 radiance_shadowed += ctx.stack.cl[i].light_shadowed;
205 radiance_unshadowed += ctx.stack.cl[i].light_unshadowed;
206 }
207 }
208 }
209 float3 shadows = radiance_shadowed * safe_rcp(radiance_unshadowed);
210 render_passes.store_value(texel, srt.render_pass_shadow_id, average(shadows));
211 }
212
213 if (srt.use_lightprobe_eval) {
214 LightProbeSample samp = lightprobes.load(frag_co.xy, P, Ng, V);
215
216 float clamp_indirect = uni.uniform_buf.clamp.surface_indirect;
218 clamp_indirect);
219
220 uint3 bin_indices = gbuf.header.bin_index_per_layer();
221
222 for (uint i = 0u; i < 3; i++) [[unroll]] {
224 if (i < closure_count) {
225 float3 indirect_light = lightprobes.eval(samp, gbuf.layer[i], P, V, thickness);
226 float3 direct_light = ctx.stack.cl[i].light_shadowed;
227 if (srt.use_split_indirect) {
228 srt.write_radiance_indirect(bin_indices[i], texel, indirect_light);
229 srt.write_radiance_direct(bin_indices[i], texel, direct_light);
230 }
231 else {
232 srt.write_radiance_direct(bin_indices[i], texel, direct_light + indirect_light);
233 }
234 }
235 }
236 }
237 }
238 else {
239 uint3 bin_indices = gbuf.header.bin_index_per_layer();
240
241 for (uint i = 0u; i < 3; i++) [[unroll]] {
243 if (i < closure_count) {
244 float3 direct_light = ctx.stack.cl[i].light_shadowed;
245 srt.write_radiance_direct(bin_indices[i], texel, direct_light);
246 }
247 }
248 }
249 }
250}
251
253
254/* -------------------------------------------------------------------- */
257
258/* Sphere probe evaluate everything as diffuse since they can only rely on volume light-probes
259 * being available. */
262 [[resource_table]] const draw::View &views,
263 [[resource_table]] const draw::Infos &infos,
264 [[resource_table]] const Sampling &sampling,
265 [[resource_table]] const LightprobeVolumeRenderData &lightprobes,
266 [[resource_table]] const Uniform &uni,
267 [[resource_table]] const HiZ &hiz,
268 [[resource_table]] const UtilityTexture &util_tx,
269 [[resource_table]] const gbuffer::Reader &reader,
270 [[frag_coord]] const float4 frag_co,
271 [[in]] const VertOut v_out,
272 [[out]] FragOut &frag_out)
273{
274 int2 texel = int2(frag_co.xy);
275
276 float depth = texelFetch(hiz.hiz_tx, texel, 0).r;
277
278 const gbuffer::Layers gbuf = reader.read_layers(texel);
279
280 if (gbuf.has_no_closure()) {
281 frag_out.radiance = float4(0.0f);
282 return;
283 }
284
285 const uchar closure_count = gbuf.header.closure_len();
286 const Thickness thickness = reader.read_thickness(gbuf.header, texel);
287
288 float3 albedo_front = float3(0.0f);
289 float3 albedo_back = float3(0.0f);
290
291 /* Unroll needed for gbuf.layer access. */
292 for (int i = 0; i < 3 /* GBUFFER_LAYER_MAX */; i++) [[unroll]] {
293 if (i < closure_count) {
294 ClosureUndetermined cl = gbuf.layer[i];
295 switch (cl.type) {
298 case CLOSURE_BSDF_MICROFACET_GGX_REFLECTION_ID:
299 albedo_front += cl.color;
300 break;
303 albedo_back += (thickness.value() != 0.0f) ? square(cl.color) : cl.color;
304 break;
306 albedo_back += cl.color;
307 break;
308 case CLOSURE_NONE_ID:
309 /* TODO(fclem): Assert. */
310 break;
311 }
312 }
313 }
314
315 const ViewMatrices view = views.get(0);
316
317 float3 P = view.point_screen_to_world(float3(v_out.screen_uv, depth));
318 float3 Ng = gbuf.header.geometry_normal(gbuf.surface_N());
320 float vPz = dot(view.forward(), P) - dot(view.forward(), view.position());
321
322 ClosureUndetermined cl;
323 cl.N = gbuf.surface_N();
324 cl.type = CLOSURE_BSDF_DIFFUSE_ID;
325
326 ClosureUndetermined cl_transmit;
327 cl_transmit.N = gbuf.surface_N();
328 cl_transmit.type = CLOSURE_BSDF_TRANSLUCENT_ID;
329
331 ctx.P = P;
332 ctx.Ng = Ng;
333 ctx.texel = frag_co.xy;
334 ctx.thickness = thickness;
335 ctx.receiver_light_set = 0;
336 ctx.terminator_normal_offset = 0.0f;
338 ctx.ray_count = uni.uniform_buf.shadow.ray_count;
339 ctx.ray_step_count = uni.uniform_buf.shadow.step_count;
340 if (gbuf.header.use_object_id()) {
341 uint object_id = reader.read_object_id(texel);
342 ObjectInfos object_infos = infos.get(object_id);
343 ctx.receiver_light_set = receiver_light_set_get(object_infos);
346 }
347
348 /* Direct light. */
349 ctx.stack.cl[0] = closure_light_new(util_tx, cl, V);
350 lights.eval_reflection(ctx, vPz);
351
352 float3 radiance_front = ctx.stack.cl[0].light_shadowed;
353
355
356 ctx_tr.stack.cl[0] = closure_light_new(util_tx, cl_transmit, V, thickness);
357 lights.eval_transmission(ctx_tr, vPz);
358
359 float3 radiance_back = ctx_tr.stack.cl[0].light_shadowed;
360
361 /* Indirect light. */
362 /* Can only load irradiance to avoid dependency loop with the reflection probe. */
363 SphericalHarmonicL1<float4> sh = lightprobes.sample_probe(sampling, P, V, Ng);
364
365 radiance_front += sh.evaluate_lambert(Ng).rgb;
366 /* TODO(fclem): Correct transmission eval. */
367 radiance_back += sh.evaluate_lambert(-Ng).rgb;
368
369 frag_out.radiance = float4(radiance_front * albedo_front + radiance_back * albedo_back, 0.0f);
370}
371
373 /* TODO(fclem): Workaround waiting for this lib to be ported to BSL. */
375};
376
380 [[resource_table]] const draw::View &views,
381 [[resource_table]] const draw::Infos &infos,
382 [[resource_table]] const LightprobeRenderData &lightprobes,
383 [[resource_table]] const Uniform &uni,
384 [[resource_table]] const Sampling &sampling,
385 [[resource_table]] const HiZ &hiz,
386 [[resource_table]] const UtilityTexture &util_tx,
387 [[resource_table]] const gbuffer::Reader &reader,
388 [[frag_coord]] const float4 frag_co,
389 [[in]] const VertOut v_out,
390 [[out]] FragOut &frag_out)
391{
392 int2 texel = int2(frag_co.xy);
393
394 float depth = texelFetch(hiz.hiz_tx, texel, 0).r;
395
396 const gbuffer::Layers gbuf = reader.read_layers(texel);
397 const uchar closure_count = gbuf.header.closure_len();
398 const Thickness thickness = reader.read_thickness(gbuf.header, texel);
399
400 float3 albedo_front = float3(0.0f);
401 float3 albedo_back = float3(0.0f);
402
403 ClosureUndetermined cl_reflect;
404 cl_reflect.type = CLOSURE_BSDF_MICROFACET_GGX_REFLECTION_ID;
405 cl_reflect.color = float3(0.0);
406 cl_reflect.N = float3(0.0);
407 cl_reflect.data = float4(0.0);
408 float reflect_weight = 0.0;
409
410 ClosureUndetermined cl_refract;
412 cl_refract.color = float3(0.0);
413 cl_refract.N = float3(0.0);
414 cl_refract.data = float4(0.0);
415 float refract_weight = 0.0;
416
417 /* Unroll needed for gbuf.layer access. */
418 for (int i = 0; i < 3; i++) [[unroll]] {
419 if (i < closure_count) {
420 ClosureUndetermined cl = gbuf.layer[i];
421 switch (cl.type) {
422 case CLOSURE_BSDF_MICROFACET_GGX_REFLECTION_ID: {
423 cl_reflect.color += cl.color;
424 /* Average roughness and normals. */
425 float weight = reduce_add(cl.color);
426 cl_reflect.N += cl.N * weight;
427 cl_reflect.data += cl.data * weight;
428 reflect_weight += weight;
429 break;
430 }
433 albedo_front += cl.color;
434 break;
436 albedo_back += (thickness.value() != 0.0f) ? square(cl.color) : cl.color;
437 break;
439 cl_refract.color += (thickness.value() != 0.0f) ? square(cl.color) : cl.color;
440 /* Average roughness and normals. */
441 float weight = reduce_add(cl.color);
442 cl_refract.N += cl.N * weight;
443 cl_refract.data += cl.data * weight;
444 refract_weight += weight;
445 break;
446 }
448 cl_refract.color += cl.color;
449 /* Average roughness and normals. */
450 float weight = reduce_add(cl.color);
451 cl_refract.N += cl.N * weight;
452 cl_refract.data += cl.data * weight;
453 refract_weight += weight;
454 break;
455 }
456 case CLOSURE_NONE_ID:
457 /* TODO(fclem): Assert. */
458 break;
459 }
460 }
461 }
462
463 {
464 if (reflect_weight > 1e-6) {
465 float inv_weight = 1.0f / reflect_weight;
466 cl_reflect.N *= inv_weight;
467 cl_reflect.data *= inv_weight;
468 }
469 else {
470 /* This is needed in order to avoid NaN during the lighting evaluation. */
471 cl_reflect.N = gbuf.surface_N();
472 cl_reflect.data.xy = float2(1.0f);
473 }
474 }
475 {
476 if (refract_weight > 1e-6) {
477 float inv_weight = 1.0f / refract_weight;
478 cl_refract.N *= inv_weight;
479 cl_refract.data *= inv_weight;
480 }
481 else {
482 /* This is needed in order to avoid NaN during the lighting evaluation. */
483 cl_refract.N = gbuf.surface_N();
484 cl_refract.data.xy = float2(1.0f);
485 }
486 }
487
488 const ViewMatrices view = views.get(0);
489
490 float3 P = view.point_screen_to_world(float3(v_out.screen_uv, depth));
491 float3 Ng = gbuf.header.geometry_normal(gbuf.surface_N());
493 float vPz = dot(view.forward(), P) - dot(view.forward(), view.position());
494
495 ClosureUndetermined cl;
496 cl.N = gbuf.surface_N();
497 cl.type = CLOSURE_BSDF_DIFFUSE_ID;
498
499 ClosureUndetermined cl_transmit;
500 cl_transmit.N = gbuf.surface_N();
501 cl_transmit.type = CLOSURE_BSDF_TRANSLUCENT_ID;
502
504 ctx.P = P;
505 ctx.Ng = Ng;
506 ctx.texel = frag_co.xy;
507 ctx.thickness = thickness;
508 ctx.receiver_light_set = 0;
509 ctx.terminator_normal_offset = 0.0f;
511 ctx.ray_count = uni.uniform_buf.shadow.ray_count;
512 ctx.ray_step_count = uni.uniform_buf.shadow.step_count;
513 if (gbuf.header.use_object_id()) {
514 uint object_id = reader.read_object_id(texel);
515 ObjectInfos object_infos = infos.get(object_id);
516 ctx.receiver_light_set = receiver_light_set_get(object_infos);
519 }
520
521 /* Direct light. */
522 ctx.stack.cl[0] = closure_light_new(util_tx, cl, V);
523 ctx.stack.cl[1] = closure_light_new(util_tx, cl_reflect, V);
524 lights.eval_reflection(ctx, vPz);
525
526 float3 radiance_front = ctx.stack.cl[0].light_shadowed;
527 float3 radiance_reflect = ctx.stack.cl[1].light_shadowed;
528
530 ctx_tr.stack.cl[0] = closure_light_new(util_tx, cl_transmit, V, thickness);
531 ctx_tr.stack.cl[1] = closure_light_new(util_tx, cl_refract, V, thickness);
532 lights.eval_transmission(ctx_tr, vPz);
533
534 float3 radiance_back = ctx_tr.stack.cl[0].light_shadowed;
535 float3 radiance_refract = ctx_tr.stack.cl[1].light_shadowed;
536
537 /* Indirect light. */
538 [[resource_table]] const LightprobeVolumeRenderData &lp_volumes = lightprobes.volumes;
539 SphericalHarmonicL1<float4> sh = lp_volumes.sample_probe(sampling, P, V, Ng);
540 LightProbeSample samp = lightprobes.load(frag_co.xy, P, Ng, V);
541
542 radiance_front += sh.evaluate_lambert(Ng).rgb;
543 radiance_back += sh.evaluate_lambert(-Ng).rgb;
544 radiance_reflect += lightprobes.eval(samp, cl_reflect, P, V, thickness);
545 radiance_refract += lightprobes.eval(samp, cl_refract, P, V, thickness);
546
547 /* Note: planar probes use transmittance and not alpha for transparency. */
548 frag_out.radiance = float4(0.0f);
549 frag_out.radiance.xyz += radiance_reflect * cl_reflect.color;
550 frag_out.radiance.xyz += radiance_refract * cl_refract.color;
551 frag_out.radiance.xyz += radiance_front * albedo_front;
552 frag_out.radiance.xyz += radiance_back * albedo_back;
553}
554
556
560 .light_closure_eval_count_reflect = 1,
561 .light_closure_eval_count_transmit = 1,
562 .light_closure_count_reflect = 1,
563 .light_closure_count_transmit = 1,
564 },
566 .shadow_random = true,
567 .shadow_static_noise = false,
568 });
572 .light_closure_eval_count_reflect = 2,
573 .light_closure_eval_count_transmit = 1,
574 .light_closure_count_reflect = 2,
575 .light_closure_count_transmit = 1,
576 },
578 .shadow_random = true,
579 .shadow_static_noise = false,
580 });
584 .light_closure_eval_count_reflect = 3,
585 .light_closure_eval_count_transmit = 1,
586 .light_closure_count_reflect = 3,
587 .light_closure_count_transmit = 1,
588 },
590 .shadow_random = true,
591 .shadow_static_noise = false,
592 });
596 .light_closure_eval_count_reflect = 1,
597 .light_closure_eval_count_transmit = 1,
598 .light_closure_count_reflect = 1,
599 .light_closure_count_transmit = 1,
600 },
602 .shadow_random = true,
603 /* Use static noise pattern to avoid non-deterministic captures. */
604 .shadow_static_noise = true,
605 });
609 .legacy_sphere_probe_enable = true,
610 },
612 .light_closure_eval_count_reflect = 2,
613 .light_closure_eval_count_transmit = 2,
614 .light_closure_count_reflect = 2,
615 .light_closure_count_transmit = 2,
616 },
617 ShadowRenderConstants{
618 .shadow_random = true,
619 .shadow_static_noise = false,
620 });
621
622} // namespace eevee::deferred
uint receiver_light_set_get(ObjectInfos object_infos)
ClosureLight closure_light_new(const UtilityTexture &util_tx, ClosureUndetermined cl, float3 V, Thickness thickness)
#define RAYTRACE_RADIANCE_FORMAT
#define DEFERRED_RADIANCE_FORMAT
float3 subsurface_transmission(const UtilityTexture &util, float3 sss_radii, float thickness)
#define position
#define image(slot, qualifiers, format)
#define early_fragment_tests
#define frag_coord
#define smooth
#define compilation_constant
#define resource_table
#define static_branch
#define specialization_constant(default_value)
#define fragment
#define vertex_id
#define unroll
#define vertex
#define frag_color(slot)
float dot(VecOp< float, D >, VecOp< float, D >) RET
ImageBase< uint, 2, true > uimage2DArray
ImageBase< float, 2 > image2D
IMG_TEMPLATE void imageStore(T &, IntCoord, DataVec)
TEX_TEMPLATE DataVec texelFetch(T, IntCoord, int) RET
unsigned int uchar
void fullscreen_vertex(int vertex_id, float4 &out_position)
float square(float v)
float safe_rcp(float a)
float reduce_add(float2 a)
float average(float2 a)
uint rgb9e5_encode(float3 color)
@ CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID
@ CLOSURE_BSDF_DIFFUSE_ID
@ CLOSURE_BSSRDF_BURLEY_ID
@ CLOSURE_NONE_ID
@ CLOSURE_BSDF_THIN_GLASS_TRANSMISSION_ID
@ CLOSURE_BSDF_TRANSLUCENT_ID
void planar_eval_frag(PlanarProbeEval &, LightEvalIterator &lights, const draw::View &views, const draw::Infos &infos, const LightprobeRenderData &lightprobes, const Uniform &uni, const Sampling &sampling, const HiZ &hiz, const UtilityTexture &util_tx, const gbuffer::Reader &reader, const float4 frag_co, const VertOut v_out, FragOut &frag_out)
void aov_clear_frag(RenderPassOutput &render_passes, Uniform &uni, const float4 frag_co)
PipelineGraphic light_single(fullscreen_vert, light_eval_frag, LightEvalConstants{ .light_closure_eval_count_reflect=1,.light_closure_eval_count_transmit=1,.light_closure_count_reflect=1,.light_closure_count_transmit=1, }, ShadowRenderConstants{ .shadow_random=true,.shadow_static_noise=false, })
void sphere_eval_frag(LightEvalIterator &lights, const draw::View &views, const draw::Infos &infos, const Sampling &sampling, const LightprobeVolumeRenderData &lightprobes, const Uniform &uni, const HiZ &hiz, const UtilityTexture &util_tx, const gbuffer::Reader &reader, const float4 frag_co, const VertOut v_out, FragOut &frag_out)
void fullscreen_vert(const int vert_id, float4 &out_position, VertOut &v_out)
PipelineGraphic planar_eval(fullscreen_vert, planar_eval_frag, PlanarProbeEval{ .legacy_sphere_probe_enable=true, }, LightEvalConstants{ .light_closure_eval_count_reflect=2,.light_closure_eval_count_transmit=2,.light_closure_count_reflect=2,.light_closure_count_transmit=2, }, ShadowRenderConstants{ .shadow_random=true,.shadow_static_noise=false, })
PipelineGraphic light_double(fullscreen_vert, light_eval_frag, LightEvalConstants{ .light_closure_eval_count_reflect=2,.light_closure_eval_count_transmit=1,.light_closure_count_reflect=2,.light_closure_count_transmit=1, }, ShadowRenderConstants{ .shadow_random=true,.shadow_static_noise=false, })
PipelineGraphic aov_clear(fullscreen_vert, aov_clear_frag, LightEvalConstants{.light_closure_count_reflect=1,.light_closure_count_transmit=1})
void light_eval_frag(LightEval &srt, LightEvalIterator &lights, const draw::View &views, const draw::Infos &infos, const Uniform &uni, const LightprobeRenderData &lightprobes, const HiZ &hiz, const UtilityTexture &util_tx, const gbuffer::Reader &reader, RenderPassOutput &render_passes, const float4 frag_co, const VertOut v_out)
PipelineGraphic light_triple(fullscreen_vert, light_eval_frag, LightEvalConstants{ .light_closure_eval_count_reflect=3,.light_closure_eval_count_transmit=1,.light_closure_count_reflect=3,.light_closure_count_transmit=1, }, ShadowRenderConstants{ .shadow_random=true,.shadow_static_noise=false, })
PipelineGraphic sphere_eval(fullscreen_vert, sphere_eval_frag, LightEvalConstants{ .light_closure_eval_count_reflect=1,.light_closure_eval_count_transmit=1,.light_closure_count_reflect=1,.light_closure_count_transmit=1, }, ShadowRenderConstants{ .shadow_random=true,.shadow_static_noise=true, })
EvalCtx< true > init_from_reflect_ctx(EvalCtx< false > ctx)
float4 transform(float4 hs_position)
SphericalHarmonicL1< float4 > clamp_energy(SphericalHarmonicL1< float4 > sh, float clamp_value)
float shadow_terminator_normal_offset
float shadow_terminator_geometry_offset
float3 forward() const
float3 point_screen_to_world(float3 ssP) const
float3 position() const
float3 world_incident_vector(float3 P) const
LightEvalConstants constants
SphericalHarmonicL1< float4 > volume_irradiance
SphericalHarmonicL1< float4 > sample_probe(const Sampling &sampling, float3 P, float3 V, float3 Ng) const
void write_radiance_indirect(uchar layer_index, int2 texel, float3 radiance)
void write_radiance_direct(uchar layer_index, int2 texel, float3 radiance)
ClosureStack< is_transmission > stack
uint3 bin_index_per_layer() const
float3 geometry_normal(float3 surface_N) const
ClosureUndetermined layer[GBUFFER_LAYER_MAX]
CCL_NAMESPACE_BEGIN struct Window V