@woosh/meep-engine 3.75.0 → 3.76.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/engine/asset/GameAssetType.d.ts +1 -0
- package/src/engine/asset/GameAssetType.js +5 -1
- package/src/engine/asset/loaders/GroomAssetLoader.d.ts +33 -0
- package/src/engine/asset/loaders/GroomAssetLoader.d.ts.map +1 -0
- package/src/engine/asset/loaders/GroomAssetLoader.js +99 -0
- package/src/engine/graphics/ecs/hair/Hair.d.ts +47 -0
- package/src/engine/graphics/ecs/hair/Hair.d.ts.map +1 -0
- package/src/engine/graphics/ecs/hair/Hair.js +61 -0
- package/src/engine/graphics/hair/Groom.d.ts +130 -0
- package/src/engine/graphics/hair/Groom.d.ts.map +1 -0
- package/src/engine/graphics/hair/Groom.js +193 -0
- package/src/engine/graphics/hair/GroomSerializationAdapter.d.ts +24 -0
- package/src/engine/graphics/hair/GroomSerializationAdapter.d.ts.map +1 -0
- package/src/engine/graphics/hair/GroomSerializationAdapter.js +77 -0
- package/src/engine/graphics/hair/groom_build_group.d.ts +85 -0
- package/src/engine/graphics/hair/groom_build_group.d.ts.map +1 -0
- package/src/engine/graphics/hair/groom_build_group.js +487 -0
- package/src/engine/graphics/hair/groom_generate_scalp.d.ts +29 -0
- package/src/engine/graphics/hair/groom_generate_scalp.d.ts.map +1 -0
- package/src/engine/graphics/hair/groom_generate_scalp.js +184 -0
- package/src/engine/graphics/hair/groom_rank_order.d.ts +15 -0
- package/src/engine/graphics/hair/groom_rank_order.d.ts.map +1 -0
- package/src/engine/graphics/hair/groom_rank_order.js +53 -0
- package/src/engine/graphics/hair/groom_root_spacing.d.ts +12 -0
- package/src/engine/graphics/hair/groom_root_spacing.d.ts.map +1 -0
- package/src/engine/graphics/hair/groom_root_spacing.js +120 -0
- package/src/engine/graphics3/HairSystem.d.ts +102 -0
- package/src/engine/graphics3/HairSystem.d.ts.map +1 -0
- package/src/engine/graphics3/HairSystem.js +456 -0
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/shade/assets/textures/hair_scattering.bin +0 -0
- package/src/shade/device/pipeline/PipelineEnquiry.d.ts +11 -0
- package/src/shade/device/pipeline/PipelineEnquiry.d.ts.map +1 -1
- package/src/shade/device/pipeline/PipelineEnquiry.js +13 -0
- package/src/shade/playground/hair/index.html +50 -0
- package/src/shade/playground/hair/main.d.ts +2 -0
- package/src/shade/playground/hair/main.d.ts.map +1 -0
- package/src/shade/playground/hair/main.js +274 -0
- package/src/shade/playground/screen_probes/README.md +54 -0
- package/src/shade/playground/screen_probes/index.html +271 -0
- package/src/shade/playground/screen_probes/main.d.ts +8 -0
- package/src/shade/playground/screen_probes/main.d.ts.map +1 -0
- package/src/shade/playground/screen_probes/main.js +527 -0
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +54 -8
- package/src/shade/renderer/STATIC_GRAPHICS_ENGINE_ASSETS.d.ts +6 -0
- package/src/shade/renderer/STATIC_GRAPHICS_ENGINE_ASSETS.d.ts.map +1 -1
- package/src/shade/renderer/STATIC_GRAPHICS_ENGINE_ASSETS.js +10 -0
- package/src/shade/renderer/acoustics/GPUAcousticLattice.d.ts +1 -1
- package/src/shade/renderer/acoustics/GPUAcousticProbes.d.ts +1 -1
- package/src/shade/renderer/acoustics/GPUAcoustics.d.ts +1 -1
- package/src/shade/renderer/deferred/chunk_read_gBuffer_material.d.ts.map +1 -1
- package/src/shade/renderer/deferred/chunk_read_gBuffer_material.js +3 -1
- package/src/shade/renderer/deferred/chunk_shade_direct_lights.d.ts +23 -0
- package/src/shade/renderer/deferred/chunk_shade_direct_lights.d.ts.map +1 -0
- package/src/shade/renderer/deferred/chunk_shade_direct_lights.js +111 -0
- package/src/shade/renderer/deferred/chunk_shade_directional_lights.d.ts +17 -6
- package/src/shade/renderer/deferred/chunk_shade_directional_lights.d.ts.map +1 -1
- package/src/shade/renderer/deferred/chunk_shade_directional_lights.js +26 -21
- package/src/shade/renderer/deferred/chunk_shade_standard_material_direct.d.ts +12 -22
- package/src/shade/renderer/deferred/chunk_shade_standard_material_direct.d.ts.map +1 -1
- package/src/shade/renderer/deferred/chunk_shade_standard_material_direct.js +20 -100
- package/src/shade/renderer/deferred/chunk_shade_standard_material_direct_restir.d.ts.map +1 -1
- package/src/shade/renderer/deferred/chunk_shade_standard_material_direct_restir.js +6 -4
- package/src/shade/renderer/deferred/chunk_standard_material_direct_light_lobe.d.ts +15 -0
- package/src/shade/renderer/deferred/chunk_standard_material_direct_light_lobe.d.ts.map +1 -0
- package/src/shade/renderer/deferred/chunk_standard_material_direct_light_lobe.js +47 -0
- package/src/shade/renderer/extension/ViewLighting.d.ts +101 -0
- package/src/shade/renderer/extension/ViewLighting.d.ts.map +1 -0
- package/src/shade/renderer/extension/ViewLighting.js +168 -0
- package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
- package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
- package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +7 -7
- package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
- package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
- package/src/shade/renderer/global_illumination/brick4/gpu/draw/shader_brick4_indirect_lighting.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/brick4/gpu/draw/shader_brick4_indirect_lighting.js +3 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_indirect_lighting.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_indirect_lighting.js +3 -1
- package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts +15 -7
- package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.js +40 -9
- package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts +23 -0
- package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.js +26 -0
- package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.d.ts +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.js +6 -0
- package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts +13 -1
- package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.js +23 -1
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.js +2 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_rough_specular.d.ts +29 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_rough_specular.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_rough_specular.js +102 -0
- package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.d.ts +8 -1
- package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.js +27 -1
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts +4 -1
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.js +4 -1
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.d.ts +11 -5
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.js +28 -10
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts +36 -2
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.js +149 -4
- package/src/shade/renderer/global_illumination/shader_resolve_indirect_lighting.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/shader_resolve_indirect_lighting.js +3 -1
- package/src/shade/renderer/hair/GPUHairSystem.d.ts +159 -0
- package/src/shade/renderer/hair/GPUHairSystem.d.ts.map +1 -0
- package/src/shade/renderer/hair/GPUHairSystem.js +1132 -0
- package/src/shade/renderer/hair/HAIR.d.ts +102 -0
- package/src/shade/renderer/hair/HAIR.d.ts.map +1 -0
- package/src/shade/renderer/hair/HAIR.js +115 -0
- package/src/shade/renderer/hair/HAIR_DATABASE_SPEC.d.ts +17 -0
- package/src/shade/renderer/hair/HAIR_DATABASE_SPEC.d.ts.map +1 -0
- package/src/shade/renderer/hair/HAIR_DATABASE_SPEC.js +71 -0
- package/src/shade/renderer/hair/HAIR_FRAME_STRUCTS.d.ts +11 -0
- package/src/shade/renderer/hair/HAIR_FRAME_STRUCTS.d.ts.map +1 -0
- package/src/shade/renderer/hair/HAIR_FRAME_STRUCTS.js +48 -0
- package/src/shade/renderer/hair/HairFrame.d.ts +41 -0
- package/src/shade/renderer/hair/HairFrame.d.ts.map +1 -0
- package/src/shade/renderer/hair/HairFrame.js +76 -0
- package/src/shade/renderer/hair/chunk_hair_bsdf.d.ts +42 -0
- package/src/shade/renderer/hair/chunk_hair_bsdf.d.ts.map +1 -0
- package/src/shade/renderer/hair/chunk_hair_bsdf.js +170 -0
- package/src/shade/renderer/hair/chunk_hair_dual_scattering.d.ts +30 -0
- package/src/shade/renderer/hair/chunk_hair_dual_scattering.d.ts.map +1 -0
- package/src/shade/renderer/hair/chunk_hair_dual_scattering.js +131 -0
- package/src/shade/renderer/hair/chunk_hair_pixel.d.ts +32 -0
- package/src/shade/renderer/hair/chunk_hair_pixel.d.ts.map +1 -0
- package/src/shade/renderer/hair/chunk_hair_pixel.js +116 -0
- package/src/shade/renderer/hair/chunk_hair_strand.d.ts +40 -0
- package/src/shade/renderer/hair/chunk_hair_strand.d.ts.map +1 -0
- package/src/shade/renderer/hair/chunk_hair_strand.js +85 -0
- package/src/shade/renderer/hair/chunk_hair_volume.d.ts +31 -0
- package/src/shade/renderer/hair/chunk_hair_volume.d.ts.map +1 -0
- package/src/shade/renderer/hair/chunk_hair_volume.js +106 -0
- package/src/shade/renderer/hair/hair_id_draw.d.ts +24 -0
- package/src/shade/renderer/hair/hair_id_draw.d.ts.map +1 -0
- package/src/shade/renderer/hair/hair_id_draw.js +135 -0
- package/src/shade/renderer/hair/hair_lighting.d.ts +53 -0
- package/src/shade/renderer/hair/hair_lighting.d.ts.map +1 -0
- package/src/shade/renderer/hair/hair_lighting.js +270 -0
- package/src/shade/renderer/hair/hair_scattering_lut.d.ts +75 -0
- package/src/shade/renderer/hair/hair_scattering_lut.d.ts.map +1 -0
- package/src/shade/renderer/hair/hair_scattering_lut.js +271 -0
- package/src/shade/renderer/hair/hair_stamp.d.ts +33 -0
- package/src/shade/renderer/hair/hair_stamp.d.ts.map +1 -0
- package/src/shade/renderer/hair/hair_stamp.js +175 -0
- package/src/shade/renderer/hair/shader_hair_classes.d.ts +21 -0
- package/src/shade/renderer/hair/shader_hair_classes.d.ts.map +1 -0
- package/src/shade/renderer/hair/shader_hair_classes.js +86 -0
- package/src/shade/renderer/hair/shader_hair_cull.d.ts +31 -0
- package/src/shade/renderer/hair/shader_hair_cull.d.ts.map +1 -0
- package/src/shade/renderer/hair/shader_hair_cull.js +194 -0
- package/src/shade/renderer/hair/shader_hair_lod.d.ts +33 -0
- package/src/shade/renderer/hair/shader_hair_lod.d.ts.map +1 -0
- package/src/shade/renderer/hair/shader_hair_lod.js +268 -0
- package/src/shade/renderer/hair/shader_hair_volume.d.ts +28 -0
- package/src/shade/renderer/hair/shader_hair_volume.d.ts.map +1 -0
- package/src/shade/renderer/hair/shader_hair_volume.js +167 -0
- package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
- package/src/shade/renderer/loader/usd/usd_build_scene.d.ts +31 -0
- package/src/shade/renderer/loader/usd/usd_build_scene.d.ts.map +1 -1
- package/src/shade/renderer/loader/usd/usd_build_scene.js +36 -21
- package/src/shade/renderer/loader/usd/usd_groom_extension.d.ts +60 -0
- package/src/shade/renderer/loader/usd/usd_groom_extension.d.ts.map +1 -0
- package/src/shade/renderer/loader/usd/usd_groom_extension.js +417 -0
- package/src/shade/renderer/path_tracer/shader/chunk_sample_material_data.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/shader/chunk_sample_material_data.js +4 -1
- package/src/shade/renderer/path_tracer/shader/chunk_shading_closure_from_material_data.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/shader/chunk_shading_closure_from_material_data.js +3 -1
- package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
- package/src/shade/renderer/postprocess/ssr/SSR.d.ts +4 -1
- package/src/shade/renderer/postprocess/ssr/SSR.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/SSR.js +9 -0
- package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_sample_radiance.d.ts +16 -1
- package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_sample_radiance.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_sample_radiance.js +47 -3
- package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader.js +5 -3
- package/src/shade/renderer/postprocess/ssr/ssr_combine_shader.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/ssr_combine_shader.js +6 -5
- package/src/shade/renderer/rasterize/forward/chunk_forward_shade_standard_fragment.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/forward/chunk_forward_shade_standard_fragment.js +5 -2
- package/src/shade/renderer/rasterize/native/avboit/avboit_draw_fragment_body.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/avboit_draw_fragment_body.js +5 -0
- package/src/shade/renderer/rasterize/native/avboit/shader_avboit_splat.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/shader_avboit_splat.js +4 -1
- package/src/shade/renderer/rasterize/native/oit/oit_resolve_fragment_body.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/oit/oit_resolve_fragment_body.js +5 -1
- package/src/shade/renderer/rasterize/native/oit/shader_oit_generate_moments.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/oit/shader_oit_generate_moments.js +7 -4
- package/src/shade/renderer/shader/chunk/brdf/chunk_shadowed_F90.d.ts +13 -8
- package/src/shade/renderer/shader/chunk/brdf/chunk_shadowed_F90.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/brdf/chunk_shadowed_F90.js +18 -14
- package/src/shade/renderer/shader/chunk/light/chunk_compute_multiscattering_specular.d.ts +3 -2
- package/src/shade/renderer/shader/chunk/light/chunk_compute_multiscattering_specular.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/light/chunk_compute_multiscattering_specular.js +12 -4
- package/src/shade/renderer/shader/chunk/material/MATERIAL_SHADING_INFO_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/material/MATERIAL_SHADING_INFO_STRUCT.js +1 -0
- package/src/shade/renderer/shader/chunk/material/chunk_compute_indirect_specular.js +1 -1
- package/src/shade/renderer/shader/chunk/material/chunk_metalness_to_specular_F90.d.ts +16 -0
- package/src/shade/renderer/shader/chunk/material/chunk_metalness_to_specular_F90.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/material/chunk_metalness_to_specular_F90.js +25 -0
- package/src/shade/renderer/shader/chunk/material/chunk_re_direct_multiscatter.js +2 -2
- package/src/shade/renderer/shader/compiler/ShaderSwitch.d.ts +1 -1
- package/src/shade/renderer/shader/compiler/ShaderSwitchSet.d.ts +1 -1
- package/src/shade/renderer/shader/resource/ShaderResourceDescriptor.d.ts +1 -1
- package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_point2.d.ts +2 -2
- package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_point2.js +2 -2
- package/src/shade/renderer/water/query/GPUWaterQueries.d.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"STATIC_GRAPHICS_ENGINE_ASSETS.d.ts","sourceRoot":"","sources":["../../../../src/shade/renderer/STATIC_GRAPHICS_ENGINE_ASSETS.js"],"names":[],"mappings":"AAIA;IAII;;;OAGG;IACH,qBAMC;
|
|
1
|
+
{"version":3,"file":"STATIC_GRAPHICS_ENGINE_ASSETS.d.ts","sourceRoot":"","sources":["../../../../src/shade/renderer/STATIC_GRAPHICS_ENGINE_ASSETS.js"],"names":[],"mappings":"AAIA;IAII;;;OAGG;IACH,qBAMC;IAwBG,wBAA6C;IAC7C,wBAA6C;IAC7C,wBAA6C;IAM7C;;;OAGG;IACH,WAFU,YAAY,CAEuB;IAG7C;;;;OAIG;IACH,iBAFU,YAAY,CAEmC;;CAKhE;AAED;;;GAGG;AACH,4CAFU,0BAA0B,CAE0C;6BAzEjD,2BAA2B"}
|
|
@@ -31,11 +31,13 @@ export class StaticGraphicsEngineAssets {
|
|
|
31
31
|
stbn_vec2,
|
|
32
32
|
stbn_vec3,
|
|
33
33
|
split_sum,
|
|
34
|
+
hair_scattering,
|
|
34
35
|
] = await Promise.all([
|
|
35
36
|
shade_load_data_image(asset_url('stbn_vec1.bin')),
|
|
36
37
|
shade_load_data_image(asset_url('stbn_vec2.bin')),
|
|
37
38
|
shade_load_data_image(asset_url('stbn_vec3.bin')),
|
|
38
39
|
shade_load_data_image(asset_url('split_sum.bin')),
|
|
40
|
+
shade_load_data_image(asset_url('hair_scattering.bin')),
|
|
39
41
|
])
|
|
40
42
|
|
|
41
43
|
this.stbn_vec1 = ShadeTexture.from(stbn_vec1);
|
|
@@ -53,6 +55,14 @@ export class StaticGraphicsEngineAssets {
|
|
|
53
55
|
this.split_sum = ShadeTexture.from(split_sum);
|
|
54
56
|
this.split_sum.clearFlag(ShadeTextureFlags.GenerateMipMaps);
|
|
55
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Strand hair's average scattering, which dual scattering reads (`hair_scattering_lut.js`): x the view's
|
|
60
|
+
* sin to the fibre, y the roughness, z the square root of the colour; front, then back.
|
|
61
|
+
* @type {ShadeTexture}
|
|
62
|
+
*/
|
|
63
|
+
this.hair_scattering = ShadeTexture.from(hair_scattering);
|
|
64
|
+
this.hair_scattering.clearFlag(ShadeTextureFlags.GenerateMipMaps);
|
|
65
|
+
|
|
56
66
|
}
|
|
57
67
|
|
|
58
68
|
}
|
|
@@ -55,7 +55,7 @@ export class GPUAcousticLattice {
|
|
|
55
55
|
* @param {number} gz
|
|
56
56
|
* @returns {number} the point's storage index: storage wraps, as the clipmaps' does
|
|
57
57
|
*/
|
|
58
|
-
static "__#
|
|
58
|
+
static "__#605@#storage"(c: number, gx: number, gy: number, gz: number): number;
|
|
59
59
|
/**
|
|
60
60
|
* @param {GPUAcoustics} acoustics whose receivers the points are
|
|
61
61
|
* @param {number} radius metres: the default source's, which the points stand for
|
|
@@ -49,7 +49,7 @@ export class GPUAcousticProbes {
|
|
|
49
49
|
* @param {*} resources
|
|
50
50
|
* @param {{encoder: import("../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext}} context
|
|
51
51
|
*/
|
|
52
|
-
static "__#
|
|
52
|
+
static "__#390@#execute"(pass: object, resources: any, context: {
|
|
53
53
|
encoder: import("../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext;
|
|
54
54
|
}): void;
|
|
55
55
|
/**
|
|
@@ -39,7 +39,7 @@ export class GPUAcoustics {
|
|
|
39
39
|
* @param {*} resources
|
|
40
40
|
* @param {{encoder: import("../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext}} context
|
|
41
41
|
*/
|
|
42
|
-
static "__#
|
|
42
|
+
static "__#604@#execute"(pass: object, resources: any, context: {
|
|
43
43
|
encoder: import("../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext;
|
|
44
44
|
}): void;
|
|
45
45
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunk_read_gBuffer_material.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/deferred/chunk_read_gBuffer_material.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chunk_read_gBuffer_material.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/deferred/chunk_read_gBuffer_material.js"],"names":[],"mappings":"AAWA,oDAyDE;0BA5DwB,iCAAiC"}
|
|
@@ -4,6 +4,7 @@ import { chunk_rgbe9995_decode } from "../shader/chunk/color/rgbe9995/chunk_rgbe
|
|
|
4
4
|
import { chunk_decode_g_buffer_metalness } from "../shader/chunk/material/chunk_decode_g_buffer_metalness.js";
|
|
5
5
|
import { chunk_decode_g_buffer_roughness } from "../shader/chunk/material/chunk_decode_g_buffer_roughness.js";
|
|
6
6
|
import { chunk_metalness_to_specular_color } from "../shader/chunk/material/chunk_metalness_to_specular_color.js";
|
|
7
|
+
import { chunk_metalness_to_specular_F90 } from "../shader/chunk/material/chunk_metalness_to_specular_F90.js";
|
|
7
8
|
import { MATERIAL_SHADING_INFO_STRUCT } from "../shader/chunk/material/MATERIAL_SHADING_INFO_STRUCT.js";
|
|
8
9
|
import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
9
10
|
import { GBUFFER_ALBEDO_RESOURCE, GBUFFER_EMISSIVE_RESOURCE, GBUFFER_PBR_RESOURCE } from "./GBUFFER_RESOURCES.js";
|
|
@@ -48,7 +49,7 @@ fn read_gBuffer_material(
|
|
|
48
49
|
material.roughness = max(f_roughness, ${BSDF_ROUGHNESS_MINIMUM});
|
|
49
50
|
|
|
50
51
|
material.specularF0 = metalness_to_specular_color(f_metalness, albedo);
|
|
51
|
-
material.specularF90 =
|
|
52
|
+
material.specularF90 = metalness_to_specular_F90(f_metalness, albedo);
|
|
52
53
|
material.specularF0_dielectric = vec3(MIN_DIELECTRICS_F0);
|
|
53
54
|
material.specularF0_metal = albedo;
|
|
54
55
|
|
|
@@ -59,6 +60,7 @@ fn read_gBuffer_material(
|
|
|
59
60
|
`, [
|
|
60
61
|
MATERIAL_SHADING_INFO_STRUCT.declaration_chunk,
|
|
61
62
|
chunk_metalness_to_specular_color,
|
|
63
|
+
chunk_metalness_to_specular_F90,
|
|
62
64
|
chunk_MIN_DIELECTRICS_F0,
|
|
63
65
|
chunk_decode_g_buffer_roughness,
|
|
64
66
|
chunk_decode_g_buffer_metalness,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every light that reaches a point: each occupied directional light, then every point and spot light of the froxel
|
|
3
|
+
* cluster the point falls in, each shadow-mapped at the point and handed to the including shader's lobe:
|
|
4
|
+
*
|
|
5
|
+
* ```wgsl
|
|
6
|
+
* fn shade_direct_lights(context: ptr<function, DirectLightContext>, position: vec3f, view_direction: vec3f,
|
|
7
|
+
* coord: vec2f, view_depth: f32)
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* `coord` is the pixel and `view_depth` the planar view depth the cluster is looked up by. The lobe, its context and
|
|
11
|
+
* the normal the shadows are taken along are the including shader's, by name, as {@link chunk_shade_directional_lights}
|
|
12
|
+
* describes. A point or spot light that its shadow hides entirely is not handed on.
|
|
13
|
+
*
|
|
14
|
+
* **Every light the cell lists is handed on; there is no budget.** A surface's direct light changes at the pixel, and
|
|
15
|
+
* stopping part-way through the list would keep a different set in each of two neighbouring cells, which list
|
|
16
|
+
* different lights, and step at their shared edge. So the cost follows the scene: a point shades as many point and
|
|
17
|
+
* spot lights as its cell lists, each with its shadow map.
|
|
18
|
+
*
|
|
19
|
+
* @type {CodeChunk}
|
|
20
|
+
*/
|
|
21
|
+
export const chunk_shade_direct_lights: CodeChunk;
|
|
22
|
+
import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
23
|
+
//# sourceMappingURL=chunk_shade_direct_lights.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk_shade_direct_lights.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/deferred/chunk_shade_direct_lights.js"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wCAFU,SAAS,CA4EjB;0BAnGwB,iCAAiC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { chunk_light_cluster_counts } from "../light/cluster/chunk_light_cluster_counts.js";
|
|
2
|
+
import { chunk_light_cluster_metadata_by_position } from "../light/cluster/chunk_light_cluster_metadata_by_position.js";
|
|
3
|
+
import { LIGHT_CLUSTER_DATA_RESOURCE } from "../light/cluster/LIGHT_CLUSTER_RESOURCES.js";
|
|
4
|
+
import { LIGHT_DATA_RESOURCE } from "../light/LIGHT_DATA_RESOURCE.js";
|
|
5
|
+
import { chunk_get_point_light_info_by_index } from "../shader/chunk/light/io/chunk_get_point_light_info_by_index.js";
|
|
6
|
+
import { chunk_get_spot_light_info_by_index } from "../shader/chunk/light/io/chunk_get_spot_light_info_by_index.js";
|
|
7
|
+
import { INCIDENT_LIGHT_STRUCT } from "../shader/chunk/light/INCIDENT_LIGHT_STRUCT.js";
|
|
8
|
+
import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
9
|
+
import { chunk_shadowmap_get_light_visibility } from "../shadow/map/shader/chunk_shadowmap_get_light_visibility.js";
|
|
10
|
+
import { VIEW_RESOURCE } from "../view/VIEW_RESOURCE.js";
|
|
11
|
+
import { chunk_shade_directional_lights } from "./chunk_shade_directional_lights.js";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Every light that reaches a point: each occupied directional light, then every point and spot light of the froxel
|
|
15
|
+
* cluster the point falls in, each shadow-mapped at the point and handed to the including shader's lobe:
|
|
16
|
+
*
|
|
17
|
+
* ```wgsl
|
|
18
|
+
* fn shade_direct_lights(context: ptr<function, DirectLightContext>, position: vec3f, view_direction: vec3f,
|
|
19
|
+
* coord: vec2f, view_depth: f32)
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* `coord` is the pixel and `view_depth` the planar view depth the cluster is looked up by. The lobe, its context and
|
|
23
|
+
* the normal the shadows are taken along are the including shader's, by name, as {@link chunk_shade_directional_lights}
|
|
24
|
+
* describes. A point or spot light that its shadow hides entirely is not handed on.
|
|
25
|
+
*
|
|
26
|
+
* **Every light the cell lists is handed on; there is no budget.** A surface's direct light changes at the pixel, and
|
|
27
|
+
* stopping part-way through the list would keep a different set in each of two neighbouring cells, which list
|
|
28
|
+
* different lights, and step at their shared edge. So the cost follows the scene: a point shades as many point and
|
|
29
|
+
* spot lights as its cell lists, each with its shadow map.
|
|
30
|
+
*
|
|
31
|
+
* @type {CodeChunk}
|
|
32
|
+
*/
|
|
33
|
+
export const chunk_shade_direct_lights = CodeChunk.from(
|
|
34
|
+
//language=WGSL
|
|
35
|
+
`
|
|
36
|
+
fn shade_direct_lights(
|
|
37
|
+
context: ptr<function, DirectLightContext>,
|
|
38
|
+
position: vec3<f32>,
|
|
39
|
+
view_direction: vec3<f32>,
|
|
40
|
+
coord: vec2<f32>,
|
|
41
|
+
view_depth: f32,
|
|
42
|
+
) {
|
|
43
|
+
shade_directional_lights(context, position, view_direction);
|
|
44
|
+
|
|
45
|
+
// Process local lights (point, then spot)
|
|
46
|
+
let cluster_metadata = light_cluster_metadata_by_position(
|
|
47
|
+
coord.xy,
|
|
48
|
+
view_depth,
|
|
49
|
+
vec2(view.width, view.height)
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
let cluster_offset = cluster_metadata.offset;
|
|
53
|
+
let point_count = light_cluster_count_point(cluster_metadata.counts);
|
|
54
|
+
let spot_count = light_cluster_count_spot(cluster_metadata.counts);
|
|
55
|
+
|
|
56
|
+
for (var i = 0u; i < point_count; i++) {
|
|
57
|
+
let light_index = cluster_data[cluster_offset + i];
|
|
58
|
+
|
|
59
|
+
var direct_light = get_point_light_info_by_index(&light_data, light_index, position);
|
|
60
|
+
|
|
61
|
+
let visibility = shadowmap_get_point_light_visibility(
|
|
62
|
+
&light_data,
|
|
63
|
+
light_index,
|
|
64
|
+
position,
|
|
65
|
+
direct_light_visibility_normal(context, direct_light)
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
direct_light.color *= visibility;
|
|
69
|
+
|
|
70
|
+
if (all(direct_light.color == vec3(0.0))) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
direct_light_lobe(context, direct_light);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
for (var j = 0u; j < spot_count; j++) {
|
|
78
|
+
let light_index = cluster_data[cluster_offset + point_count + j];
|
|
79
|
+
|
|
80
|
+
var direct_light = get_spot_light_info_by_index(&light_data, light_index, position);
|
|
81
|
+
|
|
82
|
+
let visibility = shadowmap_get_spot_light_visibility(
|
|
83
|
+
&light_data,
|
|
84
|
+
light_index,
|
|
85
|
+
position,
|
|
86
|
+
direct_light_visibility_normal(context, direct_light)
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
direct_light.color *= visibility;
|
|
90
|
+
|
|
91
|
+
if (all(direct_light.color == vec3(0.0))) {
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
direct_light_lobe(context, direct_light);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
`, [
|
|
99
|
+
INCIDENT_LIGHT_STRUCT.declaration_chunk,
|
|
100
|
+
chunk_shade_directional_lights,
|
|
101
|
+
chunk_light_cluster_metadata_by_position,
|
|
102
|
+
chunk_light_cluster_counts,
|
|
103
|
+
chunk_get_point_light_info_by_index,
|
|
104
|
+
chunk_get_spot_light_info_by_index,
|
|
105
|
+
chunk_shadowmap_get_light_visibility,
|
|
106
|
+
]
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
chunk_shade_direct_lights.requireResource(LIGHT_CLUSTER_DATA_RESOURCE);
|
|
110
|
+
chunk_shade_direct_lights.requireResource(LIGHT_DATA_RESOURCE);
|
|
111
|
+
chunk_shade_direct_lights.requireResource(VIEW_RESOURCE);
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* atlas for visibility.
|
|
2
|
+
* Every occupied directional light (at most 32, enforced by GPULightCollection), shadow-mapped at a point and
|
|
3
|
+
* handed to the including shader's lobe:
|
|
5
4
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* ```wgsl
|
|
6
|
+
* fn shade_directional_lights(context: ptr<function, DirectLightContext>, position: vec3f, view_direction: vec3f)
|
|
7
|
+
* ```
|
|
8
|
+
*
|
|
9
|
+
* The lobe is the including shader's, by name. It defines:
|
|
10
|
+
*
|
|
11
|
+
* - `struct DirectLightContext`, whatever the lobe reads and accumulates into;
|
|
12
|
+
* - `fn direct_light_lobe(context: ptr<function, DirectLightContext>, light: IncidentLight)`, given each light with
|
|
13
|
+
* its colour already multiplied by the light's shadow visibility at `position`;
|
|
14
|
+
* - `fn direct_light_visibility_normal(context: ptr<function, DirectLightContext>, light: IncidentLight) -> vec3f`,
|
|
15
|
+
* the normal the shadow lookup offsets along and culls back faces by: a light behind it is not visible. A lobe
|
|
16
|
+
* lit from every side (a strand) answers the light's own direction, which culls nothing and offsets nothing.
|
|
17
|
+
*
|
|
18
|
+
* Linked by the clustered and the ReSTIR direct shading alike, through {@link chunk_shade_direct_lights} for the
|
|
19
|
+
* former; the standard material's lobe is `chunk_standard_material_direct_light_lobe`.
|
|
9
20
|
*
|
|
10
21
|
* @type {CodeChunk}
|
|
11
22
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunk_shade_directional_lights.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/deferred/chunk_shade_directional_lights.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chunk_shade_directional_lights.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/deferred/chunk_shade_directional_lights.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,6CAFU,SAAS,CAoCjB;0BA5DwB,iCAAiC"}
|
|
@@ -4,22 +4,30 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
chunk_get_directional_light_info_by_index
|
|
6
6
|
} from "../shader/chunk/light/io/chunk_get_directional_light_info_by_index.js";
|
|
7
|
-
import {
|
|
8
|
-
import { chunk_re_direct_physical } from "../shader/chunk/material/chunk_re_direct_physical.js";
|
|
9
|
-
import { GEOMETRIC_SHADING_INFO_STRUCT } from "../shader/chunk/material/GEOMETRIC_SHADING_INFO_STRUCT.js";
|
|
10
|
-
import { MATERIAL_SHADING_INFO_STRUCT } from "../shader/chunk/material/MATERIAL_SHADING_INFO_STRUCT.js";
|
|
7
|
+
import { INCIDENT_LIGHT_STRUCT } from "../shader/chunk/light/INCIDENT_LIGHT_STRUCT.js";
|
|
11
8
|
import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
12
9
|
import { chunk_shadowmap_get_light_visibility } from "../shadow/map/shader/chunk_shadowmap_get_light_visibility.js";
|
|
13
10
|
import { LIGHT_DATA_RESOURCE } from "../light/LIGHT_DATA_RESOURCE.js";
|
|
14
11
|
|
|
15
12
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* atlas for visibility.
|
|
13
|
+
* Every occupied directional light (at most 32, enforced by GPULightCollection), shadow-mapped at a point and
|
|
14
|
+
* handed to the including shader's lobe:
|
|
19
15
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
16
|
+
* ```wgsl
|
|
17
|
+
* fn shade_directional_lights(context: ptr<function, DirectLightContext>, position: vec3f, view_direction: vec3f)
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* The lobe is the including shader's, by name. It defines:
|
|
21
|
+
*
|
|
22
|
+
* - `struct DirectLightContext`, whatever the lobe reads and accumulates into;
|
|
23
|
+
* - `fn direct_light_lobe(context: ptr<function, DirectLightContext>, light: IncidentLight)`, given each light with
|
|
24
|
+
* its colour already multiplied by the light's shadow visibility at `position`;
|
|
25
|
+
* - `fn direct_light_visibility_normal(context: ptr<function, DirectLightContext>, light: IncidentLight) -> vec3f`,
|
|
26
|
+
* the normal the shadow lookup offsets along and culls back faces by: a light behind it is not visible. A lobe
|
|
27
|
+
* lit from every side (a strand) answers the light's own direction, which culls nothing and offsets nothing.
|
|
28
|
+
*
|
|
29
|
+
* Linked by the clustered and the ReSTIR direct shading alike, through {@link chunk_shade_direct_lights} for the
|
|
30
|
+
* former; the standard material's lobe is `chunk_standard_material_direct_light_lobe`.
|
|
23
31
|
*
|
|
24
32
|
* @type {CodeChunk}
|
|
25
33
|
*/
|
|
@@ -27,9 +35,9 @@ export const chunk_shade_directional_lights = CodeChunk.from(
|
|
|
27
35
|
//language=WGSL
|
|
28
36
|
`
|
|
29
37
|
fn shade_directional_lights(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
38
|
+
context: ptr<function, DirectLightContext>,
|
|
39
|
+
position: vec3<f32>,
|
|
40
|
+
view_direction: vec3<f32>,
|
|
33
41
|
) {
|
|
34
42
|
var directional_bits = directional_lights_iteration_mask(&light_data);
|
|
35
43
|
while (directional_bits != 0u) {
|
|
@@ -41,21 +49,18 @@ fn shade_directional_lights(
|
|
|
41
49
|
let visibility = shadowmap_get_directional_light_visibility(
|
|
42
50
|
&light_data,
|
|
43
51
|
directional_index,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
52
|
+
position,
|
|
53
|
+
view_direction,
|
|
54
|
+
direct_light_visibility_normal(context, direct_light)
|
|
47
55
|
);
|
|
48
56
|
|
|
49
57
|
direct_light.color *= visibility;
|
|
50
58
|
|
|
51
|
-
|
|
59
|
+
direct_light_lobe(context, direct_light);
|
|
52
60
|
}
|
|
53
61
|
}
|
|
54
62
|
`, [
|
|
55
|
-
|
|
56
|
-
GEOMETRIC_SHADING_INFO_STRUCT.declaration_chunk,
|
|
57
|
-
MATERIAL_SHADING_INFO_STRUCT.declaration_chunk,
|
|
58
|
-
chunk_re_direct_physical,
|
|
63
|
+
INCIDENT_LIGHT_STRUCT.declaration_chunk,
|
|
59
64
|
chunk_get_directional_light_info_by_index,
|
|
60
65
|
chunk_directional_lights_iteration_mask,
|
|
61
66
|
chunk_shadowmap_get_light_visibility,
|
|
@@ -1,29 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Brute-force direct shading of a standard material: every
|
|
3
|
-
*
|
|
4
|
-
* shadow-mapped
|
|
2
|
+
* Brute-force direct shading of a standard material: every light that reaches the point
|
|
3
|
+
* ({@link chunk_shade_direct_lights}: each occupied directional light, then every point and spot light in the froxel
|
|
4
|
+
* cluster, each shadow-mapped) through the standard material's lobe, then the multiple-scattering compensation and
|
|
5
|
+
* the emission.
|
|
5
6
|
*
|
|
6
|
-
* **One chunk, linked by both the deferred and the forward paths.** `shader_deferred_main` links it
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* WGSL function name, with the cluster metadata lookup, the point loop, the spot loop and the
|
|
10
|
-
* emissive sum character-identical between the two and only the directional half differing: this copy
|
|
11
|
-
* re-inlined `chunk_shade_directional_lights`' body where the other called it. Two files one edit away
|
|
12
|
-
* from shading the same scene differently depending on which of them the pass reached.
|
|
7
|
+
* **One chunk, linked by both the deferred and the forward paths.** `shader_deferred_main` links it (through the
|
|
8
|
+
* `_deferred` choice next door) and so does `chunk_forward_shade_standard_fragment`, so two passes one edit apart
|
|
9
|
+
* cannot shade the same scene differently.
|
|
13
10
|
*
|
|
14
|
-
* The ReSTIR DI variant ({@link chunk_shade_standard_material_direct_restir}) is a genuinely different
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* (`chunk_shade_standard_material_direct_deferred`), not via a runtime branch.
|
|
11
|
+
* The ReSTIR DI variant ({@link chunk_shade_standard_material_direct_restir}) is a genuinely different function — it
|
|
12
|
+
* replaces the cluster loop with one resampled, ray-traced sample — and stays separate. The deferred pass links one
|
|
13
|
+
* of the two by a shader switch (`chunk_shade_standard_material_direct_deferred`), not via a runtime branch.
|
|
18
14
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* cells, which list different lights, and step at their shared edge. So the cost follows the scene: a
|
|
22
|
-
* pixel shades as many point and spot lights as its cell lists, each with its shadow map.
|
|
23
|
-
*
|
|
24
|
-
* A note carried by the inlined copy, kept because it is still true and now has nowhere else to sit:
|
|
25
|
-
* a screen-space ray-trace for directional visibility would be wanted on the deferred path only, and
|
|
26
|
-
* adding it means splitting these paths again deliberately rather than by accident.
|
|
15
|
+
* A screen-space ray-trace for directional visibility would be wanted on the deferred path only, and adding it means
|
|
16
|
+
* splitting these paths again deliberately rather than by accident.
|
|
27
17
|
*
|
|
28
18
|
* @type {CodeChunk}
|
|
29
19
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunk_shade_standard_material_direct.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/deferred/chunk_shade_standard_material_direct.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chunk_shade_standard_material_direct.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/deferred/chunk_shade_standard_material_direct.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;GAkBG;AACH,mDAFU,SAAS,CAgCjB;0BArDwB,iCAAiC"}
|
|
@@ -1,45 +1,27 @@
|
|
|
1
|
-
import { chunk_light_cluster_counts } from "../light/cluster/chunk_light_cluster_counts.js";
|
|
2
|
-
import { chunk_light_cluster_metadata_by_position } from "../light/cluster/chunk_light_cluster_metadata_by_position.js";
|
|
3
|
-
import { chunk_get_point_light_info_by_index } from "../shader/chunk/light/io/chunk_get_point_light_info_by_index.js";
|
|
4
|
-
import { chunk_get_spot_light_info_by_index } from "../shader/chunk/light/io/chunk_get_spot_light_info_by_index.js";
|
|
5
1
|
import { REFLECTED_LIGHT_STRUCT } from "../shader/chunk/light/REFLECTED_LIGHT_STRUCT.js";
|
|
6
2
|
import { chunk_re_direct_multiscatter } from "../shader/chunk/material/chunk_re_direct_multiscatter.js";
|
|
7
|
-
import { chunk_re_direct_physical } from "../shader/chunk/material/chunk_re_direct_physical.js";
|
|
8
3
|
import { GEOMETRIC_SHADING_INFO_STRUCT } from "../shader/chunk/material/GEOMETRIC_SHADING_INFO_STRUCT.js";
|
|
9
4
|
import { MATERIAL_SHADING_INFO_STRUCT } from "../shader/chunk/material/MATERIAL_SHADING_INFO_STRUCT.js";
|
|
10
5
|
import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { LIGHT_CLUSTER_DATA_RESOURCE } from "../light/cluster/LIGHT_CLUSTER_RESOURCES.js";
|
|
14
|
-
import { LIGHT_DATA_RESOURCE } from "../light/LIGHT_DATA_RESOURCE.js";
|
|
15
|
-
import { VIEW_RESOURCE } from "../view/VIEW_RESOURCE.js";
|
|
6
|
+
import { chunk_shade_direct_lights } from "./chunk_shade_direct_lights.js";
|
|
7
|
+
import { chunk_standard_material_direct_light_lobe } from "./chunk_standard_material_direct_light_lobe.js";
|
|
16
8
|
|
|
17
9
|
/**
|
|
18
|
-
* Brute-force direct shading of a standard material: every
|
|
19
|
-
*
|
|
20
|
-
* shadow-mapped
|
|
10
|
+
* Brute-force direct shading of a standard material: every light that reaches the point
|
|
11
|
+
* ({@link chunk_shade_direct_lights}: each occupied directional light, then every point and spot light in the froxel
|
|
12
|
+
* cluster, each shadow-mapped) through the standard material's lobe, then the multiple-scattering compensation and
|
|
13
|
+
* the emission.
|
|
21
14
|
*
|
|
22
|
-
* **One chunk, linked by both the deferred and the forward paths.** `shader_deferred_main` links it
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* WGSL function name, with the cluster metadata lookup, the point loop, the spot loop and the
|
|
26
|
-
* emissive sum character-identical between the two and only the directional half differing: this copy
|
|
27
|
-
* re-inlined `chunk_shade_directional_lights`' body where the other called it. Two files one edit away
|
|
28
|
-
* from shading the same scene differently depending on which of them the pass reached.
|
|
15
|
+
* **One chunk, linked by both the deferred and the forward paths.** `shader_deferred_main` links it (through the
|
|
16
|
+
* `_deferred` choice next door) and so does `chunk_forward_shade_standard_fragment`, so two passes one edit apart
|
|
17
|
+
* cannot shade the same scene differently.
|
|
29
18
|
*
|
|
30
|
-
* The ReSTIR DI variant ({@link chunk_shade_standard_material_direct_restir}) is a genuinely different
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* (`chunk_shade_standard_material_direct_deferred`), not via a runtime branch.
|
|
19
|
+
* The ReSTIR DI variant ({@link chunk_shade_standard_material_direct_restir}) is a genuinely different function — it
|
|
20
|
+
* replaces the cluster loop with one resampled, ray-traced sample — and stays separate. The deferred pass links one
|
|
21
|
+
* of the two by a shader switch (`chunk_shade_standard_material_direct_deferred`), not via a runtime branch.
|
|
34
22
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* cells, which list different lights, and step at their shared edge. So the cost follows the scene: a
|
|
38
|
-
* pixel shades as many point and spot lights as its cell lists, each with its shadow map.
|
|
39
|
-
*
|
|
40
|
-
* A note carried by the inlined copy, kept because it is still true and now has nowhere else to sit:
|
|
41
|
-
* a screen-space ray-trace for directional visibility would be wanted on the deferred path only, and
|
|
42
|
-
* adding it means splitting these paths again deliberately rather than by accident.
|
|
23
|
+
* A screen-space ray-trace for directional visibility would be wanted on the deferred path only, and adding it means
|
|
24
|
+
* splitting these paths again deliberately rather than by accident.
|
|
43
25
|
*
|
|
44
26
|
* @type {CodeChunk}
|
|
45
27
|
*/
|
|
@@ -53,68 +35,15 @@ fn shade_standard_material_direct(
|
|
|
53
35
|
view_depth: f32,
|
|
54
36
|
) -> vec3<f32>{
|
|
55
37
|
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
shade_directional_lights(material, geometry, &reflected_light);
|
|
59
|
-
|
|
60
|
-
// Process local lights (point, then spot)
|
|
61
|
-
let cluster_metadata = light_cluster_metadata_by_position(
|
|
62
|
-
coord.xy,
|
|
63
|
-
view_depth,
|
|
64
|
-
vec2(view.width, view.height)
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
let cluster_offset = cluster_metadata.offset;
|
|
68
|
-
let point_count = light_cluster_count_point(cluster_metadata.counts);
|
|
69
|
-
let spot_count = light_cluster_count_spot(cluster_metadata.counts);
|
|
70
|
-
|
|
71
|
-
for (var i = 0u; i < point_count; i++) {
|
|
72
|
-
let light_index = cluster_data[cluster_offset + i];
|
|
73
|
-
|
|
74
|
-
var direct_light = get_point_light_info_by_index(&light_data, light_index, geometry.position);
|
|
75
|
-
|
|
76
|
-
let visibility = shadowmap_get_point_light_visibility(
|
|
77
|
-
&light_data,
|
|
78
|
-
light_index,
|
|
79
|
-
geometry.position,
|
|
80
|
-
geometry.shading_normal
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
direct_light.color *= visibility;
|
|
38
|
+
var context = DirectLightContext(material, geometry, ${REFLECTED_LIGHT_STRUCT.wgsl_ref}());
|
|
84
39
|
|
|
85
|
-
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
40
|
+
shade_direct_lights(&context, geometry.position, geometry.view_direction, coord, view_depth);
|
|
88
41
|
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
for (var j = 0u; j < spot_count; j++) {
|
|
93
|
-
let light_index = cluster_data[cluster_offset + point_count + j];
|
|
94
|
-
|
|
95
|
-
var direct_light = get_spot_light_info_by_index(&light_data, light_index, geometry.position);
|
|
96
|
-
|
|
97
|
-
let visibility = shadowmap_get_spot_light_visibility(
|
|
98
|
-
&light_data,
|
|
99
|
-
light_index,
|
|
100
|
-
geometry.position,
|
|
101
|
-
geometry.shading_normal
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
direct_light.color *= visibility;
|
|
105
|
-
|
|
106
|
-
if (all(direct_light.color == vec3(0.0))) {
|
|
107
|
-
continue;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
re_direct_physical(direct_light, geometry, material, &reflected_light);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
re_direct_multiscatter(geometry, material, &reflected_light);
|
|
42
|
+
re_direct_multiscatter(geometry, material, &context.reflected);
|
|
114
43
|
|
|
115
44
|
var total_emissive_radiance = vec3(material.emissive);
|
|
116
45
|
|
|
117
|
-
let outgoing_light =
|
|
46
|
+
let outgoing_light = context.reflected.diffuse + context.reflected.specular + total_emissive_radiance;
|
|
118
47
|
|
|
119
48
|
return outgoing_light;
|
|
120
49
|
}
|
|
@@ -122,17 +51,8 @@ fn shade_standard_material_direct(
|
|
|
122
51
|
REFLECTED_LIGHT_STRUCT.declaration_chunk,
|
|
123
52
|
GEOMETRIC_SHADING_INFO_STRUCT.declaration_chunk,
|
|
124
53
|
MATERIAL_SHADING_INFO_STRUCT.declaration_chunk,
|
|
125
|
-
|
|
54
|
+
chunk_standard_material_direct_light_lobe,
|
|
55
|
+
chunk_shade_direct_lights,
|
|
126
56
|
chunk_re_direct_multiscatter,
|
|
127
|
-
chunk_light_cluster_metadata_by_position,
|
|
128
|
-
chunk_light_cluster_counts,
|
|
129
|
-
chunk_get_point_light_info_by_index,
|
|
130
|
-
chunk_get_spot_light_info_by_index,
|
|
131
|
-
chunk_shade_directional_lights,
|
|
132
|
-
chunk_shadowmap_get_light_visibility,
|
|
133
57
|
]
|
|
134
58
|
);
|
|
135
|
-
|
|
136
|
-
chunk_shade_standard_material_direct.requireResource(LIGHT_CLUSTER_DATA_RESOURCE);
|
|
137
|
-
chunk_shade_standard_material_direct.requireResource(LIGHT_DATA_RESOURCE);
|
|
138
|
-
chunk_shade_standard_material_direct.requireResource(VIEW_RESOURCE);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunk_shade_standard_material_direct_restir.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/deferred/chunk_shade_standard_material_direct_restir.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chunk_shade_standard_material_direct_restir.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/deferred/chunk_shade_standard_material_direct_restir.js"],"names":[],"mappings":"AASA;;;;;;;;;;;;GAYG;AACH,0DAFU,SAAS,CAiCjB;0BAjDwB,iCAAiC"}
|
|
@@ -4,6 +4,7 @@ import { GEOMETRIC_SHADING_INFO_STRUCT } from "../shader/chunk/material/GEOMETRI
|
|
|
4
4
|
import { MATERIAL_SHADING_INFO_STRUCT } from "../shader/chunk/material/MATERIAL_SHADING_INFO_STRUCT.js";
|
|
5
5
|
import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
6
6
|
import { chunk_shade_directional_lights } from "./chunk_shade_directional_lights.js";
|
|
7
|
+
import { chunk_standard_material_direct_light_lobe } from "./chunk_standard_material_direct_light_lobe.js";
|
|
7
8
|
import { RESTIR_RADIANCE_RESOURCE } from "../restir/di/RESTIR_RADIANCE_RESOURCE.js";
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -29,23 +30,24 @@ fn shade_standard_material_direct(
|
|
|
29
30
|
view_depth: f32,
|
|
30
31
|
) -> vec3<f32>{
|
|
31
32
|
|
|
32
|
-
var
|
|
33
|
+
var context = DirectLightContext(material, geometry, ${REFLECTED_LIGHT_STRUCT.wgsl_ref}());
|
|
33
34
|
|
|
34
|
-
shade_directional_lights(
|
|
35
|
+
shade_directional_lights(&context, geometry.position, geometry.view_direction);
|
|
35
36
|
|
|
36
|
-
re_direct_multiscatter(geometry, material, &
|
|
37
|
+
re_direct_multiscatter(geometry, material, &context.reflected);
|
|
37
38
|
|
|
38
39
|
// ReSTIR-resolved point + spot direct lighting (already visibility-tested).
|
|
39
40
|
let restir_radiance = textureLoad(tRestirRadiance, vec2<u32>(coord), 0).rgb;
|
|
40
41
|
|
|
41
42
|
let total_emissive_radiance = vec3(material.emissive);
|
|
42
43
|
|
|
43
|
-
return
|
|
44
|
+
return context.reflected.diffuse + context.reflected.specular + total_emissive_radiance + restir_radiance;
|
|
44
45
|
}
|
|
45
46
|
`, [
|
|
46
47
|
REFLECTED_LIGHT_STRUCT.declaration_chunk,
|
|
47
48
|
GEOMETRIC_SHADING_INFO_STRUCT.declaration_chunk,
|
|
48
49
|
MATERIAL_SHADING_INFO_STRUCT.declaration_chunk,
|
|
50
|
+
chunk_standard_material_direct_light_lobe,
|
|
49
51
|
chunk_shade_directional_lights,
|
|
50
52
|
chunk_re_direct_multiscatter,
|
|
51
53
|
]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The standard material's lobe for the direct-light loops ({@link chunk_shade_direct_lights},
|
|
3
|
+
* `chunk_shade_directional_lights`): its context carries the material and the geometry at the shaded point and
|
|
4
|
+
* accumulates the reflected light, and each light goes through `re_direct_physical`. Shadows are taken along the
|
|
5
|
+
* shading normal.
|
|
6
|
+
*
|
|
7
|
+
* ```wgsl
|
|
8
|
+
* struct DirectLightContext { material: MaterialShadingInfo, geometry: GeometricShadingInfo, reflected: ReflectedLight }
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* @type {CodeChunk}
|
|
12
|
+
*/
|
|
13
|
+
export const chunk_standard_material_direct_light_lobe: CodeChunk;
|
|
14
|
+
import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
15
|
+
//# sourceMappingURL=chunk_standard_material_direct_light_lobe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk_standard_material_direct_light_lobe.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/deferred/chunk_standard_material_direct_light_lobe.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;GAWG;AACH,wDAFU,SAAS,CAyBjB;0BAtCwB,iCAAiC"}
|