@woosh/meep-engine 3.77.0 → 3.78.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 +3 -2
- package/src/engine/EngineHarness.d.ts +4 -6
- package/src/engine/EngineHarness.d.ts.map +1 -1
- package/src/engine/EngineHarness.js +11 -19
- package/src/engine/sound/sopra/runtime/EventInstance.d.ts +0 -1
- package/src/engine/sound/sopra/runtime/EventInstance.d.ts.map +1 -1
- package/src/engine/sound/sopra/runtime/EventInstance.js +0 -1
- package/src/shade/renderer/extension/ShadowAtlas.d.ts +4 -2
- package/src/shade/renderer/extension/ShadowAtlas.d.ts.map +1 -1
- package/src/shade/renderer/extension/ShadowAtlas.js +4 -2
- package/src/shade/renderer/hair/hair_shadow_draw.d.ts +2 -2
- package/src/shade/renderer/hair/hair_shadow_draw.js +2 -2
- package/src/shade/renderer/rasterize/draw/chunk_meshlet_draw_vertex.d.ts +7 -4
- package/src/shade/renderer/rasterize/draw/chunk_meshlet_draw_vertex.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/draw/chunk_meshlet_draw_vertex.js +66 -14
- package/src/shade/renderer/rasterize/native/depth/shadow_cascade_rasterization_pass_descriptor.d.ts +20 -0
- package/src/shade/renderer/rasterize/native/depth/shadow_cascade_rasterization_pass_descriptor.d.ts.map +1 -0
- package/src/shade/renderer/rasterize/native/depth/shadow_cascade_rasterization_pass_descriptor.js +149 -0
- package/src/shade/renderer/rasterize/native/depth/shadow_rasterization_alpha_tested_pass_descriptor.d.ts +8 -0
- package/src/shade/renderer/rasterize/native/depth/shadow_rasterization_alpha_tested_pass_descriptor.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/depth/shadow_rasterization_alpha_tested_pass_descriptor.js +100 -33
- package/src/shade/renderer/rasterize/native/rasterization_shader_resources.d.ts +11 -0
- package/src/shade/renderer/rasterize/native/rasterization_shader_resources.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/rasterization_shader_resources.js +24 -11
- package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_vertex_normal.d.ts +13 -0
- package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_vertex_normal.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_vertex_normal.js +42 -0
- package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.d.ts.map +1 -1
- package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.js +14 -5
- package/src/shade/renderer/shadow/map/shader/chunk_sample_shadowmap_cascade.d.ts +34 -0
- package/src/shade/renderer/shadow/map/shader/chunk_sample_shadowmap_cascade.d.ts.map +1 -0
- package/src/shade/renderer/shadow/map/shader/chunk_sample_shadowmap_cascade.js +106 -0
- package/src/shade/renderer/shadow/map/shader/chunk_shadow_cascade_caster_position.d.ts +16 -0
- package/src/shade/renderer/shadow/map/shader/chunk_shadow_cascade_caster_position.d.ts.map +1 -0
- package/src/shade/renderer/shadow/map/shader/chunk_shadow_cascade_caster_position.js +50 -0
- package/src/shade/renderer/shadow/map/shader/chunk_shadow_caster_depth_bias.d.ts +25 -0
- package/src/shade/renderer/shadow/map/shader/chunk_shadow_caster_depth_bias.d.ts.map +1 -0
- package/src/shade/renderer/shadow/map/shader/chunk_shadow_caster_depth_bias.js +42 -0
- package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_directional_cascades.d.ts +1 -1
- package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_directional_cascades.js +5 -5
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* How far a cascade's caster vertex is pushed away from the light, in world units: Unreal's cascaded
|
|
5
|
+
* shadow map caster bias (UE 5.4 `ShadowDepthVertexShader.usf`, `FProjectedShadowInfo::UpdateShaderDepthBias`)
|
|
6
|
+
* at its defaults, in texels of the cascade.
|
|
7
|
+
*
|
|
8
|
+
* ```wgsl
|
|
9
|
+
* fn shadow_caster_depth_bias(normal_ws: vec3f, light_direction_ws: vec3f, texel_world_size: f32) -> f32
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* `2.5 texels × (1 + 1.5 × min(tan θ, 1))`, θ the angle between the vertex normal and the light, either
|
|
13
|
+
* facing. The constant is `r.Shadow.CSMDepthBias` (10) times the light's `ShadowBias` (0.5) times the
|
|
14
|
+
* cascade's `WorldSpaceTexelScale`, half a texel, at `ShadowCascadeBiasDistribution` 1. The slope term is
|
|
15
|
+
* that times `r.Shadow.CSMSlopeScaleDepthBias` (3) times the light's `ShadowSlopeBias` (0.5), with the
|
|
16
|
+
* slope clamped at `r.Shadow.ShadowMaxSlopeScaleDepthBias` (1, 45°).
|
|
17
|
+
*
|
|
18
|
+
* It is the caster half of one scheme: the rasterizer adds no bias of its own, and the receiver
|
|
19
|
+
* ({@link chunk_sample_shadowmap_cascade}) takes no offset and compares softly instead.
|
|
20
|
+
*
|
|
21
|
+
* `light_direction_ws` is unit length.
|
|
22
|
+
*
|
|
23
|
+
* @type {CodeChunk}
|
|
24
|
+
*/
|
|
25
|
+
export const chunk_shadow_caster_depth_bias = CodeChunk.from(
|
|
26
|
+
//language=WGSL
|
|
27
|
+
`
|
|
28
|
+
fn shadow_caster_depth_bias(normal_ws: vec3f, light_direction_ws: vec3f, texel_world_size: f32) -> f32 {
|
|
29
|
+
const CONSTANT_TEXELS = 2.5;
|
|
30
|
+
const SLOPE_SCALE = 1.5;
|
|
31
|
+
const MAX_SLOPE = 1.0;
|
|
32
|
+
|
|
33
|
+
// cos(atan(MAX_SLOPE)): below it the slope is clamped anyway
|
|
34
|
+
const MIN_COS = 0.7071067812;
|
|
35
|
+
|
|
36
|
+
let cos_angle = max(abs(dot(normal_ws, light_direction_ws)), MIN_COS);
|
|
37
|
+
// saturate: the dot of two unit vectors can round past 1
|
|
38
|
+
let slope = min(sqrt(saturate(1.0 - cos_angle * cos_angle)) / cos_angle, MAX_SLOPE);
|
|
39
|
+
|
|
40
|
+
return CONSTANT_TEXELS * texel_world_size * (1.0 + SLOPE_SCALE * slope);
|
|
41
|
+
}
|
|
42
|
+
`);
|
package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_directional_cascades.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* `shadowmap_sample_directional` under {@link ShadowDirectionalTechnique.Cascades}. The light's
|
|
3
3
|
* `shadow_directional` record names its cascades as a range of `shadow_cascade` rows (atlas +
|
|
4
4
|
* view-projection each), with CSM cascade blending: {@link shadowmap_csm_compute_cascade_blended} picks
|
|
5
|
-
* among them, and the one or two it picks are read again here to sample.
|
|
5
|
+
* among them, and the one or two it picks are read again here to sample, by {@link chunk_sample_shadowmap_cascade}.
|
|
6
6
|
*
|
|
7
7
|
* A light whose record names no cascades — a frame where the renderer has just switched to virtual
|
|
8
8
|
* maps and not yet rebuilt them — finds no cascade and is lit.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LIGHT_DATABASE_SPEC } from "../../../light/LIGHT_DATABASE_SPEC.js";
|
|
2
2
|
import { INCIDENT_LIGHT_STRUCT } from "../../../shader/chunk/light/INCIDENT_LIGHT_STRUCT.js";
|
|
3
3
|
import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
|
|
4
|
-
import {
|
|
4
|
+
import { chunk_sample_shadowmap_cascade } from "./chunk_sample_shadowmap_cascade.js";
|
|
5
5
|
import { chunk_shadowmap_csm_compute_cascade_blended } from "./chunk_shadowmap_csm_compute_cascade_blended.js";
|
|
6
6
|
|
|
7
7
|
const SHADOW_DIRECTIONAL_DESCRIPTOR = LIGHT_DATABASE_SPEC.get('shadow_directional');
|
|
@@ -11,7 +11,7 @@ const CASCADE_DESCRIPTOR = LIGHT_DATABASE_SPEC.get('shadow_cascade');
|
|
|
11
11
|
* `shadowmap_sample_directional` under {@link ShadowDirectionalTechnique.Cascades}. The light's
|
|
12
12
|
* `shadow_directional` record names its cascades as a range of `shadow_cascade` rows (atlas +
|
|
13
13
|
* view-projection each), with CSM cascade blending: {@link shadowmap_csm_compute_cascade_blended} picks
|
|
14
|
-
* among them, and the one or two it picks are read again here to sample.
|
|
14
|
+
* among them, and the one or two it picks are read again here to sample, by {@link chunk_sample_shadowmap_cascade}.
|
|
15
15
|
*
|
|
16
16
|
* A light whose record names no cascades — a frame where the renderer has just switched to virtual
|
|
17
17
|
* maps and not yet rebuilt them — finds no cascade and is lit.
|
|
@@ -44,7 +44,7 @@ fn shadowmap_sample_directional(
|
|
|
44
44
|
return 1.0;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
// Runtime-opaque upper bound keeps DXC from duplicating
|
|
47
|
+
// Runtime-opaque upper bound keeps DXC from duplicating sample_shadowmap_cascade twice per directional light.
|
|
48
48
|
let two = select(2u, shadowmap.cascade_count, shadowmap.cascade_count == 0x7fffffffu);
|
|
49
49
|
let sample_count = select(1u, two, cascade_info.blend > 0.0);
|
|
50
50
|
|
|
@@ -55,7 +55,7 @@ fn shadowmap_sample_directional(
|
|
|
55
55
|
let idx = select(cascade_info.index_0, cascade_info.index_1, c > 0u);
|
|
56
56
|
let cascade_meta = ${CASCADE_DESCRIPTOR.marshalling_method_read}(database, idx);
|
|
57
57
|
|
|
58
|
-
let v =
|
|
58
|
+
let v = sample_shadowmap_cascade(
|
|
59
59
|
cascade_meta.projection,
|
|
60
60
|
position_ws,
|
|
61
61
|
surface_normal_ws,
|
|
@@ -79,7 +79,7 @@ fn shadowmap_sample_directional(
|
|
|
79
79
|
`, [
|
|
80
80
|
SHADOW_DIRECTIONAL_DESCRIPTOR.chunk_read,
|
|
81
81
|
CASCADE_DESCRIPTOR.chunk_read,
|
|
82
|
-
|
|
82
|
+
chunk_sample_shadowmap_cascade,
|
|
83
83
|
chunk_shadowmap_csm_compute_cascade_blended,
|
|
84
84
|
]
|
|
85
85
|
);
|