Dynamic surface shape visualization with VSG

57 views
Skip to first unread message

Paul-Otto Müller

unread,
Jan 8, 2025, 1:03:08 PMJan 8
to ProjectChrono
Hi everyone,

I've got a little problem with the VSG visualization system. I want to add a dynamic visualization similar to ChVisualShapeSpring but with ChVisualShapeSurface (NURBS). I created my own class inheriting from ChVisualShapeSurface and implemented the Update function. But if I add this shape now to a ChLink object, nothing shows, and when added to a body, the shape doesn't change. I also tested my code with Irrlicht to check if everything was updated and visualized correctly what was the case.

I tried to adjust the code in ChVisualSystemVSG.cpp but I can't make it work.

Can you maybe give me a hint on how and where I need to adjust the code so that surface shapes are also dynamically updated with VSG?

I'm using the main branch.

Best,
Paul

dr.ratz...@gmail.com

unread,
Jan 10, 2025, 12:08:02 PMJan 10
to ProjectChrono
Hi Paul,

can you provide us with the Irrlicht based code example.It would make it easier for us to understand the problem.

Best,
Rainer

Paul-Otto Müller

unread,
Jan 11, 2025, 11:57:28 AMJan 11
to ProjectChrono
Hi Rainer,

Of course. I've attached an example for you. It's an adaption of one of your demos. I exchanged the ChVisualShapeSpring with my ChVisualShapeMuscle.

Thanks,
Paul
demo.zip

dr.ratz...@gmail.com

unread,
Jan 14, 2025, 1:31:58 AMJan 14
to ProjectChrono
Thanks for the example!

Irrlicht3d and VulkanSceneGraph are fundamentally different under the hood. 3D objects in VSG must be given as indexed face sets with proper shading setup. Size, orientation and position must be set by a transformation matrix. For a couple of primitive objects (box, shere, cone,...) we have convenience functions. User defined objects can be loaded via 3d-graphic files. We recommend the wavefront file format (*.obj/*.mtl) because it is human readable and has an easy structure.

demo_VSG_assets shows 3D objects bound to bodies and scenery objects, which are meant for decoration (treas, houses, animals,...). The scenery objects can also be moved, oriented and sized. In the demo you have the (Utah)teapot, the (Stanford)bunny, the teleporting sphere and of course the forklift truck. You could try at first this basic approach.
It should give you a similar result you have in the Irrlicht based demo. The sizing of an object only by a transformation matrix is of course limited and does not consider shape changes of the object during expansion/compression it is just linear mathematical sizing. There is a more sophisticated solution with vertex/normal/color updates but this is tricky and should not be tried as a first approach.

Good luck!

Paul-Otto Müller

unread,
Jan 15, 2025, 2:49:02 AMJan 15
to ProjectChrono
Thanks for the advice! I'll try again.

Best,
Paul
Reply all
Reply to author
Forward
0 new messages