@adobe/data-gpu 0.10.23 → 0.10.25
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/dist/core/core-plugin.d.ts +1 -1
- package/dist/graphics/animation/animation-plugin.d.ts +2 -2
- package/dist/graphics/camera/camera-plugin.d.ts +1 -1
- package/dist/graphics/camera/orbit/orbit-data-plugin.d.ts +1 -1
- package/dist/graphics/camera/orbit/orbit-plugin.d.ts +1 -1
- package/dist/graphics/camera/orbit/orbit-system-plugin.d.ts +1 -1
- package/dist/graphics/graphics-plugin.d.ts +1 -1
- package/dist/graphics/picking/picking-plugin.d.ts +770 -770
- package/dist/graphics/rendering/bone-collider-plugin.d.ts +200 -200
- package/dist/graphics/rendering/ibl-render/ibl-render-plugin.d.ts +146 -146
- package/dist/graphics/rendering/interpolation-plugin.d.ts +7 -7
- package/dist/graphics/rendering/jolt-ragdoll-plugin.d.ts +200 -200
- package/dist/graphics/rendering/material-palette-gpu/material-palette-gpu-plugin.d.ts +7 -7
- package/dist/graphics/rendering/model-collider-plugin.d.ts +150 -150
- package/dist/graphics/rendering/pbr-render/pbr-factor-render-plugin.d.ts +146 -146
- package/dist/graphics/rendering/skinning/skinning-plugin.d.ts +168 -168
- package/dist/graphics/scene/model/model-loader-plugin.d.ts +150 -150
- package/dist/graphics/scene/model/shape/shape-geometry-plugin.d.ts +74 -74
- package/dist/graphics/scene/model/world-bounds-plugin.d.ts +150 -150
- package/dist/graphics/scene/scene-plugin.d.ts +16 -16
- package/dist/graphics/scene/scene-uniforms/scene-uniforms-plugin.d.ts +13 -13
- package/dist/physics/physics-clock-plugin.d.ts +1 -1
- package/dist/physics/solvers/jolt-solver-plugin.d.ts +1 -1
- package/dist/physics/solvers/rapier-solver-plugin.d.ts +1 -1
- package/package.json +2 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/graphics/rendering/material-gpu/material-arrays.d.ts +0 -47
- package/dist/graphics/rendering/material-gpu/material-arrays.js +0 -83
- package/dist/graphics/rendering/material-gpu/material-arrays.js.map +0 -1
- package/dist/graphics/rendering/material-gpu/material-bind-group.d.ts +0 -9
- package/dist/graphics/rendering/material-gpu/material-bind-group.js +0 -52
- package/dist/graphics/rendering/material-gpu/material-bind-group.js.map +0 -1
- package/dist/graphics/rendering/material-gpu/material-gpu-plugin.d.ts +0 -259
- package/dist/graphics/rendering/material-gpu/material-gpu-plugin.js +0 -90
- package/dist/graphics/rendering/material-gpu/material-gpu-plugin.js.map +0 -1
- package/dist/graphics/rendering/pbr-render/pbr-array-shader.wgsl.d.ts +0 -10
- package/dist/graphics/rendering/pbr-render/pbr-array-shader.wgsl.js +0 -145
- package/dist/graphics/rendering/pbr-render/pbr-array-shader.wgsl.js.map +0 -1
- package/dist/graphics/rendering/pbr-render/pbr-render-plugin.d.ts +0 -1266
- package/dist/graphics/rendering/pbr-render/pbr-render-plugin.js +0 -254
- package/dist/graphics/rendering/pbr-render/pbr-render-plugin.js.map +0 -1
- package/dist/graphics/scene/model/geometry/geometry.d.ts +0 -9
- package/dist/graphics/scene/model/geometry/geometry.js +0 -3
- package/dist/graphics/scene/model/geometry/geometry.js.map +0 -1
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
-
import { wgslStructFields } from "@adobe/data/typed-buffer";
|
|
3
|
-
import { schema as sceneUniformsSchema } from "../../scene/scene-uniforms/schema.js";
|
|
4
|
-
import brdf from "../ibl-render/brdf.wgsl.js";
|
|
5
|
-
/**
|
|
6
|
-
* Unified PBR shader for instanced primitives (and, after convergence, glTF).
|
|
7
|
-
* Materials come from the shared `materialGpu` set — five `texture_2d_array`s +
|
|
8
|
-
* a palette of per-layer factors (group 1) — selected by a per-instance layer
|
|
9
|
-
* index (group 3, binding 1). Shading is identical Cook-Torrance + split-sum
|
|
10
|
-
* IBL to the per-material `ibl-shader`; only the material *source* differs.
|
|
11
|
-
*/
|
|
12
|
-
export function buildPbrArrayShader(options) {
|
|
13
|
-
return /* wgsl */ `
|
|
14
|
-
struct SceneUniforms {
|
|
15
|
-
${wgslStructFields(sceneUniformsSchema)}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
struct MaterialFactors {
|
|
19
|
-
baseColorFactor: vec4f,
|
|
20
|
-
emissiveMetallic: vec4f, // emissive.rgb, metallicFactor
|
|
21
|
-
roughNormalOcc: vec4f, // roughnessFactor, normalScale, occlusionStrength, _
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
@group(0) @binding(0) var<uniform> scene: SceneUniforms;
|
|
25
|
-
|
|
26
|
-
@group(1) @binding(0) var<storage, read> palette: array<MaterialFactors>;
|
|
27
|
-
@group(1) @binding(1) var baseColorArray: texture_2d_array<f32>;
|
|
28
|
-
@group(1) @binding(2) var metallicRoughnessArray: texture_2d_array<f32>;
|
|
29
|
-
@group(1) @binding(3) var normalArray: texture_2d_array<f32>;
|
|
30
|
-
@group(1) @binding(4) var occlusionArray: texture_2d_array<f32>;
|
|
31
|
-
@group(1) @binding(5) var emissiveArray: texture_2d_array<f32>;
|
|
32
|
-
@group(1) @binding(6) var matSampler: sampler;
|
|
33
|
-
|
|
34
|
-
@group(2) @binding(0) var iblIrradiance: texture_cube<f32>;
|
|
35
|
-
@group(2) @binding(1) var iblPrefiltered: texture_cube<f32>;
|
|
36
|
-
@group(2) @binding(2) var iblBrdfLut: texture_2d<f32>;
|
|
37
|
-
@group(2) @binding(3) var iblSampler: sampler;
|
|
38
|
-
|
|
39
|
-
@group(3) @binding(0) var<storage, read> instances: array<mat4x4<f32>>;
|
|
40
|
-
@group(3) @binding(1) var<storage, read> layers: array<u32>;
|
|
41
|
-
|
|
42
|
-
const PREFILTERED_MIP_COUNT: f32 = ${options.prefilteredMipCount.toFixed(1)};
|
|
43
|
-
|
|
44
|
-
struct VertexInput {
|
|
45
|
-
@location(0) position: vec3f,
|
|
46
|
-
@location(1) normal: vec3f,
|
|
47
|
-
@location(2) tangent: vec4f,
|
|
48
|
-
@location(3) uv: vec2f,
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
struct VertexOutput {
|
|
52
|
-
@builtin(position) clipPosition: vec4f,
|
|
53
|
-
@location(0) worldPosition: vec3f,
|
|
54
|
-
@location(1) normal: vec3f,
|
|
55
|
-
@location(2) tangent: vec3f,
|
|
56
|
-
@location(3) bitangent: vec3f,
|
|
57
|
-
@location(4) uv: vec2f,
|
|
58
|
-
@location(5) @interpolate(flat) layer: u32,
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
@vertex
|
|
62
|
-
fn vs_main(@builtin(instance_index) instanceIndex: u32, in: VertexInput) -> VertexOutput {
|
|
63
|
-
let m = instances[instanceIndex];
|
|
64
|
-
let m3 = mat3x3<f32>(m[0].xyz, m[1].xyz, m[2].xyz);
|
|
65
|
-
let normalMat = mat3x3<f32>(
|
|
66
|
-
cross(m3[1], m3[2]),
|
|
67
|
-
cross(m3[2], m3[0]),
|
|
68
|
-
cross(m3[0], m3[1]),
|
|
69
|
-
);
|
|
70
|
-
let worldPos = m * vec4f(in.position, 1.0);
|
|
71
|
-
var out: VertexOutput;
|
|
72
|
-
out.clipPosition = scene.viewProjectionMatrix * worldPos;
|
|
73
|
-
out.worldPosition = worldPos.xyz;
|
|
74
|
-
out.normal = normalize(normalMat * in.normal);
|
|
75
|
-
out.tangent = normalize(m3 * in.tangent.xyz);
|
|
76
|
-
out.bitangent = normalize(cross(out.normal, out.tangent) * in.tangent.w);
|
|
77
|
-
out.uv = in.uv;
|
|
78
|
-
out.layer = layers[instanceIndex];
|
|
79
|
-
return out;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
${brdf}
|
|
83
|
-
|
|
84
|
-
@fragment
|
|
85
|
-
fn fs_main(in: VertexOutput) -> @location(0) vec4f {
|
|
86
|
-
let f = palette[in.layer];
|
|
87
|
-
let li = i32(in.layer);
|
|
88
|
-
|
|
89
|
-
let baseColor = textureSample(baseColorArray, matSampler, in.uv, li) * f.baseColorFactor;
|
|
90
|
-
|
|
91
|
-
let mr = textureSample(metallicRoughnessArray, matSampler, in.uv, li);
|
|
92
|
-
let metallic = mr.b * f.emissiveMetallic.w;
|
|
93
|
-
var roughness = mr.g * f.roughNormalOcc.x;
|
|
94
|
-
roughness = max(roughness, MIN_ROUGHNESS);
|
|
95
|
-
let alpha = roughness * roughness;
|
|
96
|
-
|
|
97
|
-
let occlusion = textureSample(occlusionArray, matSampler, in.uv, li).r;
|
|
98
|
-
let emissive = textureSample(emissiveArray, matSampler, in.uv, li).rgb * f.emissiveMetallic.xyz;
|
|
99
|
-
|
|
100
|
-
let nSampled = textureSample(normalArray, matSampler, in.uv, li).rgb * 2.0 - vec3f(1.0);
|
|
101
|
-
let nScaled = vec3f(nSampled.xy * f.roughNormalOcc.y, nSampled.z);
|
|
102
|
-
let tbn = mat3x3<f32>(in.tangent, in.bitangent, in.normal);
|
|
103
|
-
let N = normalize(tbn * nScaled);
|
|
104
|
-
|
|
105
|
-
let V = normalize(scene.cameraPosition - in.worldPosition);
|
|
106
|
-
let nDotV = max(dot(N, V), 0.001);
|
|
107
|
-
let R = reflect(-V, N);
|
|
108
|
-
|
|
109
|
-
let f0 = mix(vec3f(0.04), baseColor.rgb, metallic);
|
|
110
|
-
|
|
111
|
-
// --- IBL contribution (split-sum) ---
|
|
112
|
-
let F_ibl = f_schlick_roughness(nDotV, f0, roughness);
|
|
113
|
-
let kD_ibl = (vec3f(1.0) - F_ibl) * (1.0 - metallic);
|
|
114
|
-
|
|
115
|
-
let irradiance = textureSampleLevel(iblIrradiance, iblSampler, N, 0.0).rgb;
|
|
116
|
-
let diffuseIbl = kD_ibl * irradiance * baseColor.rgb;
|
|
117
|
-
|
|
118
|
-
let mipLevel = roughness * (PREFILTERED_MIP_COUNT - 1.0);
|
|
119
|
-
let prefiltered = textureSampleLevel(iblPrefiltered, iblSampler, R, mipLevel).rgb;
|
|
120
|
-
let envBrdf = textureSampleLevel(iblBrdfLut, iblSampler, vec2f(nDotV, roughness), 0.0).rg;
|
|
121
|
-
let specularIbl = prefiltered * (F_ibl * envBrdf.x + envBrdf.y);
|
|
122
|
-
|
|
123
|
-
let ambient = (diffuseIbl + specularIbl) * mix(1.0, occlusion, f.roughNormalOcc.z);
|
|
124
|
-
|
|
125
|
-
// --- Direct light (parity with the single scene light) ---
|
|
126
|
-
let L = normalize(-scene.lightDirection);
|
|
127
|
-
let H = normalize(V + L);
|
|
128
|
-
let nDotL = max(dot(N, L), 0.0);
|
|
129
|
-
let nDotH = max(dot(N, H), 0.0);
|
|
130
|
-
let vDotH = max(dot(V, H), 0.0);
|
|
131
|
-
let D_d = d_ggx(nDotH, alpha);
|
|
132
|
-
let G_d = g_smith(nDotV, nDotL, alpha);
|
|
133
|
-
let F_d = f_schlick(vDotH, f0);
|
|
134
|
-
let spec_d = (D_d * G_d * F_d) / (4.0 * nDotV * nDotL + 0.0001);
|
|
135
|
-
let kD_d = (vec3f(1.0) - F_d) * (1.0 - metallic);
|
|
136
|
-
let direct = (kD_d * baseColor.rgb / PI + spec_d) * scene.lightColor * nDotL;
|
|
137
|
-
|
|
138
|
-
let color = direct + ambient + emissive;
|
|
139
|
-
let mapped = tone_map_aces(color);
|
|
140
|
-
let gamma = pow(mapped, vec3f(1.0 / 2.2));
|
|
141
|
-
return vec4f(gamma, baseColor.a);
|
|
142
|
-
}
|
|
143
|
-
`;
|
|
144
|
-
}
|
|
145
|
-
//# sourceMappingURL=pbr-array-shader.wgsl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pbr-array-shader.wgsl.js","sourceRoot":"","sources":["../../../../src/graphics/rendering/pbr-render/pbr-array-shader.wgsl.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,MAAM,IAAI,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AACrF,OAAO,IAAI,MAAM,4BAA4B,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAwC;IACxE,OAAO,UAAU,CAAC;;EAEpB,gBAAgB,CAAC,mBAAmB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;qCA2BF,OAAO,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwCzE,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6DL,CAAC;AACF,CAAC"}
|