Topper

most elegant way of loading meshes

Recommended Posts

Hi Babylonians,

I´m coming up with with a new question.

What is (for the described purpose) the most elegant way of loading meshes into an existing scene?

My application will use something like a ressource (product) configurator for forklifts, pallet trucks, etc.

To display a vehicle i want to use a BJS scene. The user will be able to scroll through the vehicles (data grid) and

the scene has to change, accordingly.

Since the vehicle models are very complex I will buy them online at turbosquid and other places.

I don´t need complex textures but I want to keep (and change) colors. There will be like 3 to 7 different colors per model.

We use Blender, but we still don´t kno which way to go:

1) obj and mtl

2) loading meshes from .babylon

3) gltf

4) stl

5) AsstesManager

When I merge the everything to one single mesh in Blender, I can´t work with different materials (colors), right?

Should I create single meshes in Blender that will share the same material in BJS?

Using multi materials and submeshes i need to know the vertices number ranges. How do i get this done with complex models like forklift?

Here´s an example of what our models look like:

What is the most elegant way to get this accomplished?

BR,

Topper

 

 

 

maxresdefault.jpg

Share this post


Link to post
Share on other sites

I can only speak for .babylon, but merging meshes will result in a BABYLON.MultiMaterial for the mesh.  This is really an aggregate of StandardMaterials.  You can still get an individual using mat. subMaterials & make changes.  Probably need to iterate through each sub material & match name to get the value for 'i' though.

Since a .babylon is very closely integrated, this might not be available for all the formats, but I do not know.

Share this post


Link to post
Share on other sites

If you're in standard workflow, .babylon file is probably the best option. As JCPalmer said, you can easily point a material then.

Example:

  • on Blender, these materials are applied on your object myObject

header.png

  • once append in your BJS scene, you can acceed to Material.001 like this:
var myObject = scene.getMeshByName("myObject");
var myMaterial = myObject.material.subMaterial[1];
myMaterial.ambientColor = new BABYLON.Color3.Magenta();

If you're in PBR workflow the GLTF exporter will split one object into one mesh per subMaterial. Here a playground example (sources) with some material parsing (line 79 to 88).

Share this post


Link to post
Share on other sites

Thanks so far.

i think i will go the .babylon way.

So if i don't wanna use multi materials and this pbr thing, what are the prelimineries in Blender?

1) one mesh per different material (wheels, chassis, cabin, etc.)

2) parenting in Blender or in BJS?

do you use the words object and mesh interchangeably?

Share this post


Link to post
Share on other sites

In case of your model, I wil try to detach only potentially animatable parts if needed. If not, one object is fine (so with multimaterials on it obviously).

But if you want, for example, yellow color at the bottom part of the model, but red color at the body, In Blender you need to assign each parts to its own material.

In fact you can also split your model into multiple meshes if you think it's easier, it's not a big deal. It's on you, depending of which type of interactions you want to code.

Share this post


Link to post
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...

  • Recently Browsing   0 members

    No registered users viewing this page.