Jump to content

Merge meshes with different color?


adam
 Share

Recommended Posts

not sure to understand well what you are trying to achieve, but have you taken a look at MeshBuilder.CreateCylinder with the parameters (used together) :

subdivisions, hasRings, faceColors ?

[EDIT] : example 

[EDIT 2] ooops, it eems you need a tube instead of a cylinder

I intend to implement the "hasRings" feature also for the tube... some day (too busy currently). Actually, I'll do it for the ribbon ("hasStripes" ?), then it will be available for any ribbon based shape

Link to comment
Share on other sites

11 hours ago, adam said:

I'd like to be able to merge meshes of different colors and have them retain their colors.  Is that possible?

In a project I am playing with I wanted the same thing. In the end I settled for not merging the meshes but 'gluing' them together by giving them a common parent. This was good enough for what I wanted but if you want to try merging meshes of different colours and retain their colours then here are somethings I though about but never attempted to do.

A merged mesh is a single mesh so can have only one material applied unless you use multi-materials in this case how do you assign correct vertices to correct material?

There is a tutorial on writing a custom mesh merge http://doc.babylonjs.com/tutorials/How_to_Merge_Meshes#use-your-own-merge-function  Perhaps this could be adapted but again you would need to assign the correct uvs to the correct vertices and in this case you do have access to which colour originally went where but how do you keep and assign the different colours. Would one way be to set a colour map of some sort, ie u from 0 to 0.25 read red, 0.25 to 0.5 read green etc? At this point I am not even sure I know what I am talking about rather it is some vague idea.

This may have helped or hindered you. As I said I went for a different option in the end so good luck.

Link to comment
Share on other sites

2 hours ago, JohnK said:

In the end I settled for not merging the meshes but 'gluing' them together by giving them a common parent.

I've explored this and wasn't happy with the way the transparency looked.

4 hours ago, jerome said:

not sure to understand well what you are trying to achieve

I need to be able to clone/copy models that I have created in Blender, make them transparent, color them differently, and merge them together.  I feel like I am 99% of the way to achieving this.  I just need for the cloned models to be able to have their own vertex color data.

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