@tinypoly/gpu-renderer 0.0.0-stage → 0.0.1
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/ARCHITECTURE.md +339 -0
- package/LICENSE +21 -0
- package/README.md +284 -2
- package/dist/accumulator.d.ts +27 -0
- package/dist/accumulator.d.ts.map +1 -0
- package/dist/accumulator.js +57 -0
- package/dist/accumulator.js.map +1 -0
- package/dist/bvh.d.ts +26 -0
- package/dist/bvh.d.ts.map +1 -0
- package/dist/bvh.js +296 -0
- package/dist/bvh.js.map +1 -0
- package/dist/bvhBuilder.d.ts +72 -0
- package/dist/bvhBuilder.d.ts.map +1 -0
- package/dist/bvhBuilder.js +126 -0
- package/dist/bvhBuilder.js.map +1 -0
- package/dist/bvhWorker.d.ts +2 -0
- package/dist/bvhWorker.d.ts.map +1 -0
- package/dist/bvhWorker.js +8 -0
- package/dist/bvhWorker.js.map +1 -0
- package/dist/camera.d.ts +29 -0
- package/dist/camera.d.ts.map +1 -0
- package/dist/camera.js +48 -0
- package/dist/camera.js.map +1 -0
- package/dist/canvas.d.ts +9 -0
- package/dist/canvas.d.ts.map +1 -0
- package/dist/canvas.js +11 -0
- package/dist/canvas.js.map +1 -0
- package/dist/denoise.d.ts +69 -0
- package/dist/denoise.d.ts.map +1 -0
- package/dist/denoise.js +455 -0
- package/dist/denoise.js.map +1 -0
- package/dist/device.d.ts +37 -0
- package/dist/device.d.ts.map +1 -0
- package/dist/device.js +52 -0
- package/dist/device.js.map +1 -0
- package/dist/dispatchScheduler.d.ts +43 -0
- package/dist/dispatchScheduler.d.ts.map +1 -0
- package/dist/dispatchScheduler.js +49 -0
- package/dist/dispatchScheduler.js.map +1 -0
- package/dist/environment.d.ts +39 -0
- package/dist/environment.d.ts.map +1 -0
- package/dist/environment.js +168 -0
- package/dist/environment.js.map +1 -0
- package/dist/frameLayout.d.ts +4 -0
- package/dist/frameLayout.d.ts.map +1 -0
- package/dist/frameLayout.js +58 -0
- package/dist/frameLayout.js.map +1 -0
- package/dist/geometry.d.ts +75 -0
- package/dist/geometry.d.ts.map +1 -0
- package/dist/geometry.js +799 -0
- package/dist/geometry.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/lights.d.ts +64 -0
- package/dist/lights.d.ts.map +1 -0
- package/dist/lights.js +264 -0
- package/dist/lights.js.map +1 -0
- package/dist/materialLayout.d.ts +143 -0
- package/dist/materialLayout.d.ts.map +1 -0
- package/dist/materialLayout.js +297 -0
- package/dist/materialLayout.js.map +1 -0
- package/dist/math.d.ts +10 -0
- package/dist/math.d.ts.map +1 -0
- package/dist/math.js +40 -0
- package/dist/math.js.map +1 -0
- package/dist/pathTracePass.d.ts +27 -0
- package/dist/pathTracePass.d.ts.map +1 -0
- package/dist/pathTracePass.js +83 -0
- package/dist/pathTracePass.js.map +1 -0
- package/dist/planarCapture.d.ts +38 -0
- package/dist/planarCapture.d.ts.map +1 -0
- package/dist/planarCapture.js +163 -0
- package/dist/planarCapture.js.map +1 -0
- package/dist/presentPass.d.ts +31 -0
- package/dist/presentPass.d.ts.map +1 -0
- package/dist/presentPass.js +78 -0
- package/dist/presentPass.js.map +1 -0
- package/dist/renderer.d.ts +209 -0
- package/dist/renderer.d.ts.map +1 -0
- package/dist/renderer.js +847 -0
- package/dist/renderer.js.map +1 -0
- package/dist/sceneAssets.d.ts +24 -0
- package/dist/sceneAssets.d.ts.map +1 -0
- package/dist/sceneAssets.js +77 -0
- package/dist/sceneAssets.js.map +1 -0
- package/dist/sceneUpload.d.ts +61 -0
- package/dist/sceneUpload.d.ts.map +1 -0
- package/dist/sceneUpload.js +98 -0
- package/dist/sceneUpload.js.map +1 -0
- package/dist/shaderModule.d.ts +7 -0
- package/dist/shaderModule.d.ts.map +1 -0
- package/dist/shaderModule.js +19 -0
- package/dist/shaderModule.js.map +1 -0
- package/dist/shaderProgram.d.ts +124 -0
- package/dist/shaderProgram.d.ts.map +1 -0
- package/dist/shaderProgram.js +1030 -0
- package/dist/shaderProgram.js.map +1 -0
- package/dist/structLayout.d.ts +28 -0
- package/dist/structLayout.d.ts.map +1 -0
- package/dist/structLayout.js +58 -0
- package/dist/structLayout.js.map +1 -0
- package/dist/texturePack.d.ts +54 -0
- package/dist/texturePack.d.ts.map +1 -0
- package/dist/texturePack.js +86 -0
- package/dist/texturePack.js.map +1 -0
- package/dist/upstream.d.ts +7 -0
- package/dist/upstream.d.ts.map +1 -0
- package/dist/upstream.js +11 -0
- package/dist/upstream.js.map +1 -0
- package/dist/volumetric.d.ts +10 -0
- package/dist/volumetric.d.ts.map +1 -0
- package/dist/volumetric.js +34 -0
- package/dist/volumetric.js.map +1 -0
- package/dist/wgsl/bsdf.wgsl.d.ts +13 -0
- package/dist/wgsl/bsdf.wgsl.d.ts.map +1 -0
- package/dist/wgsl/bsdf.wgsl.js +619 -0
- package/dist/wgsl/bsdf.wgsl.js.map +1 -0
- package/dist/wgsl/bvh.wgsl.d.ts +3 -0
- package/dist/wgsl/bvh.wgsl.d.ts.map +1 -0
- package/dist/wgsl/bvh.wgsl.js +218 -0
- package/dist/wgsl/bvh.wgsl.js.map +1 -0
- package/dist/wgsl/common.wgsl.d.ts +3 -0
- package/dist/wgsl/common.wgsl.d.ts.map +1 -0
- package/dist/wgsl/common.wgsl.js +193 -0
- package/dist/wgsl/common.wgsl.js.map +1 -0
- package/dist/wgsl/environment.wgsl.d.ts +10 -0
- package/dist/wgsl/environment.wgsl.d.ts.map +1 -0
- package/dist/wgsl/environment.wgsl.js +145 -0
- package/dist/wgsl/environment.wgsl.js.map +1 -0
- package/dist/wgsl/lights.wgsl.d.ts +10 -0
- package/dist/wgsl/lights.wgsl.d.ts.map +1 -0
- package/dist/wgsl/lights.wgsl.js +434 -0
- package/dist/wgsl/lights.wgsl.js.map +1 -0
- package/dist/wgsl/pathTrace.wgsl.d.ts +14 -0
- package/dist/wgsl/pathTrace.wgsl.d.ts.map +1 -0
- package/dist/wgsl/pathTrace.wgsl.js +1020 -0
- package/dist/wgsl/pathTrace.wgsl.js.map +1 -0
- package/dist/wgsl/present.wgsl.d.ts +7 -0
- package/dist/wgsl/present.wgsl.d.ts.map +1 -0
- package/dist/wgsl/present.wgsl.js +154 -0
- package/dist/wgsl/present.wgsl.js.map +1 -0
- package/dist/wgsl/random.wgsl.d.ts +9 -0
- package/dist/wgsl/random.wgsl.d.ts.map +1 -0
- package/dist/wgsl/random.wgsl.js +91 -0
- package/dist/wgsl/random.wgsl.js.map +1 -0
- package/dist/wgsl/sampling.wgsl.d.ts +3 -0
- package/dist/wgsl/sampling.wgsl.d.ts.map +1 -0
- package/dist/wgsl/sampling.wgsl.js +31 -0
- package/dist/wgsl/sampling.wgsl.js.map +1 -0
- package/dist/wgsl/shaderSupport.wgsl.d.ts +6 -0
- package/dist/wgsl/shaderSupport.wgsl.d.ts.map +1 -0
- package/dist/wgsl/shaderSupport.wgsl.js +120 -0
- package/dist/wgsl/shaderSupport.wgsl.js.map +1 -0
- package/dist/wgsl/surface.wgsl.d.ts +10 -0
- package/dist/wgsl/surface.wgsl.d.ts.map +1 -0
- package/dist/wgsl/surface.wgsl.js +794 -0
- package/dist/wgsl/surface.wgsl.js.map +1 -0
- package/dist/wgsl/texture.wgsl.d.ts +11 -0
- package/dist/wgsl/texture.wgsl.d.ts.map +1 -0
- package/dist/wgsl/texture.wgsl.js +132 -0
- package/dist/wgsl/texture.wgsl.js.map +1 -0
- package/package.json +77 -3
- package/src/accumulator.ts +64 -0
- package/src/bvh.ts +336 -0
- package/src/bvhBuilder.ts +178 -0
- package/src/bvhWorker.ts +13 -0
- package/src/camera.ts +77 -0
- package/src/canvas.ts +13 -0
- package/src/denoise.ts +514 -0
- package/src/device.ts +81 -0
- package/src/dispatchScheduler.ts +71 -0
- package/src/environment.ts +233 -0
- package/src/frameLayout.ts +59 -0
- package/src/geometry.ts +1067 -0
- package/src/index.ts +64 -0
- package/src/lights.ts +365 -0
- package/src/materialLayout.ts +408 -0
- package/src/math.ts +48 -0
- package/src/pathTracePass.ts +97 -0
- package/src/planarCapture.ts +225 -0
- package/src/presentPass.ts +99 -0
- package/src/renderer.ts +1145 -0
- package/src/sceneAssets.ts +118 -0
- package/src/sceneUpload.ts +185 -0
- package/src/shaderModule.ts +19 -0
- package/src/shaderProgram.ts +1370 -0
- package/src/structLayout.ts +93 -0
- package/src/texturePack.ts +152 -0
- package/src/upstream.ts +56 -0
- package/src/volumetric.ts +42 -0
- package/src/wgsl/bsdf.wgsl.ts +618 -0
- package/src/wgsl/bvh.wgsl.ts +217 -0
- package/src/wgsl/common.wgsl.ts +193 -0
- package/src/wgsl/environment.wgsl.ts +144 -0
- package/src/wgsl/lights.wgsl.ts +433 -0
- package/src/wgsl/pathTrace.wgsl.ts +1019 -0
- package/src/wgsl/present.wgsl.ts +153 -0
- package/src/wgsl/random.wgsl.ts +90 -0
- package/src/wgsl/sampling.wgsl.ts +30 -0
- package/src/wgsl/shaderSupport.wgsl.ts +119 -0
- package/src/wgsl/surface.wgsl.ts +793 -0
- package/src/wgsl/texture.wgsl.ts +131 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import type { SerializedMaterial } from "./upstream.js";
|
|
2
|
+
/**
|
|
3
|
+
* What a surface is, reduced to what the integrator reads. Three's own defaults and its shading models are resolved
|
|
4
|
+
* here, following `material.js` in the CPU renderer and Three's own shader chunks, so the two renderers start from the
|
|
5
|
+
* same numbers even though they use them differently.
|
|
6
|
+
*/
|
|
7
|
+
export interface MaterialProperties {
|
|
8
|
+
kind: number;
|
|
9
|
+
/** Linear rgb. */
|
|
10
|
+
color: number[];
|
|
11
|
+
opacity: number;
|
|
12
|
+
/** Linear rgb. */
|
|
13
|
+
emissive: number[];
|
|
14
|
+
emissiveIntensity: number;
|
|
15
|
+
/**
|
|
16
|
+
* The specular colour: for a physical material Three's `specularColor`, before the index of refraction turns it into
|
|
17
|
+
* a reflectance; for Phong its `specular`. A standard material reflects 0.04 regardless.
|
|
18
|
+
*/
|
|
19
|
+
specular: number[];
|
|
20
|
+
specularIntensity: number;
|
|
21
|
+
/** Reflectance of the dielectric at normal incidence from the index of refraction, as Three derives it. */
|
|
22
|
+
dielectric: number;
|
|
23
|
+
roughness: number;
|
|
24
|
+
metalness: number;
|
|
25
|
+
alphaTest: number;
|
|
26
|
+
flags: number;
|
|
27
|
+
/** How far the normal map tilts the surface, along the two texture axes. */
|
|
28
|
+
normalScale: number[];
|
|
29
|
+
/** Share of the diffuse layer that lets light through instead, as Three's `transmission`. Physical materials only. */
|
|
30
|
+
transmission: number;
|
|
31
|
+
ior: number;
|
|
32
|
+
/** Zero is a thin wall, which light crosses without bending; above it the surface bounds a volume that refracts. */
|
|
33
|
+
thickness: number;
|
|
34
|
+
/** Linear rgb that light inside the volume fades to over `attenuationDistance`. */
|
|
35
|
+
attenuationColor: number[];
|
|
36
|
+
/** Zero when the volume does not absorb at all, which is Three's infinite default. */
|
|
37
|
+
attenuationDistance: number;
|
|
38
|
+
clearcoat: number;
|
|
39
|
+
clearcoatRoughness: number;
|
|
40
|
+
clearcoatNormalScale: number[];
|
|
41
|
+
/** Three's `sheenColor` already multiplied by `sheen`, as its own uniform is. */
|
|
42
|
+
sheenColor: number[];
|
|
43
|
+
sheenRoughness: number;
|
|
44
|
+
iridescence: number;
|
|
45
|
+
iridescenceIor: number;
|
|
46
|
+
iridescenceThickness: number[];
|
|
47
|
+
anisotropy: number;
|
|
48
|
+
anisotropyRotation: number;
|
|
49
|
+
dispersion: number;
|
|
50
|
+
shininess: number;
|
|
51
|
+
bumpScale: number;
|
|
52
|
+
lightMapIntensity: number;
|
|
53
|
+
envMapIntensity: number;
|
|
54
|
+
reflectivity: number;
|
|
55
|
+
refractionRatio: number;
|
|
56
|
+
combine: number;
|
|
57
|
+
side: number;
|
|
58
|
+
blending: number;
|
|
59
|
+
/** An index into the texture table per slot, or `NO_TEXTURE`. */
|
|
60
|
+
maps: Record<MaterialMap, number>;
|
|
61
|
+
}
|
|
62
|
+
/** The parts of a material entry that depend on the mesh and the packing, not on the material alone. */
|
|
63
|
+
export interface MaterialPlacement {
|
|
64
|
+
/** Where the material's clipping planes start in the texture buffer, and how many there are. */
|
|
65
|
+
clipStart: number;
|
|
66
|
+
clipCount: number;
|
|
67
|
+
/** The translated fragment shader, or `NO_PROGRAM`. */
|
|
68
|
+
program: number;
|
|
69
|
+
/** Where its uniform values start in the texture buffer. */
|
|
70
|
+
shaderData: number;
|
|
71
|
+
/** Where the shader's per-corner varyings start in the attribute buffer, how many floats a corner has, and which
|
|
72
|
+
* triangle they begin at. */
|
|
73
|
+
varyingBase: number;
|
|
74
|
+
varyingStride: number;
|
|
75
|
+
firstTriangle: number;
|
|
76
|
+
/** Rows of the mesh's world normal matrix, which an object space normal map is turned by. */
|
|
77
|
+
normalMatrix: number[];
|
|
78
|
+
/** The program a hook after `<opaque_fragment>` became, and where its uniforms start. */
|
|
79
|
+
afterProgram: number;
|
|
80
|
+
afterData: number;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The map slots the integrator reads, by Three's own property names, so a material's `maps` record is looked up directly.
|
|
84
|
+
* A baked ambient occlusion map is deliberately absent: this renderer traces the occlusion it stands for, and applying
|
|
85
|
+
* both would darken the same shadow twice. `displacementMap` moves vertices, so it is applied while packing instead.
|
|
86
|
+
*/
|
|
87
|
+
export declare const MATERIAL_MAPS: readonly ["map", "emissiveMap", "roughnessMap", "metalnessMap", "normalMap", "alphaMap", "transmissionMap", "thicknessMap", "clearcoatMap", "clearcoatRoughnessMap", "clearcoatNormalMap", "sheenColorMap", "sheenRoughnessMap", "iridescenceMap", "iridescenceThicknessMap", "anisotropyMap", "specularMap", "specularIntensityMap", "specularColorMap", "bumpMap", "lightMap", "gradientMap", "matcap", "envMap"];
|
|
88
|
+
export type MaterialMap = typeof MATERIAL_MAPS[number];
|
|
89
|
+
/** How the integrator shades a surface. Each kind is one of Three's shading models. */
|
|
90
|
+
export declare const MATERIAL_KIND: {
|
|
91
|
+
readonly standard: 0;
|
|
92
|
+
readonly physical: 1;
|
|
93
|
+
readonly lambert: 2;
|
|
94
|
+
readonly phong: 3;
|
|
95
|
+
readonly toon: 4;
|
|
96
|
+
/** Unlit: basic, points, lines and sprites. */
|
|
97
|
+
readonly basic: 5;
|
|
98
|
+
readonly normal: 6;
|
|
99
|
+
/** Depth and distance materials. */
|
|
100
|
+
readonly depth: 7;
|
|
101
|
+
readonly matcap: 8;
|
|
102
|
+
readonly shadow: 9;
|
|
103
|
+
/** A `ShaderMaterial` or `RawShaderMaterial`: unlit, its colour from the translated fragment shader. */
|
|
104
|
+
readonly shader: 10;
|
|
105
|
+
};
|
|
106
|
+
/** A surface Three shades with light at all. The rest return their own colour and take no part in it. */
|
|
107
|
+
export declare const MATERIAL_LIT = 1;
|
|
108
|
+
/** Three's metalness workflow, which is the only one with a GGX specular lobe. */
|
|
109
|
+
export declare const MATERIAL_PBR = 2;
|
|
110
|
+
/** Three's `transparent`: only then does the opacity let anything through. */
|
|
111
|
+
export declare const MATERIAL_TRANSPARENT = 4;
|
|
112
|
+
export declare const MATERIAL_VERTEX_COLORS = 8;
|
|
113
|
+
export declare const MATERIAL_FLAT = 16;
|
|
114
|
+
export declare const MATERIAL_WIREFRAME = 32;
|
|
115
|
+
/** The material accepts `scene.fog`. */
|
|
116
|
+
export declare const MATERIAL_FOG = 64;
|
|
117
|
+
export declare const MATERIAL_CLIP_INTERSECTION = 128;
|
|
118
|
+
export declare const MATERIAL_OBJECT_NORMAL_MAP = 256;
|
|
119
|
+
/** A built-in material whose `onBeforeCompile` hooks run before lighting, as a program. */
|
|
120
|
+
export declare const MATERIAL_PATCHED = 512;
|
|
121
|
+
/** The material's own environment map bends the view ray instead of mirroring it. */
|
|
122
|
+
export declare const MATERIAL_ENV_REFRACTION = 1024;
|
|
123
|
+
/** Three's `alphaHash`, which keeps the coverage stochastic without `transparent`. */
|
|
124
|
+
export declare const MATERIAL_ALPHA_HASH = 2048;
|
|
125
|
+
/** A physical material, whose specular colour and intensity reach the lobe and whose grazing reflectance follows them. */
|
|
126
|
+
export declare const MATERIAL_SPECULAR = 4096;
|
|
127
|
+
/** What a material's `program` reads as when it has no shader. */
|
|
128
|
+
export declare const NO_PROGRAM = 4294967295;
|
|
129
|
+
/** The `Material` struct, as both sides of the device see it. */
|
|
130
|
+
export declare const MATERIAL_LAYOUT: import("./structLayout.js").StructLayout;
|
|
131
|
+
export declare const MATERIAL_WORDS: number;
|
|
132
|
+
/** Whether a material is drawn at all: Three skips one whose `visible` is off. */
|
|
133
|
+
export declare function isMaterialVisible(material: SerializedMaterial | undefined): boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Three's resolution of a material, defaults and all. A material outside the metalness workflow keeps its own specular
|
|
136
|
+
* colour; one Three does not light reads as its own colour.
|
|
137
|
+
*/
|
|
138
|
+
export declare function materialProperties(material: SerializedMaterial | undefined, textures?: ReadonlyMap<string, number>): MaterialProperties;
|
|
139
|
+
/** A material entry with no mesh specific parts: no clipping, no program, no varyings, an identity normal matrix. */
|
|
140
|
+
export declare const NO_PLACEMENT: MaterialPlacement;
|
|
141
|
+
/** The bytes of one material, as the shader reads them. */
|
|
142
|
+
export declare function writeMaterial(target: ArrayBuffer, index: number, properties: MaterialProperties, placement?: MaterialPlacement): void;
|
|
143
|
+
//# sourceMappingURL=materialLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"materialLayout.d.ts","sourceRoot":"","sources":["../src/materialLayout.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAgB,MAAM,eAAe,CAAC;AAEtE;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB;IAClB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,iBAAiB,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,sFAAsF;AACtF,eAAO,MAAM,mBAAmB,OAAO,CAAC;AACxC,0HAA0H;AAC1H,eAAO,MAAM,iBAAiB,OAAO,CAAC;AAEtC,kEAAkE;AAClE,eAAO,MAAM,UAAU,aAAa,CAAC;AAsDrC,iEAAiE;AACjE,eAAO,MAAM,eAAe,0CAAmC,CAAC;AAEhE,eAAO,MAAM,cAAc,QAAwB,CAAC;AA8CpD,kFAAkF;AAClF,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,SAAS,GAAG,OAAO,CAEnF;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,kBAAkB,GAAG,SAAS,EACxC,QAAQ,GAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAa,GAAG,kBAAkB,CAgFvE;AAED,qHAAqH;AACrH,eAAO,MAAM,YAAY,EAAE,iBAW1B,CAAC;AAEF,2DAA2D;AAC3D,wBAAgB,aAAa,CAC3B,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,EAAE,SAAS,GAAE,iBAAgC,QAuDhH"}
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import { layoutStruct, writeStruct } from "./structLayout.js";
|
|
2
|
+
import { NO_TEXTURE } from "./texturePack.js";
|
|
3
|
+
/**
|
|
4
|
+
* The map slots the integrator reads, by Three's own property names, so a material's `maps` record is looked up directly.
|
|
5
|
+
* A baked ambient occlusion map is deliberately absent: this renderer traces the occlusion it stands for, and applying
|
|
6
|
+
* both would darken the same shadow twice. `displacementMap` moves vertices, so it is applied while packing instead.
|
|
7
|
+
*/
|
|
8
|
+
export const MATERIAL_MAPS = [
|
|
9
|
+
"map", "emissiveMap", "roughnessMap", "metalnessMap", "normalMap", "alphaMap", "transmissionMap", "thicknessMap",
|
|
10
|
+
"clearcoatMap", "clearcoatRoughnessMap", "clearcoatNormalMap", "sheenColorMap", "sheenRoughnessMap",
|
|
11
|
+
"iridescenceMap", "iridescenceThicknessMap", "anisotropyMap", "specularMap", "specularIntensityMap",
|
|
12
|
+
"specularColorMap", "bumpMap", "lightMap", "gradientMap", "matcap", "envMap"
|
|
13
|
+
];
|
|
14
|
+
/** How the integrator shades a surface. Each kind is one of Three's shading models. */
|
|
15
|
+
export const MATERIAL_KIND = {
|
|
16
|
+
standard: 0,
|
|
17
|
+
physical: 1,
|
|
18
|
+
lambert: 2,
|
|
19
|
+
phong: 3,
|
|
20
|
+
toon: 4,
|
|
21
|
+
/** Unlit: basic, points, lines and sprites. */
|
|
22
|
+
basic: 5,
|
|
23
|
+
normal: 6,
|
|
24
|
+
/** Depth and distance materials. */
|
|
25
|
+
depth: 7,
|
|
26
|
+
matcap: 8,
|
|
27
|
+
shadow: 9,
|
|
28
|
+
/** A `ShaderMaterial` or `RawShaderMaterial`: unlit, its colour from the translated fragment shader. */
|
|
29
|
+
shader: 10,
|
|
30
|
+
};
|
|
31
|
+
/** A surface Three shades with light at all. The rest return their own colour and take no part in it. */
|
|
32
|
+
export const MATERIAL_LIT = 1;
|
|
33
|
+
/** Three's metalness workflow, which is the only one with a GGX specular lobe. */
|
|
34
|
+
export const MATERIAL_PBR = 2;
|
|
35
|
+
/** Three's `transparent`: only then does the opacity let anything through. */
|
|
36
|
+
export const MATERIAL_TRANSPARENT = 4;
|
|
37
|
+
export const MATERIAL_VERTEX_COLORS = 8;
|
|
38
|
+
export const MATERIAL_FLAT = 16;
|
|
39
|
+
export const MATERIAL_WIREFRAME = 32;
|
|
40
|
+
/** The material accepts `scene.fog`. */
|
|
41
|
+
export const MATERIAL_FOG = 64;
|
|
42
|
+
export const MATERIAL_CLIP_INTERSECTION = 128;
|
|
43
|
+
export const MATERIAL_OBJECT_NORMAL_MAP = 256;
|
|
44
|
+
/** A built-in material whose `onBeforeCompile` hooks run before lighting, as a program. */
|
|
45
|
+
export const MATERIAL_PATCHED = 512;
|
|
46
|
+
/** The material's own environment map bends the view ray instead of mirroring it. */
|
|
47
|
+
export const MATERIAL_ENV_REFRACTION = 1024;
|
|
48
|
+
/** Three's `alphaHash`, which keeps the coverage stochastic without `transparent`. */
|
|
49
|
+
export const MATERIAL_ALPHA_HASH = 2048;
|
|
50
|
+
/** A physical material, whose specular colour and intensity reach the lobe and whose grazing reflectance follows them. */
|
|
51
|
+
export const MATERIAL_SPECULAR = 4096;
|
|
52
|
+
/** What a material's `program` reads as when it has no shader. */
|
|
53
|
+
export const NO_PROGRAM = 0xffffffff;
|
|
54
|
+
const FIELDS = [
|
|
55
|
+
{ name: "color", type: "vec4f", doc: "rgb is the base colour in linear light, w the opacity." },
|
|
56
|
+
{ name: "emissive", type: "vec4f", doc: "rgb is the emissive colour, w its intensity." },
|
|
57
|
+
{ name: "specular", type: "vec4f", doc: "rgb is the specular colour, w the roughness." },
|
|
58
|
+
{ name: "attenuation", type: "vec4f", doc: "rgb is the colour a volume fades to over w; a w of zero never absorbs." },
|
|
59
|
+
{ name: "sheen", type: "vec4f", doc: "rgb is the sheen colour times its strength, w its roughness." },
|
|
60
|
+
{ name: "metalness", type: "f32" },
|
|
61
|
+
{ name: "flags", type: "u32" },
|
|
62
|
+
{ name: "alphaTest", type: "f32" },
|
|
63
|
+
{ name: "transmission", type: "f32" },
|
|
64
|
+
{ name: "normalScaleX", type: "f32" },
|
|
65
|
+
{ name: "normalScaleY", type: "f32" },
|
|
66
|
+
{ name: "ior", type: "f32" },
|
|
67
|
+
{ name: "thickness", type: "f32", doc: "Zero is a thin wall; above it the surface bounds a volume that refracts." },
|
|
68
|
+
{ name: "clearcoat", type: "f32" },
|
|
69
|
+
{ name: "clearcoatRoughness", type: "f32" },
|
|
70
|
+
{ name: "clearcoatNormalScaleX", type: "f32" },
|
|
71
|
+
{ name: "clearcoatNormalScaleY", type: "f32" },
|
|
72
|
+
{ name: "iridescence", type: "f32" },
|
|
73
|
+
{ name: "iridescenceIor", type: "f32" },
|
|
74
|
+
{ name: "iridescenceThicknessMin", type: "f32" },
|
|
75
|
+
{ name: "iridescenceThicknessMax", type: "f32" },
|
|
76
|
+
{ name: "anisotropy", type: "f32" },
|
|
77
|
+
{ name: "anisotropyRotation", type: "f32" },
|
|
78
|
+
{ name: "dispersion", type: "f32" },
|
|
79
|
+
{ name: "shininess", type: "f32" },
|
|
80
|
+
{ name: "bumpScale", type: "f32" },
|
|
81
|
+
{ name: "lightMapIntensity", type: "f32" },
|
|
82
|
+
{ name: "envMapIntensity", type: "f32" },
|
|
83
|
+
{ name: "reflectivity", type: "f32" },
|
|
84
|
+
{ name: "refractionRatio", type: "f32" },
|
|
85
|
+
{ name: "combine", type: "u32" },
|
|
86
|
+
{ name: "side", type: "u32" },
|
|
87
|
+
{ name: "blending", type: "u32" },
|
|
88
|
+
{ name: "clipStart", type: "u32" },
|
|
89
|
+
{ name: "clipCount", type: "u32" },
|
|
90
|
+
{ name: "program", type: "u32" },
|
|
91
|
+
{ name: "shaderData", type: "u32" },
|
|
92
|
+
{ name: "varyingBase", type: "u32" },
|
|
93
|
+
{ name: "varyingStride", type: "u32" },
|
|
94
|
+
{ name: "firstTriangle", type: "u32" },
|
|
95
|
+
{ name: "kind", type: "u32" },
|
|
96
|
+
{ name: "specularIntensity", type: "f32" },
|
|
97
|
+
{ name: "dielectric", type: "f32" },
|
|
98
|
+
{ name: "afterProgram", type: "u32", doc: "What a hook does after <opaque_fragment>, or NO_PROGRAM." },
|
|
99
|
+
{ name: "afterData", type: "u32" },
|
|
100
|
+
{ name: "normalRow0", type: "vec4f", doc: "The mesh's world normal matrix, for an object space normal map." },
|
|
101
|
+
{ name: "normalRow1", type: "vec4f" },
|
|
102
|
+
{ name: "normalRow2", type: "vec4f" },
|
|
103
|
+
...MATERIAL_MAPS.map(slot => ({ name: slot, type: "u32" })),
|
|
104
|
+
];
|
|
105
|
+
/** The `Material` struct, as both sides of the device see it. */
|
|
106
|
+
export const MATERIAL_LAYOUT = layoutStruct("Material", FIELDS);
|
|
107
|
+
export const MATERIAL_WORDS = MATERIAL_LAYOUT.words;
|
|
108
|
+
const KIND_OF = {
|
|
109
|
+
MeshStandardMaterial: MATERIAL_KIND.standard,
|
|
110
|
+
MeshPhysicalMaterial: MATERIAL_KIND.physical,
|
|
111
|
+
MeshLambertMaterial: MATERIAL_KIND.lambert,
|
|
112
|
+
MeshPhongMaterial: MATERIAL_KIND.phong,
|
|
113
|
+
MeshToonMaterial: MATERIAL_KIND.toon,
|
|
114
|
+
MeshNormalMaterial: MATERIAL_KIND.normal,
|
|
115
|
+
MeshDepthMaterial: MATERIAL_KIND.depth,
|
|
116
|
+
MeshDistanceMaterial: MATERIAL_KIND.depth,
|
|
117
|
+
MeshMatcapMaterial: MATERIAL_KIND.matcap,
|
|
118
|
+
ShadowMaterial: MATERIAL_KIND.shadow,
|
|
119
|
+
ShaderMaterial: MATERIAL_KIND.shader,
|
|
120
|
+
RawShaderMaterial: MATERIAL_KIND.shader,
|
|
121
|
+
};
|
|
122
|
+
/** The material types Three lights, exactly as `LIT_MATERIALS` in the CPU renderer. */
|
|
123
|
+
const LIT = new Set([
|
|
124
|
+
"MeshLambertMaterial", "MeshPhongMaterial", "MeshToonMaterial", "MeshStandardMaterial", "MeshPhysicalMaterial"
|
|
125
|
+
]);
|
|
126
|
+
const PBR = new Set(["MeshStandardMaterial", "MeshPhysicalMaterial"]);
|
|
127
|
+
/** Three's `ShaderMaterial` keeps `fog` off by default; every built-in material has it on. */
|
|
128
|
+
const FOG_OFF_BY_DEFAULT = new Set(["ShaderMaterial", "RawShaderMaterial"]);
|
|
129
|
+
/** Three's `0x111111`, the Phong default specular colour, in linear light. */
|
|
130
|
+
const PHONG_SPECULAR = 0.005605391906346412;
|
|
131
|
+
/** Reads a serialized Three colour or vector, falling back when the material does not carry it. */
|
|
132
|
+
function vector(value, fallback, size = 3) {
|
|
133
|
+
return Array.isArray(value) && value.length >= size && value.slice(0, size).every(entry => typeof entry === "number")
|
|
134
|
+
? value.slice(0, size)
|
|
135
|
+
: [...fallback];
|
|
136
|
+
}
|
|
137
|
+
function number(value, fallback) {
|
|
138
|
+
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
139
|
+
}
|
|
140
|
+
function flag(value, fallback) {
|
|
141
|
+
return typeof value === "boolean" ? value : fallback;
|
|
142
|
+
}
|
|
143
|
+
const clamp01 = (value) => Math.min(1, Math.max(0, value));
|
|
144
|
+
/** Whether a material is drawn at all: Three skips one whose `visible` is off. */
|
|
145
|
+
export function isMaterialVisible(material) {
|
|
146
|
+
return flag(material?.values?.visible, true) && flag(material?.values?.colorWrite, true);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Three's resolution of a material, defaults and all. A material outside the metalness workflow keeps its own specular
|
|
150
|
+
* colour; one Three does not light reads as its own colour.
|
|
151
|
+
*/
|
|
152
|
+
export function materialProperties(material, textures = new Map()) {
|
|
153
|
+
const values = material?.values ?? {};
|
|
154
|
+
const type = material?.type ?? "MeshStandardMaterial";
|
|
155
|
+
const pbr = PBR.has(type);
|
|
156
|
+
const physical = type === "MeshPhysicalMaterial";
|
|
157
|
+
const ior = number(values.ior, 1.5);
|
|
158
|
+
const attenuationDistance = number(values.attenuationDistance, 0);
|
|
159
|
+
const transparent = flag(values.transparent, false);
|
|
160
|
+
const sheen = physical ? Math.max(0, number(values.sheen, 0)) : 0;
|
|
161
|
+
const anisotropy = physical ? number(values.anisotropy, 0) : 0;
|
|
162
|
+
const thickness = vector(values.iridescenceThicknessRange, [100, 400], 2);
|
|
163
|
+
const maps = Object.fromEntries(MATERIAL_MAPS.map(slot => {
|
|
164
|
+
const id = material?.maps?.[slot];
|
|
165
|
+
return [slot, id !== undefined ? textures.get(id) ?? NO_TEXTURE : NO_TEXTURE];
|
|
166
|
+
}));
|
|
167
|
+
// A shader material's own colour comes from its program; a patched built-in keeps its type's shading.
|
|
168
|
+
const shader = material?.shader;
|
|
169
|
+
const kind = KIND_OF[type] ?? MATERIAL_KIND.basic;
|
|
170
|
+
const flags = (LIT.has(type) ? MATERIAL_LIT : 0)
|
|
171
|
+
| (pbr ? MATERIAL_PBR : 0)
|
|
172
|
+
| (transparent ? MATERIAL_TRANSPARENT : 0)
|
|
173
|
+
| (flag(values.vertexColors, false) ? MATERIAL_VERTEX_COLORS : 0)
|
|
174
|
+
| (flag(values.flatShading, false) ? MATERIAL_FLAT : 0)
|
|
175
|
+
| (flag(values.wireframe, false) ? MATERIAL_WIREFRAME : 0)
|
|
176
|
+
| (flag(values.fog, !FOG_OFF_BY_DEFAULT.has(type)) ? MATERIAL_FOG : 0)
|
|
177
|
+
| (flag(values.clipIntersection, false) ? MATERIAL_CLIP_INTERSECTION : 0)
|
|
178
|
+
| (number(values.normalMapType, 0) === 1 ? MATERIAL_OBJECT_NORMAL_MAP : 0)
|
|
179
|
+
| (shader?.patched ? MATERIAL_PATCHED : 0)
|
|
180
|
+
| (flag(values.alphaHash, false) ? MATERIAL_ALPHA_HASH : 0)
|
|
181
|
+
| (physical ? MATERIAL_SPECULAR : 0);
|
|
182
|
+
return {
|
|
183
|
+
kind,
|
|
184
|
+
color: vector(values.color, [1, 1, 1]),
|
|
185
|
+
opacity: number(values.opacity, 1),
|
|
186
|
+
emissive: vector(values.emissive, [0, 0, 0]),
|
|
187
|
+
emissiveIntensity: number(values.emissiveIntensity, 1),
|
|
188
|
+
specular: physical
|
|
189
|
+
? vector(values.specularColor, [1, 1, 1])
|
|
190
|
+
: vector(values.specular, [PHONG_SPECULAR, PHONG_SPECULAR, PHONG_SPECULAR]),
|
|
191
|
+
specularIntensity: physical ? number(values.specularIntensity, 1) : 1,
|
|
192
|
+
// A standard material has no index of refraction in Three's shader and reflects 0.04, which is what 1.5 gives.
|
|
193
|
+
dielectric: ((ior - 1) / (ior + 1)) ** 2,
|
|
194
|
+
roughness: number(values.roughness, 1),
|
|
195
|
+
metalness: number(values.metalness, 0),
|
|
196
|
+
alphaTest: number(values.alphaTest, 0),
|
|
197
|
+
flags,
|
|
198
|
+
normalScale: vector(values.normalScale, [1, 1], 2),
|
|
199
|
+
// Three only lets light through a physical material. Like its own shader, metal takes the share back.
|
|
200
|
+
transmission: physical ? clamp01(number(values.transmission, 0)) : 0,
|
|
201
|
+
ior,
|
|
202
|
+
thickness: Math.max(0, number(values.thickness, 0)),
|
|
203
|
+
attenuationColor: vector(values.attenuationColor, [1, 1, 1]),
|
|
204
|
+
attenuationDistance: attenuationDistance > 0 ? attenuationDistance : 0,
|
|
205
|
+
clearcoat: physical ? clamp01(number(values.clearcoat, 0)) : 0,
|
|
206
|
+
clearcoatRoughness: number(values.clearcoatRoughness, 0),
|
|
207
|
+
clearcoatNormalScale: vector(values.clearcoatNormalScale, [1, 1], 2),
|
|
208
|
+
sheenColor: vector(values.sheenColor, [0, 0, 0]).map(channel => channel * sheen),
|
|
209
|
+
sheenRoughness: Math.min(1, Math.max(1e-4, number(values.sheenRoughness, 1))),
|
|
210
|
+
iridescence: physical ? Math.max(0, number(values.iridescence, 0)) : 0,
|
|
211
|
+
iridescenceIor: number(values.iridescenceIOR, 1.3),
|
|
212
|
+
iridescenceThickness: thickness,
|
|
213
|
+
anisotropy,
|
|
214
|
+
anisotropyRotation: number(values.anisotropyRotation, 0),
|
|
215
|
+
dispersion: physical ? Math.max(0, number(values.dispersion, 0)) : 0,
|
|
216
|
+
shininess: Math.max(0, number(values.shininess, 30)),
|
|
217
|
+
bumpScale: number(values.bumpScale, 1),
|
|
218
|
+
lightMapIntensity: number(values.lightMapIntensity, 1),
|
|
219
|
+
envMapIntensity: number(values.envMapIntensity, 1),
|
|
220
|
+
reflectivity: number(values.reflectivity, 1),
|
|
221
|
+
refractionRatio: number(values.refractionRatio, 0.98),
|
|
222
|
+
combine: number(values.combine, 0),
|
|
223
|
+
side: number(values.side, 0),
|
|
224
|
+
blending: number(values.blending, 1),
|
|
225
|
+
maps,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
/** A material entry with no mesh specific parts: no clipping, no program, no varyings, an identity normal matrix. */
|
|
229
|
+
export const NO_PLACEMENT = {
|
|
230
|
+
clipStart: 0,
|
|
231
|
+
clipCount: 0,
|
|
232
|
+
program: NO_PROGRAM,
|
|
233
|
+
shaderData: 0,
|
|
234
|
+
varyingBase: 0,
|
|
235
|
+
varyingStride: 0,
|
|
236
|
+
firstTriangle: 0,
|
|
237
|
+
normalMatrix: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
238
|
+
afterProgram: NO_PROGRAM,
|
|
239
|
+
afterData: 0,
|
|
240
|
+
};
|
|
241
|
+
/** The bytes of one material, as the shader reads them. */
|
|
242
|
+
export function writeMaterial(target, index, properties, placement = NO_PLACEMENT) {
|
|
243
|
+
const p = properties;
|
|
244
|
+
const n = placement.normalMatrix;
|
|
245
|
+
writeStruct(MATERIAL_LAYOUT, target, index * MATERIAL_WORDS, {
|
|
246
|
+
color: [...p.color, p.opacity],
|
|
247
|
+
emissive: [...p.emissive, p.emissiveIntensity],
|
|
248
|
+
specular: [...p.specular, p.roughness],
|
|
249
|
+
attenuation: [...p.attenuationColor, p.attenuationDistance],
|
|
250
|
+
sheen: [...p.sheenColor, p.sheenRoughness],
|
|
251
|
+
metalness: p.metalness,
|
|
252
|
+
flags: p.flags,
|
|
253
|
+
alphaTest: p.alphaTest,
|
|
254
|
+
transmission: p.transmission,
|
|
255
|
+
normalScaleX: p.normalScale[0],
|
|
256
|
+
normalScaleY: p.normalScale[1],
|
|
257
|
+
ior: p.ior,
|
|
258
|
+
thickness: p.thickness,
|
|
259
|
+
clearcoat: p.clearcoat,
|
|
260
|
+
clearcoatRoughness: p.clearcoatRoughness,
|
|
261
|
+
clearcoatNormalScaleX: p.clearcoatNormalScale[0],
|
|
262
|
+
clearcoatNormalScaleY: p.clearcoatNormalScale[1],
|
|
263
|
+
iridescence: p.iridescence,
|
|
264
|
+
iridescenceIor: p.iridescenceIor,
|
|
265
|
+
iridescenceThicknessMin: p.iridescenceThickness[0],
|
|
266
|
+
iridescenceThicknessMax: p.iridescenceThickness[1],
|
|
267
|
+
anisotropy: p.anisotropy,
|
|
268
|
+
anisotropyRotation: p.anisotropyRotation,
|
|
269
|
+
dispersion: p.dispersion,
|
|
270
|
+
shininess: p.shininess,
|
|
271
|
+
bumpScale: p.bumpScale,
|
|
272
|
+
lightMapIntensity: p.lightMapIntensity,
|
|
273
|
+
envMapIntensity: p.envMapIntensity,
|
|
274
|
+
reflectivity: p.reflectivity,
|
|
275
|
+
refractionRatio: p.refractionRatio,
|
|
276
|
+
combine: p.combine,
|
|
277
|
+
side: p.side,
|
|
278
|
+
blending: p.blending,
|
|
279
|
+
clipStart: placement.clipStart,
|
|
280
|
+
clipCount: placement.clipCount,
|
|
281
|
+
program: placement.program,
|
|
282
|
+
shaderData: placement.shaderData,
|
|
283
|
+
varyingBase: placement.varyingBase,
|
|
284
|
+
varyingStride: placement.varyingStride,
|
|
285
|
+
firstTriangle: placement.firstTriangle,
|
|
286
|
+
kind: p.kind,
|
|
287
|
+
specularIntensity: p.specularIntensity,
|
|
288
|
+
dielectric: p.dielectric,
|
|
289
|
+
afterProgram: placement.afterProgram,
|
|
290
|
+
afterData: placement.afterData,
|
|
291
|
+
normalRow0: [n[0], n[3], n[6], 0],
|
|
292
|
+
normalRow1: [n[1], n[4], n[7], 0],
|
|
293
|
+
normalRow2: [n[2], n[5], n[8], 0],
|
|
294
|
+
...Object.fromEntries(MATERIAL_MAPS.map(slot => [slot, p.maps[slot]])),
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
//# sourceMappingURL=materialLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"materialLayout.js","sourceRoot":"","sources":["../src/materialLayout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAoB,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAqF9C;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAA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AAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACjC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACjC,GAAG,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACvE,CAAC,CAAC;AACL,CAAC"}
|
package/dist/math.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Applies a column-major 4x4 to a point, writing three floats at `offset`. */
|
|
2
|
+
export declare function transformPoint(m: readonly number[], x: number, y: number, z: number, out: Float32Array, offset: number): void;
|
|
3
|
+
/**
|
|
4
|
+
* The inverse transpose of the upper-left 3x3, as a column-major 3x3. Non-uniform scale makes the world matrix itself
|
|
5
|
+
* wrong for normals, which is what this corrects; a singular matrix falls back to the identity.
|
|
6
|
+
*/
|
|
7
|
+
export declare function normalMatrix(m: readonly number[]): Float64Array;
|
|
8
|
+
/** Applies a column-major 3x3 to a direction and normalizes it, writing three floats at `offset`. */
|
|
9
|
+
export declare function transformNormal(n: Float64Array, x: number, y: number, z: number, out: Float32Array, offset: number): void;
|
|
10
|
+
//# sourceMappingURL=math.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../src/math.ts"],"names":[],"mappings":"AAGA,+EAA+E;AAC/E,wBAAgB,cAAc,CAAC,CAAC,EAAE,SAAS,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAClF,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,QAMlC;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,YAAY,CAiB/D;AAED,qGAAqG;AACrG,wBAAgB,eAAe,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAC9E,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,QASlC"}
|
package/dist/math.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Small matrix helpers. Three is a peer dependency, but the packing path stays free of it so it can be tested in Node
|
|
2
|
+
// without a scene. Matrices arrive as Three's column-major sixteen number arrays.
|
|
3
|
+
/** Applies a column-major 4x4 to a point, writing three floats at `offset`. */
|
|
4
|
+
export function transformPoint(m, x, y, z, out, offset) {
|
|
5
|
+
const w = m[3] * x + m[7] * y + m[11] * z + m[15] || 1;
|
|
6
|
+
out[offset] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;
|
|
7
|
+
out[offset + 1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;
|
|
8
|
+
out[offset + 2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The inverse transpose of the upper-left 3x3, as a column-major 3x3. Non-uniform scale makes the world matrix itself
|
|
12
|
+
* wrong for normals, which is what this corrects; a singular matrix falls back to the identity.
|
|
13
|
+
*/
|
|
14
|
+
export function normalMatrix(m) {
|
|
15
|
+
const a = m[0], b = m[1], c = m[2];
|
|
16
|
+
const d = m[4], e = m[5], f = m[6];
|
|
17
|
+
const g = m[8], h = m[9], i = m[10];
|
|
18
|
+
const cofactor0 = e * i - f * h, cofactor1 = f * g - d * i, cofactor2 = d * h - e * g;
|
|
19
|
+
const determinant = a * cofactor0 + b * cofactor1 + c * cofactor2;
|
|
20
|
+
if (determinant === 0)
|
|
21
|
+
return new Float64Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
|
|
22
|
+
const s = 1 / determinant;
|
|
23
|
+
// The inverse is the adjugate over the determinant; transposing it is the same as reading the adjugate row-wise.
|
|
24
|
+
return new Float64Array([
|
|
25
|
+
cofactor0 * s, cofactor1 * s, cofactor2 * s,
|
|
26
|
+
(c * h - b * i) * s, (a * i - c * g) * s, (b * g - a * h) * s,
|
|
27
|
+
(b * f - c * e) * s, (c * d - a * f) * s, (a * e - b * d) * s,
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
/** Applies a column-major 3x3 to a direction and normalizes it, writing three floats at `offset`. */
|
|
31
|
+
export function transformNormal(n, x, y, z, out, offset) {
|
|
32
|
+
const nx = n[0] * x + n[3] * y + n[6] * z;
|
|
33
|
+
const ny = n[1] * x + n[4] * y + n[7] * z;
|
|
34
|
+
const nz = n[2] * x + n[5] * y + n[8] * z;
|
|
35
|
+
const length = Math.hypot(nx, ny, nz) || 1;
|
|
36
|
+
out[offset] = nx / length;
|
|
37
|
+
out[offset + 1] = ny / length;
|
|
38
|
+
out[offset + 2] = nz / length;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=math.js.map
|
package/dist/math.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"math.js","sourceRoot":"","sources":["../src/math.ts"],"names":[],"mappings":"AAAA,sHAAsH;AACtH,kFAAkF;AAElF,+EAA+E;AAC/E,MAAM,UAAU,cAAc,CAAC,CAAoB,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS,EAClF,GAAiB,EAAE,MAAc;IACjC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IAEvD,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAA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AC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC1C,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;IAE3C,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC;IAC1B,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC;IAC9B,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { FRAME_LAYOUT } from "./frameLayout.js";
|
|
2
|
+
import { type ShaderPrograms } from "./shaderProgram.js";
|
|
3
|
+
import type { SceneBuffers } from "./sceneUpload.js";
|
|
4
|
+
/** One dispatch worth of state: which band, which samples, and everything the kernel reads about the frame. */
|
|
5
|
+
export type FrameUniforms = Record<keyof typeof FRAME_LAYOUT.offsets & string, number | boolean | ArrayLike<number>>;
|
|
6
|
+
/**
|
|
7
|
+
* The whole kernel, in the order WGSL needs: every stage may only call what comes before it, as there are no forward
|
|
8
|
+
* declarations. The scene's translated shaders sit between the texture code they call and the surface code that calls
|
|
9
|
+
* them.
|
|
10
|
+
*/
|
|
11
|
+
export declare function pathTraceSource(programs?: ShaderPrograms | null): string;
|
|
12
|
+
export declare class PathTracePass {
|
|
13
|
+
private readonly device;
|
|
14
|
+
private pipeline;
|
|
15
|
+
private readonly uniforms;
|
|
16
|
+
private readonly values;
|
|
17
|
+
private bindGroup;
|
|
18
|
+
private programKey;
|
|
19
|
+
constructor(device: GPUDevice);
|
|
20
|
+
/** Recompiles the kernel when the scene's shaders changed; the same set of programs keeps the pipeline it has. */
|
|
21
|
+
setPrograms(programs: ShaderPrograms | null): void;
|
|
22
|
+
private build;
|
|
23
|
+
/** Rebinds after the scene or the accumulation buffer was replaced. */
|
|
24
|
+
setBindings(scene: SceneBuffers, accumulation: GPUBuffer): void;
|
|
25
|
+
encode(encoder: GPUCommandEncoder, frame: FrameUniforms): void;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=pathTracePass.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pathTracePass.d.ts","sourceRoot":"","sources":["../src/pathTracePass.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAcrD,+GAA+G;AAC/G,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,OAAO,YAAY,CAAC,OAAO,GAAG,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;AAErH;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,GAAE,cAAc,GAAG,IAAW,GAAG,MAAM,CAG9E;AAMD,qBAAa,aAAa;IAOZ,OAAO,CAAC,QAAQ,CAAC,MAAM;IANnC,OAAO,CAAC,QAAQ,CAAqB;IACrC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAY;IACrC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgC;IACvD,OAAO,CAAC,SAAS,CAA6B;IAC9C,OAAO,CAAC,UAAU,CAAM;gBAEK,MAAM,EAAE,SAAS;IAK9C,kHAAkH;IAClH,WAAW,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAU3C,OAAO,CAAC,KAAK;IAMb,uEAAuE;IACvE,WAAW,CAAC,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS;IAiBxD,MAAM,CAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,aAAa;CAexD"}
|