Jump to content

How does mesh.simplify() work ?


jerome
 Share

Recommended Posts

Hi,

 

I'm trying to add some simplified skull meshes into my SPS.

I'm following this doc and this related PG : http://www.babylonjs-playground.com/#2JBSNA#4

 

The thing I don't get is :

 

Is the original mesh modified after the simplication process (meaning : it has then less vertices and indices than before) ?

Or are new instances created somewhere (submeshes ?) ?

 

 

Link to comment
Share on other sites

mesh.simplify({...}, true, QUADRATIC,function() {   var simplified = mesh.getLODLevelAtDistance(distance);});

where "distance" can be set by you, as you gave it in the settings.

 

Another way aould be to directly use the simplification, I documented it shortly here - http://doc.babylonjs.com/page.php?p=24822 , scroll all the way down.

Link to comment
Share on other sites

Ok, that's exactly what I need : the direct simplication !

I need to import the skull mesh, then to simplify it, then use a simplified instance as a shape model for my 3D particles (it runs for now with complete skulls but the FPS decreases to 30 with only 6 skulls)

 

So what is the way to do ?

var decimator = new QuadraticErrorSimplification(skull);

Then I set, if needed the decimator properties (iteration, aggressiveness, etc).

Then ... ?

mesh.simplify( what here ? I don't need distance, neither many different decimation levels);

How do I actually run the decimation and where is the simplified instance ?

Link to comment
Share on other sites

you will need to give one single Settings object. The distance will technically not be used. So:

var decimator = new QuadraticErrorSimplification(skull);decimator.simplify({ quality: 0.9, distance: 25, optimizeMesh:true }, function(newMesh) {   console.log("Profit!!!", newMesh);});

will give you newMesh, that will be the mesh you wanted.
In theory this should work :-)

Link to comment
Share on other sites

thannnnk so much you Raanan !!! :D

 

The results locally are impressive in Chrome : I can emit 100 skulls at 60 FPS here

 

[EDIT] 150 is the limit at 60 FPS on my machine

I feel surprised by my own SPS... and BJS power !

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