Coder Social home page Coder Social logo

[QUESTION] Is there a more propper way to generate a mesh which contains primitives that have different vertex fragment types? about sharpgltf HOT 3 CLOSED

FlyingBamboo avatar FlyingBamboo commented on June 12, 2024
[QUESTION] Is there a more propper way to generate a mesh which contains primitives that have different vertex fragment types?

from sharpgltf.

Comments (3)

vpenades avatar vpenades commented on June 12, 2024

I'm afraid the only way to do what you want is to use the lower level APIs to construct the mesh on your own.

The way to do so is to create the vertex and index buffers, create the accessors, and then the mesh primitives and the mesh

from sharpgltf.

FlyingBamboo avatar FlyingBamboo commented on June 12, 2024

Thanks for your quick reply!
I can't give up on using the toolkit, so I'm going to try modifying the generated ModelRoot before saving to a glTF file.

from sharpgltf.

vpenades avatar vpenades commented on June 12, 2024

MeshBuilder uses a unique vertex definition for the whole mesh for two reasons:
1- it simplifies the mesh building process.
2- a single vertex format guarantees that all the vertex buffers used by the mesh can be merged into a single vertex buffer. Actually, if all the meshes of the model share the same vertex format, it could lead to use a single vertex buffer for the whole model.

Having said that, the post processor that converts the meshbuilder to a glTF mesh could be improved to identify attributes that have been filled with zeros, and re-arrange the data to remove unused attributes. The bad news is that this is one of the trickiest parts of the whole library and it would not be easy to deal with.

from sharpgltf.

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.