Jump to content

LOD level on imported meshes


snot224
 Share

Recommended Posts

Hi,

I'm trying to use addLODLevel, but, I don't found anywhere how to use it like I want.

 

In Babylon Tutorial there is good explanation about how to use it with one created mesh.

 

But in my case I import one babylon file with multiple meshes inside, and all meshes insides this file are only separated triangles with texture. I created 4 files with different number of triangles means to be use in LODLevel.

But, in my case, I don't know how to use addLODLevel function because, like explained in tutorial :

 

var knot00 = BABYLON.Mesh.CreateTorusKnot("knot0", 0.5, 0.2, 128, 64, 2, 3, scene);var knot01 = BABYLON.Mesh.CreateTorusKnot("knot1", 0.5, 0.2, 32, 16, 2, 3, scene);var knot02 = BABYLON.Mesh.CreateTorusKnot("knot2", 0.5, 0.2, 24, 12, 2, 3, scene);var knot03 = BABYLON.Mesh.CreateTorusKnot("knot3", 0.5, 0.2, 16, 8, 2, 3, scene);knot00.addLODLevel(15, knot01);knot00.addLODLevel(30, knot02);knot00.addLODLevel(45, knot03);knot00.addLODLevel(55, null);

But here in my code "knot00" is an array of meshes ...

 

 

    BABYLON.SceneLoader.ImportMesh("",dossier,fichier,scene,function(mesh, particleSystems, skeletons)
    {

                for (var i=0;i<mesh.length;i++)
                {
                        tabModele[name]['mesh'].push(mesh);
                }

    }


I don't know if i'm clear and if my problem could be solve, but it will be nice if someone could explain me how to use addLODLevel on an imported file with lot of meshes inside. I think is like optimize a scene but .... In my case, triangles in each files are already optimized, because they are already single triangles....

Have a nice day :)

 

Link to comment
Share on other sites

To be a little more clear, what I want to know is on which mesh I must attach the addLODLevel ?

I've got :
 

 

// Mesh1.babylon (4 triangles)

tabModele['Mesh1']['mesh'].[0]
tabModele['Mesh1']['mesh'].[1]
tabModele['Mesh1']['mesh'].[2]
tabModele['Mesh1']['mesh'].[3]

 

// Mesh2.babylon (3 triangles)

tabModele['Mesh2']['mesh'].[0]
tabModele['Mesh2']['mesh'].[1]
tabModele['Mesh2']['mesh'].[2]

 

// Mesh3.babylon (2 triangles)

tabModele['Mesh3']['mesh'].[0]
tabModele['Mesh3']['mesh'].[1]

 

// Mesh4.babylon (1 triangles)

tabModele['Mesh4']['mesh'].[0]

 

And I wanted something like that :

 

 

tabModele['Mesh1']['mesh'].addLODLevel(15, tabModele['Mesh2']['mesh'] );

tabModele['Mesh1']['mesh'].addLODLevel(40, tabModele['Mesh3']['mesh'] );

tabModele['Mesh1']['mesh'].addLODLevel(50, tabModele['Mesh4']['mesh'] );

 

But tabModele['Mesh1']['mesh'] is not a mesh, is an array of mesh.

Link to comment
Share on other sites

I think noboby can help me :(

I expose one possible solution, say if I'm on wrong way :

1 ) Import Babylon files
2 ) For each mesh inside give a specific addLODLevel.

     a ) If Distance < something, use mesh in file 2, 3, and 4
     b ) If Distance > something, hide mesh not used in over files ...

 

it will look like something like that :

 

tabModele['Mesh1]['mesh'][0].addLODLevel(15, tabModele['Mesh2]['mesh'][0] );

tabModele['Mesh1]['mesh'][1].addLODLevel(15, tabModele['Mesh2]['mesh'][1] );

tabModele['Mesh1]['mesh'][2].addLODLevel(15, tabModele['Mesh2]['mesh'][2] );

tabModele['Mesh1]['mesh'][3].addLODLevel(15, null );

 

tabModele['Mesh1]['mesh'][0].addLODLevel(30, tabModele['Mesh3]['mesh'][0] );

tabModele['Mesh1]['mesh'][1].addLODLevel(30, tabModele['Mesh3]['mesh'][1] );

tabModele['Mesh1]['mesh'][2].addLODLevel(30, null );

tabModele['Mesh1]['mesh'][3].addLODLevel(30, null );

 

tabModele['Mesh1]['mesh'][0].addLODLevel(40, tabModele['Mesh4]['mesh'][0] );

tabModele['Mesh1]['mesh'][1].addLODLevel(40, null );

tabModele['Mesh1]['mesh'][2].addLODLevel(40, null );

tabModele['Mesh1]['mesh'][3].addLODLevel(40, null );

 

 

But it is really the way to be use ?

 

Link to comment
Share on other sites

Hi snot224.

 

Maybe you can share with us an example, somewhere. Maybe on playground.

 

And yes, this is the way for using LOD.  ;)

 

Hi bulisor,

 

If I do a playground, it mean I could solve the problem...

But if you say I'm right to use it like I mensioned, I will try and put it on a playground for over people. Thank you for the answer ;)

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