# Displacement map or other "custom shape" function

**URL:** <https://forum.babylonjs.com/t/displacement-map-or-other-custom-shape-function/9548>\
**Category:** Questions\
**Created:** [March 28, 2020, 7:10pm UTC](https://forum.babylonjs.com/t/displacement-map-or-other-custom-shape-function/9548 "2020-03-28T19:10:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![olli2home](https://avatars.discourse-cdn.com/v4/letter/o/7ab992/32.png) [@olli2home](https://forum.babylonjs.com/u/olli2home)\
**Post date:** [March 28, 2020, 7:10pm UTC](https://forum.babylonjs.com/t/displacement-map-or-other-custom-shape-function/9548/1 "2020-03-28T19:10:08Z")

</div>

Hi Guys,  
I am trying to realize the following mesh in Babylon.  
Here is a picture as a goal:

 ![picturemessage_ruff1iue.e10](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/a/a16d170be3ead9a40b16186d7f4096acfd61525d.jpeg)

A tube with a cutout that is straight at the bottom and does not follow the outer contour.

Unfortunately, when using a DisplacementMap, the outer contour is simply pressed inwards. What other options would there be for such a problem?

The ideal would be the CreateRibbon function, which would also take over the shape as a function.

I’ve been sitting on this problem for 3 days now … my head is smoking …

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [March 29, 2020, 1:15pm UTC](https://forum.babylonjs.com/t/displacement-map-or-other-custom-shape-function/9548/2 "2020-03-29T13:15:10Z")

</div>

You can try with CSG:

[https://playground.babylonjs.com/#5D768P#1](https://playground.babylonjs.com/#5D768P#1)

I have subtracted a thin torus to a bigger torus to get this.

In your case, you will have to generate your own shape instead of the thin torus, however. Maybe with a ribbon…

---

<div class="post-metadata">

**Author:** ![olli2home](https://avatars.discourse-cdn.com/v4/letter/o/7ab992/32.png) [@olli2home](https://forum.babylonjs.com/u/olli2home)\
**Post date:** [March 29, 2020, 2:44pm UTC](https://forum.babylonjs.com/t/displacement-map-or-other-custom-shape-function/9548/3 "2020-03-29T14:44:15Z")

</div>

Thanks for the answer.  
With CSG, I think the calculation would take too long. The inner torus should be straight at the bottom and not round and the path of the inner torus should follow a curve. I am currently implementing this using DisplacementMap. To do this, I have adjusted the displacement function somewhat. If I get a good result, I’ll post it here.
