Jump to content

Animating a triangle


Recommended Posts

27 minutes ago, Deltakosh said:

you can use getVerticesData and updateVerticesData functions. Here is a cool example using a ribbon: http://www.babylonjs-playground.com/#16NCF0#7

Thanks Deltakosh!

I see that that demo uses registerBeforeRender and constantly updates the mesh. Do I understand correctly that this implies constant reuploading of vertex data to the GPU, and that this solution might not scale well to lots of triangles?

Ideally, I would like to upload 6 Vector3s per triangle to the GPU: 3 for the initial position of the triangle, and 3 for the final position. Then, I would like to be able to animate the triangle at linearly interpolated positions, /without/ constantly reuploading vertex data.

Is that doable?

Link to comment
Share on other sites

Another lead is to use the SPS and to design each triangle as different particles. http://doc.babylonjs.com/overviews/Solid_Particle_System

Have a look please at the function updateParticleVertex() : http://doc.babylonjs.com/overviews/Solid_Particle_System#update-each-particle-shape

You particle model could be a disc tessellated at 3 : http://doc.babylonjs.com/overviews/Mesh_CreateXXX_Methods_With_Options_Parameter#disc

This will trigger only one draw call to the GPU

Link to comment
Share on other sites

  • 3 months later...

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.

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.


  • Recently Browsing   0 members

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