Giter VIP home page Giter VIP logo

Comments (3)

tellypresence avatar tellypresence commented on June 11, 2024

What rendering implementation are you using (OpenGL etc)? For example in OpenGL, assimp would parse the .mtl file for texture paths, and the paths would be in the aiScene object -- you would need to load those textures separately in OpenGL (bind to texture objects etc as usual) -- so you could override texture paths there and leave the .obj/.mtl files alone.

Would expect there'd be similar seams in other rendering flows (WebGL, vulkan etc) where you'd be able to replace the requested textures, and could bubble all the way up to the UI so the user could select from available options (if that was in scope for your project and under your control)

from assimp.

KleberPF avatar KleberPF commented on June 11, 2024

I am using OpenGL.

assimp would parse the .mtl file for texture paths, and the paths would be in the aiScene object

So instead of doing scene->mMaterials[mesh->mMaterialIndex] to get the material I loop through all materials in scene->mMaterials and load the textures from all materials in the scene? And then pick one of the materials when rendering a mesh? I guess this would work, but if I understood correctly, I would have to modify the .obj file for every new material added. Is there any way to process material files separately from the .obj (maybe there's a problem not knowing which faces to apply the material to, but I would be fine with all faces by default) so I don't have to change the model file constantly?

from assimp.

kimkulling avatar kimkulling commented on June 11, 2024

There are two supported ways to change the materials. In code you just can select a different material by changing the material index of the mesh. And you can create a new mtl-file and reference this in your obj-model. There is a statement which describes the materiallib to load: mtllib .

But you must guarantee that all textures are there.

from assimp.

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.