Pryme8 Posted March 26, 2018 Share Posted March 26, 2018 So when doing somthing like: var uvRefBuffer = new BABYLON.Buffer(engine, uvRef, false, 2, false, false); would create the Buffer as non Instanced. and var uvRefBuffer = new BABYLON.Buffer(engine, uvRef, false, 2, false, true); Makes it instanced, what is the difference? I noticed when I make it instanced things stop working, so I am wondering when would you use that and what is its convention. Quote Link to comment Share on other sites More sharing options...
Guest Posted March 27, 2018 Share Posted March 27, 2018 when a buffer is flag as instanced it must be used with a shader supporting instancing Quote Link to comment Share on other sites More sharing options...
Guest Posted March 27, 2018 Share Posted March 27, 2018 More detailed answer: Here is the code of the GPU particles which heavily rely on instancing. https://github.com/BabylonJS/Babylon.js/blob/master/src/Particles/babylon.gpuParticleSystem.ts#L618 you can see that I only draw 4 vertices which are instanced this._currentActiveCount times The main buffer contains the data for the 4 vertices (and this one is not instanciated ie. it will be repeated for all instances): https://github.com/BabylonJS/Babylon.js/blob/master/src/Particles/babylon.gpuParticleSystem.ts#L466 and then I have all the data that must be sent to all instances (which is unique per instance) https://github.com/BabylonJS/Babylon.js/blob/master/src/Particles/babylon.gpuParticleSystem.ts#L398 Pryme8 1 Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted March 27, 2018 Author Share Posted March 27, 2018 Starting to feel more and more like I need to go back to school... o_O... 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.