@woosh/meep-engine 2.109.5 → 2.109.7
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/build/bundle-worker-terrain.js +1 -1
- package/build/meep.cjs +211 -179
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +211 -179
- package/editor/tools/v2/TransformControls.js +39 -33
- package/package.json +1 -1
- package/src/core/bvh2/bvh3/BVH.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/BVH.js +8 -0
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js +11 -9
- package/src/core/collection/queue/Deque.d.ts.map +1 -1
- package/src/core/collection/queue/Deque.js +8 -5
- package/src/core/geom/3d/Ray3.js +1 -1
- package/src/core/geom/3d/aabb/AABB3.js +1 -1
- package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.d.ts +4 -4
- package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.d.ts.map +1 -1
- package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.js +15 -11
- package/src/core/geom/3d/normal/octahedron/encode_unit_to_octahedron.d.ts.map +1 -1
- package/src/core/geom/3d/normal/octahedron/encode_unit_to_octahedron.js +13 -7
- package/src/core/geom/3d/normal/octahedron/encoding.spec.js +26 -1
- package/src/core/geom/3d/normal/octahedron/prototype.d.ts +2 -0
- package/src/core/geom/3d/normal/octahedron/prototype.d.ts.map +1 -0
- package/src/core/geom/3d/normal/octahedron/prototype.js +226 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate_bl.d.ts +1 -1
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate_bl.js +4 -4
- package/src/core/geom/3d/tetrahedra/triangle/triangle_encode_rasterized_depth.d.ts +7 -1
- package/src/core/geom/3d/tetrahedra/triangle/triangle_encode_rasterized_depth.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/triangle/triangle_encode_rasterized_depth.js +6 -0
- package/src/core/geom/vec3/v3_distance.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_distance.js +5 -5
- package/src/core/geometry/3d/tetrahedra/tetrahedral_mesh_find_tets_attached_to_vertex.d.ts +10 -0
- package/src/core/geometry/3d/tetrahedra/tetrahedral_mesh_find_tets_attached_to_vertex.d.ts.map +1 -0
- package/src/core/geometry/3d/tetrahedra/tetrahedral_mesh_find_tets_attached_to_vertex.js +34 -0
- package/src/core/model/node-graph/json/serializeNodeGraphToJSON.d.ts +5 -1
- package/src/core/model/node-graph/json/serializeNodeGraphToJSON.d.ts.map +1 -1
- package/src/core/model/node-graph/json/serializeNodeGraphToJSON.js +11 -6
- package/src/engine/asset/loaders/AssetLoader.d.ts.map +1 -1
- package/src/engine/asset/loaders/AssetLoader.js +1 -1
- package/src/engine/asset/loaders/material/computeTextureEquality.d.ts.map +1 -1
- package/src/engine/asset/loaders/material/computeTextureEquality.js +6 -1
- package/src/engine/asset/loaders/material/computeTextureHash.d.ts.map +1 -1
- package/src/engine/asset/loaders/material/computeTextureHash.js +8 -3
- package/src/engine/graphics/geometry/instancing/InstancedMeshGroup.d.ts.map +1 -1
- package/src/engine/graphics/geometry/instancing/InstancedMeshGroup.js +9 -15
- package/src/engine/graphics/geometry/instancing/geometry_copy.d.ts +7 -0
- package/src/engine/graphics/geometry/instancing/geometry_copy.d.ts.map +1 -0
- package/src/engine/graphics/geometry/instancing/geometry_copy.js +15 -0
- package/src/engine/graphics/impostors/octahedral/ImpostorBaker.d.ts.map +1 -1
- package/src/engine/graphics/impostors/octahedral/ImpostorBaker.js +28 -20
- package/src/engine/graphics/impostors/octahedral/ImpostorCaptureType.d.ts +1 -0
- package/src/engine/graphics/impostors/octahedral/ImpostorCaptureType.d.ts.map +1 -1
- package/src/engine/graphics/impostors/octahedral/ImpostorCaptureType.js +4 -0
- package/src/engine/graphics/impostors/octahedral/grid/OctahedralUvEncoder.js +6 -6
- package/src/engine/graphics/impostors/octahedral/prototypeBaker.js +16 -7
- package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.d.ts +3 -2
- package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.d.ts.map +1 -1
- package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.js +25 -14
- package/src/engine/graphics/render/visibility/hiz/buildCanvasViewFromTexture.js +1 -0
- package/src/engine/graphics/sh3/gi/material/MaterialTransformer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/gi/material/MaterialTransformer.js +48 -33
- package/src/engine/graphics/sh3/gi/material/common.glsl +434 -0
- package/src/engine/graphics/sh3/gi/material/makeLookupTexture3D.d.ts +8 -0
- package/src/engine/graphics/sh3/gi/material/makeLookupTexture3D.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/makeLookupTexture3D.js +35 -0
- package/src/engine/graphics/sh3/gi/material/makeOctahedralDepthAtlas.d.ts +8 -0
- package/src/engine/graphics/sh3/gi/material/makeOctahedralDepthAtlas.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/makeOctahedralDepthAtlas.js +28 -0
- package/src/engine/graphics/sh3/gi/material/space_fragment/build_fragment_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/space_fragment/build_fragment_shader.js +53 -0
- package/src/engine/graphics/sh3/gi/material/space_fragment/build_vertex_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/space_fragment/build_vertex_shader.js +29 -0
- package/src/engine/graphics/sh3/gi/material/space_fragment/space_fragment_transform_shader.d.ts +9 -0
- package/src/engine/graphics/sh3/gi/material/space_fragment/space_fragment_transform_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/space_fragment/space_fragment_transform_shader.js +12 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/build_fragment_shader.d.ts +6 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/build_fragment_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/build_fragment_shader.js +26 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/build_vertex_shader.d.ts +6 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/build_vertex_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/build_vertex_shader.js +62 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/preable.frag.glsl +43 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/preable.vert.glsl +9 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/space_vertex_transform_shader.d.ts +9 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/space_vertex_transform_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/space_vertex_transform_shader.js +12 -0
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts +2 -0
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.js +35 -3
- package/src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.js +67 -8
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts +10 -0
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js +27 -41
- package/src/engine/graphics/sh3/lpv/depth/octahedral/OctahedralDepthDebuggerWidget.d.ts +17 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/OctahedralDepthDebuggerWidget.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/OctahedralDepthDebuggerWidget.js +100 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.d.ts +12 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.js +58 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/shader/OctahedralDepthVisualizationMaterial.d.ts +11 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/shader/OctahedralDepthVisualizationMaterial.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/shader/OctahedralDepthVisualizationMaterial.js +45 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/shader/visualize.frag.glsl +126 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/shader/visualize.vert.glsl +10 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/v2/VLPDepthMapVisualisation.d.ts +13 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/v2/VLPDepthMapVisualisation.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/v2/VLPDepthMapVisualisation.js +146 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/v2/visualise.frag.glsl +159 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/v2/visualise.vert.glsl +13 -0
- package/src/engine/graphics/sh3/lpv/depth/sh3_bake_depth.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/{sh3_bake_depth.js → depth/sh3_bake_depth.js} +7 -7
- package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.d.ts +3 -6
- package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.js +34 -58
- package/src/engine/graphics/sh3/lpv/serialization/LightProbeVolumeSerializationAdapter.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/serialization/LightProbeVolumeSerializationAdapter.js +8 -0
- package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.d.ts +2 -2
- package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.js +8 -5
- package/src/engine/graphics/sh3/path_tracer/populate_path_traced_scene_from_ecd.d.ts +7 -0
- package/src/engine/graphics/sh3/path_tracer/populate_path_traced_scene_from_ecd.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/populate_path_traced_scene_from_ecd.js +50 -0
- package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +40 -3
- package/src/engine/graphics/sh3/path_tracer/sorting/build_bvh_nodes_distances_along_ray.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/{build_bvh_nodes_distances_along_ray.js → sorting/build_bvh_nodes_distances_along_ray.js} +2 -2
- package/src/engine/graphics/sh3/path_tracer/sorting/build_bvh_nodes_distances_sqr_to_point.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/{build_bvh_nodes_distances_sqr_to_point.js → sorting/build_bvh_nodes_distances_sqr_to_point.js} +2 -2
- package/src/engine/graphics/sh3/path_tracer/sorting/sort_bvh_nodes_by_distance_to_point.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/{sort_bvh_nodes_by_distance_to_point.js → sorting/sort_bvh_nodes_by_distance_to_point.js} +3 -3
- package/src/engine/graphics/sh3/prototypeSH3Probe.js +40 -7
- package/src/engine/graphics/sh3/shader/SH3VisualisationMaterial.d.ts.map +1 -0
- package/src/engine/graphics/sh3/shader/SH3VisualisationMaterial.js +29 -0
- package/src/engine/graphics/sh3/shader/visualize.frag.glsl +41 -0
- package/src/engine/graphics/sh3/shader/visualize.vert.glsl +9 -0
- package/src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.js +1 -1
- package/src/engine/graphics/texture/debug_preview_texture.d.ts +8 -0
- package/src/engine/graphics/texture/debug_preview_texture.d.ts.map +1 -0
- package/src/engine/graphics/texture/debug_preview_texture.js +38 -0
- package/src/engine/graphics/texture/virtual/prototype.js +4 -3
- package/src/view/View.d.ts.map +1 -1
- package/src/view/View.js +2 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate_filament.d.ts +0 -8
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate_filament.d.ts.map +0 -1
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate_filament.js +0 -32
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band1.d.ts +0 -8
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band1.d.ts.map +0 -1
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band1.js +0 -44
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band2.d.ts +0 -8
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band2.d.ts.map +0 -1
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band2.js +0 -86
- package/src/engine/graphics/sh3/SH3VisualisationMaterial.d.ts.map +0 -1
- package/src/engine/graphics/sh3/SH3VisualisationMaterial.js +0 -83
- package/src/engine/graphics/sh3/gi/material/build_fragment_shader.d.ts.map +0 -1
- package/src/engine/graphics/sh3/gi/material/build_fragment_shader.js +0 -71
- package/src/engine/graphics/sh3/gi/material/build_vertex_shader.d.ts.map +0 -1
- package/src/engine/graphics/sh3/gi/material/build_vertex_shader.js +0 -256
- package/src/engine/graphics/sh3/lpv/sh3_bake_depth.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/build_bvh_nodes_distances_along_ray.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/build_bvh_nodes_distances_sqr_to_point.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/ray_reflect.d.ts +0 -2
- package/src/engine/graphics/sh3/path_tracer/ray_reflect.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/ray_reflect.js +0 -27
- package/src/engine/graphics/sh3/path_tracer/sort_bvh_nodes_by_distance_to_point.d.ts.map +0 -1
- /package/src/engine/graphics/sh3/gi/material/{build_fragment_shader.d.ts → space_fragment/build_fragment_shader.d.ts} +0 -0
- /package/src/engine/graphics/sh3/gi/material/{build_vertex_shader.d.ts → space_fragment/build_vertex_shader.d.ts} +0 -0
- /package/src/engine/graphics/sh3/lpv/{sh3_bake_depth.d.ts → depth/sh3_bake_depth.d.ts} +0 -0
- /package/src/engine/graphics/sh3/path_tracer/{build_bvh_nodes_distances_along_ray.d.ts → sorting/build_bvh_nodes_distances_along_ray.d.ts} +0 -0
- /package/src/engine/graphics/sh3/path_tracer/{build_bvh_nodes_distances_sqr_to_point.d.ts → sorting/build_bvh_nodes_distances_sqr_to_point.d.ts} +0 -0
- /package/src/engine/graphics/sh3/path_tracer/{sort_bvh_nodes_by_distance_to_point.d.ts → sorting/sort_bvh_nodes_by_distance_to_point.d.ts} +0 -0
- /package/src/engine/graphics/sh3/{SH3VisualisationMaterial.d.ts → shader/SH3VisualisationMaterial.d.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Vector3 } from "three";
|
|
2
2
|
import { BinaryDataType } from "../../../../../core/binary/type/BinaryDataType.js";
|
|
3
3
|
import { AABB3 } from "../../../../../core/geom/3d/aabb/AABB3.js";
|
|
4
4
|
import { aabb3_from_v3_array } from "../../../../../core/geom/3d/aabb/aabb3_from_v3_array.js";
|
|
@@ -7,38 +7,29 @@ import { composeCompile } from "../../../material/composeCompile.js";
|
|
|
7
7
|
import { AbstractMaterialTransformer } from "../../../material/manager/AbstractMaterialTransformer.js";
|
|
8
8
|
import { isLitMaterial } from "../../../render/forward_plus/plugin/isLitMaterial.js";
|
|
9
9
|
import { AttributeDataTexture } from "../../../texture/AttributeDataTexture.js";
|
|
10
|
-
import { vector_buffer_to_attribute_texture } from "../../lpv/probe_volume_to_textures.js";
|
|
10
|
+
import { octahedral_depth_to_atlas, vector_buffer_to_attribute_texture } from "../../lpv/probe_volume_to_textures.js";
|
|
11
11
|
import { tetrahedral_mesh_to_texture } from "../tetrahedral_mesh_to_texture.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
12
|
+
import { makeLookupTexture3D } from "./makeLookupTexture3D.js";
|
|
13
|
+
import { makeOctahedralDepthAtlas } from "./makeOctahedralDepthAtlas.js";
|
|
14
|
+
import { space_fragment_transform_shader } from "./space_fragment/space_fragment_transform_shader.js";
|
|
15
|
+
import { space_vertex_transform_shader } from "./space_vertex/space_vertex_transform_shader.js";
|
|
14
16
|
|
|
15
17
|
const PROPERTY_TRANSFORMER_MARKER = '@light-probe-volume-material-transformer';
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
lookup.magFilter = NearestFilter;
|
|
32
|
-
lookup.minFilter = NearestFilter;
|
|
33
|
-
|
|
34
|
-
lookup.type = UnsignedIntType;
|
|
35
|
-
lookup.format = RedIntegerFormat;
|
|
36
|
-
lookup.internalFormat = "R32UI";
|
|
37
|
-
|
|
38
|
-
lookup.needsUpdate = true;
|
|
39
|
-
|
|
40
|
-
return lookup;
|
|
41
|
-
}
|
|
19
|
+
/**
|
|
20
|
+
* Where should probes be resolved?
|
|
21
|
+
* @enum {number}
|
|
22
|
+
*/
|
|
23
|
+
const ProbeResolutionSpace = {
|
|
24
|
+
/**
|
|
25
|
+
* Cheaper, but less precise
|
|
26
|
+
*/
|
|
27
|
+
Vertex: 0,
|
|
28
|
+
/**
|
|
29
|
+
* More expensive, necessary for large geometries with few vertices
|
|
30
|
+
*/
|
|
31
|
+
Fragment: 1
|
|
32
|
+
};
|
|
42
33
|
|
|
43
34
|
export class MaterialTransformer extends AbstractMaterialTransformer {
|
|
44
35
|
|
|
@@ -48,9 +39,15 @@ export class MaterialTransformer extends AbstractMaterialTransformer {
|
|
|
48
39
|
*/
|
|
49
40
|
#volume = null;
|
|
50
41
|
|
|
51
|
-
#mesh_lookup =
|
|
42
|
+
#mesh_lookup = makeLookupTexture3D(32);
|
|
52
43
|
#mesh_bounds = new AABB3();
|
|
53
44
|
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* @type {ProbeResolutionSpace|number}
|
|
48
|
+
*/
|
|
49
|
+
#space = ProbeResolutionSpace.Fragment
|
|
50
|
+
|
|
54
51
|
#textures = {
|
|
55
52
|
vertex: new AttributeDataTexture(
|
|
56
53
|
AttributeSpec.fromJSON({
|
|
@@ -87,7 +84,8 @@ export class MaterialTransformer extends AbstractMaterialTransformer {
|
|
|
87
84
|
normalized: false
|
|
88
85
|
}),
|
|
89
86
|
256, 9
|
|
90
|
-
)
|
|
87
|
+
),
|
|
88
|
+
depth: makeOctahedralDepthAtlas()
|
|
91
89
|
};
|
|
92
90
|
|
|
93
91
|
#uniforms = {
|
|
@@ -107,6 +105,10 @@ export class MaterialTransformer extends AbstractMaterialTransformer {
|
|
|
107
105
|
type: "t",
|
|
108
106
|
value: this.#textures.harmonics.texture
|
|
109
107
|
},
|
|
108
|
+
lpv_t_probe_depth: {
|
|
109
|
+
type: "t",
|
|
110
|
+
value: this.#textures.depth
|
|
111
|
+
},
|
|
110
112
|
lpv_t_mesh_lookup: {
|
|
111
113
|
type: "t",
|
|
112
114
|
value: this.#mesh_lookup
|
|
@@ -134,8 +136,16 @@ export class MaterialTransformer extends AbstractMaterialTransformer {
|
|
|
134
136
|
#onBeforeCompile = (shader) => {
|
|
135
137
|
Object.assign(shader.uniforms, this.#uniforms);
|
|
136
138
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
+
switch (this.#space) {
|
|
140
|
+
case ProbeResolutionSpace.Vertex:
|
|
141
|
+
space_vertex_transform_shader(shader);
|
|
142
|
+
break;
|
|
143
|
+
case ProbeResolutionSpace.Fragment:
|
|
144
|
+
space_fragment_transform_shader(shader);
|
|
145
|
+
break;
|
|
146
|
+
default:
|
|
147
|
+
throw new Error(`Unsupported resolution space ${this.#space}`);
|
|
148
|
+
}
|
|
139
149
|
};
|
|
140
150
|
|
|
141
151
|
#materials = [];
|
|
@@ -166,6 +176,7 @@ export class MaterialTransformer extends AbstractMaterialTransformer {
|
|
|
166
176
|
super();
|
|
167
177
|
|
|
168
178
|
this.#volume = volume;
|
|
179
|
+
|
|
169
180
|
}
|
|
170
181
|
|
|
171
182
|
update_bounds() {
|
|
@@ -250,9 +261,13 @@ export class MaterialTransformer extends AbstractMaterialTransformer {
|
|
|
250
261
|
tetrahedral_mesh_to_texture(
|
|
251
262
|
this.#textures.vertex, this.#textures.neighbour, lpv.mesh
|
|
252
263
|
);
|
|
264
|
+
octahedral_depth_to_atlas(lpv, this.#textures.depth.image.data, this.#textures.depth.image.width);
|
|
265
|
+
this.#textures.depth.needsUpdate = true;
|
|
253
266
|
|
|
254
267
|
console.timeEnd('prepareTextures');
|
|
255
268
|
|
|
269
|
+
console.log(this.#textures);
|
|
270
|
+
|
|
256
271
|
for (let i = 0; i < this.#materials.length; i++) {
|
|
257
272
|
const material = this.#materials[i];
|
|
258
273
|
|
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
#ifndef LPV_SHADER_CHUNK_COMMON
|
|
2
|
+
#define LPV_SHADER_CHUNK_COMMON
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
uniform usampler2D lpv_t_mesh_vertices;
|
|
6
|
+
uniform usampler2D lpv_t_mesh_neighbours;
|
|
7
|
+
uniform usampler3D lpv_t_mesh_lookup;
|
|
8
|
+
|
|
9
|
+
uniform sampler2D lpv_t_probe_positions;
|
|
10
|
+
uniform sampler2D lpv_t_probe_data;
|
|
11
|
+
uniform sampler2D lpv_t_probe_depth;
|
|
12
|
+
|
|
13
|
+
uniform uint lpv_u_mesh_tet_count;
|
|
14
|
+
uniform vec3 lpv_v3_bounds_min;
|
|
15
|
+
uniform vec3 lpv_v3_bounds_max;
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
#define SEARCH_STEP_LIMIT 64u
|
|
19
|
+
#define INVALID_TET 1073741823u
|
|
20
|
+
|
|
21
|
+
ivec2 lpv_index_to_256_coordinate(uint index) {
|
|
22
|
+
|
|
23
|
+
uint pixel_x = index % 256u;
|
|
24
|
+
uint pixel_y = index / 256u;
|
|
25
|
+
|
|
26
|
+
return ivec2(int(pixel_x), int(pixel_y));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
uvec4 lpv_mesh_getVertices(uint tet_index) {
|
|
30
|
+
ivec2 p = lpv_index_to_256_coordinate(tet_index);
|
|
31
|
+
|
|
32
|
+
return texelFetch(lpv_t_mesh_vertices, p, 0);
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
uvec4 lpv_mesh_getNeighbours(uint tet_index) {
|
|
37
|
+
ivec2 p = lpv_index_to_256_coordinate(tet_index);
|
|
38
|
+
|
|
39
|
+
return texelFetch(lpv_t_mesh_neighbours, p, 0);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
vec3[9] lpv_probe_getData(uint probe_index) {
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
int slot = int(probe_index % 256u);
|
|
46
|
+
int column = int(probe_index / 256u);
|
|
47
|
+
|
|
48
|
+
int offset_x = int(slot * 9);
|
|
49
|
+
|
|
50
|
+
vec3[9] result;
|
|
51
|
+
|
|
52
|
+
for (int i = 0; i < 9; i++) {
|
|
53
|
+
result[i] = texelFetch(lpv_t_probe_data, ivec2(offset_x + i, column), 0).rgb;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
vec3 sign_not_zero(vec3 x) {
|
|
60
|
+
return vec3(
|
|
61
|
+
x.x >= 0.0 ? 1.0 : -1.0,
|
|
62
|
+
x.y >= 0.0 ? 1.0 : -1.0,
|
|
63
|
+
x.z >= 0.0 ? 1.0 : -1.0
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
vec4 quadBlendWieghts(vec2 coords)
|
|
68
|
+
{
|
|
69
|
+
vec4 res;
|
|
70
|
+
/* 0 0 0
|
|
71
|
+
0 0 0
|
|
72
|
+
1 0 0 */
|
|
73
|
+
res.x = min(1.0f - coords.x, 1.0f - coords.y);
|
|
74
|
+
/* 1 0 0
|
|
75
|
+
0 0 0
|
|
76
|
+
0 0 1 */
|
|
77
|
+
res.y = abs(coords.x - coords.y);
|
|
78
|
+
/* 0 0 1
|
|
79
|
+
0 0 0
|
|
80
|
+
0 0 0 */
|
|
81
|
+
res.z = min(coords.x, coords.y);
|
|
82
|
+
/* 0 0 0
|
|
83
|
+
0 0 1
|
|
84
|
+
0 1 1 */
|
|
85
|
+
res.w = ceil(coords.x - coords.y);
|
|
86
|
+
//res.xyz /= (res.x + res.y + res.z);
|
|
87
|
+
return res;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
//vec2 VecToSphereOct(vec3 direction)
|
|
91
|
+
//{
|
|
92
|
+
// vec3 octant = sign_not_zero(direction);
|
|
93
|
+
//
|
|
94
|
+
// // |x| + |y| + |z| = 1
|
|
95
|
+
// float sum = dot(direction, octant);
|
|
96
|
+
// vec3 octahedron = direction / sum;
|
|
97
|
+
//
|
|
98
|
+
// if (direction.z < 0.0)
|
|
99
|
+
// {
|
|
100
|
+
// vec3 absolute = abs(octahedron);
|
|
101
|
+
//
|
|
102
|
+
// octahedron.xy = octant.xy * vec2(1.0f - absolute.y, 1.0f - absolute.x);
|
|
103
|
+
// }
|
|
104
|
+
//
|
|
105
|
+
// return octahedron.xy;
|
|
106
|
+
//}
|
|
107
|
+
|
|
108
|
+
vec2 VecToSphereOct(vec3 direction)
|
|
109
|
+
{
|
|
110
|
+
vec3 octant = sign_not_zero(direction);
|
|
111
|
+
|
|
112
|
+
// |x| + |y| + |z| = 1
|
|
113
|
+
float sum = dot(direction, octant);
|
|
114
|
+
vec3 octahedron = direction / sum;
|
|
115
|
+
|
|
116
|
+
if (direction.y < 0.0)
|
|
117
|
+
{
|
|
118
|
+
vec3 absolute = abs(octahedron);
|
|
119
|
+
|
|
120
|
+
octahedron.xz = octant.xz * vec2(1.0f - absolute.z, 1.0f - absolute.x);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return octahedron.xz;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
float SampleBlended(sampler2D tex, vec2 uv0, vec2 uv1, vec2 uv2, vec4 weights) {
|
|
127
|
+
|
|
128
|
+
float samp0 = textureLod(tex, uv0, 0.0).r;
|
|
129
|
+
float samp1 = textureLod(tex, uv1, 0.0).r;
|
|
130
|
+
float samp2 = textureLod(tex, uv2, 0.0).r;
|
|
131
|
+
|
|
132
|
+
return samp0 * weights.x + samp1 * weights.y + samp2 * weights.z;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
float lpv_probe_getDepth(uint probe_index, vec3 direction) {
|
|
136
|
+
// get offset
|
|
137
|
+
uint depth_tile_resolution = 24u;
|
|
138
|
+
uvec2 atlas_size = uvec2(4096u);
|
|
139
|
+
|
|
140
|
+
uint tiles_per_row = atlas_size.x / depth_tile_resolution;
|
|
141
|
+
|
|
142
|
+
uint tile_x = probe_index % tiles_per_row;
|
|
143
|
+
uint tile_y = probe_index / tiles_per_row;
|
|
144
|
+
|
|
145
|
+
vec2 tile_offset = vec2(
|
|
146
|
+
tile_x * depth_tile_resolution,
|
|
147
|
+
tile_y * depth_tile_resolution
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
// convert direction to UV
|
|
151
|
+
vec2 octahedral_uv = clamp(VecToSphereOct(direction) * 0.5 + 0.5, 0.0, 1.0);
|
|
152
|
+
vec2 grid = octahedral_uv * vec2(depth_tile_resolution - 1u);
|
|
153
|
+
|
|
154
|
+
vec2 gridFrac = fract(grid);
|
|
155
|
+
vec2 gridFloor = floor(grid);
|
|
156
|
+
|
|
157
|
+
vec4 weights = quadBlendWieghts(gridFrac);
|
|
158
|
+
|
|
159
|
+
//3 nearest frames
|
|
160
|
+
vec2 frame0 = gridFloor;
|
|
161
|
+
vec2 frame1 = gridFloor + mix(vec2(0, 1), vec2(1, 0), weights.w);
|
|
162
|
+
vec2 frame2 = gridFloor + vec2(1.0, 1.0);
|
|
163
|
+
|
|
164
|
+
// move frames to atlas space
|
|
165
|
+
frame0 += tile_offset;
|
|
166
|
+
frame1 += tile_offset;
|
|
167
|
+
frame2 += tile_offset;
|
|
168
|
+
|
|
169
|
+
vec2 uv0 = (frame0 + 0.5) / vec2(atlas_size);
|
|
170
|
+
vec2 uv1 = (frame1 + 0.5) / vec2(atlas_size);
|
|
171
|
+
vec2 uv2 = (frame2 + 0.5) / vec2(atlas_size);
|
|
172
|
+
|
|
173
|
+
return textureLod(lpv_t_probe_depth,uv0,0.0).r;
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
return SampleBlended(
|
|
177
|
+
lpv_t_probe_depth,
|
|
178
|
+
uv0, uv1, uv2,
|
|
179
|
+
weights
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
vec3 lpv_probe_getPosition(uint probe_index) {
|
|
184
|
+
return texelFetch(lpv_t_probe_positions, lpv_index_to_256_coordinate(probe_index), 0).rgb;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
mat3 lpv_mesh_makeMatrix(vec3 p0, vec3 p1, vec3 p2, vec3 p3) {
|
|
188
|
+
|
|
189
|
+
return inverse(
|
|
190
|
+
mat3(
|
|
191
|
+
p0 - p3,
|
|
192
|
+
p1 - p3,
|
|
193
|
+
p2 - p3
|
|
194
|
+
)
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
vec4 lpv_mesh_getBarycentricCoordinates(uint tet_index, vec3 position) {
|
|
200
|
+
uvec4 vertices = lpv_mesh_getVertices(tet_index);
|
|
201
|
+
|
|
202
|
+
vec3 p0 = lpv_probe_getPosition(vertices[0]);
|
|
203
|
+
vec3 p1 = lpv_probe_getPosition(vertices[1]);
|
|
204
|
+
vec3 p2 = lpv_probe_getPosition(vertices[2]);
|
|
205
|
+
vec3 p3 = lpv_probe_getPosition(vertices[3]);
|
|
206
|
+
|
|
207
|
+
mat3 matrix = lpv_mesh_makeMatrix(p0, p1, p2, p3);
|
|
208
|
+
|
|
209
|
+
vec3 mult = matrix * (position - p3);
|
|
210
|
+
|
|
211
|
+
return vec4(mult, 1.0 - mult.x - mult.y - mult.z);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
void lpv_getTetrahedron(
|
|
215
|
+
in vec3 position,
|
|
216
|
+
in uint tet_guess,
|
|
217
|
+
out uint tet_index,
|
|
218
|
+
out vec4 weights
|
|
219
|
+
) {
|
|
220
|
+
uint came_from = 0u;
|
|
221
|
+
|
|
222
|
+
tet_index = tet_guess;
|
|
223
|
+
|
|
224
|
+
for (uint i = 0u; i < SEARCH_STEP_LIMIT; i++) {
|
|
225
|
+
|
|
226
|
+
weights = lpv_mesh_getBarycentricCoordinates(tet_index, position);
|
|
227
|
+
|
|
228
|
+
if (weights.x >= 0.0 && weights.y >= 0.0 && weights.z >= 0.0 && weights.w >= 0.0) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
uvec4 neighbors = lpv_mesh_getNeighbours(tet_index);
|
|
233
|
+
|
|
234
|
+
uint next_tet;
|
|
235
|
+
|
|
236
|
+
// Otherwise find the smallest barycentric coord and move in that direction
|
|
237
|
+
if (weights.x < weights.y && weights.x < weights.z && weights.x < weights.w) {
|
|
238
|
+
next_tet = neighbors[0];
|
|
239
|
+
} else if (weights.y < weights.z && weights.y < weights.w) {
|
|
240
|
+
next_tet = neighbors[1];
|
|
241
|
+
} else if (weights.z < weights.w) {
|
|
242
|
+
next_tet = neighbors[2];
|
|
243
|
+
} else {
|
|
244
|
+
next_tet = neighbors[3];
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (next_tet == came_from) {
|
|
248
|
+
// numerical instability caused us to oscillate on the boundary
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
came_from = tet_index;
|
|
253
|
+
tet_index = next_tet;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
tet_index = INVALID_TET;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
float lpv_probe_getVisibilityMask(vec3 position, uint probe_index) {
|
|
260
|
+
|
|
261
|
+
vec3 probe_position = lpv_probe_getPosition(probe_index);
|
|
262
|
+
|
|
263
|
+
vec3 local_probe_offset = probe_position - position;
|
|
264
|
+
|
|
265
|
+
vec3 direction = normalize(local_probe_offset);
|
|
266
|
+
|
|
267
|
+
float depth = lpv_probe_getDepth(probe_index, direction);
|
|
268
|
+
|
|
269
|
+
return step(length(local_probe_offset), depth);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
vec4 lvp_mask_weights_by_visibility(vec3 position, uint tet_index, vec4 weights) {
|
|
273
|
+
|
|
274
|
+
uvec4 vertices = lpv_mesh_getVertices(tet_index);
|
|
275
|
+
|
|
276
|
+
vec4 visibility = vec4(
|
|
277
|
+
lpv_probe_getVisibilityMask(position, vertices[0]),
|
|
278
|
+
lpv_probe_getVisibilityMask(position, vertices[1]),
|
|
279
|
+
lpv_probe_getVisibilityMask(position, vertices[2]),
|
|
280
|
+
lpv_probe_getVisibilityMask(position, vertices[3])
|
|
281
|
+
);
|
|
282
|
+
|
|
283
|
+
return visibility * weights;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
vec4 lvp_mask_weights_by_visibility_by_normal(vec3 position, vec3 normal, uint tet_index, vec4 weights) {
|
|
287
|
+
|
|
288
|
+
uvec4 vertices = lpv_mesh_getVertices(tet_index);
|
|
289
|
+
|
|
290
|
+
vec4 visibility;
|
|
291
|
+
|
|
292
|
+
for (int i = 0; i < 4; i++) {
|
|
293
|
+
vec3 probe_position = lpv_probe_getPosition(vertices[i]);
|
|
294
|
+
|
|
295
|
+
vec3 direction_to_probe = position - probe_position;
|
|
296
|
+
|
|
297
|
+
visibility[i] = step(dot(direction_to_probe, normal),0.0);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
return visibility * weights;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
vec3[9] lpv_interpolate_probes(vec4 weights, uint tet_index) {
|
|
304
|
+
|
|
305
|
+
uvec4 vertices = lpv_mesh_getVertices(tet_index);
|
|
306
|
+
|
|
307
|
+
vec3[9] probe0 = lpv_probe_getData(vertices[0]);
|
|
308
|
+
vec3[9] probe1 = lpv_probe_getData(vertices[1]);
|
|
309
|
+
vec3[9] probe2 = lpv_probe_getData(vertices[2]);
|
|
310
|
+
vec3[9] probe3 = lpv_probe_getData(vertices[3]);
|
|
311
|
+
|
|
312
|
+
vec3[9] result;
|
|
313
|
+
|
|
314
|
+
for (int i = 0; i < 9; i++) {
|
|
315
|
+
|
|
316
|
+
result[i] = probe0[i] * weights[0]
|
|
317
|
+
+ probe1[i] * weights[1]
|
|
318
|
+
+ probe2[i] * weights[2]
|
|
319
|
+
+ probe3[i] * weights[3];
|
|
320
|
+
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
return result;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
vec4 lpv_bias_weight_by_normal(const in vec3 position, const in vec3 normal, const in uint tet_index, const in vec4 weights) {
|
|
327
|
+
|
|
328
|
+
uvec4 vertices = lpv_mesh_getVertices(tet_index);
|
|
329
|
+
|
|
330
|
+
vec4 result = weights;
|
|
331
|
+
|
|
332
|
+
for (int i = 0; i < 4; i++) {
|
|
333
|
+
vec3 p = lpv_probe_getPosition(vertices[i]) - position;
|
|
334
|
+
|
|
335
|
+
if (dot(normal, p) <= 0.0) {
|
|
336
|
+
// behind the surface, bias to 0
|
|
337
|
+
result[i] = 0.0;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
float total_weight = result.x + result.y + result.z + result.w;
|
|
342
|
+
|
|
343
|
+
// needs to add up to 1
|
|
344
|
+
result = result / total_weight;
|
|
345
|
+
|
|
346
|
+
return result;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
uint lpv_guess_initial_tet(vec3 position) {
|
|
350
|
+
|
|
351
|
+
vec3 lpv_mesh_bounds_min = lpv_v3_bounds_min;
|
|
352
|
+
vec3 lpv_mesh_bounds_max = lpv_v3_bounds_max;
|
|
353
|
+
|
|
354
|
+
vec3 lookup_coordinates = (position - lpv_mesh_bounds_min) / (lpv_mesh_bounds_max - lpv_mesh_bounds_min);
|
|
355
|
+
|
|
356
|
+
return textureLod(lpv_t_mesh_lookup, lookup_coordinates, 0.0).r;
|
|
357
|
+
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf
|
|
361
|
+
vec3 lpv_get_irradiance_at( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
|
|
362
|
+
// normal is assumed to have unit length
|
|
363
|
+
float x = normal.x, y = normal.y, z = normal.z;
|
|
364
|
+
|
|
365
|
+
// band 0
|
|
366
|
+
vec3 result = shCoefficients[ 0 ] * 0.8862269254527579;
|
|
367
|
+
|
|
368
|
+
// band 1
|
|
369
|
+
result -= shCoefficients[ 1 ] * 1.0233267079464885 * y;
|
|
370
|
+
result += shCoefficients[ 2 ] * 1.0233267079464885 * z;
|
|
371
|
+
result -= shCoefficients[ 3 ] * 1.0233267079464885 * x;
|
|
372
|
+
|
|
373
|
+
// band 2
|
|
374
|
+
result += shCoefficients[ 4 ] * 0.8580855308097834 * x * y;
|
|
375
|
+
result -= shCoefficients[ 5 ] * 0.8580855308097834 * y * z;
|
|
376
|
+
result += shCoefficients[ 6 ] * ( 0.7431238683011272 * z * z - 0.24770795610037571 );
|
|
377
|
+
result -= shCoefficients[ 7 ] * 0.8580855308097834 * x * z;
|
|
378
|
+
result += shCoefficients[ 8 ] * 0.4290427654048917 * ( x * x - y * y );
|
|
379
|
+
|
|
380
|
+
return result;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
vec4 lpv_renormalize_weights(in vec4 source){
|
|
384
|
+
|
|
385
|
+
float sum = source.x + source.y + source.z + source.w;
|
|
386
|
+
|
|
387
|
+
return source / sum;
|
|
388
|
+
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
#define LPV_NORMAL_BIAS 0.01
|
|
394
|
+
|
|
395
|
+
vec3 lpv_sample_irradiance(vec3 position, vec3 normal){
|
|
396
|
+
|
|
397
|
+
vec3 lookup_position = position + normal * LPV_NORMAL_BIAS;
|
|
398
|
+
|
|
399
|
+
// lookup nearby tet
|
|
400
|
+
vec3 lpv_mesh_bounds_min = lpv_v3_bounds_min;
|
|
401
|
+
vec3 lpv_mesh_bounds_max = lpv_v3_bounds_max;
|
|
402
|
+
vec3 lookup_coordinates = (lookup_position - lpv_mesh_bounds_min) / (lpv_mesh_bounds_max - lpv_mesh_bounds_min) ;
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
uint nearest_tet = lpv_guess_initial_tet( lookup_position );
|
|
406
|
+
|
|
407
|
+
uint tet;
|
|
408
|
+
vec4 weights;
|
|
409
|
+
lpv_getTetrahedron(lookup_position, nearest_tet, tet, weights);
|
|
410
|
+
|
|
411
|
+
weights = lvp_mask_weights_by_visibility(lookup_position, tet, weights);
|
|
412
|
+
// weights = lvp_mask_weights_by_visibility_by_normal(lookup_position, normal, tet, weights);
|
|
413
|
+
|
|
414
|
+
// square weights to mimic irradiance influence
|
|
415
|
+
// weights = weights * weights;
|
|
416
|
+
|
|
417
|
+
// re-normalize weights
|
|
418
|
+
// weights = normalize(weights);
|
|
419
|
+
weights = lpv_renormalize_weights(weights);
|
|
420
|
+
|
|
421
|
+
if(tet == INVALID_TET){
|
|
422
|
+
// do nothing
|
|
423
|
+
return vec3(0.0);
|
|
424
|
+
|
|
425
|
+
}else{
|
|
426
|
+
|
|
427
|
+
vec3[9] lpv_values = lpv_interpolate_probes(weights, tet);
|
|
428
|
+
|
|
429
|
+
return lpv_get_irradiance_at( normal, lpv_values );
|
|
430
|
+
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
#endif
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"makeLookupTexture3D.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/sh3/gi/material/makeLookupTexture3D.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,gDAHW,MAAM,GACJ,aAAa,CA6BzB;8BAlCoG,OAAO"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ClampToEdgeWrapping, DataTexture3D, NearestFilter, RedIntegerFormat, UnsignedIntType } from "three";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Uint32
|
|
5
|
+
* @param {number} resolution
|
|
6
|
+
* @returns {DataTexture3D}
|
|
7
|
+
*/
|
|
8
|
+
export function makeLookupTexture3D(resolution) {
|
|
9
|
+
|
|
10
|
+
const lookup = new DataTexture3D(
|
|
11
|
+
new Uint32Array(resolution * resolution * resolution),
|
|
12
|
+
resolution,
|
|
13
|
+
resolution,
|
|
14
|
+
resolution
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
lookup.name = "Tetrahedron Lookup";
|
|
18
|
+
|
|
19
|
+
lookup.flipY = false;
|
|
20
|
+
lookup.generateMipmaps = false;
|
|
21
|
+
lookup.magFilter = NearestFilter;
|
|
22
|
+
lookup.minFilter = NearestFilter;
|
|
23
|
+
|
|
24
|
+
lookup.wrapT = ClampToEdgeWrapping;
|
|
25
|
+
lookup.wrapS = ClampToEdgeWrapping;
|
|
26
|
+
lookup.wrapR = ClampToEdgeWrapping;
|
|
27
|
+
|
|
28
|
+
lookup.type = UnsignedIntType;
|
|
29
|
+
lookup.format = RedIntegerFormat;
|
|
30
|
+
lookup.internalFormat = "R32UI";
|
|
31
|
+
|
|
32
|
+
lookup.needsUpdate = true;
|
|
33
|
+
|
|
34
|
+
return lookup;
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"makeOctahedralDepthAtlas.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/sh3/gi/material/makeOctahedralDepthAtlas.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,sDAHW,MAAM,GACJ,WAAW,CAsBvB;4BA3BqF,OAAO"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ClampToEdgeWrapping, DataTexture, FloatType, NearestFilter, RedFormat } from "three";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {number} resolution
|
|
6
|
+
* @returns {DataTexture}
|
|
7
|
+
*/
|
|
8
|
+
export function makeOctahedralDepthAtlas(resolution = 4096) {
|
|
9
|
+
const texture = new DataTexture(
|
|
10
|
+
new Float32Array(resolution * resolution),
|
|
11
|
+
resolution,
|
|
12
|
+
resolution,
|
|
13
|
+
RedFormat,
|
|
14
|
+
FloatType
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
texture.minFilter = texture.magFilter = NearestFilter;
|
|
18
|
+
|
|
19
|
+
texture.wrapT = ClampToEdgeWrapping;
|
|
20
|
+
texture.wrapS = ClampToEdgeWrapping;
|
|
21
|
+
|
|
22
|
+
texture.flipY = false;
|
|
23
|
+
texture.generateMipmaps = false;
|
|
24
|
+
|
|
25
|
+
texture.needsUpdate = true;
|
|
26
|
+
|
|
27
|
+
return texture;
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build_fragment_shader.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/sh3/gi/material/space_fragment/build_fragment_shader.js"],"names":[],"mappings":"AAoCA;;;GAGG;AACH,8CAFW,MAAM,UAchB"}
|