# Box with cartesian grid

**URL:** https://forum.babylonjs.com/t/box-with-cartesian-grid/12256
**Category:** Questions
**Created:** [July 6, 2020, 6:37am UTC](https://forum.babylonjs.com/t/box-with-cartesian-grid/12256 "2020-07-06T06:37:05Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![AlbertoPa](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/albertopa/32/9358_2.png) [@AlbertoPa](https://forum.babylonjs.com/u/AlbertoPa)
#### Post date: [July 6, 2020, 6:37am UTC](https://forum.babylonjs.com/t/box-with-cartesian-grid/12256/1 "2020-07-06T06:37:05Z")

</div>

Hello,

I am trying to make a cuboid and show a Cartesian grid with different number of subdivisions in each direction.

I have tried using a tiled box with edge rendering; however, it does not seem to let the subdivisions in the three directions to be controlled independently (tiles are the same on each face). Similarly, the spacing of the grid material is equal in both directions.

To give a bit more context, what I am trying to achieve is what in Three.js would be done with:

var box = new THREE.BoxGeometry(width, height, depth, nx, ny, nz);

and then building a WireframeGeometry on top of it, and using the LineBasicMaterial to create LineSegments and assign them the box geometry.

Any help is greatly appreciated! Thank you 🙂

---

<div class="post-metadata">

### Author: ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)
#### Post date: [July 6, 2020, 10:35am UTC](https://forum.babylonjs.com/t/box-with-cartesian-grid/12256/2 "2020-07-06T10:35:20Z")

</div>

I guess the most efficient would be to customize the grid material with the node material editor to allow different scale depending on the direction ???

> [@Customizing GridMaterial](https://forum.babylonjs.com/t/customizing-gridmaterial/12216/6):
>
> Oh wow this is perfect! I can’t believe I missed this in the materials thread. Thanks!!!

---

<div class="post-metadata">

### Author: ![AlbertoPa](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/albertopa/32/9358_2.png) [@AlbertoPa](https://forum.babylonjs.com/u/AlbertoPa)
#### Post date: [July 7, 2020, 2:07am UTC](https://forum.babylonjs.com/t/box-with-cartesian-grid/12256/3 "2020-07-07T02:07:14Z")

</div>

Thanks sebavan.

Is there no way to actually have a tiled box with different tiles on each face or, at least, parallel faces? That would seem easier than carrying around a custom material with all the generated code…

---

<div class="post-metadata">

### Author: ![AlbertoPa](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/albertopa/32/9358_2.png) [@AlbertoPa](https://forum.babylonjs.com/u/AlbertoPa)
#### Post date: [July 7, 2020, 5:12am UTC](https://forum.babylonjs.com/t/box-with-cartesian-grid/12256/4 "2020-07-07T05:12:03Z")

</div>

I think I found a way using tiled planes:

[https://playground.babylonjs.com/#8RK8SM](https://playground.babylonjs.com/#8RK8SM)

I am not sure it is the most efficient way to do this, but it seems to work OK.

---

<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: [July 7, 2020, 7:33am UTC](https://forum.babylonjs.com/t/box-with-cartesian-grid/12256/5 "2020-07-07T07:33:09Z")

</div>

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

---

<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: [July 7, 2020, 12:59pm UTC](https://forum.babylonjs.com/t/box-with-cartesian-grid/12256/6 "2020-07-07T12:59:27Z")

</div>

TiledBox has less code but you can only control two dimensions for tile size [https://www.babylonjs-playground.com/#Z5JFSM#140](https://www.babylonjs-playground.com/#Z5JFSM#140)

---

<div class="post-metadata">

### Author: ![AlbertoPa](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/albertopa/32/9358_2.png) [@AlbertoPa](https://forum.babylonjs.com/u/AlbertoPa)
#### Post date: [July 7, 2020, 2:44pm UTC](https://forum.babylonjs.com/t/box-with-cartesian-grid/12256/7 "2020-07-07T14:44:09Z")

</div>

Thank you @JohnK and @nasimiasl!
