unicomp21 Posted February 18, 2017 Share Posted February 18, 2017 Instanced meshes, for a given root mesh, would it be possible to have multiple arrays of instances where each has a different material? I'm using geometries which tile across 3D space, kinda like 3D noise, being able to use multiple materials w/o cloning meshes would really help me save gpu memory. Quote Link to comment Share on other sites More sharing options...
unicomp21 Posted February 18, 2017 Author Share Posted February 18, 2017 I should clarify ... 3D noise -> periodic 3D noise which tiles across 3D space Quote Link to comment Share on other sites More sharing options...
BitOfGold Posted February 18, 2017 Share Posted February 18, 2017 Each and every tile has a different material? If not, you could create one root mesh by each material and clone thoose meshes. Or you could use SPS particles, where you can color each particle mesh with different color. unicomp21 1 Quote Link to comment Share on other sites More sharing options...
unicomp21 Posted February 18, 2017 Author Share Posted February 18, 2017 No, that's why I'm asking for multiple instance arrays, each with a different material. Let's say I have 3 different types of interlocking bricks I use for constructing buildings (in my case it's a much higher count). Allowing each of these bricks to have two instance arrays, 1 for red material and 1 for brown material, allows me to save gpu memory in that I don't have to make copies of the "root" brick meshes for each different color of brick. The example I've given is trivial, but when moving to hundreds or thousands of proc-generated meshes, the overhead is no longer trival. Quote Link to comment Share on other sites More sharing options...
unicomp21 Posted February 18, 2017 Author Share Posted February 18, 2017 I'll look at the SPS particle meshes. Quote Link to comment Share on other sites More sharing options...
unicomp21 Posted February 18, 2017 Author Share Posted February 18, 2017 Think I have the same dilema w/ SPS, don't see how I can have different groups of particles within an SPS, each w/ a different material. Looks like I still have to duplicate the mesh data. Quote Link to comment Share on other sites More sharing options...
JohnK Posted February 18, 2017 Share Posted February 18, 2017 Use sps with a spritemap of materials. Spritemap use in a different context here http://doc.babylonjs.com/tutorials/createbox_per_face_textures_and_colors but process of using uv is the same just read about uv in sps unicomp21 1 Quote Link to comment Share on other sites More sharing options...
jerome Posted February 18, 2017 Share Posted February 18, 2017 http://doc.babylonjs.com/overviews/solid_particle_system#uvs unicomp21 1 Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted February 18, 2017 Share Posted February 18, 2017 what you could do is to import your model, clone it one time for each different material, disable them all, and then use them as base meshes for your instances unicomp21 1 Quote Link to comment Share on other sites More sharing options...
unicomp21 Posted February 19, 2017 Author Share Posted February 19, 2017 Thanks everyone! Quote Link to comment Share on other sites More sharing options...
unicomp21 Posted February 19, 2017 Author Share Posted February 19, 2017 In the beforeRender callback, could I change materials multiple times and call setParticles() after each? The setParticles() flushes out the render(), right? Quote Link to comment Share on other sites More sharing options...
unicomp21 Posted February 19, 2017 Author Share Posted February 19, 2017 Long story short, I'm wanting to use multiple PBRMaterial's on the particle system. Quote Link to comment Share on other sites More sharing options...
unicomp21 Posted February 19, 2017 Author Share Posted February 19, 2017 Is there an example using SPS with web workers? 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.