I am creating a series of very complex materials for rayMarching. However, I am failing to figure out how to utilise the same raymarched material (assigned to different meshes), and give them different sets of data for their occurances.
Is there a way to do this? In my understanding instances is not appropriate way too many uniforms. I am assuming it can be done as you can instance animated models and I believe have them animated differently. Which means different streams of matrix data into each occurance.
https://playground.babylonjs.com/#YF6L4T#24
Have done it via cloning the material. But will this cloned material also need to compile? The shaders can take a minute to compile, so if I want 6 occurrences of the same object don’t want to have six compilations, when all that is changing is their data set.
https://playground.babylonjs.com/#YF6L4T#26
Cloning is ok.
As all the clones are using the same shader, the compilation will be done a single time and all shaders will reuse the already compiled code.
Marvelous. Thanks for your help.
Hers is a nice example of what I am trying to achieve.
https://playground.babylonjs.com/#HYIHBI#8
1 Like