Code Monkey home page Code Monkey logo

Comments (5)

lasalvavida avatar lasalvavida commented on July 23, 2024

@javagl is correct. node-_161000103jz0271b has a huge translation component in its matrix. This transform is applied to the primitives when the node hierarchy is flattened. My suggestion would be to make your transform matrix in the glTF more reasonable and then do the conversion. It looks like you're using Cesium for viewing, so you can do the translation by changing the origin of where you place the model instead of storing it in the glTF.

from gltf-pipeline.

javagl avatar javagl commented on July 23, 2024

@lasalvavida Is there a particular reason to bake the transform into the primitives? I can imagine that there are cases where this makes sense (maybe related to quantization?), but maybe there should be an option to disable this? At least, I found the idea somewhat appealing that a binary glTF is basically the same glTF asset (with the same buffer data, verbatim), only combined into a single file, but without unnecessary structural or semantic modifications.

from gltf-pipeline.

lilleyse avatar lilleyse commented on July 23, 2024

This is similar to #186. Right now the default behavior does not preserve the hierarchy. We plan on adding an optimize flag that will keep the hierarchy intact when false.

from gltf-pipeline.

lasalvavida avatar lasalvavida commented on July 23, 2024

@javagl We do it because this is an optimization pipeline. We want to reduce draw calls and the way to do that is to have fewer primitives. If two primitives are part of meshes on different nodes, we have to transform them to be under the same parent in order to combine them. It may be possible to make this process less greedy (don't transform anything unless there is a primitive we can combine with after flattening), but I think the best answer here is just to allow enabling/disabling of the optimization.

from gltf-pipeline.

javagl avatar javagl commented on July 23, 2024

Reducing the number of draw calls sounds familiar. (I'm not an expert here, but IIRC the draw calls are less of a problem than e.g. state changes, but I assume that this is optimized in the gltf-pipeline as well).

Intuitively, it could make sense to let the coordinates of one merged geometry refer to the bounding box of this geometry, and still use the nodes to set up the (possibly huge) translations of the merged geometries. But I'm sure that something like this will be part of the different options for the exact implementation of such an optimize flag that will be considered.

In any case, your suggestion of creating the glb with an identity transform and then translating the whole glb via the root modelMatrix should solve this particular issue.

from gltf-pipeline.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.