Odd behavior on Visibility or Alpha with Instances

So in the playground the behavior is not the same, and I am kinda wondering what is different
https://playground.babylonjs.com/#IDAVNB

This is pretty much the exact setup which it works just fine here in the playground.

You can go into the inspector and change the visibility of the mesh or the alpha of the material (the backplane stuff) and it works just fine.

But in my local scene (which is using all the same BJS scripts as the playground) anytime I set the visibility or the alpha all instances of the plane disappear entirely and will not come back even if I set them back to 1. If I set the mesh that the instances are being created from back to setEnabled(true) then they all come back, but then the I can see the “Master” plane that I am creating the instances from.

Its really really weird behavior that I have never seen before and cant recreate in a PG with the same code oddly enough.

Notice the white plane behind the unit?


main mesh setEnabled(false) and no alpha or visibility


setEnabled(false) but some visibility applied


setEnabled(true) but some visibility applied

Super trippy…

So then I thought… OK hacky workaround leave the plane enabled then stick it off into Narnia and go about my day… BUT NOOOOOOO, still the same behavior except now toggling the enabled on the main plane does not cause them to come back.

Are you using the same Babylon version than in the PG? Browser cache cleaned?

Yup and yup, this is really trippy behavior!

I was convinced it would replicated in the PG, but then when it didn’t my mind about blew up.

Nothing I can think of would cause this behavior in Instances ever and I have never seen anything like this.

Logically I dont know what the difference between toggling the master mesh to disabled then to enabled after the visibility is set would make vs keeping it as enabled and setting the visibility…

Are you freezing some materials? If yes, try to not freeze.

There is nothing I can think of as well. Are you using:

@sebavan yes across the board.

    <script src="https://preview.babylonjs.com/babylon.js"></script>
	<script src="https://preview.babylonjs.com/materialsLibrary/babylonjs.materials.min.js"></script>
	<script src="https://preview.babylonjs.com/gui/babylon.gui.min.js"></script>	
    <script src="https://preview.babylonjs.com/loaders/babylonjs.loaders.min.js"></script>
    <script src="https://cdn.babylonjs.com/cannon.js"></script>

Ill try that now

@Evgeni_Popov Nope no change.

If I do clones everything is golden, but that is way to many drawcalls now and really instances should work considering they function how expected in the PG.

I guess my workaround is take all of the clones and merge them into a single buffer