@woosh/meep-engine 3.11.0 → 3.11.2
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/ecs/storage/populateEngineSerializationRegistry.d.ts.map +1 -1
- package/src/engine/ecs/storage/populateEngineSerializationRegistry.js +294 -290
- package/src/engine/graphics3/ParticipatingMedia.d.ts +111 -0
- package/src/engine/graphics3/ParticipatingMedia.d.ts.map +1 -0
- package/src/engine/graphics3/ParticipatingMedia.js +203 -0
- package/src/engine/graphics3/ParticipatingMediaSerializationAdapter.d.ts +34 -0
- package/src/engine/graphics3/ParticipatingMediaSerializationAdapter.d.ts.map +1 -0
- package/src/engine/graphics3/ParticipatingMediaSerializationAdapter.js +73 -0
- package/src/engine/graphics3/ParticipatingMediaSystem3.d.ts +87 -0
- package/src/engine/graphics3/ParticipatingMediaSystem3.d.ts.map +1 -0
- package/src/engine/graphics3/ParticipatingMediaSystem3.js +184 -0
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/shade/playground/volumetrics_froxel/README.md +191 -0
- package/src/shade/playground/volumetrics_froxel/index.html +270 -0
- package/src/shade/playground/volumetrics_froxel/main.d.ts +2 -0
- package/src/shade/playground/volumetrics_froxel/main.d.ts.map +1 -0
- package/src/shade/playground/volumetrics_froxel/main.js +917 -0
- package/src/shade/playground/volumetrics_froxel/measure.d.ts +119 -0
- package/src/shade/playground/volumetrics_froxel/measure.d.ts.map +1 -0
- package/src/shade/playground/volumetrics_froxel/measure.js +559 -0
- package/src/shade/renderer/Renderer.d.ts +13 -0
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +45 -18
- package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
- package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_point2.d.ts +14 -13
- package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_point2.d.ts.map +1 -1
- package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_point2.js +133 -129
- package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/GPUViewVolumetrics.js +480 -315
- package/src/shade/renderer/volumetrics/NOTES.md +691 -9
- package/src/shade/renderer/volumetrics/ParticipatingMediaVolume.d.ts +5 -0
- package/src/shade/renderer/volumetrics/ParticipatingMediaVolume.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/ParticipatingMediaVolume.js +21 -2
- package/src/shade/renderer/volumetrics/SceneVolumetrics.d.ts +26 -0
- package/src/shade/renderer/volumetrics/SceneVolumetrics.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/SceneVolumetrics.js +64 -21
- package/src/shade/renderer/volumetrics/VOLUMETRICS_METADATA_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/VOLUMETRICS_METADATA_STRUCT.js +84 -28
- package/src/shade/renderer/volumetrics/VOLUMETRICS_SUN_SHADOW_RESOLUTION.d.ts +98 -0
- package/src/shade/renderer/volumetrics/VOLUMETRICS_SUN_SHADOW_RESOLUTION.d.ts.map +1 -0
- package/src/shade/renderer/volumetrics/VOLUMETRICS_SUN_SHADOW_RESOLUTION.js +111 -0
- package/src/shade/renderer/volumetrics/build_volumetrics_sun_shadow_transform.d.ts +84 -0
- package/src/shade/renderer/volumetrics/build_volumetrics_sun_shadow_transform.d.ts.map +1 -0
- package/src/shade/renderer/volumetrics/build_volumetrics_sun_shadow_transform.js +252 -0
- package/src/shade/renderer/volumetrics/chunk_camera_ray_planar_depth_scale.d.ts +21 -0
- package/src/shade/renderer/volumetrics/chunk_camera_ray_planar_depth_scale.d.ts.map +1 -0
- package/src/shade/renderer/volumetrics/chunk_camera_ray_planar_depth_scale.js +47 -0
- package/src/shade/renderer/volumetrics/chunk_integrate_optical_depth.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/chunk_integrate_optical_depth.js +75 -64
- package/src/shade/renderer/volumetrics/chunk_volumetrics_froxel_content_offset.d.ts +37 -0
- package/src/shade/renderer/volumetrics/chunk_volumetrics_froxel_content_offset.d.ts.map +1 -0
- package/src/shade/renderer/volumetrics/chunk_volumetrics_froxel_content_offset.js +56 -0
- package/src/shade/renderer/volumetrics/chunk_volumetrics_local_light_shadow.d.ts +43 -0
- package/src/shade/renderer/volumetrics/chunk_volumetrics_local_light_shadow.d.ts.map +1 -0
- package/src/shade/renderer/volumetrics/chunk_volumetrics_local_light_shadow.js +145 -0
- package/src/shade/renderer/volumetrics/chunk_volumetrics_sample_froxel_extinction.d.ts +20 -0
- package/src/shade/renderer/volumetrics/chunk_volumetrics_sample_froxel_extinction.d.ts.map +1 -0
- package/src/shade/renderer/volumetrics/chunk_volumetrics_sample_froxel_extinction.js +48 -0
- package/src/shade/renderer/volumetrics/chunk_volumetrics_sun_optical_depth.d.ts +38 -0
- package/src/shade/renderer/volumetrics/chunk_volumetrics_sun_optical_depth.d.ts.map +1 -0
- package/src/shade/renderer/volumetrics/chunk_volumetrics_sun_optical_depth.js +107 -0
- package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts +4 -1
- package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/graph_build_volumetrics.js +577 -465
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.js +418 -324
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_scattering_lut.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_scattering_lut.js +14 -3
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_sun_shadow_volume.d.ts +8 -0
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_sun_shadow_volume.d.ts.map +1 -0
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_sun_shadow_volume.js +174 -0
- package/src/shade/renderer/volumetrics/volumetrics_position_world_to_froxel_uvw.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/volumetrics_position_world_to_froxel_uvw.js +48 -36
- package/src/shade/wgsl/emulator/CPUBitmapData.d.ts +25 -0
- package/src/shade/wgsl/emulator/CPUBitmapData.d.ts.map +1 -1
- package/src/shade/wgsl/emulator/CPUBitmapData.js +33 -0
- package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.js +2221 -2215
- package/src/shade/wgsl/emulator/WGSLLanguageCore.d.ts.map +1 -1
- package/src/shade/wgsl/emulator/WGSLLanguageCore.js +1297 -1117
- package/src/shade/wgsl/emulator/cpu_texture_gather.d.ts +69 -0
- package/src/shade/wgsl/emulator/cpu_texture_gather.d.ts.map +1 -0
- package/src/shade/wgsl/emulator/cpu_texture_gather.js +148 -0
- package/src/shade/wgsl/emulator/cpu_texture_sample.d.ts +16 -0
- package/src/shade/wgsl/emulator/cpu_texture_sample.d.ts.map +1 -1
- package/src/shade/wgsl/emulator/cpu_texture_sample.js +176 -172
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Renderer.d.ts","sourceRoot":"","sources":["../../../../src/shade/renderer/Renderer.js"],"names":[],"mappings":"AA4FA;IAOI,0BAEC;IAED;;OAEG;IACH,0BAAQ;IAER;;;;;;OAMG;IACH,kDAEC;IAED;;OAEG;IACH,kBAAO;IAYP;;;OAGG;IACH,2BAEC;IAaD,0CAGC;IAED,uCAEC;IAED;;;;OAIG;IACH,wBAFU,yBAAyB,CAEoB;IAEvD,6BAA4B;IAC5B,8BAA4B;IAC5B;;;;OAIG;IACH,mCAAkC;IAClC;;;;;;;OAOG;IACH,mCAFU,OAAO,CAEyB;IAC1C,+BAA6B;IAC7B,4CAA0C;
|
|
1
|
+
{"version":3,"file":"Renderer.d.ts","sourceRoot":"","sources":["../../../../src/shade/renderer/Renderer.js"],"names":[],"mappings":"AA4FA;IAOI,0BAEC;IAED;;OAEG;IACH,0BAAQ;IAER;;;;;;OAMG;IACH,kDAEC;IAED;;OAEG;IACH,kBAAO;IAYP;;;OAGG;IACH,2BAEC;IAaD,0CAGC;IAED,uCAEC;IAED;;;;OAIG;IACH,wBAFU,yBAAyB,CAEoB;IAEvD,6BAA4B;IAC5B,8BAA4B;IAC5B;;;;OAIG;IACH,mCAAkC;IAClC;;;;;;;OAOG;IACH,mCAFU,OAAO,CAEyB;IAC1C,+BAA6B;IAC7B,4CAA0C;IAkB1C,uCAKC;IArBD;;;;;;;;;;OAUG;IACH,oCAGC;IASD;;;;;;;OAOG;IACH,0BAFU,OAAO,CAEe;IAQhC;;;;;OAKG;IACH,sCAOC;IAjBD,mCAEC;IAiBD;;;;;;;;;OASG;IACH,6BAFU,OAAO,CAEmB;IAWpC;;;;;OAKG;IACH,8BAA+C;IAE/C;;;;;;;;OAQG;IACH,6BAFU,OAAO,CAEmB;IAEpC;;;;;;;;;;;;;;OAcG;IACH,8BAFU,OAAO,CAEoB;IAErC;;;;;;;;;;OAUG;IACH,qBAFU,OAAO,CAEW;IAU5B;;;;;OAKG;IACH,wBAA0C;IAE1C;;;;;;;;OAQG;IACH,eAFU,UAAU,GAAC,QAAQ,CAEF;IAU3B;;;;OAIG;IACH,gCAAwD;IAExD;;;;;;;;;;;;OAYG;IACH,gBAFU,OAAO,CAEK;IAEtB;;;OAGG;IACH,4BAFU,OAAO,CAEiB;IAKlC;;;OAGG;IACH,yBAEC;IAOD;;;OAGG;IACH,gCAEC;IAcD;;;;;;;;;OASG;IACH,qBAA+B;IAE/B,wBAA+B;IAE/B;;;OAGG;IACH,kBAA4B;IAiB5B;;;OAGG;IACH,2CAeC;IAED;;;OAGG;IACH,wCAEC;IA0BD;;;OAGG;IACH,iCAEC;IAED;;;;OAIG;IACH,2BAEC;IAQD;;;OAGG;IACH,+CAIC;IAED;;;OAGG;IACH,gDAIC;IAwCD;;;OAGG;IACH,6BAcC;IA1BD;;;OAGG;IACH,0BAEC;IA4BD;;;;;;;;;;;;;;;;;;;OAmBG;IACH,iBAFU,oBAAkB,IAAI,CAET;IAEvB;;OAEG;IACH;;;;;;;;;;;;;;OAcG;IACH,2DAEC;IAED;;;;;OAKG;IACH,8CAFa,OAAO,CAInB;IAED;;;OAGG;IACH,uBAHW,UAAU,GACR,MAAM,CAIlB;IAGD,sCAIC;IAeD;;;;OAIG;IACH,iCAFY,gBAAgB,CAW3B;IAED;;;OAGG;IACH,6BAYC;IAED;;;;OAIG;IACH,wCAFa,2BAA2B,CAcvC;IAGD;;;OAGG;IACH,+BAuBC;IAmMD;;;;OAIG;IACH,0BAEC;IAgBD;;;;;;OAMG;IACH,cAFU,iBAAiB,CAEU;IAErC;;;;;;OAMG;IACH,eAgBC;IAiFD;;;;;OAKG;IACH,+EA0NC;IAED;;OAEG;IACH,gBAGC;IAQD,4BAwBC;IAqID;;;;;OAKG;IACH,UAHW,MAAM,KACN,MAAM,QAgBhB;IAoFD,0CAMC;IAED;;;;;;;;;;OAUG;IACH,qEAHW,MAAM,GACJ,OAAO,CAsBnB;IAED;;;;;;;;;;;;;;;OAeG;IACH,8EAJW,MAAM,UACN,iBAAiB,GACf,OAAO,CAi3BnB;;CACJ;6BA16E4B,yBAAyB;0CACZ,gCAAgC;2BApB/C,yCAAyC;6BAFvC,4CAA4C;8BAD3C,2CAA2C;4BAiC7C,uBAAuB;gCAtCnB,sBAAsB;mBArCnC,oCAAoC;oBACnC,4BAA4B;kCAuEd,gCAAgC;2BApDvC,2BAA2B;iCAkDrB,0CAA0C;4CApC/B,+DAA+D;yBA6BlF,yBAAyB;kCAMhB,wBAAwB;oBAvBtC,0BAA0B;uCAPP,sDAAsD"}
|
|
@@ -16,21 +16,8 @@ import { CameraManager } from "./camera/CameraManager.js";
|
|
|
16
16
|
import { shader_background } from "./deferred/shader_background.js";
|
|
17
17
|
import { shader_composite_volumetrics } from "./deferred/shader_composite_volumetrics.js";
|
|
18
18
|
import { shader_deferred_main, shader_deferred_main_restir } from "./deferred/shader_deferred_main.js";
|
|
19
|
-
import { ReSTIRDI } from "./restir/di/ReSTIRDI.js";
|
|
20
19
|
import { shader_tonemap_HDR } from "./deferred/shader_tonemap_HDR.js";
|
|
21
20
|
import { shader_tonemap_LDR } from "./deferred/shader_tonemap_LDR.js";
|
|
22
|
-
import { G_BUFFER_MIP_LEVELS } from "./gbuffer/G_BUFFER_MIP_LEVELS.js";
|
|
23
|
-
import {
|
|
24
|
-
graph_rasterize_meshes_transparent_oit
|
|
25
|
-
} from "./rasterize/native/oit/graph_rasterize_meshes_transparent_oit.js";
|
|
26
|
-
import {
|
|
27
|
-
viz_rasterization_alpha_tested_pass_descriptor
|
|
28
|
-
} from "./rasterize/native/viz/viz_rasterization_alpha_tested_pass_descriptor.js";
|
|
29
|
-
import {
|
|
30
|
-
viz_rasterization_opaque_pass_descriptor
|
|
31
|
-
} from "./rasterize/native/viz/viz_rasterization_opaque_pass_descriptor.js";
|
|
32
|
-
import { RasterizationJob } from "./rasterize/RasterizationJob.js";
|
|
33
|
-
import { graph_rasterize_scene } from "./rasterize/standard/graph_rasterize_scene.js";
|
|
34
21
|
import { FrameContext } from "./extension/FrameContext.js";
|
|
35
22
|
import { FramePhase } from "./extension/FramePhase.js";
|
|
36
23
|
import { GBufferTextures } from "./extension/GBufferTextures.js";
|
|
@@ -38,6 +25,7 @@ import { PresentTarget } from "./extension/PresentTarget.js";
|
|
|
38
25
|
import { RenderExtensionRegistry } from "./extension/RenderExtensionRegistry.js";
|
|
39
26
|
import { SceneColor } from "./extension/SceneColor.js";
|
|
40
27
|
import { ViewTextures } from "./extension/ViewTextures.js";
|
|
28
|
+
import { G_BUFFER_MIP_LEVELS } from "./gbuffer/G_BUFFER_MIP_LEVELS.js";
|
|
41
29
|
import { shader_brick4_diffuse } from "./global_illumination/brick4/gpu/draw/shader_brick4_diffuse.js";
|
|
42
30
|
import {
|
|
43
31
|
shader_brick4_indirect_lighting
|
|
@@ -53,24 +41,36 @@ import { graph_build_light_clusters } from "./light/cluster/graph_build_light_cl
|
|
|
53
41
|
import { AccumulatingPathTracer } from "./path_tracer/accumulating/AccumulatingPathTracer.js";
|
|
54
42
|
import { graph_postprocess_bloom } from "./postprocess/bloom/graph_postprocess_bloom.js";
|
|
55
43
|
import { shader_ffx_rcas } from "./postprocess/cas/shader_ffx_rcas.js";
|
|
44
|
+
import { DepthOfFieldU } from "./postprocess/dof/gather/DepthOfFieldU.js";
|
|
45
|
+
import { DepthOfField } from "./postprocess/dof/raymarch/DepthOfField.js";
|
|
56
46
|
import { GPUCameraExposureManager } from "./postprocess/eye/GPUCameraExposureManager.js";
|
|
47
|
+
import { MotionBlur } from "./postprocess/motion_blur/MotionBlur.js";
|
|
57
48
|
import { NSS } from "./postprocess/nss/NSS.js";
|
|
58
49
|
import { PostProcess } from "./postprocess/PostProcess.js";
|
|
59
50
|
import { shader_depth_occlusion_clip } from "./postprocess/taa/shader_depth_occlusion_clip.js";
|
|
60
51
|
import { TAA } from "./postprocess/taa/TAA.js";
|
|
61
|
-
import { MotionBlur } from "./postprocess/motion_blur/MotionBlur.js";
|
|
62
|
-
import { DepthOfField } from "./postprocess/dof/raymarch/DepthOfField.js";
|
|
63
|
-
import { DepthOfFieldU } from "./postprocess/dof/gather/DepthOfFieldU.js";
|
|
64
52
|
import { graph_add_per_object_velocity } from "./postprocess/velocity/graph_add_per_object_velocity.js";
|
|
53
|
+
import { shader_debug_velocity } from "./postprocess/velocity/shader_debug_velocity.js";
|
|
54
|
+
import {
|
|
55
|
+
graph_rasterize_meshes_transparent_oit
|
|
56
|
+
} from "./rasterize/native/oit/graph_rasterize_meshes_transparent_oit.js";
|
|
57
|
+
import {
|
|
58
|
+
viz_rasterization_alpha_tested_pass_descriptor
|
|
59
|
+
} from "./rasterize/native/viz/viz_rasterization_alpha_tested_pass_descriptor.js";
|
|
60
|
+
import {
|
|
61
|
+
viz_rasterization_opaque_pass_descriptor
|
|
62
|
+
} from "./rasterize/native/viz/viz_rasterization_opaque_pass_descriptor.js";
|
|
63
|
+
import { RasterizationJob } from "./rasterize/RasterizationJob.js";
|
|
64
|
+
import { graph_rasterize_scene } from "./rasterize/standard/graph_rasterize_scene.js";
|
|
65
|
+
import { ReSTIRDI } from "./restir/di/ReSTIRDI.js";
|
|
65
66
|
import { SceneManager } from "./scene/SceneManager.js";
|
|
66
67
|
import { ShadeIndirectLightingMode } from "./ShadeIndirectLightingMode.js";
|
|
67
|
-
import { ShadeUpscalerType } from "./ShadeUpscalerType.js";
|
|
68
68
|
import { graph_image_pass } from "./shader/graph/graph_image_pass.js";
|
|
69
69
|
import { graph_import_buffer } from "./shader/graph/graph_import_buffer.js";
|
|
70
70
|
import { graph_import_texture } from "./shader/graph/graph_import_texture.js";
|
|
71
|
+
import { ShadeUpscalerType } from "./ShadeUpscalerType.js";
|
|
71
72
|
import { CascadedSceneSDF } from "./shadow/sdf/cascade/CascadedSceneSDF.js";
|
|
72
73
|
import { STATIC_GRAPHICS_ENGINE_ASSETS } from "./STATIC_GRAPHICS_ENGINE_ASSETS.js";
|
|
73
|
-
import { shader_debug_velocity } from "./postprocess/velocity/shader_debug_velocity.js";
|
|
74
74
|
import { GPUTextureContext } from "./texture/GPUTextureContext.js";
|
|
75
75
|
import { RenderTarget } from "./texture/RenderTarget.js";
|
|
76
76
|
import { View } from "./view/View.js";
|
|
@@ -187,6 +187,29 @@ export class Renderer {
|
|
|
187
187
|
feature_bloom_enabled = true;
|
|
188
188
|
feature_automatic_exposure_enabled = true;
|
|
189
189
|
|
|
190
|
+
/**
|
|
191
|
+
* Fixed exposure, in f-stops, used when {@link feature_automatic_exposure_enabled} is off.
|
|
192
|
+
*
|
|
193
|
+
* Turning adaptation off without being able to set this leaves the frame at 2 stops, which is
|
|
194
|
+
* black for any scene the eye would otherwise have opened up for — so the flag alone is not
|
|
195
|
+
* usable. Anything comparing two renders wants adaptation off and this pinned: eye adaptation
|
|
196
|
+
* keeps drifting for seconds after a change, which makes two shots of the *same* setting differ
|
|
197
|
+
* by more than the change being judged.
|
|
198
|
+
*
|
|
199
|
+
* @returns {number}
|
|
200
|
+
*/
|
|
201
|
+
get exposure_compensation() {
|
|
202
|
+
// the manager is built in initialize(); before that there is no value to report
|
|
203
|
+
return this.#autoexposure === undefined ? 0 : this.#autoexposure.exposure_compensation;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
set exposure_compensation(v) {
|
|
207
|
+
assert.isNumber(v, 'exposure_compensation');
|
|
208
|
+
assert.defined(this.#autoexposure, 'autoexposure (set exposure_compensation after initialize)');
|
|
209
|
+
|
|
210
|
+
this.#autoexposure.exposure_compensation = v;
|
|
211
|
+
}
|
|
212
|
+
|
|
190
213
|
/**
|
|
191
214
|
* Virtual texture streaming (opt-in per material via
|
|
192
215
|
* {@link StandardShadeMaterial#vt_stack}). This flag is the system-wide
|
|
@@ -2244,6 +2267,8 @@ export class Renderer {
|
|
|
2244
2267
|
|
|
2245
2268
|
if (this.#feature_enabled_transparencies) {
|
|
2246
2269
|
// do transparent alpha pass
|
|
2270
|
+
graph.push_scope("transparencies");
|
|
2271
|
+
|
|
2247
2272
|
current_color_out = graph_rasterize_meshes_transparent_oit({
|
|
2248
2273
|
graph,
|
|
2249
2274
|
buckets: gr_render_buckets,
|
|
@@ -2265,6 +2290,8 @@ export class Renderer {
|
|
|
2265
2290
|
|
|
2266
2291
|
indirect_lighting_mode: this.indirect_lighting_mode,
|
|
2267
2292
|
});
|
|
2293
|
+
|
|
2294
|
+
graph.pop_scope();
|
|
2268
2295
|
}
|
|
2269
2296
|
|
|
2270
2297
|
frame.phase = FramePhase.AfterTransparency;
|
|
@@ -49,7 +49,7 @@ export class NSS {
|
|
|
49
49
|
* @returns {number}
|
|
50
50
|
*/
|
|
51
51
|
static recommended_jitter_sequence_size(upscale_ratio: number): number;
|
|
52
|
-
static "__#
|
|
52
|
+
static "__#132@#preprocess_tensor_descriptor"(render_w: any, render_h: any): TextureResourceDescriptor;
|
|
53
53
|
/**
|
|
54
54
|
* @param {GraphicsContext} graphics
|
|
55
55
|
*/
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Cone-sampled point shadow PCF
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* comparable.
|
|
2
|
+
* Cone-sampled point shadow PCF: 8 random directions inside a cone around the receiver-to-light
|
|
3
|
+
* vector, each re-encoded to the light's octahedral map, one `textureLoad` per tap, ending in
|
|
4
|
+
* {@link chunk_contact_harden_pcf_kernel}. Tap directions come from {@link chunk_random}, which the
|
|
5
|
+
* calling shader (deferred lighting / volumetrics) initialises per invocation, so neighbouring
|
|
6
|
+
* pixels decorrelate without a rotation table or a blue-noise disk.
|
|
8
7
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* \`textureLoad\` and the loop ends in {@link chunk_contact_harden_pcf_kernel} unchanged.
|
|
8
|
+
* The aperture is the GDC bulb-radius scaling in {@link chunk_max_penumbra_percentage}; the factor
|
|
9
|
+
* of 2 carries over the texels → tangent-plane conversion an earlier disk-based variant used (1
|
|
10
|
+
* atlas texel ≈ 2/face_dim of Δn.xy near the +Z pole), so the angular footprint stays comparable.
|
|
13
11
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
12
|
+
* Addressing: `atlas_aabb` is the INNER octahedral surface, and the cube → octahedral remap
|
|
13
|
+
* surrounds it with a `SHADOWMAP_ATLAS_BORDER`-texel skirt holding
|
|
14
|
+
* `inner[texture_octahedral_wrap_texel_coordinates(local)]`. Under the bilinear convention
|
|
15
|
+
* `uv * size - 0.5` a uv on the edge of the square rounds to -1 or `size` — one texel into that
|
|
16
|
+
* skirt, which is this light's own wrapped data. The encode always lands in [0, 1]² and the round
|
|
17
|
+
* can overshoot by at most one texel, so the aperture needs no clamp.
|
|
17
18
|
*
|
|
18
19
|
* @see chunk_cone_sample_direction
|
|
19
20
|
* @type {CodeChunk}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunk_shadowmap_sample_point2.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_point2.js"],"names":[],"mappings":"AAgBA
|
|
1
|
+
{"version":3,"file":"chunk_shadowmap_sample_point2.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_point2.js"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,4CAFU,SAAS,CAiGjB;0BA3HwB,uCAAuC"}
|
|
@@ -1,129 +1,133 @@
|
|
|
1
|
-
import { LIGHT_DATABASE_SPEC } from "../../../light/LIGHT_DATABASE_SPEC.js";
|
|
2
|
-
import { chunk_cone_sample_direction } from "../../../shader/chunk/geometry/cone/chunk_cone_sample_direction.js";
|
|
3
|
-
import {
|
|
4
|
-
chunk_uv_octahedral_unit_encode
|
|
5
|
-
} from "../../../shader/chunk/geometry/octahedron/chunk_uv_octahedral_unit_encode.js";
|
|
6
|
-
import { chunk_random } from "../../../shader/chunk/random/chunk_random.js";
|
|
7
|
-
import { chunk_random_round_vec2 } from "../../../shader/chunk/random/chunk_random_round_vec2.js";
|
|
8
|
-
import { chunk_random_vec2 } from "../../../shader/chunk/random/chunk_random_vec2.js";
|
|
9
|
-
import { chunk_uv_to_texel_coordinate } from "../../../shader/chunk/texture/chunk_uv_to_texel_coordinate.js";
|
|
10
|
-
import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
|
|
11
|
-
import { chunk_get_shadow_offsets } from "./chunk_get_shadow_offsets.js";
|
|
12
|
-
import { chunk_contact_harden_pcf_kernel } from "./dpcf/chunk_contact_harden_pcf_kernel.js";
|
|
13
|
-
import { chunk_max_penumbra_percentage } from "./dpcf/chunk_max_penumbra_percentage.js";
|
|
14
|
-
|
|
15
|
-
const SHADOW_POINT_DESCRIPTOR = LIGHT_DATABASE_SPEC.get('shadow_point');
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Cone-sampled point shadow PCF
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* the
|
|
32
|
-
* this light's
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* @
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
let
|
|
57
|
-
let
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
let
|
|
61
|
-
let
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
let
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
let
|
|
75
|
-
let
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
//
|
|
79
|
-
//
|
|
80
|
-
//
|
|
81
|
-
let cone_aperture = 2.0 * max_penumbra_percentage(light_radius, light_radius);
|
|
82
|
-
|
|
83
|
-
var occluders: f32 = 0.0;
|
|
84
|
-
var occluder_dist_sum: f32 = 0.0;
|
|
85
|
-
|
|
86
|
-
for (var tap: u32 = 0u; tap < 8u; tap++) {
|
|
87
|
-
|
|
88
|
-
let xi = random_vec2();
|
|
89
|
-
|
|
90
|
-
let perturbed_dir = cone_sample_direction(dir_light_to_surface, cone_aperture, xi);
|
|
91
|
-
|
|
92
|
-
let octahedral_uv = uv_octahedral_unit_encode(perturbed_dir);
|
|
93
|
-
let local_texel = uv_to_texel_coordinate(octahedral_uv, face_size);
|
|
94
|
-
|
|
95
|
-
//
|
|
96
|
-
let rounded_local_texel = random_round_vec2(local_texel);
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
let
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
1
|
+
import { LIGHT_DATABASE_SPEC } from "../../../light/LIGHT_DATABASE_SPEC.js";
|
|
2
|
+
import { chunk_cone_sample_direction } from "../../../shader/chunk/geometry/cone/chunk_cone_sample_direction.js";
|
|
3
|
+
import {
|
|
4
|
+
chunk_uv_octahedral_unit_encode
|
|
5
|
+
} from "../../../shader/chunk/geometry/octahedron/chunk_uv_octahedral_unit_encode.js";
|
|
6
|
+
import { chunk_random } from "../../../shader/chunk/random/chunk_random.js";
|
|
7
|
+
import { chunk_random_round_vec2 } from "../../../shader/chunk/random/chunk_random_round_vec2.js";
|
|
8
|
+
import { chunk_random_vec2 } from "../../../shader/chunk/random/chunk_random_vec2.js";
|
|
9
|
+
import { chunk_uv_to_texel_coordinate } from "../../../shader/chunk/texture/chunk_uv_to_texel_coordinate.js";
|
|
10
|
+
import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
|
|
11
|
+
import { chunk_get_shadow_offsets } from "./chunk_get_shadow_offsets.js";
|
|
12
|
+
import { chunk_contact_harden_pcf_kernel } from "./dpcf/chunk_contact_harden_pcf_kernel.js";
|
|
13
|
+
import { chunk_max_penumbra_percentage } from "./dpcf/chunk_max_penumbra_percentage.js";
|
|
14
|
+
|
|
15
|
+
const SHADOW_POINT_DESCRIPTOR = LIGHT_DATABASE_SPEC.get('shadow_point');
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Cone-sampled point shadow PCF: 8 random directions inside a cone around the receiver-to-light
|
|
19
|
+
* vector, each re-encoded to the light's octahedral map, one `textureLoad` per tap, ending in
|
|
20
|
+
* {@link chunk_contact_harden_pcf_kernel}. Tap directions come from {@link chunk_random}, which the
|
|
21
|
+
* calling shader (deferred lighting / volumetrics) initialises per invocation, so neighbouring
|
|
22
|
+
* pixels decorrelate without a rotation table or a blue-noise disk.
|
|
23
|
+
*
|
|
24
|
+
* The aperture is the GDC bulb-radius scaling in {@link chunk_max_penumbra_percentage}; the factor
|
|
25
|
+
* of 2 carries over the texels → tangent-plane conversion an earlier disk-based variant used (1
|
|
26
|
+
* atlas texel ≈ 2/face_dim of Δn.xy near the +Z pole), so the angular footprint stays comparable.
|
|
27
|
+
*
|
|
28
|
+
* Addressing: `atlas_aabb` is the INNER octahedral surface, and the cube → octahedral remap
|
|
29
|
+
* surrounds it with a `SHADOWMAP_ATLAS_BORDER`-texel skirt holding
|
|
30
|
+
* `inner[texture_octahedral_wrap_texel_coordinates(local)]`. Under the bilinear convention
|
|
31
|
+
* `uv * size - 0.5` a uv on the edge of the square rounds to -1 or `size` — one texel into that
|
|
32
|
+
* skirt, which is this light's own wrapped data. The encode always lands in [0, 1]² and the round
|
|
33
|
+
* can overshoot by at most one texel, so the aperture needs no clamp.
|
|
34
|
+
*
|
|
35
|
+
* @see chunk_cone_sample_direction
|
|
36
|
+
* @type {CodeChunk}
|
|
37
|
+
*/
|
|
38
|
+
export const chunk_shadowmap_sample_point2 = CodeChunk.from(
|
|
39
|
+
//language=WGSL
|
|
40
|
+
`
|
|
41
|
+
fn shadowmap_sample_point(
|
|
42
|
+
database: ptr<storage, array<u32>>,
|
|
43
|
+
shadow_id: u32,
|
|
44
|
+
position_ws: vec3f,
|
|
45
|
+
surface_normal_ws: vec3f,
|
|
46
|
+
light_position_ws: vec3f,
|
|
47
|
+
light_max_distance: f32,
|
|
48
|
+
light_radius: f32,
|
|
49
|
+
) -> f32 {
|
|
50
|
+
const NORMAL_BIAS_SCALE = 2.0;
|
|
51
|
+
const DEPTH_OFFSET_BIAS = 0.0001;
|
|
52
|
+
|
|
53
|
+
let atlas_aabb = ${SHADOW_POINT_DESCRIPTOR.marshalling_method_read}(database, shadow_id);
|
|
54
|
+
|
|
55
|
+
// unbiased distance and light direction, used to compute the bias amounts
|
|
56
|
+
let to_light_unbiased = light_position_ws - position_ws;
|
|
57
|
+
let dist_to_light_unbiased = length(to_light_unbiased);
|
|
58
|
+
let light_direction = to_light_unbiased / max(dist_to_light_unbiased, 1e-6);
|
|
59
|
+
|
|
60
|
+
let world_pixel_size = 2.0 * dist_to_light_unbiased / max(atlas_aabb.z, 1.0);
|
|
61
|
+
let shadowmap_bias = get_shadow_offsets(surface_normal_ws, light_direction);
|
|
62
|
+
let normal_offset = world_pixel_size * shadowmap_bias.x * surface_normal_ws * NORMAL_BIAS_SCALE;
|
|
63
|
+
|
|
64
|
+
// re-evaluate direction and distance from the normal-biased position
|
|
65
|
+
let to_surface = (position_ws + normal_offset) - light_position_ws;
|
|
66
|
+
let distance_to_center = length(to_surface);
|
|
67
|
+
|
|
68
|
+
// Direction the cube faces captured: FROM LIGHT TO SURFACE
|
|
69
|
+
let dir_light_to_surface = to_surface / max(distance_to_center, 1e-6);
|
|
70
|
+
|
|
71
|
+
let face_size = vec2u(atlas_aabb.zw);
|
|
72
|
+
|
|
73
|
+
// reverse-Z convention: close to light -> 1, at or beyond light_max_distance -> 0.
|
|
74
|
+
let radial = distance_to_center / max(light_max_distance, 1e-6);
|
|
75
|
+
let depth_bias = DEPTH_OFFSET_BIAS * shadowmap_bias.y;
|
|
76
|
+
let reference_depth = (1.0 - saturate(radial)) + depth_bias;
|
|
77
|
+
|
|
78
|
+
// Cone aperture (~ tan of the half-angle). max_penumbra_percentage is the GDC formula mapping
|
|
79
|
+
// bulb radius to a fraction of the atlas face; the 2× factor is the texels → tangent-plane
|
|
80
|
+
// conversion. Unclamped — see the header on why any aperture stays addressable.
|
|
81
|
+
let cone_aperture = 2.0 * max_penumbra_percentage(light_radius, light_radius);
|
|
82
|
+
|
|
83
|
+
var occluders: f32 = 0.0;
|
|
84
|
+
var occluder_dist_sum: f32 = 0.0;
|
|
85
|
+
|
|
86
|
+
for (var tap: u32 = 0u; tap < 8u; tap++) {
|
|
87
|
+
|
|
88
|
+
let xi = random_vec2();
|
|
89
|
+
|
|
90
|
+
let perturbed_dir = cone_sample_direction(dir_light_to_surface, cone_aperture, xi);
|
|
91
|
+
|
|
92
|
+
let octahedral_uv = uv_octahedral_unit_encode(perturbed_dir);
|
|
93
|
+
let local_texel = uv_to_texel_coordinate(octahedral_uv, face_size);
|
|
94
|
+
|
|
95
|
+
// one of the two neighbours at random rather than a blend of them: stochastic bilinear
|
|
96
|
+
let rounded_local_texel = random_round_vec2(local_texel);
|
|
97
|
+
|
|
98
|
+
// Signed: the round reaches -1 at a uv of 0, and the skirt is where that tap belongs. Via
|
|
99
|
+
// u32 the -1 would be an indeterminate conversion — 0xFFFFFFFF reaches the skirt through
|
|
100
|
+
// the wrapping add, 0 silently reads the opposite edge of the inner surface. i32 is exact
|
|
101
|
+
// here, and the inner origin is at least SHADOWMAP_ATLAS_BORDER, so the sum is positive.
|
|
102
|
+
let sample_texel = vec2<u32>(vec2<i32>(rounded_local_texel) + vec2<i32>(atlas_aabb.xy));
|
|
103
|
+
|
|
104
|
+
let stored = textureLoad(shadowmapAtlas, sample_texel, 0);
|
|
105
|
+
let dist = stored - reference_depth;
|
|
106
|
+
|
|
107
|
+
// Per-tap binary compare; reverse-Z + step(0, stored - ref) ⇒ 1 = occluded.
|
|
108
|
+
let occluded = step(0.0, dist);
|
|
109
|
+
|
|
110
|
+
occluders += occluded;
|
|
111
|
+
occluder_dist_sum += dist * occluded;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return contact_harden_pcf_kernel(
|
|
115
|
+
occluders,
|
|
116
|
+
occluder_dist_sum,
|
|
117
|
+
reference_depth,
|
|
118
|
+
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
`, [
|
|
122
|
+
SHADOW_POINT_DESCRIPTOR.chunk_read,
|
|
123
|
+
chunk_cone_sample_direction,
|
|
124
|
+
chunk_contact_harden_pcf_kernel,
|
|
125
|
+
chunk_get_shadow_offsets,
|
|
126
|
+
chunk_max_penumbra_percentage,
|
|
127
|
+
chunk_random,
|
|
128
|
+
chunk_uv_octahedral_unit_encode,
|
|
129
|
+
chunk_uv_to_texel_coordinate,
|
|
130
|
+
chunk_random_round_vec2,
|
|
131
|
+
chunk_random_vec2,
|
|
132
|
+
]
|
|
133
|
+
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GPUViewVolumetrics.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/volumetrics/GPUViewVolumetrics.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GPUViewVolumetrics.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/volumetrics/GPUViewVolumetrics.js"],"names":[],"mappings":"AA4BA;IAyHI;;;;OAIG;IACH,qDAqBC;IA/GD;;OAEG;IACH,8BAOC;IAjBD;;OAEG;IACH,2BAEC;IA6BD;;OAEG;IACH,4BAEC;IAZD;;OAEG;IACH,yBAEC;IAwFD,gBAWC;IAiND;;;;;;;OAOG;IACH;;;MAyEC;;CAEJ"}
|