Jump to content

Material Freeze and Instances


The Snow Irbix
 Share

Recommended Posts

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 :o

 

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 !

Link to comment
Share on other sites

  • The Snow Irbix changed the title to Material Freeze and Instances

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...