Jump to content

Failed to use CSG function to add a hole on a mesh created via CreateRibbon function


Recommended Posts

Hi all,

I want to add a hole one a mesh which created via CreateRibbon function (the mesh itself is a bit complext, but I simplify in the demo).

Following the demo http://playground.babylonjs.com/#T6NP3F#0 I create a demo, links is http://playground.babylonjs.com/#J4H6RF 

but seems it will failed to do the subtract operation on the mesh created via CreateRibbon, any one can help me on it?


If I want to add a hole on this type of mesh, which is the better way I can have a try ?

Thanks in advace.

Link to comment
Share on other sites

Hi @JZ7878 and welcome to the forum from me. The issue is the use of double sides for the ribbons. To ensure the normal directions for the sides are correct (ie point away from solid) to produce the 'solid looking' mesh you need to swap the order of some of your arrays. I have done this by using the reverse function but you could change the appropriate arrays by hand. The 'direction' of the ribbon will also affect how CSG works. So here is a cube made up of single sided ribbons in correct direction


You can also remove the backface culling lines.

I stuck to using a standard box as it was easier to experiment with just one 'ribbon cube'.  You can try the same approach with a 'ribbon hole maker' making sure normals will be correct.

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.

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