How can I make a custom block?

Hello there! If you’re familiar with Minecraft then you must know the sapling “block”.


How can I make such a block using BabylonJS?

Hey @EnderAdel,

You’re referring to this? Sapling – Official Minecraft Wiki

There’s a very old and well known CG trick that’s used to create grass, which is just 2 planes vertically oriented to the ground, and crossing each other in a perpendicular manner. You then have to apply a sapling texture to it with alpha (transparency) values all around it.

Here’s a picture that helps illustrate how it’s done: image

Here’s a video that talks about the technique…this uses the unity engine, but the same principles can be used for Babylon as well.

Hope this is helpful.

How can I create such a module in BabylonJS?

Just following the same core concepts from the video.

Highest level workflow…create 2 planes, orient them the way you want, apply texture.

That’s the most simple path.

Can’t I do that with BabylonJS alone?

Yup! absolutely.

Create 2 planes in Babylon, apply textures in Babylon.

A quick search through our docs will help on both those subjects:

https://doc.babylonjs.com/

If you’re not familiar with how to create meshes with Babylon, I’d start here:

https://doc.babylonjs.com/babylon101/discover_basic_elements

1 Like