Comments (2)
Concluding notes —
dequantize ✅
OK to iterate vertex attributes, because the attributes are processed only once, never cloned.
reorder ✅
Calls remapAttribute, iterates over the source attribute. Appears not to write any more than necessary, either way. Improved by switching from remapAttribute to compactAttribute. Further improved by reducing excess iteration over primitives sharing the same vertex stream.
unweld ✅
Did a clone on the vertex attributes before overwriting the array with setElement. Should be a shallow clone, and we can make the loop a bit tighter. Fixed both.
weld ✅
Use of remapPrimitive+remapAttribute resulted in iteration over the entire vertex attribute without need, even if only a subset was copied. Replaced with compactPrimitive / compactAttribute. Vastly faster on oval.gltf.
simplify ✅
Calls dequantizeAttributeArray unoptimally, and passes the entire vertex buffer into simplification when it can only really use the indexed positions.
quantize ✅
Clones and quantizes each attribute in isolation, without regard for indices. Then dedups to clean up at the end. Fixed, mostly with compactPrimitive.
oval.gltf:
- before: 156.85s
- after: 8.74s
join ✅
Compact primitives to isolate vertex streams and remove unused vertices on a per-primitive level. Then deep cloning primitives and transformPrimitive are cheaper. Then in joinPrimitives, fix call to remapAttribute to reduce allocations.
Remove skipIndices argument to transformPrimitive, now that we can guarantee vertex streams are isolated.
oval.gltf + join:
- before: 74.39s
- after: 2.34s (remaining time is I/O-constrained)
lovecraftian.glb + opt, join step only:
- before: 219ms
- after: 115ms
from gltf-transform.
Essentially the same issue coming up for join()
in #1317, which I'll merge into this issue. The functions need to either be smarter about working only with the specific vertices indexed by a given primitive (not its entire vertex stream, possibly shared), or the functions need to be refactored to operate on some concept of a vertex stream. I suspect the first is more maintainable.
Another example file, available at:
https://www.dropbox.com/scl/fi/q1uisxtqoe7hj4d5gzm1r/world.zip?rlkey=1gt9q5t4ns9v8xwwx8gy6geo2&dl=0
from gltf-transform.
Related Issues (20)
- Race condition in toKtx.ts HOT 3
- Merging documents with extensions HOT 7
- Cache cleanup HOT 2
- Draco compression may produce an UNSIGNED_SHORT index buffer with vertex count > 65535 HOT 3
- Change default compression with 'optimize' CLI to Meshopt
- `partition` command is slow for large models HOT 6
- Simplify Draco and Meshopt compression implementations
- Prune fails to clean up accessors referenced by non-root properties HOT 2
- VRM gets treated as glTF instead of GLB HOT 11
- Serialization format for transforms HOT 2
- Roadmap for '@gltf-transform/view' package
- Quantization creates invalid skinning weights for CesiumMan.glb HOT 3
- Support transforms reporting a 'skip' result
- Minor glitch in documentation typings HOT 1
- implements meshoptimizer -sv HOT 1
- sharp error HOT 2
- Improving website credits
- CLI 'validate' command should use exit codes and stderr properly
- optimize removes leaf nodes with --prune-leaves false HOT 2
- Support Morph Targets in '@gltf-transform/view' package
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.