Comments (3)
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.
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.
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)
- Bug: Build error ISO C99 and later do not support implicit function declarations HOT 1
- Bug: Issue 55843 in oss-fuzz: assimp:assimp_fuzzer: Integer-overflow in Assimp::DXF::LineReader::operator++
- GLTF2Exporter and KHR_lights_punctual
- Bug: 3mf export tests are broken
- Bug: Assimp 5.4.1 can not find FBX loader for FBX file when it was read from memory. HOT 2
- Bug:Export OBJ file node name failed to export HOT 2
- Constructor/destructor for class aiScene is in Version.cpp
- Bug:The crash occurred when the ifc file was imported
- Bug:The stack-overflow occurred when the ifc file was imported HOT 1
- Bug:Exporting FBX file using assimp, unable to parse mesh
- Bug: Importing Collada file fails with "Error importing model: Cannot parse string" HOT 1
- Bug: GCC-14 fails to build when default symbol visibility is set to hidden HOT 1
- Bug: Possible nullptr dereferencing in Subdivision
- Question: blender 4.1 exported and imported to flax engine has some issues
- Bug: Hard-Crash when loading FBX file HOT 1
- Bug: Compile error in Visual Studio 2022 in Debug mode
- Bug: There may be an out-of-bound access of the variable m_DataIt (static analysis report) HOT 1
- Bug: There may be a dead loop in the file code/PostProcessing/TextureTransform.cpp( static analysis report). HOT 1
- Bug: compile assimp for android failed HOT 4
- when it could support vmd format in mmd after pmx format in mmd have been supported? 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 assimp.