Can i remove a meshInstance from the draw call list?

Hi,

I am currently developing an app with PlayCanvas, and I would like to optimize my mesh and hide / show some mesh instances from my model at runtime. I searched in the documentation and came across this:

pc.MeshInstance.visible

However, it hides the mesh instance without removing it from the draw call list. Am I saving performance / draw calls by hiding them ? is there a better way to do this ?

Thank you for helping me,
Cheers,
Tristan

From the code in https://github.com/playcanvas/engine/blob/af8003fd79f686c8e96ace9dacef26a4f779529c/src/scene/forward-renderer.js it does omit rendering thus saving on polycount/actual draw calls, but still runs through the item in draw call list. However , it seems that the visible flag is only used if cull=true is set ( the default) . In my opinion, visible should not be dependent on cull !!! Can playcanvas team fix the code so that visible=false combined with cull=false can skip executing the entire _isVisible frustum culling function and rendering entirely ? Right if I set cull=false for my meshInstances to skip frustum culling, the visible flag no longer works!! For now, the temporary solution when I’m using my custom onPreCull culling implementation on Mesh hierarchy , is to set both cull=true and visible =false when hiding mesh instances instead of cull=false and visible=true when showing them. A bit confusing I know and they should better adjust the code so that _isVisible function call can be skipped entirely if visible master flag is set to false. Best coding practice is that Functions should usually focus only 1 thing ( in this case, frustum culling ONLY) and not consider irrelevant/external flags which early return them. ( ie. it’s better/more performance to check for the conditional flags prior to executing the function itself)