Jump to content

Difference Between Instanced Attributed and non.


Pryme8
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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...