@woosh/meep-engine 3.11.1 → 3.11.3
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/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/descriptor/pipeline/PipelineLayoutDescriptor.d.ts +16 -2
- package/src/shade/descriptor/pipeline/PipelineLayoutDescriptor.d.ts.map +1 -1
- package/src/shade/descriptor/pipeline/PipelineLayoutDescriptor.js +28 -4
- package/src/shade/descriptor/pipeline/compute/ComputePipelineDescriptor.d.ts +1 -1
- package/src/shade/descriptor/pipeline/compute/ComputePipelineDescriptor.d.ts.map +1 -1
- package/src/shade/descriptor/pipeline/compute/ComputePipelineDescriptor.js +5 -2
- package/src/shade/device/IMMEDIATE_DATA_PLAN_2026_08_28.md +564 -451
- package/src/shade/device/ShadeGPUCommandContext.d.ts +18 -2
- package/src/shade/device/ShadeGPUCommandContext.d.ts.map +1 -1
- package/src/shade/device/ShadeGPUCommandContext.js +994 -940
- package/src/shade/device/immediate_data_supported.d.ts +33 -0
- package/src/shade/device/immediate_data_supported.d.ts.map +1 -0
- package/src/shade/device/immediate_data_supported.js +53 -0
- package/src/shade/device/mock/SoftwareGPUCommandEncoder.d.ts +18 -0
- package/src/shade/device/mock/SoftwareGPUCommandEncoder.d.ts.map +1 -1
- package/src/shade/device/mock/SoftwareGPUCommandEncoder.js +24 -0
- package/src/shade/device/mock/SoftwareGPUComputePassEncoder.d.ts +7 -0
- package/src/shade/device/mock/SoftwareGPUComputePassEncoder.d.ts.map +1 -1
- package/src/shade/device/mock/SoftwareGPUComputePassEncoder.js +49 -1
- package/src/shade/device/mock/SoftwareGPUDevice.d.ts.map +1 -1
- package/src/shade/device/mock/SoftwareGPUDevice.js +20 -2
- package/src/shade/device/mock/SoftwareGPUImmediateData.d.ts +65 -0
- package/src/shade/device/mock/SoftwareGPUImmediateData.d.ts.map +1 -0
- package/src/shade/device/mock/SoftwareGPUImmediateData.js +160 -0
- package/src/shade/device/mock/SoftwareGPURenderPassEncoder.d.ts +7 -0
- package/src/shade/device/mock/SoftwareGPURenderPassEncoder.d.ts.map +1 -1
- package/src/shade/device/mock/SoftwareGPURenderPassEncoder.js +50 -0
- package/src/shade/device/mock/pipeline_immediate_size.d.ts +11 -0
- package/src/shade/device/mock/pipeline_immediate_size.d.ts.map +1 -0
- package/src/shade/device/mock/pipeline_immediate_size.js +18 -0
- package/src/shade/device/pipeline/PipelineLayoutManager.d.ts.map +1 -1
- package/src/shade/device/pipeline/PipelineLayoutManager.js +1 -0
- package/src/shade/playground/volumetrics_froxel/README.md +104 -1
- package/src/shade/playground/volumetrics_froxel/index.html +20 -1
- package/src/shade/playground/volumetrics_froxel/main.d.ts.map +1 -1
- package/src/shade/playground/volumetrics_froxel/main.js +298 -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/GraphicsContext.d.ts +9 -2
- package/src/shade/renderer/GraphicsContext.d.ts.map +1 -1
- package/src/shade/renderer/GraphicsContext.js +13 -1
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +22 -18
- package/src/shade/renderer/atmosphere/GPUSky.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/GPUSky.js +145 -142
- package/src/shade/renderer/atmosphere/MULTISCATTER_LUT_CONFIG.d.ts +34 -0
- package/src/shade/renderer/atmosphere/MULTISCATTER_LUT_CONFIG.d.ts.map +1 -0
- package/src/shade/renderer/atmosphere/MULTISCATTER_LUT_CONFIG.js +36 -0
- package/src/shade/renderer/atmosphere/SAMPLER_SKY_LUT.d.ts +20 -0
- package/src/shade/renderer/atmosphere/SAMPLER_SKY_LUT.d.ts.map +1 -0
- package/src/shade/renderer/atmosphere/SAMPLER_SKY_LUT.js +25 -0
- package/src/shade/renderer/atmosphere/chunk_get_multiscatter_values.d.ts +14 -1
- package/src/shade/renderer/atmosphere/chunk_get_multiscatter_values.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/chunk_get_multiscatter_values.js +163 -177
- package/src/shade/renderer/atmosphere/chunk_multiscatter_sample_direction.d.ts +20 -0
- package/src/shade/renderer/atmosphere/chunk_multiscatter_sample_direction.d.ts.map +1 -0
- package/src/shade/renderer/atmosphere/chunk_multiscatter_sample_direction.js +46 -0
- package/src/shade/renderer/atmosphere/chunk_sample_multiscatter_lut.d.ts +11 -1
- package/src/shade/renderer/atmosphere/chunk_sample_multiscatter_lut.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/chunk_sample_multiscatter_lut.js +57 -27
- package/src/shade/renderer/atmosphere/chunk_sample_transmittance_lut.d.ts +19 -1
- package/src/shade/renderer/atmosphere/chunk_sample_transmittance_lut.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/chunk_sample_transmittance_lut.js +69 -33
- package/src/shade/renderer/atmosphere/chunk_sky_lut_compute_uv.d.ts +13 -0
- package/src/shade/renderer/atmosphere/chunk_sky_lut_compute_uv.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/chunk_sky_lut_compute_uv.js +35 -35
- package/src/shade/renderer/atmosphere/chunk_sky_lut_params.d.ts +13 -0
- package/src/shade/renderer/atmosphere/chunk_sky_lut_params.d.ts.map +1 -0
- package/src/shade/renderer/atmosphere/chunk_sky_lut_params.js +38 -0
- package/src/shade/renderer/atmosphere/chunk_sky_lut_texel_to_unit.d.ts +17 -0
- package/src/shade/renderer/atmosphere/chunk_sky_lut_texel_to_unit.d.ts.map +1 -0
- package/src/shade/renderer/atmosphere/chunk_sky_lut_texel_to_unit.js +29 -0
- package/src/shade/renderer/atmosphere/chunk_sky_lut_uv.d.ts +21 -0
- package/src/shade/renderer/atmosphere/chunk_sky_lut_uv.d.ts.map +1 -0
- package/src/shade/renderer/atmosphere/chunk_sky_lut_uv.js +42 -0
- package/src/shade/renderer/atmosphere/shader_multiscatter_lut.d.ts +2 -2
- package/src/shade/renderer/atmosphere/shader_multiscatter_lut.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/shader_multiscatter_lut.js +165 -84
- package/src/shade/renderer/atmosphere/shader_sky_irradiance_lut.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/shader_sky_irradiance_lut.js +215 -204
- package/src/shade/renderer/atmosphere/shader_transmittance_lut.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/shader_transmittance_lut.js +79 -67
- package/src/shade/renderer/light/cluster/graph_assign_clsuters.d.ts.map +1 -1
- package/src/shade/renderer/light/cluster/graph_assign_clsuters.js +6 -2
- package/src/shade/renderer/postprocess/gtao/GTAO.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/gtao/GTAO.js +4 -0
- package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
- package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.js +341 -345
- package/src/shade/renderer/rasterize/bucket/shader_read_out_bucket.d.ts +0 -2
- package/src/shade/renderer/rasterize/bucket/shader_read_out_bucket.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/bucket/shader_read_out_bucket.js +58 -57
- package/src/shade/renderer/rasterize/expand/mesh/graph_expand_meshes_to_meshlets.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/expand/mesh/graph_expand_meshes_to_meshlets.js +7 -3
- package/src/shade/renderer/rasterize/fast/graph_extract_meshes_from_bucket.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/fast/graph_extract_meshes_from_bucket.js +77 -81
- package/src/shade/renderer/rasterize/standard/graph_rasterize_scene.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/standard/graph_rasterize_scene.js +5 -1
- package/src/shade/renderer/shader/ComputeShader.d.ts.map +1 -1
- package/src/shade/renderer/shader/ComputeShader.js +6 -2
- package/src/shade/renderer/shader/ImageShader.d.ts.map +1 -1
- package/src/shade/renderer/shader/ImageShader.js +4 -1
- package/src/shade/renderer/shader/ShaderDescriptor.d.ts.map +1 -1
- package/src/shade/renderer/shader/ShaderDescriptor.js +26 -0
- package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_RADII_DECLARATION.d.ts +18 -0
- package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_RADII_DECLARATION.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_RADII_DECLARATION.js +32 -0
- package/src/shade/renderer/shader/chunk/atmosphere/PLANET_CENTER_DECLARATION.d.ts +7 -0
- package/src/shade/renderer/shader/chunk/atmosphere/PLANET_CENTER_DECLARATION.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/atmosphere/PLANET_CENTER_DECLARATION.js +17 -6
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_ray_bounds.d.ts +21 -0
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_ray_bounds.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_ray_bounds.js +69 -0
- package/src/shade/renderer/shader/chunk/geometry/aabb3/chunk_aabb3_contains_aabb3.d.ts +9 -0
- package/src/shade/renderer/shader/chunk/geometry/aabb3/chunk_aabb3_contains_aabb3.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/geometry/aabb3/chunk_aabb3_contains_aabb3.js +22 -0
- package/src/shade/renderer/shader/chunk/geometry/aabb3/chunk_aabb3_from_transformed_corners.d.ts +16 -0
- package/src/shade/renderer/shader/chunk/geometry/aabb3/chunk_aabb3_from_transformed_corners.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/geometry/aabb3/chunk_aabb3_from_transformed_corners.js +41 -0
- package/src/shade/renderer/shader/chunk/geometry/frustum/chunk_frustum_transform_m4.d.ts +11 -0
- package/src/shade/renderer/shader/chunk/geometry/frustum/chunk_frustum_transform_m4.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/geometry/frustum/chunk_frustum_transform_m4.js +15 -19
- package/src/shade/renderer/shader/chunk/geometry/frustum/chunk_frustum_transform_plane_matrix.d.ts +23 -0
- package/src/shade/renderer/shader/chunk/geometry/frustum/chunk_frustum_transform_plane_matrix.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/geometry/frustum/chunk_frustum_transform_plane_matrix.js +44 -0
- package/src/shade/renderer/shader/chunk/geometry/octahedron/chunk_uv_octahedral_unit_decode.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/geometry/octahedron/chunk_uv_octahedral_unit_decode.js +1 -4
- package/src/shade/renderer/shader/compiler/CodeChunk.d.ts +7 -1
- package/src/shade/renderer/shader/compiler/CodeChunk.d.ts.map +1 -1
- package/src/shade/renderer/shader/compiler/CodeChunk.js +37 -2
- package/src/shade/renderer/shader/graph/compute/compute_binding_read_names.d.ts.map +1 -1
- package/src/shade/renderer/shader/graph/compute/compute_binding_read_names.js +6 -0
- package/src/shade/renderer/shader/graph/compute/graph_compute_indirect_pass.js +1 -1
- package/src/shade/renderer/shader/graph/compute/graph_compute_pass.js +1 -1
- package/src/shade/renderer/shader/graph/graph_image_pass.js +1 -1
- package/src/shade/renderer/shader/graph/graph_prepare_bindings.d.ts.map +1 -1
- package/src/shade/renderer/shader/graph/graph_prepare_bindings.js +7 -0
- package/src/shade/renderer/shader/graph/graph_prepare_pass_input_data.d.ts +3 -1
- package/src/shade/renderer/shader/graph/graph_prepare_pass_input_data.d.ts.map +1 -1
- package/src/shade/renderer/shader/graph/graph_prepare_pass_input_data.js +12 -1
- package/src/shade/renderer/shader/pass/RenderPassDescriptor.d.ts.map +1 -1
- package/src/shade/renderer/shader/pass/RenderPassDescriptor.js +1 -0
- package/src/shade/renderer/shader/resource/IMMEDIATE_DATA.d.ts +21 -0
- package/src/shade/renderer/shader/resource/IMMEDIATE_DATA.d.ts.map +1 -0
- package/src/shade/renderer/shader/resource/IMMEDIATE_DATA.js +21 -0
- package/src/shade/renderer/shader/resource/ShaderResourceSetDescriptor.d.ts +59 -1
- package/src/shade/renderer/shader/resource/ShaderResourceSetDescriptor.d.ts.map +1 -1
- package/src/shade/renderer/shader/resource/ShaderResourceSetDescriptor.js +195 -2
- package/src/shade/renderer/shader/type/type_has_arrays.d.ts +14 -0
- package/src/shade/renderer/shader/type/type_has_arrays.d.ts.map +1 -0
- package/src/shade/renderer/shader/type/type_has_arrays.js +33 -0
- 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/view/GPUViewSkyContext.d.ts.map +1 -1
- package/src/shade/renderer/view/GPUViewSkyContext.js +169 -173
- 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 +887 -8
- 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_integrate_optical_depth.js +75 -75
- 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 +130 -0
- package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts +18 -3
- package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/graph_build_volumetrics.js +193 -70
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.d.ts +16 -0
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.js +83 -15
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_participating_media.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_participating_media.js +29 -18
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_scattering_lut.js +260 -260
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_sun_shadow_volume.d.ts +58 -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 +290 -0
- 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 +2228 -2215
- package/src/shade/wgsl/emulator/WGSLLanguageCore.d.ts.map +1 -1
- package/src/shade/wgsl/emulator/WGSLLanguageCore.js +210 -2
- 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
- package/src/shade/renderer/volumetrics/VOLUMETRICS_WORKGROUP_RESOLUTION.d.ts +0 -2
- package/src/shade/renderer/volumetrics/VOLUMETRICS_WORKGROUP_RESOLUTION.d.ts.map +0 -1
- package/src/shade/renderer/volumetrics/VOLUMETRICS_WORKGROUP_RESOLUTION.js +0 -1
|
@@ -1,177 +1,163 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
C_MIE_ABSORPTION_DECLARATION,
|
|
4
|
-
C_MIE_SCATTERING_DECLARATION
|
|
5
|
-
} from "../shader/chunk/atmosphere/C_MIE_SCATTERING_DECLARATION.js";
|
|
6
|
-
import { C_OZONE_DECLARATION } from "../shader/chunk/atmosphere/C_OZONE_DECLARATION.js";
|
|
7
|
-
import { C_RAYLEIGH_DECLARATION } from "../shader/chunk/atmosphere/C_RAYLEIGH_DECLARATION.js";
|
|
8
|
-
import { chunk_atmosphere_density } from "../shader/chunk/atmosphere/chunk_atmosphere_density.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
} from "../shader/
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
C_RAYLEIGH_DECLARATION,
|
|
165
|
-
chunk_safe_acos,
|
|
166
|
-
chunk_atmosphere_height,
|
|
167
|
-
chunk_spherical_to_cartesian,
|
|
168
|
-
chunk_sphere_intersection,
|
|
169
|
-
chunk_atmosphere_intersection,
|
|
170
|
-
chunk_atmosphere_density,
|
|
171
|
-
chunk_phase_mie_cornette_shanks,
|
|
172
|
-
chunk_phase_rayleigh,
|
|
173
|
-
chunk_sample_transmittance_lut,
|
|
174
|
-
chunk_sphere_intersection_nearest,
|
|
175
|
-
chunk_position_relative_to_planet_center,
|
|
176
|
-
]
|
|
177
|
-
)
|
|
1
|
+
import { ATMOSPHERE_RADII_DECLARATION } from "../shader/chunk/atmosphere/ATMOSPHERE_RADII_DECLARATION.js";
|
|
2
|
+
import {
|
|
3
|
+
C_MIE_ABSORPTION_DECLARATION,
|
|
4
|
+
C_MIE_SCATTERING_DECLARATION
|
|
5
|
+
} from "../shader/chunk/atmosphere/C_MIE_SCATTERING_DECLARATION.js";
|
|
6
|
+
import { C_OZONE_DECLARATION } from "../shader/chunk/atmosphere/C_OZONE_DECLARATION.js";
|
|
7
|
+
import { C_RAYLEIGH_DECLARATION } from "../shader/chunk/atmosphere/C_RAYLEIGH_DECLARATION.js";
|
|
8
|
+
import { chunk_atmosphere_density } from "../shader/chunk/atmosphere/chunk_atmosphere_density.js";
|
|
9
|
+
import { chunk_atmosphere_ray_bounds } from "../shader/chunk/atmosphere/chunk_atmosphere_ray_bounds.js";
|
|
10
|
+
import {
|
|
11
|
+
chunk_position_relative_to_planet_center
|
|
12
|
+
} from "../shader/chunk/atmosphere/chunk_position_relative_to_planet_center.js";
|
|
13
|
+
import {
|
|
14
|
+
chunk_phase_mie_cornette_shanks
|
|
15
|
+
} from "../shader/chunk/atmosphere/phase/chunk_phase_mie_cornette_shanks.js";
|
|
16
|
+
import { chunk_phase_rayleigh } from "../shader/chunk/atmosphere/phase/chunk_phase_rayleigh.js";
|
|
17
|
+
import { PI_DECLARATION } from "../shader/chunk/math/PI_DECLARATION.js";
|
|
18
|
+
import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
19
|
+
import { chunk_sample_transmittance_lut_params } from "./chunk_sample_transmittance_lut.js";
|
|
20
|
+
import { MIE_G } from "./MIE_G.js";
|
|
21
|
+
import { MULTISCATTER_LUT_STEPS } from "./MULTISCATTER_LUT_CONFIG.js";
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* One direction's contribution to Equations (5) and (7) from the paper: `out_lum` is the
|
|
26
|
+
* second-order in-scattered luminance along `rayDir`, `out_fms` the luminance that would
|
|
27
|
+
* come back if the medium scattered one unit of light isotropically. The caller integrates
|
|
28
|
+
* over the direction set -- see {@link chunk_multiscatter_sample_direction} -- by taking the
|
|
29
|
+
* mean, which is what the paper's uniform phase p_u = 1/(4*PI) reduces to.
|
|
30
|
+
*
|
|
31
|
+
* Splitting one direction out of the loop is what lets `shader_multiscatter_lut` put a
|
|
32
|
+
* thread on each of the 64 directions, the way Hillaire's `NewMultiScattCS` does.
|
|
33
|
+
*
|
|
34
|
+
* `pos` is assumed to be inside the atmosphere and at or above the surface, which is what
|
|
35
|
+
* makes the far root of the outer sphere the atmosphere exit.
|
|
36
|
+
*
|
|
37
|
+
* @see "A Scalable and Production Ready Sky and Atmosphere Rendering Technique", Hillaire (2020)
|
|
38
|
+
* @see https://www.shadertoy.com/view/slSXRW
|
|
39
|
+
* @type {CodeChunk}
|
|
40
|
+
*/
|
|
41
|
+
export const chunk_get_multiscatter_values = CodeChunk.from(
|
|
42
|
+
//language=WGSL
|
|
43
|
+
`
|
|
44
|
+
const MULTISCATTER_GROUND_ALBEDO = vec3(0.3);
|
|
45
|
+
const MULTISCATTER_STEPS = ${MULTISCATTER_LUT_STEPS}u;
|
|
46
|
+
const MULTISCATTER_STEPS_F = f32(MULTISCATTER_STEPS);
|
|
47
|
+
|
|
48
|
+
fn get_multiscatter_values(
|
|
49
|
+
pos: vec3<f32>,
|
|
50
|
+
sunDir: vec3<f32>,
|
|
51
|
+
rayDir: vec3<f32>,
|
|
52
|
+
out_lum: ptr<function,vec3<f32>>,
|
|
53
|
+
out_fms: ptr<function,vec3<f32>>,
|
|
54
|
+
) {
|
|
55
|
+
let rel = position_relative_to_planet_center(pos);
|
|
56
|
+
|
|
57
|
+
// one quadratic setup for both spheres; in case we're looking down, the ground is as far
|
|
58
|
+
// as the march goes
|
|
59
|
+
let bounds = atmosphere_ray_bounds(rel, rayDir);
|
|
60
|
+
|
|
61
|
+
let tMax = bounds.t_max;
|
|
62
|
+
|
|
63
|
+
let cosTheta = dot(rayDir, sunDir);
|
|
64
|
+
|
|
65
|
+
let miePhaseValue = phase_mie(cosTheta, ${MIE_G});
|
|
66
|
+
let rayleighPhaseValue = phase_rayleigh(-cosTheta);
|
|
67
|
+
|
|
68
|
+
var lum = vec3(0.0);
|
|
69
|
+
var lumFactor = vec3(0.0);
|
|
70
|
+
var transmittance = vec3(1.0);
|
|
71
|
+
|
|
72
|
+
var t = 0.0;
|
|
73
|
+
for (var stepI = 0u; stepI < MULTISCATTER_STEPS; stepI++) {
|
|
74
|
+
let newT = ( (f32(stepI) + 0.3) / MULTISCATTER_STEPS_F ) * tMax;
|
|
75
|
+
let dt = newT - t;
|
|
76
|
+
t = newT;
|
|
77
|
+
|
|
78
|
+
// Stepping the planet-relative position directly: building the world position only
|
|
79
|
+
// to have the LUT lookup subtract the planet centre back off it was the second of
|
|
80
|
+
// two square roots per step.
|
|
81
|
+
let step_rel = rel + t * rayDir;
|
|
82
|
+
let step_radius = length(step_rel);
|
|
83
|
+
let up = step_rel / step_radius;
|
|
84
|
+
|
|
85
|
+
let local_height = step_radius - ATMOSPHERE_GROUND_RADIUS;
|
|
86
|
+
let local_density = atmosphere_density(local_height);
|
|
87
|
+
|
|
88
|
+
let ozone_density = local_density.z;
|
|
89
|
+
let ozone_absorption = ozone_density * C_OZONE;
|
|
90
|
+
|
|
91
|
+
let mie_density = local_density.y;
|
|
92
|
+
let mie_absorption = mie_density * C_MIE_ABSORPTION;
|
|
93
|
+
let mie_scattering = mie_density * C_MIE_SCATTERING;
|
|
94
|
+
|
|
95
|
+
// note - taken from the Hillaire's atmosphere code: https://github.com/sebh/UnrealEngineSkyAtmosphere/blob/183ead5bdacc701b3b626347a680a2f3cd3d4fbd/Resources/RenderSkyCommon.hlsl#L248
|
|
96
|
+
let rayleigh_absorption = 0.0;
|
|
97
|
+
let rayleigh_scattering = local_density.x * C_RAYLEIGH;
|
|
98
|
+
|
|
99
|
+
let extinction = rayleigh_scattering + rayleigh_absorption + mie_scattering + mie_absorption + ozone_absorption;
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
let sample_transmittance = exp(-dt * extinction);
|
|
103
|
+
|
|
104
|
+
// Integrate within each segment.
|
|
105
|
+
let scatteringNoPhase = rayleigh_scattering + mie_scattering;
|
|
106
|
+
let scatteringF = (scatteringNoPhase - scatteringNoPhase * sample_transmittance) / extinction;
|
|
107
|
+
lumFactor += transmittance * scatteringF;
|
|
108
|
+
|
|
109
|
+
// This is slightly different from the paper, but I think the paper has a mistake?
|
|
110
|
+
// In equation (6), I think S(x,w_s) should be S(x-tv,w_s).
|
|
111
|
+
let sun_transmittance = sample_transmittance_lut_params(local_height, dot(sunDir, up));
|
|
112
|
+
|
|
113
|
+
let rayleighInScattering = rayleigh_scattering * rayleighPhaseValue;
|
|
114
|
+
let mieInScattering = mie_scattering * miePhaseValue;
|
|
115
|
+
let inScattering = (rayleighInScattering + mieInScattering) * sun_transmittance;
|
|
116
|
+
|
|
117
|
+
// Integrated scattering within path segment.
|
|
118
|
+
let scatteringIntegral = (inScattering - inScattering * sample_transmittance) / extinction;
|
|
119
|
+
|
|
120
|
+
lum += scatteringIntegral * transmittance;
|
|
121
|
+
transmittance *= sample_transmittance;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (bounds.hits_ground) {
|
|
125
|
+
|
|
126
|
+
// Light bounced off the planet. Hillaire reaches this through
|
|
127
|
+
// IntegrateScatteredLuminance:
|
|
128
|
+
// L += ... * throughput * NdotL * Atmosphere.GroundAlbedo / PI
|
|
129
|
+
// The surface is Lambertian, hence albedo/PI, and the cosine belongs to the hit
|
|
130
|
+
// point rather than to \`pos\`: along a shallow ray the two are hundreds of
|
|
131
|
+
// kilometres apart and can sit on opposite sides of the terminator.
|
|
132
|
+
let hit_up = normalize(rel + bounds.ground_distance * rayDir);
|
|
133
|
+
|
|
134
|
+
let sun_cos_zenith_angle = dot(hit_up, sunDir);
|
|
135
|
+
|
|
136
|
+
// the hit lies on the surface by construction, so its LUT altitude is exactly zero
|
|
137
|
+
let sun_transmittance = sample_transmittance_lut_params(0.0, sun_cos_zenith_angle);
|
|
138
|
+
|
|
139
|
+
lum += transmittance
|
|
140
|
+
* saturate(sun_cos_zenith_angle)
|
|
141
|
+
* (MULTISCATTER_GROUND_ALBEDO / PI)
|
|
142
|
+
* sun_transmittance;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
*out_fms = lumFactor;
|
|
146
|
+
*out_lum = lum;
|
|
147
|
+
|
|
148
|
+
}
|
|
149
|
+
`, [
|
|
150
|
+
PI_DECLARATION,
|
|
151
|
+
ATMOSPHERE_RADII_DECLARATION,
|
|
152
|
+
C_OZONE_DECLARATION,
|
|
153
|
+
C_MIE_SCATTERING_DECLARATION,
|
|
154
|
+
C_MIE_ABSORPTION_DECLARATION,
|
|
155
|
+
C_RAYLEIGH_DECLARATION,
|
|
156
|
+
chunk_atmosphere_density,
|
|
157
|
+
chunk_atmosphere_ray_bounds,
|
|
158
|
+
chunk_phase_mie_cornette_shanks,
|
|
159
|
+
chunk_phase_rayleigh,
|
|
160
|
+
chunk_position_relative_to_planet_center,
|
|
161
|
+
chunk_sample_transmittance_lut_params,
|
|
162
|
+
]
|
|
163
|
+
)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The direction set the multiple-scattering LUT integrates over, one direction per index in
|
|
3
|
+
* `[0, MULTISCATTER_LUT_DIRECTION_COUNT)`. Stratified: midpoints of a uniform grid in
|
|
4
|
+
* azimuth, and of a uniform grid in the cosine of the polar angle, so every sample carries
|
|
5
|
+
* the same solid angle and a plain mean over the set is the spherical average that
|
|
6
|
+
* Equations (5) and (7) ask for.
|
|
7
|
+
*
|
|
8
|
+
* PRECONDITION: only valid when the sun lies in the y-z plane (`sunDir.x == 0`) and the
|
|
9
|
+
* sample position is on the +y axis through the planet centre. Azimuth spans [0, PI), not
|
|
10
|
+
* [0, 2*PI), which covers only the x >= 0 hemisphere; the mean over that half equals the
|
|
11
|
+
* mean over the whole sphere because reflecting x -> -x leaves both the sun direction and a
|
|
12
|
+
* spherically symmetric atmosphere unchanged. Hillaire integrates the full 2*PI precisely
|
|
13
|
+
* because his formulation does not lean on that. `shader_multiscatter_lut` satisfies the
|
|
14
|
+
* precondition by construction; a caller that does not must widen the azimuth.
|
|
15
|
+
*
|
|
16
|
+
* @type {CodeChunk}
|
|
17
|
+
*/
|
|
18
|
+
export const chunk_multiscatter_sample_direction: CodeChunk;
|
|
19
|
+
import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
20
|
+
//# sourceMappingURL=chunk_multiscatter_sample_direction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk_multiscatter_sample_direction.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/atmosphere/chunk_multiscatter_sample_direction.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;GAgBG;AACH,kDAFU,SAAS,CAwBjB;0BA1CwB,iCAAiC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { chunk_spherical_to_cartesian } from "../shader/chunk/geometry/sphere/chunk_spherical_to_cartesian.js";
|
|
2
|
+
import { chunk_safe_acos } from "../shader/chunk/math/chunk_safe_acos.js";
|
|
3
|
+
import { PI_DECLARATION } from "../shader/chunk/math/PI_DECLARATION.js";
|
|
4
|
+
import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
5
|
+
import { MULTISCATTER_LUT_SQRT_SAMPLES } from "./MULTISCATTER_LUT_CONFIG.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The direction set the multiple-scattering LUT integrates over, one direction per index in
|
|
9
|
+
* `[0, MULTISCATTER_LUT_DIRECTION_COUNT)`. Stratified: midpoints of a uniform grid in
|
|
10
|
+
* azimuth, and of a uniform grid in the cosine of the polar angle, so every sample carries
|
|
11
|
+
* the same solid angle and a plain mean over the set is the spherical average that
|
|
12
|
+
* Equations (5) and (7) ask for.
|
|
13
|
+
*
|
|
14
|
+
* PRECONDITION: only valid when the sun lies in the y-z plane (`sunDir.x == 0`) and the
|
|
15
|
+
* sample position is on the +y axis through the planet centre. Azimuth spans [0, PI), not
|
|
16
|
+
* [0, 2*PI), which covers only the x >= 0 hemisphere; the mean over that half equals the
|
|
17
|
+
* mean over the whole sphere because reflecting x -> -x leaves both the sun direction and a
|
|
18
|
+
* spherically symmetric atmosphere unchanged. Hillaire integrates the full 2*PI precisely
|
|
19
|
+
* because his formulation does not lean on that. `shader_multiscatter_lut` satisfies the
|
|
20
|
+
* precondition by construction; a caller that does not must widen the azimuth.
|
|
21
|
+
*
|
|
22
|
+
* @type {CodeChunk}
|
|
23
|
+
*/
|
|
24
|
+
export const chunk_multiscatter_sample_direction = CodeChunk.from(
|
|
25
|
+
//language=WGSL
|
|
26
|
+
`
|
|
27
|
+
const MULTISCATTER_SQRT_SAMPLES = ${MULTISCATTER_LUT_SQRT_SAMPLES}u;
|
|
28
|
+
const MULTISCATTER_SQRT_SAMPLES_F = f32(MULTISCATTER_SQRT_SAMPLES);
|
|
29
|
+
|
|
30
|
+
fn multiscatter_sample_direction(index: u32) -> vec3<f32> {
|
|
31
|
+
|
|
32
|
+
let i = f32(index / MULTISCATTER_SQRT_SAMPLES);
|
|
33
|
+
let j = f32(index % MULTISCATTER_SQRT_SAMPLES);
|
|
34
|
+
|
|
35
|
+
// see the PRECONDITION note: half the azimuth, by symmetry about the sun plane
|
|
36
|
+
let theta = PI * (i + 0.5) / MULTISCATTER_SQRT_SAMPLES_F;
|
|
37
|
+
let phi = safe_acos(1.0 - 2.0 * (j + 0.5) / MULTISCATTER_SQRT_SAMPLES_F);
|
|
38
|
+
|
|
39
|
+
return spherical_to_cartesian(theta, phi);
|
|
40
|
+
}
|
|
41
|
+
`, [
|
|
42
|
+
PI_DECLARATION,
|
|
43
|
+
chunk_safe_acos,
|
|
44
|
+
chunk_spherical_to_cartesian,
|
|
45
|
+
]
|
|
46
|
+
);
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Assumes following in the context:
|
|
3
|
+
* tSkyLutMultiscatter: texture_2d<f32> (sample type "float", i.e. filterable)
|
|
4
|
+
* sSkyLut: sampler (see {@link SAMPLER_SKY_LUT})
|
|
5
|
+
*
|
|
6
|
+
* see {@link shader_multiscatter_lut}, and {@link chunk_sample_transmittance_lut_params} for
|
|
7
|
+
* why this filters in hardware and reads its own resolution.
|
|
8
|
+
* @type {CodeChunk}
|
|
9
|
+
*/
|
|
10
|
+
export const chunk_sample_multiscatter_lut_params: CodeChunk;
|
|
11
|
+
/**
|
|
12
|
+
* {@link chunk_sample_multiscatter_lut_params} from a world-space position.
|
|
3
13
|
* @type {CodeChunk}
|
|
4
14
|
*/
|
|
5
15
|
export const chunk_sample_multiscatter_lut: CodeChunk;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunk_sample_multiscatter_lut.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/atmosphere/chunk_sample_multiscatter_lut.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chunk_sample_multiscatter_lut.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/atmosphere/chunk_sample_multiscatter_lut.js"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AACH,mDAFU,SAAS,CAsBjB;AAEF;;;GAGG;AACH,4CAFU,SAAS,CAmBjB;0BAxDwB,iCAAiC"}
|
|
@@ -1,27 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
} from "
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* see {@link
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
2
|
+
import { chunk_sky_lut_params } from "./chunk_sky_lut_params.js";
|
|
3
|
+
import { chunk_sky_lut_uv } from "./chunk_sky_lut_uv.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Assumes following in the context:
|
|
7
|
+
* tSkyLutMultiscatter: texture_2d<f32> (sample type "float", i.e. filterable)
|
|
8
|
+
* sSkyLut: sampler (see {@link SAMPLER_SKY_LUT})
|
|
9
|
+
*
|
|
10
|
+
* see {@link shader_multiscatter_lut}, and {@link chunk_sample_transmittance_lut_params} for
|
|
11
|
+
* why this filters in hardware and reads its own resolution.
|
|
12
|
+
* @type {CodeChunk}
|
|
13
|
+
*/
|
|
14
|
+
export const chunk_sample_multiscatter_lut_params = CodeChunk.from(
|
|
15
|
+
//language=WGSL
|
|
16
|
+
`
|
|
17
|
+
fn sample_multiscatter_lut_params(
|
|
18
|
+
height: f32,
|
|
19
|
+
sun_cos_zenith_angle: f32
|
|
20
|
+
) -> vec3<f32>{
|
|
21
|
+
|
|
22
|
+
let uv = sky_lut_uv(
|
|
23
|
+
height,
|
|
24
|
+
sun_cos_zenith_angle,
|
|
25
|
+
vec2<f32>(textureDimensions(tSkyLutMultiscatter))
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
return textureSampleLevel(tSkyLutMultiscatter, sSkyLut, uv, 0.0).rgb;
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
`, [
|
|
32
|
+
chunk_sky_lut_uv,
|
|
33
|
+
]
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* {@link chunk_sample_multiscatter_lut_params} from a world-space position.
|
|
38
|
+
* @type {CodeChunk}
|
|
39
|
+
*/
|
|
40
|
+
export const chunk_sample_multiscatter_lut = CodeChunk.from(
|
|
41
|
+
//language=WGSL
|
|
42
|
+
`
|
|
43
|
+
fn sample_multiscatter_lut(
|
|
44
|
+
pos:vec3<f32>,
|
|
45
|
+
sunDir:vec3<f32>
|
|
46
|
+
) -> vec3<f32>{
|
|
47
|
+
|
|
48
|
+
let params = sky_lut_params(pos, sunDir);
|
|
49
|
+
|
|
50
|
+
return sample_multiscatter_lut_params(params.x, params.y);
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
`, [
|
|
54
|
+
chunk_sample_multiscatter_lut_params,
|
|
55
|
+
chunk_sky_lut_params,
|
|
56
|
+
]
|
|
57
|
+
);
|
|
@@ -1,10 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Assumes following in the context:
|
|
3
|
-
* tSkyLutTransmittance: texture_2d<f32>
|
|
3
|
+
* tSkyLutTransmittance: texture_2d<f32> (sample type "float", i.e. filterable)
|
|
4
|
+
* sSkyLut: sampler (see {@link SAMPLER_SKY_LUT})
|
|
5
|
+
*
|
|
6
|
+
* The LUT is rgba16float, which is filterable in core WebGPU -- only the 32-bit float
|
|
7
|
+
* formats need the `float32-filterable` feature -- so this goes through the texture unit
|
|
8
|
+
* rather than the 4-tap `texture_sample_bilinear_uv`. Clamp-to-edge on the sampler
|
|
9
|
+
* reproduces that function's per-corner clamping.
|
|
10
|
+
*
|
|
11
|
+
* The half-texel inset {@link chunk_sky_lut_uv} applies needs the LUT's resolution, which is
|
|
12
|
+
* read from the binding rather than passed in: the texture is the authority on its own size,
|
|
13
|
+
* and a caller cannot get it wrong.
|
|
4
14
|
*
|
|
5
15
|
* see {@link shader_transmittance_lut}
|
|
6
16
|
* @type {CodeChunk}
|
|
7
17
|
*/
|
|
18
|
+
export const chunk_sample_transmittance_lut_params: CodeChunk;
|
|
19
|
+
/**
|
|
20
|
+
* {@link chunk_sample_transmittance_lut_params} from a world-space position. A ray-march that
|
|
21
|
+
* already knows the altitude and the local up vector should build the pair itself and call
|
|
22
|
+
* the primitive, rather than have this recover them with another square root.
|
|
23
|
+
*
|
|
24
|
+
* @type {CodeChunk}
|
|
25
|
+
*/
|
|
8
26
|
export const chunk_sample_transmittance_lut: CodeChunk;
|
|
9
27
|
import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
10
28
|
//# sourceMappingURL=chunk_sample_transmittance_lut.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunk_sample_transmittance_lut.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/atmosphere/chunk_sample_transmittance_lut.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chunk_sample_transmittance_lut.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/atmosphere/chunk_sample_transmittance_lut.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;GAgBG;AACH,oDAFU,SAAS,CAsBjB;AAEF;;;;;;GAMG;AACH,6CAFU,SAAS,CAoBjB;0BApEwB,iCAAiC"}
|