Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGPURenderer: InstancedMesh Supports Instance Color and Morph Target #870

Merged
merged 4 commits into from
Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions examples-testing/changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -13879,6 +13879,43 @@ index 9f06a5a..5b5f93c 100644

init();

diff --git a/examples-testing/examples/webgpu_instancing_morph.ts b/examples-testing/examples/webgpu_instancing_morph.ts
index 0d7e9fe..5067e62 100644
--- a/examples-testing/examples/webgpu_instancing_morph.ts
+++ b/examples-testing/examples/webgpu_instancing_morph.ts
@@ -7,7 +7,13 @@ import Stats from 'three/addons/libs/stats.module.js';
import WebGPURenderer from 'three/addons/renderers/webgpu/WebGPURenderer.js';
import { MeshStandardNodeMaterial } from 'three/nodes';

-let camera, scene, renderer, stats, mesh, mixer, dummy;
+let camera: THREE.PerspectiveCamera,
+ scene: THREE.Scene,
+ renderer: WebGPURenderer,
+ stats: Stats,
+ mesh: THREE.InstancedMesh,
+ mixer: THREE.AnimationMixer,
+ dummy: THREE.Mesh;

const offset = 5000;

@@ -73,7 +79,7 @@ function init() {
const loader = new GLTFLoader();

loader.load('models/gltf/Horse.glb', function (glb) {
- dummy = glb.scene.children[0];
+ dummy = glb.scene.children[0] as THREE.Mesh;

mesh = new THREE.InstancedMesh(
dummy.geometry,
@@ -143,7 +149,7 @@ function animate() {
mesh.setMorphAt(i, dummy);
}

- mesh.morphTexture.needsUpdate = true;
+ mesh.morphTexture!.needsUpdate = true;
}

renderer.render(scene, camera);
diff --git a/examples-testing/examples/webgpu_lights_ies_spotlight.ts b/examples-testing/examples/webgpu_lights_ies_spotlight.ts
index 1430a29..58b951d 100644
--- a/examples-testing/examples/webgpu_lights_ies_spotlight.ts
Expand Down
2 changes: 1 addition & 1 deletion three.js
Submodule three.js updated 45 files
+3 −3 .github/workflows/codeql-code-scanning.yml
+20 −10 build/three.cjs
+20 −10 build/three.module.js
+1 −1 build/three.module.min.js
+2 −1 docs/api/en/animation/AnimationMixer.html
+1 −1 docs/api/en/materials/Material.html
+2 −1 examples/files.json
+1 −1 examples/jsm/loaders/FBXLoader.js
+25 −2 examples/jsm/nodes/accessors/InstanceNode.js
+13 −3 examples/jsm/nodes/accessors/MorphNode.js
+12 −2 examples/jsm/nodes/accessors/NormalNode.js
+17 −3 examples/jsm/nodes/materials/NodeMaterial.js
+1 −1 examples/jsm/renderers/common/Background.js
+ examples/screenshots/webgpu_instancing_morph.jpg
+14 −0 examples/webgpu_equirectangular.html
+195 −0 examples/webgpu_instancing_morph.html
+82 −82 package-lock.json
+9 −32 playground/BaseNodeEditor.js
+165 −0 playground/DataTypeLib.js
+3 −46 playground/NodeEditorUtils.js
+4 −3 playground/editors/BasicMaterialEditor.js
+0 −2 playground/editors/ColorEditor.js
+4 −1 playground/editors/CustomNodeEditor.js
+0 −2 playground/editors/FloatEditor.js
+5 −4 playground/editors/JoinEditor.js
+6 −5 playground/editors/PointsMaterialEditor.js
+3 −2 playground/editors/PreviewEditor.js
+8 −6 playground/editors/ScriptableEditor.js
+6 −5 playground/editors/SplitEditor.js
+8 −7 playground/editors/StandardMaterialEditor.js
+0 −2 playground/editors/StringEditor.js
+2 −1 playground/editors/SwizzleEditor.js
+4 −5 playground/editors/TextureEditor.js
+0 −2 playground/editors/UVEditor.js
+0 −2 playground/editors/Vector2Editor.js
+0 −2 playground/editors/Vector3Editor.js
+0 −2 playground/editors/Vector4Editor.js
+10 −7 src/core/Object3D.js
+9 −0 src/extras/PMREMGenerator.js
+5 −1 src/renderers/WebGLRenderer.js
+32 −22 src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js
+1 −1 src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js
+1 −1 src/renderers/shaders/ShaderLib.js
+4 −1 src/renderers/webgl/WebGLTextures.js
+1 −0 test/e2e/puppeteer.js
3 changes: 2 additions & 1 deletion types/three/examples/jsm/nodes/accessors/InstanceNode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { ShaderNodeObject } from "../shadernode/ShaderNode.js";

export default class InstanceNode extends Node {
instanceMesh: InstancedMesh;
instanceMatrixNode: Node;
instanceMatrixNode: Node | null;
instanceColorNode: Node | null;

constructor(instanceMesh: InstancedMesh);
}
Expand Down
Loading