Chrono::VSG is being developed in the feature/vsg branch.  Right now, it’s 
pretty much a one-man job, with Rainer - our collaborator in Germany – doing 
all the heavy lifting. If you are interested and willing to help, that would be 
great!

Best,
--Radu


From: [email protected] <[email protected]> On Behalf 
Of Marcel Offermans
Sent: Saturday, June 18, 2022 5:08 PM
To: ProjectChrono <[email protected]>
Subject: Re: [chrono] Materials and textures for most loaded OBJ files are not 
rendered...

Indeed I was referring to #2 and I'm aware that this is far from trivial. It's 
a bit of a side step, but to explore Chrono it would be really helpful for me 
to be able to load arbitrary 3D OBJ files, mainly for terrain models, and have 
those rendered with textures (as without they become grey blobs that are hard 
to drive for a human driver). Based on your info, a workaround for the vehicles 
is to modify ChVehicleGeometry::AddVisualizationAssets(...) and basically make 
it do the same for both m_has_obj and m_has_mesh:

    if (vis == VisualizationType::MESH && (m_has_obj || m_has_mesh)) {
        auto obj_shape = chrono_types::make_shared<ChObjFileShape>();
        obj_shape->SetFilename(vehicle::GetDataFile(m_vis_mesh_file));
        body->AddVisualShape(obj_shape, ChFrame<>());
        return;
    }
Which simply confirms what you wrote earlier, that having irrlicht load the 
object directly does seem to work. I took the demo_VEH_CityBus as an example. 
One thing that I did have to change is to remove all but the diffuse texture 
from the material (deleting the lines that are so subtly marked in red below):

# Blender MTL File: 'None'
# Material Count: 1
newmtl lambert15SG
Ns 0.000000
Ka 1.000000 1.000000 1.000000
Kd 0.500000 0.500000 0.500000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 1
map_Kd textures/Bus_Texturing_Bus_Chassis_BaseColor.jpg
map_Pr textures/Bus_Texturing_Bus_Chassis_Roughness.jpg
map_Pm textures/Bus_Texturing_Bus_Chassis_Metallic.jpg
map_d textures/Bus_Chassis_Opacity.jpg

When I do that, I get a bus (with opaque windows and no real material 
properties but) with a texture!

And thanks for clarifying what VSG is, I was not aware of that project yet. I 
am following the progress of some completely different library (Godot game 
engine) to Vulkan, and that's a long journey for them. That said, Vulkan is a 
much more modern graphics engine. Is that something that's being developed 
somewhere out in the open (Chrono integration with VSG)?

Greetings, Marcel

On Saturday, June 18, 2022 at 4:46:21 PM UTC+2 Radu Serban wrote:
Marcel, assuming you are talking about option #2 I listed below, keep in mind 
that this is not a trivial task unless you have some experience with rendering 
pipelines in general and Irrlicht in particular.  Also, this will not teach you 
much about Chrono.
However, if you are interested in learning more about that kind of things, by 
all means, give it a shot.

VSG is VulkanSceneGraph. See https://vsg-dev.github.io/VulkanSceneGraph/
--Radu

From: [email protected] <[email protected]> On Behalf Of 
Marcel Offermans
Sent: Saturday, June 18, 2022 2:30 PM
To: ProjectChrono <[email protected]>
Subject: Re: [chrono] Materials and textures for most loaded OBJ files are not 
rendered...

Thank you for providing these pointers. I will have a go at this although, 
since I'm new to the project, I can't promise I can figure it out. :)

What is a "VSG-based system" out of interest?

Greetings, Marcel
On Saturday, June 18, 2022 at 2:09:36 PM UTC+2 Radu Serban wrote:
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].
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/e27f6e3e-b40d-43e8-93fb-94041662c974n%40googlegroups.com<https://groups.google.com/d/msgid/projectchrono/e27f6e3e-b40d-43e8-93fb-94041662c974n%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]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/projectchrono/b8d933cb-e60f-46e8-9102-a00776cee499n%40googlegroups.com<https://groups.google.com/d/msgid/projectchrono/b8d933cb-e60f-46e8-9102-a00776cee499n%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/PH0PR06MB82378889BA02648975AEC77CA7AE9%40PH0PR06MB8237.namprd06.prod.outlook.com.

Reply via email to