Marcel,

Indeed, this is a known current limitation (bug if you wish) in the Irrlicht 
run-time visualization module.
I have recently redesigned the entire framework for specifying visualization 
models and rendering. The code is set up to make use of both the OBJ and any 
MTL file, but there’s still something I must be missing when creating the 
Irrlicht materials and mesh buffers that prevents rendering of material 
textures.

I can think of 3 options for now:

  *   I will look again at this issue when I get a chance.  However, it’s not a 
top priority right now (also because the expectation is that we will eventually 
replace Irrlicht run-time visualization with a VSG-based system).  So, you may 
have to wait a bit longer.

  *   You (or someone else familiar with Irrlicht) could help with a fix for 
this through a pull request 😊
For whoever is interested, the two relevant parts in the code to look at are:
     *   Lines 717-739 in 
ChVisualSystemIrrlicht.cpp<https://github.com/projectchrono/chrono/blob/1eb75c2c9fa80cc2c8b710baf07b3072db2093d4/src/chrono_irrlicht/ChVisualSystemIrrlicht.cpp#L717>
 (where the Irrlicht mesh buffers are created)
     *   Function ChIrrNodeShape::UpdateTriangleMesh_mat of 
ChIrrNodeShape.cpp<https://github.com/projectchrono/chrono/blob/1eb75c2c9fa80cc2c8b710baf07b3072db2093d4/src/chrono_irrlicht/ChIrrNodeShape.cpp#L209>
 (where the Irrlicht materials and buffers are populated)

  *   Instead of using a trimesh asset read from file (in which case Chrono 
constructs an internal mesh representation and also reads in visual materials 
which are later passed on the run-time visualization system to be converted in 
their own objects), use a ChObjFileShape and attach that as a visual shape to 
your model.   The difference is that a ChObjFileShape is only a reference to a 
Wavefront OBJ file which is passed as such to the visualization system;  if it 
knows how to do that, it is the renderer responsibility (in this case Irrlicht) 
to open that OBJ file (and any associated MTL files) and create its own 
internal meshes and materials.  Irrlicht knows how to do that, and the material 
textures show up fine if going this route.
For an example of this, look at the “Gator” vehicle model and something like 
demo_VEH_Gator.

--Radu

From: [email protected] <[email protected]> On Behalf 
Of Marcel Offermans
Sent: Friday, June 17, 2022 11:01 PM
To: ProjectChrono <[email protected]>
Subject: [chrono] Materials and textures for most loaded OBJ files are not 
rendered...

Hi all, can anybody tell me how to enable the correct rendering of textures and 
materials that are defined within the various OBJ files? They are missing for 
most demos, and I tried both the latest 7.0.3 release as well as "develop". Is 
this a bug?
--
You received this message because you are subscribed to the Google Groups 
"ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/projectchrono/9e0c9aab-d5ad-4bc2-bcd0-b9dcdda77b9bn%40googlegroups.com<https://groups.google.com/d/msgid/projectchrono/9e0c9aab-d5ad-4bc2-bcd0-b9dcdda77b9bn%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/projectchrono/PH0PR06MB8237A8E0FEE4D2B2CA67B389A7AE9%40PH0PR06MB8237.namprd06.prod.outlook.com.

Reply via email to