# Rounded corner for a playing card

**URL:** <https://forum.babylonjs.com/t/rounded-corner-for-a-playing-card/630>\
**Category:** Questions\
**Created:** [January 8, 2019, 1:19pm UTC](https://forum.babylonjs.com/t/rounded-corner-for-a-playing-card/630 "2019-01-08T13:19:40Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fenryll](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/fenryll/32/2677_2.png) [@Fenryll](https://forum.babylonjs.com/u/Fenryll)\
**Post date:** [January 8, 2019, 1:19pm UTC](https://forum.babylonjs.com/t/rounded-corner-for-a-playing-card/630/1 "2019-01-08T13:19:40Z")

</div>

Hello everybody, 10 years later, it is time to refresh my flash online card game (www.chibre.ch): so I am thinking to learn and implement it with a modern stack (node.js/sock.io/angular), and as I would like something beautiful, I am making my first steps with babylon js.

A few line of codes on a scaled textured box gives already something impressive (at least for me): [Title](http://www.hubris.ch/chibre2020/test.html)

Question is about the best way to have nice rounded corners… I did some tries with and exported model from Blender, but hum… beginner there too… [Title](http://www.hubris.ch/chibre2020/index.html), wrong texture mapping, but not only, the rounded corners look ugly…

Guidance where to spend my next time would be very appreciated !

Thanks!

Cyril

---

<div class="post-metadata">

**Author:** ![Vinc3r](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/vinc3r/32/25340_2.png) [@Vinc3r](https://forum.babylonjs.com/u/Vinc3r)\
**Post date:** [January 8, 2019, 1:50pm UTC](https://forum.babylonjs.com/t/rounded-corner-for-a-playing-card/630/2 "2019-01-08T13:50:09Z")

</div>

You should just do as your [first test scene](http://www.hubris.ch/chibre2020/test.html), but with alpha on your texture 🙂

---

<div class="post-metadata">

**Author:** ![trevordev](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/trevordev/32/16_2.png) [@trevordev](https://forum.babylonjs.com/u/trevordev)\
**Post date:** [January 8, 2019, 6:08pm UTC](https://forum.babylonjs.com/t/rounded-corner-for-a-playing-card/630/3 "2019-01-08T18:08:45Z")

</div>

Vinc3r is right, you can find a playground for something similar is here: [https://playground.babylonjs.com/#YDO1F#92](https://playground.babylonjs.com/#YDO1F#92), alpha is used to make the sharp corners invisible.

---

<div class="post-metadata">

**Author:** ![nasimiasl](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/nasimiasl/32/34_2.png) [@nasimiasl](https://forum.babylonjs.com/u/nasimiasl)\
**Post date:** [January 8, 2019, 10:48pm UTC](https://forum.babylonjs.com/t/rounded-corner-for-a-playing-card/630/4 "2019-01-08T22:48:15Z")

</div>

[https://www.babylonjs-playground.com/#G44L79#13](https://www.babylonjs-playground.com/#G44L79#13)  
hi use this  
front uv is cyan and bak is magenta in this pic

![](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/1X/ee36e236167ba4d16084066aa8f90c79825376ef.png)

corner rounded scale and seg scale control by this code  
var mesh = geo1({ seg: 60 , scale:0.031 , deep:0.03 , width:3. ,height : 4.2 }).toMesh(scene);

[https://www.babylonjs-playground.com/#G44L79#14](https://www.babylonjs-playground.com/#G44L79#14)

---

<div class="post-metadata">

**Author:** ![Fenryll](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/fenryll/32/2677_2.png) [@Fenryll](https://forum.babylonjs.com/u/Fenryll)\
**Post date:** [January 14, 2019, 8:14pm UTC](https://forum.babylonjs.com/t/rounded-corner-for-a-playing-card/630/6 "2019-01-14T20:14:50Z")

</div>

Some tries later, I am having fun and being impressed with what I can produce by putting tutorials together, here is my test scene: www.hubris.ch/chibre2020/gui.html

I was thinking to give a try to you example to create the “ardoise” (scoring table) on the right, which is a box with rounded angles… but your example is actually too complicated for me to understand…

I managed to have a “rounded” box more or less where I want, and with more or less the correct rounded corners but I don’t find the way to have my texture applied correctly 🙂

Some hints would be appreciated…

btw: is it normal that I have super perfs on my mobile phone (S7) but awful perfs on y old (2010) mac book air ?

---

<div class="post-metadata">

**Author:** ![JohnK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johnk/32/26764_2.png) [@JohnK](https://forum.babylonjs.com/u/JohnK)\
**Post date:** [January 15, 2019, 4:10pm UTC](https://forum.babylonjs.com/t/rounded-corner-for-a-playing-card/630/7 "2019-01-15T16:10:04Z")

</div>

Here is an ardoise built from ExtrudePolygon [https://www.babylonjs-playground.com/#NNPEZE#1](https://www.babylonjs-playground.com/#NNPEZE#1)

Had to add back corners in image.

**NOTE** ExtrudePolygon uses Earcut, so, in non playground projects, you will have to add a reference to their [cdn](https://unpkg.com/earcut@2.1.1/dist/earcut.min.js) or download their [npm package](https://github.com/mapbox/earcut#install)

---

<div class="post-metadata">

**Author:** ![Fenryll](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/fenryll/32/2677_2.png) [@Fenryll](https://forum.babylonjs.com/u/Fenryll)\
**Post date:** [January 15, 2019, 8:59pm UTC](https://forum.babylonjs.com/t/rounded-corner-for-a-playing-card/630/8 "2019-01-15T20:59:02Z")

</div>

Thank you some much!  
I am enjoying to go back to development and so glad to have found this amazing framework and community 🙂

These results in in a few hours are so promising that I will do my whole game with babylon js, so I’ll be back in the forum, more than often… hope to reach a level that will allow me to help people too one day, hehe

See you

ps: here it is with your ardoise [Title](http://www.hubris.ch/chibre2020/anim4.html), now about to try so nice animation for the 9 cards game opening

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [January 16, 2019, 12:00am UTC](https://forum.babylonjs.com/t/rounded-corner-for-a-playing-card/630/9 "2019-01-16T00:00:02Z")

</div>

We are happy to have you with us as well!
