When there are more than 1000 complex models in a scene, the transparency of all models is set uniformly, and it is found that the execution time is 5-8 seconds. Blocking the page causes the problem. Is there a solution
Execution case
https://playground.babylonjs.com/#DN1HF1#2
Can you try:
mesh.visibility = 0.2;
If I recall correctly visibility goes through the alpha test which makes it faster and can avoid some other issues with the alphaIndex and prepass. However, I’m not sure I understand the title of your post (despite for being very long ). What do you mean by saying “blocking the page causes the problem”? Else, it’s clear that the alpha is kind of consuming resources.
When you use alpha, the execution time is too long, causing the page to get stuck and blocked
I understand now. Well, it’s because of the method used to order the alpha on materials. Except for using ‘visibility’ instead of ‘alpha’, I don’t know if it can be further optimized. May be through OIT or the performance tool. Best to ask THE alpha expert cc @Evgeni_Popov
In your case, because the initializations occur at the very beginning of the program before any rendering, you can block the “material dirty” mechanism, which is what takes time when you change the alpha value to something less than 1.
However, you must change the scene internal variable and not use the setter, because reseting the property to true
through the setter will trigger the slow process: