Cross browser performance priority material bug?

I came across an issue where animating materials wasn’t working consistently cross-browser. I distilled it down to the basics with this playground snippet. The red color of the sphere changes as expected in Chrome but doesn’t change with Safari. If I get rid of the performance priority line it changes in both. I’d expect identical behavior in both browsers. Any idea what might be happening here? Also, any thoughts on how to update the material color with the performance priority set to immediate in a way that works cross-browser?

Thanks!!

As explained here


* Freeze materials when they are ready. If you need to change something on a material, 
you will have to call `material.unfreeze()`, do your changes, and then call `material.freeze()` again

The reason it doesn’t change is because Intermediate mode freezes materials

but this seems to be the problem.

cc @Evgeni_Popov

  1. material.isFrozen is false if ScenePerformancePriority

  2. Material._checkScenePerformancePriority 's call order is out of whack, or the comparison order is out of whack (works on additional calls)

  3. As a result, can’t unfreeze during render
    https://playground.babylonjs.com/#AM4NXY#1

maybe you should probably add to this in the milestone as well.

Material._checkScenePerformancePriority is called by isReadyForSubMesh when the material is not frozen, that’s why the “frozen” state is reset back each time you call unfreeze.

Instead of calling unfreeze you should call markDirty(true):

I will see to update the doc accordingly when tackling the issue you linked to.

2 Likes