Comments (14)
Actually reporting the same issue
On this model in particular :
https://github.com/Samsy/glbs/blob/main/sample.glb
Using the command line CLI ( 3.4.0 ) to instance it results good :
https://github.com/Samsy/glbs/blob/main/sample-instanced-good.glb
![Screenshot 2024-02-08 at 15 30 28](https://private-user-images.githubusercontent.com/3786958/303368029-2020ac72-4c9a-4a90-a0d7-f64cc706a8f4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTA4MjA4NzIsIm5iZiI6MTcxMDgyMDU3MiwicGF0aCI6Ii8zNzg2OTU4LzMwMzM2ODAyOS0yMDIwYWM3Mi00YzlhLTRhOTAtYTBkNy1mNjRjYzcwNmE4ZjQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDMxOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDAzMTlUMDM1NjEyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9M2NmYmEzYTdjOTUwMjY1YmUwMTJjODYzODE3YjA0ZTZkOGU5MjM0Mzk0YzVjNzJlNTU0NDkwNTE2MjExMGU0MCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.8i2Dq3oWG-bzpQmebc6A6vnVYHUlGhsHAgvtJB5aF9M)
But using GLTF report script to instance dont show anything, I opened the file on threejs editor, and does not seem to be correct. ( also tested on nodejs packages, no luck )
https://github.com/Samsy/glbs/blob/main/sample-instanced-broken.glb
![Screenshot 2024-02-08 at 15 30 50](https://private-user-images.githubusercontent.com/3786958/303368131-0c63f3fa-a6d1-4e22-86cf-d4396ad9363d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTA4MjA4NzIsIm5iZiI6MTcxMDgyMDU3MiwicGF0aCI6Ii8zNzg2OTU4LzMwMzM2ODEzMS0wYzYzZjNmYS1hNmQxLTRlMjItODZjZi1kNDM5NmFkOTM2M2QucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDMxOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDAzMTlUMDM1NjEyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NDQ5YmQxYjQ4ZWVkYmRkZjk4NWRmYTk3N2Q4OGVlMjQ3YzM0ZTllYmU0ZDc0ZDNjZTEzMWExNDY4NGE3MGFhZSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.DyJDs3n2gc3sBXTP1BNNN8Gf3vSD8A9zrD2KBeJKL34)
I also noticed, flatten does not seem to work on GLTF-report scripts
Flatten using cli ( 3.4.0 ) :
![Screenshot 2024-02-08 at 15 44 46](https://private-user-images.githubusercontent.com/3786958/303372248-60dda427-6054-4dd9-a57e-3f2b0774c53e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTA4MjA4NzIsIm5iZiI6MTcxMDgyMDU3MiwicGF0aCI6Ii8zNzg2OTU4LzMwMzM3MjI0OC02MGRkYTQyNy02MDU0LTRkZDktYTU3ZS0zZjJiMDc3NGM1M2UucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDMxOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDAzMTlUMDM1NjEyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MDNjNDVkNGFhZjc5YWYzZTgzZWVmMWZkNTdhOTJhZTE5MjM4ZTBhZDA3YjhiOTQ3MTQyZTI1ZWJjZTg1MDcyYyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.KI2fWXbtNKe0LwBpZ3KxHAQXYLNjuB10xmrULPgsyRs)
Flatten using GLTF report scripts :
![Screenshot 2024-02-08 at 15 44 24](https://private-user-images.githubusercontent.com/3786958/303372326-8a4ed897-5092-41fb-bee1-03a55c9c7fa7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTA4MjA4NzIsIm5iZiI6MTcxMDgyMDU3MiwicGF0aCI6Ii8zNzg2OTU4LzMwMzM3MjMyNi04YTRlZDg5Ny01MDkyLTQxZmItYmVlMS0wM2E1NWM5YzdmYTcucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDMxOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDAzMTlUMDM1NjEyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NmY0MzExOTJmMWEzN2E3YTVhZGIzYTAxZjIyYjBlYmFhYWE4ZTA5MjAxYzZiNGMxZDRhNmYzNjNiZmE3Njc3NCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.zDDKooa_Odspf0PwA6GCR-kJ3iXAIKm6Zrp1qwWlxOI)
from gltf-transform.
Thank you very much, I'm going to check this !
from gltf-transform.
Thank you @donmccurdy. Sorry I missed your request above for more info. I'm not sure I can avoid using clone(), so I'll test in v4 :D
from gltf-transform.
I tested the next cli, confirms flatten / dedup / instance work as expected
Is there a way to install the "@next" version with node js ?
from gltf-transform.
Confirmed, thanks @harrycollin! I'm seeing the same issue in the latest stable version v3.10.
from gltf-transform.
I've been able to reproduce this error in https://gltf.report, but I can't reproduce it in a Node.js script or in the CLI, and it's fairly difficult to debug in the web app. if you're able to observe the error in Node, do you mind sharing how you went about that? Things that might be important:
- Node.js version
- ES Modules or CommonJS
- TypeScript or JavaScript
- any build tools, and config files if applicable
Thanks!
from gltf-transform.
Note to self — broken version of the file contains no accessors in the instance TRS transforms.
Correct:
{
"mesh": 30,
"extensions": {
"EXT_mesh_gpu_instancing": {
"attributes": {
"TRANSLATION": 0,
"ROTATION": 1,
"SCALE": 2
}
}
}
},
Broken:
{
"mesh": 30,
"extensions": {
"EXT_mesh_gpu_instancing": {
"attributes": {}
}
}
},
from gltf-transform.
Thanks for looking at this! I first noticed this in my Node environment. My bundled version of glTF-Transform is higher than that used on https://gltf.report.
Info:
- glTF-Transform 3.10.0
- Node 18.x
- ES Modules
- Typescript
- Bundled with esbuild
- Banner config for esbuild:
import { fileURLToPath } from 'url';
import * as path from 'path';
import { createRequire as topLevelCreateRequire } from 'module';
const require = topLevelCreateRequire(import.meta.url);
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
from gltf-transform.
if you're able to observe the error in Node
I created a very simple node script but couldn't reproduce the problem. However in my bundled version (info above) the problem still occurs. I can't think of anything else right now that would cause this to happen. I'll keep digging in the meantime.
from gltf-transform.
I have a hunch this might be a case of dual package hazard. Certain build configurations compiling ESM to CJS (for example) can cause two copies of a dependency to be loaded. If the @gltf-transform/functions
package imports code from one copy of @gltf-transform/core
but is given an input document from another copy, lots of unpredictable bugs can happen, like material instanceof Material
returning false.
If that's the case, setting output to ESM in either your ESBuild or TypeScript configuration would likely fix it ... see #857 (reply in thread) for a similar bug and resolution.
from gltf-transform.
Would someone be able to share a Node.js script that reproduces this error, along with the specific bundlers and typescript configurations (if any) used to build and run that script? The script in the top post is fine, but I think the build processes compiling it are creating problems.
I'm fairly confident this has to do with dual package hazard. Presumably I can fix the issue in glTF Report, but if you're running into the same issues in your own code, your build process may also need a configuration change. Targeting ESM (whatever that means in your build system) tends to resolve this problem.
from gltf-transform.
I've found the cause — partial fix in #1269, but there are a few pieces of the solution I still need to figure out before merging.
Doesn't look like build processes or dual package hazard were to blame.
from gltf-transform.
Fixed and published to 4.0.0-alpha.6. If you'd like to test that fix, you can use the @next
tag, like npm install @gltf-transform/cli@next
. glTF Report will be updated after the v4 stable release, which I'm hoping will happen by the end of March.
The issue was related to document.clone()
leaving the scene graph in a subtly broken state, so if you need a workaround in v3 in the meantime, avoiding document.clone()
should sidestep the issue.
from gltf-transform.
@Samsy yes – if you're using the scripting API in a node.js environment you'd probably want:
npm install --save @gltf-transform/core@next @gltf-transform/extensions@next @gltf-transform/functions@next
from gltf-transform.
Related Issues (20)
- Simplify breaks due to assertion failed HOT 6
- Some text nodes are not visible after using draco compression HOT 2
- Incorrect vertex color dequantization, context-dependent HOT 3
- Join also does a prune inside, with settings that are overly aggressive for certain use cases. HOT 16
- Dedup / instance / prune is breaking the model HOT 1
- Saving information on instancing for subsequent mapping. HOT 1
- Weld getting stuck on large OBJ files HOT 2
- Broken og:url on website
- CLI: Optimize flag --texture-size has no effect for KTX2 compression
- Center of model changing HOT 6
- Sparse accessor with many non-zero elements (78.0%) may increase file size HOT 3
- Official website docs could describe full CLI commands args and options
- Unable join() primitives with TRIANGLE_STRIP or TRIANGLE_FAN modes HOT 1
- Simplification stops abruptly at target ratio, leading to non-uniform simplification HOT 2
- Optimize inspect(), weld(), and join() for scenes with many primitives sharing vertex streams HOT 2
- Join command runs out of memory HOT 2
- Improving vertex counts
- Simplification removes all vertices HOT 1
- Simplification with `ratio: 0 error: 1` does not simplify enough HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gltf-transform.