I got a 3-D Warehouse overview with about 10k shelfs with up to as many pallets on them, and well performance was horrible of course. So I read up on what to do and figured BatchNode was the way to go, problem is each shelf and each pallet can be selected in my application and it will be colored in a different color. Generally color can change for many different reasons.
Now here is my problem, I cant just simply change the color of the material of an Object when its in a Batchnode without setting the Material anew. I tried and nothing happened. And when the Object is still batched I get an exception. So if I remove the Object from the BatchNode, change the Material , and then add it again without batching it works but it looks like z-fighting as the old color and new color appear depending on camera angle and position. However if I batch it after selection, it goes trough all the objects twice (1x for deselecting old object, 1x for selecting new one) and my application freezes for half a minute.
What is the best approach to solve this? I know the guide says its best to only batch static objects, but ALL my objects are non-static as they are selectable and there is up to 20k or more.
I read that 1 BatchNode = 1 Geometry = 1 Mesh = 1 Material, so should I make a separate BatchNode for every possible texture+mesh+color combination and make the Object travel between the according Batchnodes? I am not sure that would help either as when I deselect an Objcet it would be readded to the big BatchNode with all the objects with no special color so performance would be crap again when batching it.
Texture or mesh doesnt change on the fly, only color. Atleast for now