The Snow Irbix Posted August 30, 2017 Share Posted August 30, 2017 Hellooo ! I was trying to improve my little voxel engine with the tuto here : https://doc.babylonjs.com/tutorials/optimizing_your_scene Quote Babylon.js uses an advanced and automatic shaders engine. This system will keep shaders up to date regarding material options. If you are using a static material (ie. an immutable material) then you can let it know to Babylon.js by using the following code: material.freeze(); But I came with a bug that causes my boxes to disappear when I freeze the material and move the camera. I recreated it in the PG : https://playground.babylonjs.com/#NXU14G If you move the camera so the center of the cube is not in the frustum culling anymore, all instances seem to disappear Note that this bug only occurs when working with instances, if you replace let instance = box.createInstance(''+x+y+z); by let instance = box.clone(''+x+y+z); it works well. Can someone help me or explain me why I can't freeze the material when working with instances ? Thank you very much ! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 30, 2017 Share Posted August 30, 2017 Unfortunately this is a known limitation. But with the recent updates we did on the material, you should not see a big improvements but using freeze(). The Snow Irbix 1 Quote Link to comment Share on other sites More sharing options...
The Snow Irbix Posted August 31, 2017 Author Share Posted August 31, 2017 Thank you for your reply ! Indeed there is not much performance difference, so I will do without. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.