multimesh optimization - tips please

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Inces

I am trying to create custom 3d tilemap made by multimesh instances. Built-in gridmap is just bad, it doesn’t allow any individual shader / light action.
Scene strucure :

Spatial ( "hexmap" )
     Spatial ( "tileset")
             >MultimeshInstance * 10 ("grass","sand","mountain","road",so on

Rendering 100 tiles was good. Rendering 1000 was also OK. Rendering 10000 started to visually drop framerate.
So I made hexmap to create new “tileset” scenes once per 30 x 30 square, so visibility notifier would allow only the chunk of tiles on the camera to be visible at once. And this is where outcome was unexpected for me :
single visible chunk of 30*30 tiles of one active “tileset” caused similar frame drop as 10k tiles rendered at once !
So my question is : is multimesh rendered behind the scenes even when visibility is set to false ?? If it is so, how can I optimize it ?

Note : I did ensure that other chunks have visibility set to false at runtime.

Other strange thing I realized : frame seemed to drop more the further Camera was from the viewport origin on x axis.

Finally : when I choose to render 10k of tiles of the same type I notice, that tile “ocean” drops frame much more compared to tile “grass”. But grass tile has 3 times more faces than ocean tile ! they have the same material and light settings. How can this be ??

:bust_in_silhouette: Reply From: Inces

Ok, I realized that visible instances were still rendering tiles, that were also behind vision, and when all instances were visible, tiles were rendered multiple times. That was of course because I didn’t set multimesh property as resource local_to_scene :slight_smile: