[SOLVED]Struggling with texture on cubes

Just picked BabylonJS up a few days ago and it’s my first experience with 3D. Having lots of fun trying to figure it out, despite many frustrations. So hello to the babylonJS community!

I’m trying to build a simple voxel engine. I’ve made textures in Blender, and applied them to:
new Babylon.MeshBuilder.CreateBox('box', options, scene)

Took me a little while to figure out how to use faceUV to apply this texture to a single cube. The problem now is that when I render 16x16x16 of these cubes together, the texture seems to draw across the entire face of all of the cubes.

Here a playground link since I have no idea how to explain the problem properly.

Can anyone help explain what’s happening here?


you were not scaling your positions by the cube size.

what you were seeing was z-index fighting.

1 Like

Pretty sure your chunk size code is off. The best thing to solve these problems is to break it down, so rather than chunksize of 16, do a chunk size of 2. this showed me that it was just layer large blocks on top of each other.
I think this is sort of what you are trying to achieve. Note that I did createInstance instead of clone, since it is the same material. You can read up on that more to decide what you want to do. Unsure what to do to increate the frame rate correctly.

1 Like

Beat me just by a bit. Although my PG was done first :slight_smile:

I see, thanks so much for the help!
Huh just noticing the frame now…