Multithreading with Node, Geometry and Mesh

Hi all, I have a Question about Nodes, Geometries and Meshes.

I know to make changes in jme the Best Way is to do this in the Main Thread.
But Sometimes you need other Threads for Performance.

I want to know if is safe to Create new one of the Object in a other Thread, work whit them before attach to root tree, and after detach from the root tree.

Hi @l1a2r3s4x, welcome!

It looks like what you want (creating spatials) is safe to do in another thread, provided you do not edit the scene graph in that thread.

The JMonkeyEngine Wiki provides more information on multithreading in jme.

As long as you do not attach to the root node or anywhere else in the scene graph you can create/edit any node or geometry on separate threads.

Just make sure that once the operation ends and you want to attach your custom spatials, it does not interrupt rendering of the scene. There are many approaches for that.

My map rendering library creates the map tiles and vector tile objects (buildings in my case) on separate threads before attaching them to the scene graph

JME for Rendering World Maps - #11 by bloodwalker

1 Like

Thanks for you answers.
The Tutorial i have found too, and i have no Problem whit Multi threading in general, i was only not sure there a side effects, that need do be call in Main Thread.