Heightmap of SCMDeformableTerrain Issues

30 views
Skip to first unread message

Whop42 Whop42

unread,
Jan 22, 2023, 5:50:47 PM1/22/23
to ProjectChrono
I previously posted it in another conversation, however it got no attention due to the original question being resolved.)

I have run into a problem with this approach (although i suspect it's just my code.) I used the SCMDeformableTerrain's mesh's ChTriangleMeshConnected to gather a list of all the vertices in the mesh. I then added the heights to a 2D list (and normalized them), then dumped them into a grayscale image. However, the image turns out unintelligible (example attached.) It's supposed to be a shoeprint, imprinted from a (3D-scanned) .obj of a shoe.

tmpw15joiam.PNG
Print in Irrlicht:2023-01-19_16-10.png
How do I rectify this problem and make the print show up, like it is in Irrlicht?

Radu Serban

unread,
Jan 23, 2023, 5:29:49 PM1/23/23
to ProjectChrono

I didn’t respond because I’m not sure what to tell you.  As you indicated, this doesn’t seem to be a Chrono problem but rather an issue with your code.  All I can suggest is export the terrain mesh from Chrono to an OBJ and use an external viewer to make sure it is what you also see in the Irrlicht rendering.  If that is the case, you must have some bug in how you postprocess the mesh to generate your heightmap image. 

You may want to use a third-party tool to generate the heightmap from an OBJ.  A web search shows this: https://github.com/ryobg/obj2hmap

 

--Radu

 

From: projec...@googlegroups.com <projec...@googlegroups.com> On Behalf Of Whop42 Whop42
Sent: Sunday, 22 January 2023 23:51
To: ProjectChrono <projec...@googlegroups.com>
Subject: [chrono] Heightmap of SCMDeformableTerrain Issues

 

I previously posted it in another conversation, however it got no attention due to the original question being resolved.)

 

I have run into a problem with this approach (although i suspect it's just my code.) I used the SCMDeformableTerrain's mesh's ChTriangleMeshConnected to gather a list of all the vertices in the mesh. I then added the heights to a 2D list (and normalized them), then dumped them into a grayscale image. However, the image turns out unintelligible (example attached.) It's supposed to be a shoeprint, imprinted from a (3D-scanned) .obj of a shoe.

 

Print in Irrlicht:

How do I rectify this problem and make the print show up, like it is in Irrlicht?

 

--
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 projectchron...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/projectchrono/3d5ccf3d-6f49-4291-8a19-0bb0dda3815dn%40googlegroups.com.

Whop42 Whop42

unread,
Jan 24, 2023, 11:20:25 PM1/24/23
to ProjectChrono
Hello, thanks for the answer. I honestly missed the exporting .obj feature. However, when I try to use it in PyChrono, it comes up with a type error.

Here's an example:
mesh: chrono.ChTriangleMeshConnected = terrain.GetMesh().GetMesh()
mesh.WriteWavefront("terrain.obj", mesh)
...
TypeError: in method 'ChTriangleMeshConnected_WriteWavefront', argument 2 of type 'std::vector< chrono::geometry::ChTriangleMeshConnected,std::allocator< chrono::geometry::ChTriangleMeshConnected > > const &'

It seems that the c++ class std::vector isn't implemented in PyChrono (at least from what I can tell with experimenting with tuples, lists, etc. and the PyChrono reference). Is there a workaround for this, or should I just go another route?

Thanks,
whop42
Reply all
Reply to author
Forward
0 new messages