@meimu/mutracer 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/LICENSES/Apache-2.0.txt +202 -0
- package/LICENSES/GLSL-PathTracer-MIT.txt +21 -0
- package/LICENSES/GlMatrix-MIT.txt +19 -0
- package/LICENSES/KinoBloom-MIT.txt +21 -0
- package/LICENSES/OIDNWeb-MIT.txt +21 -0
- package/LICENSES/Octicons-MIT.txt +21 -0
- package/LICENSES/RayTracingRenderer-MIT.txt +21 -0
- package/LICENSES/TinyBVH-MIT.txt +21 -0
- package/LICENSES/WebGPUUtils-MIT.txt +21 -0
- package/LICENSES/ZetaRay-MIT.txt +21 -0
- package/README.md +195 -2
- package/THIRD_PARTY_NOTICES.md +160 -0
- package/dist/assets/bvh.worker.js +1 -0
- package/dist/mutracer.umd.js +14352 -0
- package/docs/api.md +394 -0
- package/docs/bvh.md +141 -0
- package/docs/denoising.md +301 -0
- package/docs/getting-started.md +308 -0
- package/docs/materials.md +281 -0
- package/docs/performance.md +85 -0
- package/docs/post-processing.md +87 -0
- package/docs/progressive-rendering.md +144 -0
- package/docs/sampling.md +40 -0
- package/docs/threejs.md +273 -0
- package/docs/todo.md +61 -0
- package/docs/updates.md +208 -0
- package/lib/Display.d.ts +72 -0
- package/lib/Display.js +121 -0
- package/lib/Display.js.map +1 -0
- package/lib/Engine.d.ts +161 -0
- package/lib/Engine.js +681 -0
- package/lib/Engine.js.map +1 -0
- package/lib/Render.d.ts +256 -0
- package/lib/Render.js +671 -0
- package/lib/Render.js.map +1 -0
- package/lib/RenderLoop.d.ts +76 -0
- package/lib/RenderLoop.js +204 -0
- package/lib/RenderLoop.js.map +1 -0
- package/lib/Sync.d.ts +19 -0
- package/lib/Sync.js +19 -0
- package/lib/Sync.js.map +1 -0
- package/lib/constants.d.ts +2 -0
- package/lib/constants.js +3 -0
- package/lib/constants.js.map +1 -0
- package/lib/main.d.ts +56 -0
- package/lib/main.js +43 -0
- package/lib/main.js.map +1 -0
- package/lib/math.d.ts +23 -0
- package/lib/math.js +56 -0
- package/lib/math.js.map +1 -0
- package/lib/oidn.d.ts +45 -0
- package/lib/oidn.js +42 -0
- package/lib/oidn.js.map +1 -0
- package/lib/oidnBundledWeights.cdn.d.ts +2 -0
- package/lib/oidnBundledWeights.cdn.js +5 -0
- package/lib/oidnBundledWeights.cdn.js.map +1 -0
- package/lib/oidnBundledWeights.d.ts +2 -0
- package/lib/oidnBundledWeights.js +4 -0
- package/lib/oidnBundledWeights.js.map +1 -0
- package/lib/renderer/DisplayPostProcess.d.ts +14 -0
- package/lib/renderer/DisplayPostProcess.js +41 -0
- package/lib/renderer/DisplayPostProcess.js.map +1 -0
- package/lib/renderer/MaterialTable.d.ts +119 -0
- package/lib/renderer/MaterialTable.js +550 -0
- package/lib/renderer/MaterialTable.js.map +1 -0
- package/lib/renderer/OfflineAdaptiveSampling.d.ts +47 -0
- package/lib/renderer/OfflineAdaptiveSampling.js +36 -0
- package/lib/renderer/OfflineAdaptiveSampling.js.map +1 -0
- package/lib/renderer/RenderingPipeline.d.ts +232 -0
- package/lib/renderer/RenderingPipeline.js +18 -0
- package/lib/renderer/RenderingPipeline.js.map +1 -0
- package/lib/renderer/ScratchPool.d.ts +13 -0
- package/lib/renderer/ScratchPool.js +21 -0
- package/lib/renderer/ScratchPool.js.map +1 -0
- package/lib/renderer/TileRender.d.ts +44 -0
- package/lib/renderer/TileRender.js +283 -0
- package/lib/renderer/TileRender.js.map +1 -0
- package/lib/renderer/WGPUBloomPass.d.ts +17 -0
- package/lib/renderer/WGPUBloomPass.js +243 -0
- package/lib/renderer/WGPUBloomPass.js.map +1 -0
- package/lib/renderer/WGPUCanvasSurface.d.ts +21 -0
- package/lib/renderer/WGPUCanvasSurface.js +48 -0
- package/lib/renderer/WGPUCanvasSurface.js.map +1 -0
- package/lib/renderer/WGPUComputePass.d.ts +73 -0
- package/lib/renderer/WGPUComputePass.js +317 -0
- package/lib/renderer/WGPUComputePass.js.map +1 -0
- package/lib/renderer/WGPUFullQuadPass.d.ts +73 -0
- package/lib/renderer/WGPUFullQuadPass.js +389 -0
- package/lib/renderer/WGPUFullQuadPass.js.map +1 -0
- package/lib/renderer/WGPUHDRPeakMeter.d.ts +19 -0
- package/lib/renderer/WGPUHDRPeakMeter.js +112 -0
- package/lib/renderer/WGPUHDRPeakMeter.js.map +1 -0
- package/lib/renderer/WGPUJNLMDenoiser.d.ts +61 -0
- package/lib/renderer/WGPUJNLMDenoiser.js +412 -0
- package/lib/renderer/WGPUJNLMDenoiser.js.map +1 -0
- package/lib/renderer/WGPURayTraceOutput.d.ts +44 -0
- package/lib/renderer/WGPURayTraceOutput.js +368 -0
- package/lib/renderer/WGPURayTraceOutput.js.map +1 -0
- package/lib/renderer/WGPURayTracePass.d.ts +284 -0
- package/lib/renderer/WGPURayTracePass.js +2323 -0
- package/lib/renderer/WGPURayTracePass.js.map +1 -0
- package/lib/renderer/WGPURenderingPipeline.d.ts +9 -0
- package/lib/renderer/WGPURenderingPipeline.js +1446 -0
- package/lib/renderer/WGPURenderingPipeline.js.map +1 -0
- package/lib/renderer/WGPUSceneFeatures.d.ts +3 -0
- package/lib/renderer/WGPUSceneFeatures.js +20 -0
- package/lib/renderer/WGPUSceneFeatures.js.map +1 -0
- package/lib/renderer/WGPUScratchBuffer.d.ts +9 -0
- package/lib/renderer/WGPUScratchBuffer.js +21 -0
- package/lib/renderer/WGPUScratchBuffer.js.map +1 -0
- package/lib/renderer/WGPUScratchTexture.d.ts +10 -0
- package/lib/renderer/WGPUScratchTexture.js +27 -0
- package/lib/renderer/WGPUScratchTexture.js.map +1 -0
- package/lib/renderer/WGPUShaderCache.d.ts +26 -0
- package/lib/renderer/WGPUShaderCache.js +103 -0
- package/lib/renderer/WGPUShaderCache.js.map +1 -0
- package/lib/renderer/WebGLBloomPass.d.ts +18 -0
- package/lib/renderer/WebGLBloomPass.js +113 -0
- package/lib/renderer/WebGLBloomPass.js.map +1 -0
- package/lib/renderer/WebGLFullQuadPass.d.ts +65 -0
- package/lib/renderer/WebGLFullQuadPass.js +208 -0
- package/lib/renderer/WebGLFullQuadPass.js.map +1 -0
- package/lib/renderer/WebGLJNLMDenoiser.d.ts +32 -0
- package/lib/renderer/WebGLJNLMDenoiser.js +328 -0
- package/lib/renderer/WebGLJNLMDenoiser.js.map +1 -0
- package/lib/renderer/WebGLRayTraceOutputPass.d.ts +20 -0
- package/lib/renderer/WebGLRayTraceOutputPass.js +106 -0
- package/lib/renderer/WebGLRayTraceOutputPass.js.map +1 -0
- package/lib/renderer/WebGLRayTracePass.d.ts +142 -0
- package/lib/renderer/WebGLRayTracePass.js +845 -0
- package/lib/renderer/WebGLRayTracePass.js.map +1 -0
- package/lib/renderer/WebGLReadback.d.ts +4 -0
- package/lib/renderer/WebGLReadback.js +75 -0
- package/lib/renderer/WebGLReadback.js.map +1 -0
- package/lib/renderer/WebGLRenderingPipeline.d.ts +4 -0
- package/lib/renderer/WebGLRenderingPipeline.js +510 -0
- package/lib/renderer/WebGLRenderingPipeline.js.map +1 -0
- package/lib/renderer/WebGLScratchCopy.d.ts +10 -0
- package/lib/renderer/WebGLScratchCopy.js +27 -0
- package/lib/renderer/WebGLScratchCopy.js.map +1 -0
- package/lib/renderer/accumulationTarget.d.ts +26 -0
- package/lib/renderer/accumulationTarget.js +2 -0
- package/lib/renderer/accumulationTarget.js.map +1 -0
- package/lib/renderer/binnedSahBvh.d.ts +31 -0
- package/lib/renderer/binnedSahBvh.js +263 -0
- package/lib/renderer/binnedSahBvh.js.map +1 -0
- package/lib/renderer/bvh.worker.d.ts +1 -0
- package/lib/renderer/bvh.worker.js +16 -0
- package/lib/renderer/bvh.worker.js.map +1 -0
- package/lib/renderer/bvhAccel.d.ts +81 -0
- package/lib/renderer/bvhAccel.js +621 -0
- package/lib/renderer/bvhAccel.js.map +1 -0
- package/lib/renderer/bvhWorkerBuild.d.ts +12 -0
- package/lib/renderer/bvhWorkerBuild.js +17 -0
- package/lib/renderer/bvhWorkerBuild.js.map +1 -0
- package/lib/renderer/bvhWorkerClient.d.ts +57 -0
- package/lib/renderer/bvhWorkerClient.js +166 -0
- package/lib/renderer/bvhWorkerClient.js.map +1 -0
- package/lib/renderer/cameraLens.d.ts +5 -0
- package/lib/renderer/cameraLens.js +15 -0
- package/lib/renderer/cameraLens.js.map +1 -0
- package/lib/renderer/cameraSnapshot.d.ts +3 -0
- package/lib/renderer/cameraSnapshot.js +7 -0
- package/lib/renderer/cameraSnapshot.js.map +1 -0
- package/lib/renderer/committedScene.d.ts +13 -0
- package/lib/renderer/committedScene.js +121 -0
- package/lib/renderer/committedScene.js.map +1 -0
- package/lib/renderer/dataTextureUtil.d.ts +32 -0
- package/lib/renderer/dataTextureUtil.js +46 -0
- package/lib/renderer/dataTextureUtil.js.map +1 -0
- package/lib/renderer/denoiser.d.ts +65 -0
- package/lib/renderer/denoiser.js +2 -0
- package/lib/renderer/denoiser.js.map +1 -0
- package/lib/renderer/depthQuery.d.ts +14 -0
- package/lib/renderer/depthQuery.js +14 -0
- package/lib/renderer/depthQuery.js.map +1 -0
- package/lib/renderer/deviceRequirements.d.ts +23 -0
- package/lib/renderer/deviceRequirements.js +50 -0
- package/lib/renderer/deviceRequirements.js.map +1 -0
- package/lib/renderer/envMapCreation.d.ts +10 -0
- package/lib/renderer/envMapCreation.js +96 -0
- package/lib/renderer/envMapCreation.js.map +1 -0
- package/lib/renderer/envMapDistribution.d.ts +9 -0
- package/lib/renderer/envMapDistribution.js +107 -0
- package/lib/renderer/envMapDistribution.js.map +1 -0
- package/lib/renderer/float16.d.ts +1 -0
- package/lib/renderer/float16.js +19 -0
- package/lib/renderer/float16.js.map +1 -0
- package/lib/renderer/geometryBvh.d.ts +11 -0
- package/lib/renderer/geometryBvh.js +24 -0
- package/lib/renderer/geometryBvh.js.map +1 -0
- package/lib/renderer/geometryUpdates.d.ts +28 -0
- package/lib/renderer/geometryUpdates.js +131 -0
- package/lib/renderer/geometryUpdates.js.map +1 -0
- package/lib/renderer/glsl/chunks/cameraRay.glsl.d.ts +2 -0
- package/lib/renderer/glsl/chunks/cameraRay.glsl.js +37 -0
- package/lib/renderer/glsl/chunks/cameraRay.glsl.js.map +1 -0
- package/lib/renderer/glsl/chunks/common.glsl.d.ts +2 -0
- package/lib/renderer/glsl/chunks/common.glsl.js +17 -0
- package/lib/renderer/glsl/chunks/common.glsl.js.map +1 -0
- package/lib/renderer/glsl/chunks/envMap.glsl.d.ts +2 -0
- package/lib/renderer/glsl/chunks/envMap.glsl.js +192 -0
- package/lib/renderer/glsl/chunks/envMap.glsl.js.map +1 -0
- package/lib/renderer/glsl/chunks/intersect.glsl.d.ts +2 -0
- package/lib/renderer/glsl/chunks/intersect.glsl.js +1091 -0
- package/lib/renderer/glsl/chunks/intersect.glsl.js.map +1 -0
- package/lib/renderer/glsl/chunks/materialBuffer.glsl.d.ts +2 -0
- package/lib/renderer/glsl/chunks/materialBuffer.glsl.js +371 -0
- package/lib/renderer/glsl/chunks/materialBuffer.glsl.js.map +1 -0
- package/lib/renderer/glsl/chunks/openPbrBsdf.glsl.d.ts +2 -0
- package/lib/renderer/glsl/chunks/openPbrBsdf.glsl.js +1767 -0
- package/lib/renderer/glsl/chunks/openPbrBsdf.glsl.js.map +1 -0
- package/lib/renderer/glsl/chunks/rand.glsl.d.ts +2 -0
- package/lib/renderer/glsl/chunks/rand.glsl.js +26 -0
- package/lib/renderer/glsl/chunks/rand.glsl.js.map +1 -0
- package/lib/renderer/glsl/chunks/random.glsl.d.ts +2 -0
- package/lib/renderer/glsl/chunks/random.glsl.js +27 -0
- package/lib/renderer/glsl/chunks/random.glsl.js.map +1 -0
- package/lib/renderer/glsl/chunks/rayTraceCore.glsl.d.ts +2 -0
- package/lib/renderer/glsl/chunks/rayTraceCore.glsl.js +287 -0
- package/lib/renderer/glsl/chunks/rayTraceCore.glsl.js.map +1 -0
- package/lib/renderer/glsl/chunks/sampleLight.glsl.d.ts +2 -0
- package/lib/renderer/glsl/chunks/sampleLight.glsl.js +254 -0
- package/lib/renderer/glsl/chunks/sampleLight.glsl.js.map +1 -0
- package/lib/renderer/glsl/chunks/sampleMaterial.glsl.d.ts +2 -0
- package/lib/renderer/glsl/chunks/sampleMaterial.glsl.js +279 -0
- package/lib/renderer/glsl/chunks/sampleMaterial.glsl.js.map +1 -0
- package/lib/renderer/glsl/chunks/sampleShadowCatcher.glsl.d.ts +2 -0
- package/lib/renderer/glsl/chunks/sampleShadowCatcher.glsl.js +48 -0
- package/lib/renderer/glsl/chunks/sampleShadowCatcher.glsl.js.map +1 -0
- package/lib/renderer/glsl/chunks/sampling.glsl.d.ts +2 -0
- package/lib/renderer/glsl/chunks/sampling.glsl.js +194 -0
- package/lib/renderer/glsl/chunks/sampling.glsl.js.map +1 -0
- package/lib/renderer/glsl/chunks/sobol.glsl.d.ts +2 -0
- package/lib/renderer/glsl/chunks/sobol.glsl.js +170 -0
- package/lib/renderer/glsl/chunks/sobol.glsl.js.map +1 -0
- package/lib/renderer/glsl/chunks/textureLinear.glsl.d.ts +2 -0
- package/lib/renderer/glsl/chunks/textureLinear.glsl.js +27 -0
- package/lib/renderer/glsl/chunks/textureLinear.glsl.js.map +1 -0
- package/lib/renderer/glsl/chunks/uvProjection.glsl.d.ts +2 -0
- package/lib/renderer/glsl/chunks/uvProjection.glsl.js +72 -0
- package/lib/renderer/glsl/chunks/uvProjection.glsl.js.map +1 -0
- package/lib/renderer/glsl/depthQuery.frag.d.ts +3 -0
- package/lib/renderer/glsl/depthQuery.frag.js +55 -0
- package/lib/renderer/glsl/depthQuery.frag.js.map +1 -0
- package/lib/renderer/glsl/normalizeRayTraceOutput.frag.d.ts +6 -0
- package/lib/renderer/glsl/normalizeRayTraceOutput.frag.js +46 -0
- package/lib/renderer/glsl/normalizeRayTraceOutput.frag.js.map +1 -0
- package/lib/renderer/glsl/rayTrace.frag.d.ts +2 -0
- package/lib/renderer/glsl/rayTrace.frag.js +619 -0
- package/lib/renderer/glsl/rayTrace.frag.js.map +1 -0
- package/lib/renderer/glsl/shadowCatcher.frag.d.ts +3 -0
- package/lib/renderer/glsl/shadowCatcher.frag.js +119 -0
- package/lib/renderer/glsl/shadowCatcher.frag.js.map +1 -0
- package/lib/renderer/glsl/webglPipeline.frag.d.ts +4 -0
- package/lib/renderer/glsl/webglPipeline.frag.js +208 -0
- package/lib/renderer/glsl/webglPipeline.frag.js.map +1 -0
- package/lib/renderer/gpuMemory.d.ts +2 -0
- package/lib/renderer/gpuMemory.js +10 -0
- package/lib/renderer/gpuMemory.js.map +1 -0
- package/lib/renderer/halton.d.ts +1 -0
- package/lib/renderer/halton.js +15 -0
- package/lib/renderer/halton.js.map +1 -0
- package/lib/renderer/jnlm.d.ts +85 -0
- package/lib/renderer/jnlm.js +87 -0
- package/lib/renderer/jnlm.js.map +1 -0
- package/lib/renderer/lightSampling.d.ts +75 -0
- package/lib/renderer/lightSampling.js +305 -0
- package/lib/renderer/lightSampling.js.map +1 -0
- package/lib/renderer/lightsUtil.d.ts +26 -0
- package/lib/renderer/lightsUtil.js +154 -0
- package/lib/renderer/lightsUtil.js.map +1 -0
- package/lib/renderer/materialChanges.d.ts +13 -0
- package/lib/renderer/materialChanges.js +59 -0
- package/lib/renderer/materialChanges.js.map +1 -0
- package/lib/renderer/materialComparison.generated.d.ts +5 -0
- package/lib/renderer/materialComparison.generated.js +655 -0
- package/lib/renderer/materialComparison.generated.js.map +1 -0
- package/lib/renderer/materialConstants.d.ts +6 -0
- package/lib/renderer/materialConstants.js +3 -0
- package/lib/renderer/materialConstants.js.map +1 -0
- package/lib/renderer/materialEmission.d.ts +9 -0
- package/lib/renderer/materialEmission.js +21 -0
- package/lib/renderer/materialEmission.js.map +1 -0
- package/lib/renderer/materialIndices.d.ts +7 -0
- package/lib/renderer/materialIndices.js +34 -0
- package/lib/renderer/materialIndices.js.map +1 -0
- package/lib/renderer/materialLayout.d.ts +102 -0
- package/lib/renderer/materialLayout.js +189 -0
- package/lib/renderer/materialLayout.js.map +1 -0
- package/lib/renderer/materialTextureSlots.d.ts +537 -0
- package/lib/renderer/materialTextureSlots.js +219 -0
- package/lib/renderer/materialTextureSlots.js.map +1 -0
- package/lib/renderer/mergeMeshesToGeometry.d.ts +8 -0
- package/lib/renderer/mergeMeshesToGeometry.js +236 -0
- package/lib/renderer/mergeMeshesToGeometry.js.map +1 -0
- package/lib/renderer/meshInstances.d.ts +23 -0
- package/lib/renderer/meshInstances.js +66 -0
- package/lib/renderer/meshInstances.js.map +1 -0
- package/lib/renderer/meshMembership.d.ts +10 -0
- package/lib/renderer/meshMembership.js +72 -0
- package/lib/renderer/meshMembership.js.map +1 -0
- package/lib/renderer/oidnNetwork.d.ts +20 -0
- package/lib/renderer/oidnNetwork.js +123 -0
- package/lib/renderer/oidnNetwork.js.map +1 -0
- package/lib/renderer/openPbrEnergyLut.d.ts +32 -0
- package/lib/renderer/openPbrEnergyLut.js +965 -0
- package/lib/renderer/openPbrEnergyLut.js.map +1 -0
- package/lib/renderer/pathLimits.d.ts +4 -0
- package/lib/renderer/pathLimits.js +7 -0
- package/lib/renderer/pathLimits.js.map +1 -0
- package/lib/renderer/prepareMeshBVH.d.ts +110 -0
- package/lib/renderer/prepareMeshBVH.js +857 -0
- package/lib/renderer/prepareMeshBVH.js.map +1 -0
- package/lib/renderer/progressiveScheduler.d.ts +11 -0
- package/lib/renderer/progressiveScheduler.js +19 -0
- package/lib/renderer/progressiveScheduler.js.map +1 -0
- package/lib/renderer/renderPipeline.d.ts +57 -0
- package/lib/renderer/renderPipeline.js +49 -0
- package/lib/renderer/renderPipeline.js.map +1 -0
- package/lib/renderer/sampling.d.ts +10 -0
- package/lib/renderer/sampling.js +28 -0
- package/lib/renderer/sampling.js.map +1 -0
- package/lib/renderer/sceneChangeDetector.d.ts +29 -0
- package/lib/renderer/sceneChangeDetector.js +232 -0
- package/lib/renderer/sceneChangeDetector.js.map +1 -0
- package/lib/renderer/sceneLightChanges.d.ts +14 -0
- package/lib/renderer/sceneLightChanges.js +34 -0
- package/lib/renderer/sceneLightChanges.js.map +1 -0
- package/lib/renderer/scratchSampling.d.ts +3 -0
- package/lib/renderer/scratchSampling.js +39 -0
- package/lib/renderer/scratchSampling.js.map +1 -0
- package/lib/renderer/shader.d.ts +37 -0
- package/lib/renderer/shader.js +41 -0
- package/lib/renderer/shader.js.map +1 -0
- package/lib/renderer/staticBvhPreparation.d.ts +24 -0
- package/lib/renderer/staticBvhPreparation.js +116 -0
- package/lib/renderer/staticBvhPreparation.js.map +1 -0
- package/lib/renderer/textureRegion.d.ts +8 -0
- package/lib/renderer/textureRegion.js +9 -0
- package/lib/renderer/textureRegion.js.map +1 -0
- package/lib/renderer/texturesFromMaterials.d.ts +6 -0
- package/lib/renderer/texturesFromMaterials.js +37 -0
- package/lib/renderer/texturesFromMaterials.js.map +1 -0
- package/lib/renderer/util.d.ts +17 -0
- package/lib/renderer/util.js +56 -0
- package/lib/renderer/util.js.map +1 -0
- package/lib/renderer/webgl.d.ts +131 -0
- package/lib/renderer/webgl.js +586 -0
- package/lib/renderer/webgl.js.map +1 -0
- package/lib/renderer/webglShaders.d.ts +4 -0
- package/lib/renderer/webglShaders.js +41 -0
- package/lib/renderer/webglShaders.js.map +1 -0
- package/lib/renderer/wgsl/chunks/common.wgsl.d.ts +2 -0
- package/lib/renderer/wgsl/chunks/common.wgsl.js +23 -0
- package/lib/renderer/wgsl/chunks/common.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/chunks/envMap.wgsl.d.ts +2 -0
- package/lib/renderer/wgsl/chunks/envMap.wgsl.js +128 -0
- package/lib/renderer/wgsl/chunks/envMap.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/chunks/intersect.wgsl.d.ts +6 -0
- package/lib/renderer/wgsl/chunks/intersect.wgsl.js +1441 -0
- package/lib/renderer/wgsl/chunks/intersect.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/chunks/intersectionAlpha.wgsl.d.ts +8 -0
- package/lib/renderer/wgsl/chunks/intersectionAlpha.wgsl.js +85 -0
- package/lib/renderer/wgsl/chunks/intersectionAlpha.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/chunks/materialBuffer.wgsl.d.ts +7 -0
- package/lib/renderer/wgsl/chunks/materialBuffer.wgsl.js +315 -0
- package/lib/renderer/wgsl/chunks/materialBuffer.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/chunks/openPbrBsdf.wgsl.d.ts +3 -0
- package/lib/renderer/wgsl/chunks/openPbrBsdf.wgsl.js +1737 -0
- package/lib/renderer/wgsl/chunks/openPbrBsdf.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/chunks/pdm_displacement.wgsl.d.ts +4 -0
- package/lib/renderer/wgsl/chunks/pdm_displacement.wgsl.js +352 -0
- package/lib/renderer/wgsl/chunks/pdm_displacement.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/chunks/rand.wgsl.d.ts +2 -0
- package/lib/renderer/wgsl/chunks/rand.wgsl.js +25 -0
- package/lib/renderer/wgsl/chunks/rand.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/chunks/random.wgsl.d.ts +1 -0
- package/lib/renderer/wgsl/chunks/random.wgsl.js +2 -0
- package/lib/renderer/wgsl/chunks/random.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/chunks/rayTraceCore.wgsl.d.ts +5 -0
- package/lib/renderer/wgsl/chunks/rayTraceCore.wgsl.js +328 -0
- package/lib/renderer/wgsl/chunks/rayTraceCore.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/chunks/sampleLight.wgsl.d.ts +2 -0
- package/lib/renderer/wgsl/chunks/sampleLight.wgsl.js +400 -0
- package/lib/renderer/wgsl/chunks/sampleLight.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/chunks/sampleMaterial.wgsl.d.ts +3 -0
- package/lib/renderer/wgsl/chunks/sampleMaterial.wgsl.js +439 -0
- package/lib/renderer/wgsl/chunks/sampleMaterial.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/chunks/sampleShadowCatcher.wgsl.d.ts +2 -0
- package/lib/renderer/wgsl/chunks/sampleShadowCatcher.wgsl.js +40 -0
- package/lib/renderer/wgsl/chunks/sampleShadowCatcher.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/chunks/sampling.wgsl.d.ts +2 -0
- package/lib/renderer/wgsl/chunks/sampling.wgsl.js +198 -0
- package/lib/renderer/wgsl/chunks/sampling.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/chunks/shadowCatcherAccumulation.wgsl.d.ts +8 -0
- package/lib/renderer/wgsl/chunks/shadowCatcherAccumulation.wgsl.js +16 -0
- package/lib/renderer/wgsl/chunks/shadowCatcherAccumulation.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/chunks/sobol.wgsl.d.ts +2 -0
- package/lib/renderer/wgsl/chunks/sobol.wgsl.js +170 -0
- package/lib/renderer/wgsl/chunks/sobol.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/chunks/uvProjection.wgsl.d.ts +2 -0
- package/lib/renderer/wgsl/chunks/uvProjection.wgsl.js +42 -0
- package/lib/renderer/wgsl/chunks/uvProjection.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/compose.frag.wgsl.d.ts +5 -0
- package/lib/renderer/wgsl/compose.frag.wgsl.js +218 -0
- package/lib/renderer/wgsl/compose.frag.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/customDenoise.wgsl.d.ts +4 -0
- package/lib/renderer/wgsl/customDenoise.wgsl.js +28 -0
- package/lib/renderer/wgsl/customDenoise.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/depthQuery.wgsl.d.ts +3 -0
- package/lib/renderer/wgsl/depthQuery.wgsl.js +34 -0
- package/lib/renderer/wgsl/depthQuery.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/offlineAdaptive.compute.d.ts +2 -0
- package/lib/renderer/wgsl/offlineAdaptive.compute.js +108 -0
- package/lib/renderer/wgsl/offlineAdaptive.compute.js.map +1 -0
- package/lib/renderer/wgsl/rayTrace.compute.d.ts +16 -0
- package/lib/renderer/wgsl/rayTrace.compute.js +923 -0
- package/lib/renderer/wgsl/rayTrace.compute.js.map +1 -0
- package/lib/scene/AmbientLight.d.ts +17 -0
- package/lib/scene/AmbientLight.js +15 -0
- package/lib/scene/AmbientLight.js.map +1 -0
- package/lib/scene/Camera.d.ts +78 -0
- package/lib/scene/Camera.js +111 -0
- package/lib/scene/Camera.js.map +1 -0
- package/lib/scene/DirectionalLight.d.ts +18 -0
- package/lib/scene/DirectionalLight.js +17 -0
- package/lib/scene/DirectionalLight.js.map +1 -0
- package/lib/scene/EnvironmentLight.d.ts +14 -0
- package/lib/scene/EnvironmentLight.js +14 -0
- package/lib/scene/EnvironmentLight.js.map +1 -0
- package/lib/scene/Geometry.d.ts +87 -0
- package/lib/scene/Geometry.js +108 -0
- package/lib/scene/Geometry.js.map +1 -0
- package/lib/scene/IESProfile.d.ts +19 -0
- package/lib/scene/IESProfile.js +165 -0
- package/lib/scene/IESProfile.js.map +1 -0
- package/lib/scene/InstancedMesh.d.ts +43 -0
- package/lib/scene/InstancedMesh.js +79 -0
- package/lib/scene/InstancedMesh.js.map +1 -0
- package/lib/scene/Mesh.d.ts +14 -0
- package/lib/scene/Mesh.js +17 -0
- package/lib/scene/Mesh.js.map +1 -0
- package/lib/scene/OpenPBRMaterial.d.ts +224 -0
- package/lib/scene/OpenPBRMaterial.js +240 -0
- package/lib/scene/OpenPBRMaterial.js.map +1 -0
- package/lib/scene/RectLight.d.ts +31 -0
- package/lib/scene/RectLight.js +26 -0
- package/lib/scene/RectLight.js.map +1 -0
- package/lib/scene/Scene.d.ts +55 -0
- package/lib/scene/Scene.js +2 -0
- package/lib/scene/Scene.js.map +1 -0
- package/lib/scene/SceneNode.d.ts +16 -0
- package/lib/scene/SceneNode.js +33 -0
- package/lib/scene/SceneNode.js.map +1 -0
- package/lib/scene/SphereLight.d.ts +22 -0
- package/lib/scene/SphereLight.js +20 -0
- package/lib/scene/SphereLight.js.map +1 -0
- package/lib/scene/SpotLight.d.ts +35 -0
- package/lib/scene/SpotLight.js +29 -0
- package/lib/scene/SpotLight.js.map +1 -0
- package/lib/scene/Texture.d.ts +38 -0
- package/lib/scene/Texture.js +37 -0
- package/lib/scene/Texture.js.map +1 -0
- package/lib/scene/anisotropyParameters.d.ts +1 -0
- package/lib/scene/anisotropyParameters.js +13 -0
- package/lib/scene/anisotropyParameters.js.map +1 -0
- package/lib/scene/geometryChanges.d.ts +5 -0
- package/lib/scene/geometryChanges.js +18 -0
- package/lib/scene/geometryChanges.js.map +1 -0
- package/lib/scene/materialTextureNames.d.ts +2 -0
- package/lib/scene/materialTextureNames.js +9 -0
- package/lib/scene/materialTextureNames.js.map +1 -0
- package/lib/scene/openPbrSchema.d.ts +400 -0
- package/lib/scene/openPbrSchema.js +149 -0
- package/lib/scene/openPbrSchema.js.map +1 -0
- package/lib/scene/thinFilmParameters.d.ts +4 -0
- package/lib/scene/thinFilmParameters.js +12 -0
- package/lib/scene/thinFilmParameters.js.map +1 -0
- package/lib/settings/display.d.ts +118 -0
- package/lib/settings/display.js +34 -0
- package/lib/settings/display.js.map +1 -0
- package/lib/settings/engine.d.ts +37 -0
- package/lib/settings/engine.js +26 -0
- package/lib/settings/engine.js.map +1 -0
- package/lib/settings/render.d.ts +178 -0
- package/lib/settings/render.js +36 -0
- package/lib/settings/render.js.map +1 -0
- package/lib/tinybvh/LICENSE +21 -0
- package/lib/tinybvh/TinyBvhBuilder.d.ts +17 -0
- package/lib/tinybvh/TinyBvhBuilder.js +211 -0
- package/lib/tinybvh/TinyBvhBuilder.js.map +1 -0
- package/lib/tinybvh/tinybvh.wasm +0 -0
- package/lib/types.d.ts +13 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/lib/util/canvas.d.ts +2 -0
- package/lib/util/canvas.js +13 -0
- package/lib/util/canvas.js.map +1 -0
- package/lib/util/commonGeometry.d.ts +15 -0
- package/lib/util/commonGeometry.js +240 -0
- package/lib/util/commonGeometry.js.map +1 -0
- package/lib/util/events.d.ts +7 -0
- package/lib/util/events.js +23 -0
- package/lib/util/events.js.map +1 -0
- package/lib/util/frame.d.ts +2 -0
- package/lib/util/frame.js +10 -0
- package/lib/util/frame.js.map +1 -0
- package/lib/util/fromTHREE.d.ts +100 -0
- package/lib/util/fromTHREE.js +1063 -0
- package/lib/util/fromTHREE.js.map +1 -0
- package/lib/util/geometry.d.ts +13 -0
- package/lib/util/geometry.js +292 -0
- package/lib/util/geometry.js.map +1 -0
- package/lib/util/loadRGBE.d.ts +7 -0
- package/lib/util/loadRGBE.js +168 -0
- package/lib/util/loadRGBE.js.map +1 -0
- package/lib/util/math.d.ts +8 -0
- package/lib/util/math.js +64 -0
- package/lib/util/math.js.map +1 -0
- package/lib/util/mesh.d.ts +7 -0
- package/lib/util/mesh.js +20 -0
- package/lib/util/mesh.js.map +1 -0
- package/lib/util/threeDeformation.d.ts +20 -0
- package/lib/util/threeDeformation.js +218 -0
- package/lib/util/threeDeformation.js.map +1 -0
- package/lib/version.d.ts +2 -0
- package/lib/version.js +3 -0
- package/lib/version.js.map +1 -0
- package/llms.txt +62 -0
- package/oidn/weights/LICENSE.txt +202 -0
- package/oidn/weights/README.md +43 -0
- package/oidn/weights/rt_hdr_alb_nrm.tza +0 -0
- package/oidn/weights/rt_hdr_alb_nrm_small.tza +0 -0
- package/package.json +124 -4
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
import { LIGHT_CHOICE_ANALYTIC, LIGHT_CHOICE_EMISSIVE_TRIANGLE, LIGHT_CHOICE_ENVIRONMENT } from '../../lightSampling.js';
|
|
2
|
+
export default /*wgsl */ `
|
|
3
|
+
fn eJ(light: Light, fm: vec3f, iT: vec2f, lightSample: ptr<function, LightSampleRec>) {
|
|
4
|
+
let iq = light.position - fm;
|
|
5
|
+
let aj = length(iq);
|
|
6
|
+
if (light.radiusOrSpread <= 0.0) {
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
if (aj <= 1e-6) {
|
|
11
|
+
(*lightSample).direction = vec3f(0.0, 0.0, 1.0);
|
|
12
|
+
(*lightSample).normal = vec3f(0.0, 0.0, -1.0);
|
|
13
|
+
(*lightSample).dist = 0.0;
|
|
14
|
+
(*lightSample).pdf = 1.0;
|
|
15
|
+
(*lightSample).emission = vec3f(0.0);
|
|
16
|
+
(*lightSample).isDelta = true;
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
(*lightSample).direction = iq / aj;
|
|
20
|
+
(*lightSample).normal = -(*lightSample).direction;
|
|
21
|
+
(*lightSample).dist = aj;
|
|
22
|
+
(*lightSample).pdf = 1.0;
|
|
23
|
+
(*lightSample).emission = light.emission /
|
|
24
|
+
max(aj * aj, 1e-8);
|
|
25
|
+
(*lightSample).isDelta = true;
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
let radius = max(light.radiusOrSpread, 1e-6);
|
|
29
|
+
(*lightSample).isDelta = false;
|
|
30
|
+
var gC: vec3f;
|
|
31
|
+
|
|
32
|
+
if (aj <= radius) {
|
|
33
|
+
let z = 1.0 - 2.0 * iT.x;
|
|
34
|
+
let fi = sqrt(max(0.0, 1.0 - z * z));
|
|
35
|
+
let br = TWOPI * iT.y;
|
|
36
|
+
gC = vec3f(
|
|
37
|
+
fi * cos(br),
|
|
38
|
+
fi * sin(br),
|
|
39
|
+
z
|
|
40
|
+
);
|
|
41
|
+
(*lightSample).pdf = INV4PI;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
let sF = iq / aj;
|
|
45
|
+
let jn = min(
|
|
46
|
+
1.0,
|
|
47
|
+
radius * radius / (aj * aj)
|
|
48
|
+
);
|
|
49
|
+
let cosThetaMax = sqrt(max(0.0, 1.0 - jn));
|
|
50
|
+
let cc = mix(1.0, cosThetaMax, iT.x);
|
|
51
|
+
let sinTheta = sqrt(max(0.0, 1.0 - cc * cc));
|
|
52
|
+
let br = TWOPI * iT.y;
|
|
53
|
+
var tangent: vec3f;
|
|
54
|
+
var bitangent: vec3f;
|
|
55
|
+
aK(sF, &tangent, &bitangent);
|
|
56
|
+
gC = sF * cc
|
|
57
|
+
+ tangent * (sinTheta * cos(br))
|
|
58
|
+
+ bitangent * (sinTheta * sin(br));
|
|
59
|
+
(*lightSample).pdf = 1.0 / max(
|
|
60
|
+
TWOPI * (1.0 - cosThetaMax),
|
|
61
|
+
1e-8
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
let ir = dot(gC, iq);
|
|
66
|
+
let pQ = dot(iq, iq);
|
|
67
|
+
let ej = ir * ir
|
|
68
|
+
- pQ + radius * radius;
|
|
69
|
+
let cN = ir - sqrt(max(0.0, ej));
|
|
70
|
+
let cB = ir + sqrt(max(0.0, ej));
|
|
71
|
+
(*lightSample).dist = select(cB, cN, cN > 1e-6);
|
|
72
|
+
(*lightSample).direction = gC;
|
|
73
|
+
let rQ = fm + gC * (*lightSample).dist;
|
|
74
|
+
(*lightSample).normal = normalize(rQ - light.position);
|
|
75
|
+
(*lightSample).emission = light.emission;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
fn cZ(
|
|
79
|
+
light: Light,
|
|
80
|
+
surfacePoint: vec3f,
|
|
81
|
+
lowerLeft: vec3f,
|
|
82
|
+
result: ptr<function, LightSampleRec>
|
|
83
|
+
) {
|
|
84
|
+
if (light.textureIndex < 0.0) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
let width = length(light.u);
|
|
88
|
+
let height = length(light.v);
|
|
89
|
+
let hY = surfacePoint - lowerLeft;
|
|
90
|
+
let uv = vec2f(
|
|
91
|
+
dot(hY, light.u / width) / width,
|
|
92
|
+
dot(hY, light.v / height) / height
|
|
93
|
+
);
|
|
94
|
+
(*result).emission *= sampleMap(i32(light.textureIndex), uv).rgb;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
fn jJ(
|
|
98
|
+
light: Light,
|
|
99
|
+
shadingPoint: vec3f,
|
|
100
|
+
samplePoint: vec2f,
|
|
101
|
+
result: ptr<function, LightSampleRec>
|
|
102
|
+
) {
|
|
103
|
+
let normal = normalize(cross(light.u, light.v));
|
|
104
|
+
let lowerLeft = light.position - 0.5 * (light.u + light.v);
|
|
105
|
+
let spread = clamp(light.radiusOrSpread, 0.0, 1.0);
|
|
106
|
+
|
|
107
|
+
if (spread <= 0.001) {
|
|
108
|
+
let ga = dot(normal, shadingPoint - light.position);
|
|
109
|
+
let surfacePoint = shadingPoint - normal * ga;
|
|
110
|
+
let hY = surfacePoint - lowerLeft;
|
|
111
|
+
let width = length(light.u);
|
|
112
|
+
let height = length(light.v);
|
|
113
|
+
let uv = vec2f(
|
|
114
|
+
dot(hY, light.u / width) / width,
|
|
115
|
+
dot(hY, light.v / height) / height
|
|
116
|
+
);
|
|
117
|
+
if (ga <= 0.0 || any(uv < vec2f(0.0)) || any(uv > vec2f(1.0))) {
|
|
118
|
+
(*result).emission = vec3f(0.0);
|
|
119
|
+
(*result).pdf = 0.0;
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
(*result).direction = -normal;
|
|
123
|
+
(*result).dist = ga;
|
|
124
|
+
(*result).normal = normal;
|
|
125
|
+
(*result).emission = light.emission;
|
|
126
|
+
(*result).pdf = 1.0;
|
|
127
|
+
(*result).isDelta = true;
|
|
128
|
+
cZ(light, surfacePoint, lowerLeft, result);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
let surfacePoint = lowerLeft
|
|
133
|
+
+ light.u * samplePoint.x
|
|
134
|
+
+ light.v * samplePoint.y;
|
|
135
|
+
let offset = surfacePoint - shadingPoint;
|
|
136
|
+
let hl = dot(offset, offset);
|
|
137
|
+
(*result).dist = sqrt(hl);
|
|
138
|
+
(*result).direction = offset / (*result).dist;
|
|
139
|
+
(*result).normal = normal;
|
|
140
|
+
let fV = dot(-(*result).direction, normal);
|
|
141
|
+
let oC = cos(0.5 * PI * spread);
|
|
142
|
+
if (fV <= 0.0 || fV < oC) {
|
|
143
|
+
(*result).emission = vec3f(0.0);
|
|
144
|
+
(*result).pdf = 0.0;
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
(*result).emission = light.emission;
|
|
148
|
+
(*result).pdf = hl / max(light.area * fV, 1e-8);
|
|
149
|
+
cZ(light, surfacePoint, lowerLeft, result);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
fn fX(
|
|
153
|
+
light: Light,
|
|
154
|
+
result: ptr<function, LightSampleRec>
|
|
155
|
+
) {
|
|
156
|
+
(*result).direction = normalize(-light.u);
|
|
157
|
+
(*result).normal = -(*result).direction;
|
|
158
|
+
(*result).emission = light.emission;
|
|
159
|
+
(*result).dist = INF;
|
|
160
|
+
(*result).pdf = 1.0;
|
|
161
|
+
(*result).isDelta = true;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
fn jK(
|
|
165
|
+
light: Light,
|
|
166
|
+
shadingPoint: vec3f,
|
|
167
|
+
samplePoint: vec2f,
|
|
168
|
+
result: ptr<function, LightSampleRec>
|
|
169
|
+
) {
|
|
170
|
+
eJ(light, shadingPoint, samplePoint, result);
|
|
171
|
+
let surfacePoint = shadingPoint + (*result).direction * (*result).dist;
|
|
172
|
+
let dJ = normalize(shadingPoint - surfacePoint);
|
|
173
|
+
(*result).emission *= bL(light, dJ);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
fn iK(
|
|
177
|
+
light: Light,
|
|
178
|
+
shadingPoint: vec3f,
|
|
179
|
+
samplePoint: vec2f,
|
|
180
|
+
result: ptr<function, LightSampleRec>
|
|
181
|
+
) {
|
|
182
|
+
let dO = i32(light.litType);
|
|
183
|
+
if (dO == RECT_LIGHT) {
|
|
184
|
+
jJ(light, shadingPoint, samplePoint, result);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (dO == SPHERE_LIGHT) {
|
|
188
|
+
eJ(light, shadingPoint, samplePoint, result);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
if (dO == SPOT_LIGHT) {
|
|
192
|
+
jK(light, shadingPoint, samplePoint, result);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
if (dO == DIRECTIONAL_LIGHT) {
|
|
196
|
+
fX(light, result);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
fn mu(iT: vec2f, lightSample: ptr<function, LightSampleRec>) {
|
|
201
|
+
var uv: vec2f;
|
|
202
|
+
(*lightSample).direction = oA(iT, &uv, &(*lightSample).pdf);
|
|
203
|
+
(*lightSample).emission = textureLinear(envMap, uv).rgb;
|
|
204
|
+
(*lightSample).dist = INF;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
fn bV(ij: i32) -> vec4f {
|
|
208
|
+
let width = rtUniform.lightSamplingTextureWidth;
|
|
209
|
+
return textureLoad(
|
|
210
|
+
lightSamplingData,
|
|
211
|
+
vec2i(ij % width, ij / width),
|
|
212
|
+
0
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
fn pR(index: i32) -> EmissiveTriangle {
|
|
217
|
+
let offset = index * 6;
|
|
218
|
+
let a = bV(offset);
|
|
219
|
+
let b = bV(offset + 1);
|
|
220
|
+
let c = bV(offset + 2);
|
|
221
|
+
let d = bV(offset + 3);
|
|
222
|
+
let e = bV(offset + 4);
|
|
223
|
+
let f = bV(offset + 5);
|
|
224
|
+
return EmissiveTriangle(
|
|
225
|
+
a.xyz, a.w,
|
|
226
|
+
b.xyz, b.w,
|
|
227
|
+
c.xyz, c.w,
|
|
228
|
+
d.xy, d.zw, e.xy,
|
|
229
|
+
e.zw, f.xy, f.zw
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
fn sa(index: i32) -> oR {
|
|
234
|
+
let data = bV(rtUniform.lightChoiceTexelOffset + index);
|
|
235
|
+
return oR(
|
|
236
|
+
data.x,
|
|
237
|
+
bitcast<i32>(data.y),
|
|
238
|
+
bitcast<i32>(data.z),
|
|
239
|
+
bitcast<i32>(data.w)
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
fn jt(mN: i32, index: i32) -> oR {
|
|
244
|
+
return sa(mN + index);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
fn mF(
|
|
248
|
+
rnd: vec3f,
|
|
249
|
+
ca: u32,
|
|
250
|
+
aW: u32
|
|
251
|
+
) -> vec3f {
|
|
252
|
+
var sH = rnd;
|
|
253
|
+
let count = max(aW, 1u);
|
|
254
|
+
sH.z = (rnd.z + f32(min(ca, count - 1u))) /
|
|
255
|
+
f32(count);
|
|
256
|
+
return sH;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
fn lK(
|
|
260
|
+
triangle: EmissiveTriangle,
|
|
261
|
+
fm: vec3f,
|
|
262
|
+
iT: vec2f,
|
|
263
|
+
lightSample: ptr<function, LightSampleRec>
|
|
264
|
+
) {
|
|
265
|
+
let vl = sqrt(iT.x);
|
|
266
|
+
let barycentric = vec3f(
|
|
267
|
+
1.0 - vl,
|
|
268
|
+
vl * (1.0 - iT.y),
|
|
269
|
+
vl * iT.y
|
|
270
|
+
);
|
|
271
|
+
let sN =
|
|
272
|
+
barycentric.x * triangle.p0 +
|
|
273
|
+
barycentric.y * triangle.p1 +
|
|
274
|
+
barycentric.z * triangle.p2;
|
|
275
|
+
let uv =
|
|
276
|
+
barycentric.x * triangle.uv0 +
|
|
277
|
+
barycentric.y * triangle.uv1 +
|
|
278
|
+
barycentric.z * triangle.uv2;
|
|
279
|
+
let cX =
|
|
280
|
+
barycentric.x * triangle.secondaryUv0 +
|
|
281
|
+
barycentric.y * triangle.secondaryUv1 +
|
|
282
|
+
barycentric.z * triangle.secondaryUv2;
|
|
283
|
+
let normal = normalize(cross(triangle.p1 - triangle.p0, triangle.p2 - triangle.p0));
|
|
284
|
+
(*lightSample).direction = sN - fm;
|
|
285
|
+
(*lightSample).dist = length((*lightSample).direction);
|
|
286
|
+
if ((*lightSample).dist <= EPS) {
|
|
287
|
+
(*lightSample).emission = vec3f(0.0);
|
|
288
|
+
(*lightSample).pdf = 0.0;
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
(*lightSample).direction /= (*lightSample).dist;
|
|
292
|
+
(*lightSample).normal = normal;
|
|
293
|
+
let oZ = dot(normal, -(*lightSample).direction);
|
|
294
|
+
if (oZ <= 0.0) {
|
|
295
|
+
(*lightSample).emission = vec3f(0.0);
|
|
296
|
+
(*lightSample).pdf = 0.0;
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
(*lightSample).emission = lB(
|
|
300
|
+
i32(triangle.materialIndex), uv, cX
|
|
301
|
+
);
|
|
302
|
+
(*lightSample).selectionPmf = triangle.selectionPmf;
|
|
303
|
+
(*lightSample).pdf = triangle.selectionPmf *
|
|
304
|
+
((*lightSample).dist * (*lightSample).dist) /
|
|
305
|
+
max(triangle.area * oZ, 1e-8);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
fn jZ(
|
|
309
|
+
fm: vec3f,
|
|
310
|
+
rnd: vec3f,
|
|
311
|
+
mN: i32,
|
|
312
|
+
oY: i32,
|
|
313
|
+
mM: f32,
|
|
314
|
+
lightSample: ptr<function, LightSampleRec>
|
|
315
|
+
) {
|
|
316
|
+
(*lightSample).emission = vec3f(0.0);
|
|
317
|
+
(*lightSample).pdf = 0.0;
|
|
318
|
+
(*lightSample).selectionPmf = 0.0;
|
|
319
|
+
(*lightSample).dist = INF;
|
|
320
|
+
(*lightSample).isDelta = false;
|
|
321
|
+
(*lightSample).sourceType = 0u;
|
|
322
|
+
(*lightSample).sourceIndex = 0xffffffffu;
|
|
323
|
+
if (oY <= 0) {
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
let qV = rnd.z * f32(oY);
|
|
328
|
+
let column = min(i32(qV), oY - 1);
|
|
329
|
+
let qF = jt(mN, column);
|
|
330
|
+
let kQ = select(
|
|
331
|
+
qF.aliasIndex,
|
|
332
|
+
column,
|
|
333
|
+
fract(qV) < qF.probability
|
|
334
|
+
);
|
|
335
|
+
let oX = jt(mN, kQ);
|
|
336
|
+
if (oX.sourceType == ${LIGHT_CHOICE_ENVIRONMENT}) {
|
|
337
|
+
(*lightSample).sourceType = 0u;
|
|
338
|
+
(*lightSample).sourceIndex = u32(oX.sourceIndex);
|
|
339
|
+
mu(rnd.xy, lightSample);
|
|
340
|
+
(*lightSample).selectionPmf = rtUniform.envLightPmf;
|
|
341
|
+
(*lightSample).pdf *= rtUniform.envLightPmf;
|
|
342
|
+
}
|
|
343
|
+
else if (oX.sourceType == ${LIGHT_CHOICE_ANALYTIC}) {
|
|
344
|
+
(*lightSample).sourceType = 2u;
|
|
345
|
+
(*lightSample).sourceIndex = u32(oX.sourceIndex);
|
|
346
|
+
let light = analyticLights[oX.sourceIndex];
|
|
347
|
+
iK(light, fm, rnd.xy, lightSample);
|
|
348
|
+
(*lightSample).selectionPmf = light.selectionPmf;
|
|
349
|
+
(*lightSample).pdf *= light.selectionPmf;
|
|
350
|
+
}
|
|
351
|
+
else if (oX.sourceType == ${LIGHT_CHOICE_EMISSIVE_TRIANGLE}) {
|
|
352
|
+
(*lightSample).sourceType = 1u;
|
|
353
|
+
(*lightSample).sourceIndex = u32(oX.sourceIndex);
|
|
354
|
+
lK(
|
|
355
|
+
pR(oX.sourceIndex),
|
|
356
|
+
fm,
|
|
357
|
+
rnd.xy,
|
|
358
|
+
lightSample
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
(*lightSample).selectionPmf *= mM;
|
|
362
|
+
(*lightSample).pdf *= mM;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
fn sampleLight(
|
|
366
|
+
fm: vec3f,
|
|
367
|
+
rnd: vec3f,
|
|
368
|
+
lightSample: ptr<function, LightSampleRec>,
|
|
369
|
+
rP: bool
|
|
370
|
+
) {
|
|
371
|
+
jZ(
|
|
372
|
+
fm,
|
|
373
|
+
rnd,
|
|
374
|
+
0,
|
|
375
|
+
rtUniform.lightChoiceCount,
|
|
376
|
+
1.0,
|
|
377
|
+
lightSample
|
|
378
|
+
);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
fn mv(
|
|
384
|
+
fm: vec3f,
|
|
385
|
+
rnd: vec3f,
|
|
386
|
+
ca: u32,
|
|
387
|
+
aW: u32,
|
|
388
|
+
lightSample: ptr<function, LightSampleRec>
|
|
389
|
+
) {
|
|
390
|
+
jZ(
|
|
391
|
+
fm,
|
|
392
|
+
mF(rnd, ca, aW),
|
|
393
|
+
0,
|
|
394
|
+
rtUniform.lightChoiceCount,
|
|
395
|
+
1.0,
|
|
396
|
+
lightSample
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
`;
|
|
400
|
+
//# sourceMappingURL=sampleLight.wgsl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sampleLight.wgsl.js","sourceRoot":"","sources":["../../../../src/renderer/wgsl/chunks/sampleLight.wgsl.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,8BAA8B,EAC9B,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAEhC,eAAe,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBA8UI,wBAAwB;;;;;;;4BAOnB,qBAAqB;;;;;;;;4BAQrB,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgD/D,CAAC","sourcesContent":["import {\n LIGHT_CHOICE_ANALYTIC,\n LIGHT_CHOICE_EMISSIVE_TRIANGLE,\n LIGHT_CHOICE_ENVIRONMENT\n} from '../../lightSampling.js';\n\nexport default /*wgsl */ `\nfn light_sample_sphere(light: Light, scatterPos: vec3f, randomV2: vec2f, lightSample: ptr<function, LightSampleRec>) {\n let centerOffset = light.position - scatterPos;\n let centerDistance = length(centerOffset);\n if (light.radiusOrSpread <= 0.0) {\n // A zero-radius sphere is a point emitter. The stored emission is\n // luminous intensity, so convert it to incident radiance here rather\n // than approximating the delta source as a tiny area sphere.\n if (centerDistance <= 1e-6) {\n (*lightSample).direction = vec3f(0.0, 0.0, 1.0);\n (*lightSample).normal = vec3f(0.0, 0.0, -1.0);\n (*lightSample).dist = 0.0;\n (*lightSample).pdf = 1.0;\n (*lightSample).emission = vec3f(0.0);\n (*lightSample).isDelta = true;\n return;\n }\n (*lightSample).direction = centerOffset / centerDistance;\n (*lightSample).normal = -(*lightSample).direction;\n (*lightSample).dist = centerDistance;\n (*lightSample).pdf = 1.0;\n (*lightSample).emission = light.emission /\n max(centerDistance * centerDistance, 1e-8);\n (*lightSample).isDelta = true;\n return;\n }\n let radius = max(light.radiusOrSpread, 1e-6);\n (*lightSample).isDelta = false;\n var sampledDirection: vec3f;\n\n if (centerDistance <= radius) {\n let z = 1.0 - 2.0 * randomV2.x;\n let radial = sqrt(max(0.0, 1.0 - z * z));\n let azimuth = TWOPI * randomV2.y;\n sampledDirection = vec3f(\n radial * cos(azimuth),\n radial * sin(azimuth),\n z\n );\n (*lightSample).pdf = INV4PI;\n }\n else {\n let sphereAxis = centerOffset / centerDistance;\n let sinThetaMaxSquared = min(\n 1.0,\n radius * radius / (centerDistance * centerDistance)\n );\n let cosThetaMax = sqrt(max(0.0, 1.0 - sinThetaMaxSquared));\n let cosTheta = mix(1.0, cosThetaMax, randomV2.x);\n let sinTheta = sqrt(max(0.0, 1.0 - cosTheta * cosTheta));\n let azimuth = TWOPI * randomV2.y;\n var tangent: vec3f;\n var bitangent: vec3f;\n sampling_orthonormal_basis(sphereAxis, &tangent, &bitangent);\n sampledDirection = sphereAxis * cosTheta\n + tangent * (sinTheta * cos(azimuth))\n + bitangent * (sinTheta * sin(azimuth));\n (*lightSample).pdf = 1.0 / max(\n TWOPI * (1.0 - cosThetaMax),\n 1e-8\n );\n }\n\n let centerProjection = dot(sampledDirection, centerOffset);\n let centerOffsetSquared = dot(centerOffset, centerOffset);\n let discriminant = centerProjection * centerProjection\n - centerOffsetSquared + radius * radius;\n let nearDistance = centerProjection - sqrt(max(0.0, discriminant));\n let farDistance = centerProjection + sqrt(max(0.0, discriminant));\n (*lightSample).dist = select(farDistance, nearDistance, nearDistance > 1e-6);\n (*lightSample).direction = sampledDirection;\n let lightSurfacePos = scatterPos + sampledDirection * (*lightSample).dist;\n (*lightSample).normal = normalize(lightSurfacePos - light.position);\n (*lightSample).emission = light.emission;\n}\n\nfn light_apply_rect_texture(\n light: Light,\n surfacePoint: vec3f,\n lowerLeft: vec3f,\n result: ptr<function, LightSampleRec>\n) {\n if (light.textureIndex < 0.0) {\n return;\n }\n let width = length(light.u);\n let height = length(light.v);\n let relative = surfacePoint - lowerLeft;\n let uv = vec2f(\n dot(relative, light.u / width) / width,\n dot(relative, light.v / height) / height\n );\n (*result).emission *= sampleMap(i32(light.textureIndex), uv).rgb;\n}\n\nfn light_sample_rect(\n light: Light,\n shadingPoint: vec3f,\n samplePoint: vec2f,\n result: ptr<function, LightSampleRec>\n) {\n let normal = normalize(cross(light.u, light.v));\n let lowerLeft = light.position - 0.5 * (light.u + light.v);\n let spread = clamp(light.radiusOrSpread, 0.0, 1.0);\n\n if (spread <= 0.001) {\n let planeDistance = dot(normal, shadingPoint - light.position);\n let surfacePoint = shadingPoint - normal * planeDistance;\n let relative = surfacePoint - lowerLeft;\n let width = length(light.u);\n let height = length(light.v);\n let uv = vec2f(\n dot(relative, light.u / width) / width,\n dot(relative, light.v / height) / height\n );\n if (planeDistance <= 0.0 || any(uv < vec2f(0.0)) || any(uv > vec2f(1.0))) {\n (*result).emission = vec3f(0.0);\n (*result).pdf = 0.0;\n return;\n }\n (*result).direction = -normal;\n (*result).dist = planeDistance;\n (*result).normal = normal;\n (*result).emission = light.emission;\n (*result).pdf = 1.0;\n (*result).isDelta = true;\n light_apply_rect_texture(light, surfacePoint, lowerLeft, result);\n return;\n }\n\n let surfacePoint = lowerLeft\n + light.u * samplePoint.x\n + light.v * samplePoint.y;\n let offset = surfacePoint - shadingPoint;\n let distanceSquared = dot(offset, offset);\n (*result).dist = sqrt(distanceSquared);\n (*result).direction = offset / (*result).dist;\n (*result).normal = normal;\n let emitterCosine = dot(-(*result).direction, normal);\n let spreadCosine = cos(0.5 * PI * spread);\n if (emitterCosine <= 0.0 || emitterCosine < spreadCosine) {\n (*result).emission = vec3f(0.0);\n (*result).pdf = 0.0;\n return;\n }\n (*result).emission = light.emission;\n (*result).pdf = distanceSquared / max(light.area * emitterCosine, 1e-8);\n light_apply_rect_texture(light, surfacePoint, lowerLeft, result);\n}\n\nfn light_sample_directional(\n light: Light,\n result: ptr<function, LightSampleRec>\n) {\n (*result).direction = normalize(-light.u);\n (*result).normal = -(*result).direction;\n (*result).emission = light.emission;\n (*result).dist = INF;\n (*result).pdf = 1.0;\n (*result).isDelta = true;\n}\n\nfn light_sample_spot(\n light: Light,\n shadingPoint: vec3f,\n samplePoint: vec2f,\n result: ptr<function, LightSampleRec>\n) {\n light_sample_sphere(light, shadingPoint, samplePoint, result);\n let surfacePoint = shadingPoint + (*result).direction * (*result).dist;\n let lightToSurface = normalize(shadingPoint - surfacePoint);\n (*result).emission *= evaluateSpotEmissionMultiplier(light, lightToSurface);\n}\n\nfn sampleAnalyticLight(\n light: Light,\n shadingPoint: vec3f,\n samplePoint: vec2f,\n result: ptr<function, LightSampleRec>\n) {\n let lightType = i32(light.litType);\n if (lightType == RECT_LIGHT) {\n light_sample_rect(light, shadingPoint, samplePoint, result);\n return;\n }\n if (lightType == SPHERE_LIGHT) {\n light_sample_sphere(light, shadingPoint, samplePoint, result);\n return;\n }\n if (lightType == SPOT_LIGHT) {\n light_sample_spot(light, shadingPoint, samplePoint, result);\n return;\n }\n if (lightType == DIRECTIONAL_LIGHT) {\n light_sample_directional(light, result);\n }\n}\n\nfn sampleEnvLight(randomV2: vec2f, lightSample: ptr<function, LightSampleRec>) {\n var uv: vec2f;\n (*lightSample).direction = sampleEnvmap(randomV2, &uv, &(*lightSample).pdf);\n (*lightSample).emission = textureLinear(envMap, uv).rgb;\n (*lightSample).dist = INF;\n}\n\nfn loadLightSamplingTexel(texelIndex: i32) -> vec4f {\n let width = rtUniform.lightSamplingTextureWidth;\n return textureLoad(\n lightSamplingData,\n vec2i(texelIndex % width, texelIndex / width),\n 0\n );\n}\n\nfn getEmissiveTriangle(index: i32) -> EmissiveTriangle {\n let offset = index * 6;\n let a = loadLightSamplingTexel(offset);\n let b = loadLightSamplingTexel(offset + 1);\n let c = loadLightSamplingTexel(offset + 2);\n let d = loadLightSamplingTexel(offset + 3);\n let e = loadLightSamplingTexel(offset + 4);\n let f = loadLightSamplingTexel(offset + 5);\n return EmissiveTriangle(\n a.xyz, a.w,\n b.xyz, b.w,\n c.xyz, c.w,\n d.xy, d.zw, e.xy,\n e.zw, f.xy, f.zw\n );\n}\n\nfn getLightChoice(index: i32) -> LightChoice {\n let data = loadLightSamplingTexel(rtUniform.lightChoiceTexelOffset + index);\n return LightChoice(\n data.x,\n bitcast<i32>(data.y),\n bitcast<i32>(data.z),\n bitcast<i32>(data.w)\n );\n}\n\nfn getLightChoiceFromTable(tableOffset: i32, index: i32) -> LightChoice {\n return getLightChoice(tableOffset + index);\n}\n\nfn stratifyLightChoiceRandom(\n rnd: vec3f,\n candidateIndex: u32,\n candidateCount: u32\n) -> vec3f {\n var stratified = rnd;\n let count = max(candidateCount, 1u);\n stratified.z = (rnd.z + f32(min(candidateIndex, count - 1u))) /\n f32(count);\n return stratified;\n}\n\nfn sampleEmissiveTriangleLight(\n triangle: EmissiveTriangle,\n scatterPos: vec3f,\n randomV2: vec2f,\n lightSample: ptr<function, LightSampleRec>\n) {\n let sqrtU = sqrt(randomV2.x);\n let barycentric = vec3f(\n 1.0 - sqrtU,\n sqrtU * (1.0 - randomV2.y),\n sqrtU * randomV2.y\n );\n let lightPosition =\n barycentric.x * triangle.p0 +\n barycentric.y * triangle.p1 +\n barycentric.z * triangle.p2;\n let uv =\n barycentric.x * triangle.uv0 +\n barycentric.y * triangle.uv1 +\n barycentric.z * triangle.uv2;\n let secondaryUv =\n barycentric.x * triangle.secondaryUv0 +\n barycentric.y * triangle.secondaryUv1 +\n barycentric.z * triangle.secondaryUv2;\n let normal = normalize(cross(triangle.p1 - triangle.p0, triangle.p2 - triangle.p0));\n (*lightSample).direction = lightPosition - scatterPos;\n (*lightSample).dist = length((*lightSample).direction);\n if ((*lightSample).dist <= EPS) {\n (*lightSample).emission = vec3f(0.0);\n (*lightSample).pdf = 0.0;\n return;\n }\n (*lightSample).direction /= (*lightSample).dist;\n (*lightSample).normal = normal;\n let cosLight = dot(normal, -(*lightSample).direction);\n if (cosLight <= 0.0) {\n (*lightSample).emission = vec3f(0.0);\n (*lightSample).pdf = 0.0;\n return;\n }\n (*lightSample).emission = getMaterialEmission(\n i32(triangle.materialIndex), uv, secondaryUv\n );\n (*lightSample).selectionPmf = triangle.selectionPmf;\n (*lightSample).pdf = triangle.selectionPmf *\n ((*lightSample).dist * (*lightSample).dist) /\n max(triangle.area * cosLight, 1e-8);\n}\n\nfn sampleLightChoiceTable(\n scatterPos: vec3f,\n rnd: vec3f,\n tableOffset: i32,\n choiceCount: i32,\n selectionPmfScale: f32,\n lightSample: ptr<function, LightSampleRec>\n) {\n (*lightSample).emission = vec3f(0.0);\n (*lightSample).pdf = 0.0;\n (*lightSample).selectionPmf = 0.0;\n (*lightSample).dist = INF;\n (*lightSample).isDelta = false;\n (*lightSample).sourceType = 0u;\n (*lightSample).sourceIndex = 0xffffffffu;\n if (choiceCount <= 0) {\n return;\n }\n\n let scaledChoice = rnd.z * f32(choiceCount);\n let column = min(i32(scaledChoice), choiceCount - 1);\n let columnChoice = getLightChoiceFromTable(tableOffset, column);\n let selectedIndex = select(\n columnChoice.aliasIndex,\n column,\n fract(scaledChoice) < columnChoice.probability\n );\n let choice = getLightChoiceFromTable(tableOffset, selectedIndex);\n if (choice.sourceType == ${LIGHT_CHOICE_ENVIRONMENT}) {\n (*lightSample).sourceType = 0u;\n (*lightSample).sourceIndex = u32(choice.sourceIndex);\n sampleEnvLight(rnd.xy, lightSample);\n (*lightSample).selectionPmf = rtUniform.envLightPmf;\n (*lightSample).pdf *= rtUniform.envLightPmf;\n }\n else if (choice.sourceType == ${LIGHT_CHOICE_ANALYTIC}) {\n (*lightSample).sourceType = 2u;\n (*lightSample).sourceIndex = u32(choice.sourceIndex);\n let light = analyticLights[choice.sourceIndex];\n sampleAnalyticLight(light, scatterPos, rnd.xy, lightSample);\n (*lightSample).selectionPmf = light.selectionPmf;\n (*lightSample).pdf *= light.selectionPmf;\n }\n else if (choice.sourceType == ${LIGHT_CHOICE_EMISSIVE_TRIANGLE}) {\n (*lightSample).sourceType = 1u;\n (*lightSample).sourceIndex = u32(choice.sourceIndex);\n sampleEmissiveTriangleLight(\n getEmissiveTriangle(choice.sourceIndex),\n scatterPos,\n rnd.xy,\n lightSample\n );\n }\n (*lightSample).selectionPmf *= selectionPmfScale;\n (*lightSample).pdf *= selectionPmfScale;\n}\n\nfn sampleLight(\n scatterPos: vec3f,\n rnd: vec3f,\n lightSample: ptr<function, LightSampleRec>,\n distByIntensity: bool\n) {\n sampleLightChoiceTable(\n scatterPos,\n rnd,\n 0,\n rtUniform.lightChoiceCount,\n 1.0,\n lightSample\n );\n}\n\n// Light choice for one of the resampled NEE candidates. The selection random\n// number is stratified across the candidates.\nfn sampleLightForNEECandidate(\n scatterPos: vec3f,\n rnd: vec3f,\n candidateIndex: u32,\n candidateCount: u32,\n lightSample: ptr<function, LightSampleRec>\n) {\n sampleLightChoiceTable(\n scatterPos,\n stratifyLightChoiceRandom(rnd, candidateIndex, candidateCount),\n 0,\n rtUniform.lightChoiceCount,\n 1.0,\n lightSample\n );\n}\n`;\n"]}
|