please help me to color this closed object drawn using lines

. Babylon.js Playground

Hi @Akash_A_R and welcome to the community

can we color inside lines area without adjusting ground width and height?

Hello and welcome aboard!

Can you be more precise on what you want to achieve please?

Our aim is to draw a closed shape (for eg: square , pentagon or any with more than 3 and less than 10 vertex) with line or anything . and need to give color to the shape

If you use lines, your lines is your shape. It does not delimit a shape within the lines, so you cannot color it or texture it. There are multiple ways however you can achieve that. I.E. Instead of drawing lines, you could draw a shape and use edge rendering.

Here’s also another PG (a bit more complex)

And then, there are lots of other methods but I’d say if your aim is to draw a shape and fill-it in with a stroke, the easiest is probably to just draw this shape.

1 Like

I think you are interested in something like this:

Change the value of tesselation to 4 and you get a square.

If you don’t want the shape to be shaded and to have a uniform color, disable it’s lighting and set it’s emissiveColor like I did on lines 13 and 14.


Hi, the team I need to draw a zone/shape (a shape with min coordinates of 3 and a max of 10 ) and need to fill a color inside the shape, and need to change the shape coordinates by dragging it. On an obj model I used lines but it’s not possible to achieve the same using it coordinates example will be [x,y.z]

You can use the gizmos for moving, scaling and rotating you mesh on the scene.