How to create a terrain? Is it possible to import from Unity?

Hello,

I am making a browser game with Babylonjs and I was looking for ways to build the heightmap/textures for the terrain.

I thought Unity would be a good way to create a terrain and then export it, but I can’t seem to make the export work. I know there is the Babylon Unity Toolkit, but I have not found how to use it to get the heightmap and textures of my terrain and found nothing in the documentation. If someone can explain to me how to export what’s needed to reproduce my Unity terrain in Babylonjs that would be very appreciated! :slightly_smiling_face:

If Unity isn’t the way to go, is there another beginner-friendly way to build a relatively large map that I could use in my Babylonjs game?

Thanks a lot!

You can draw a heightmap with drawing software like photoshop. Then to create a terrain with Babylon which uses the heightmap or to generate your terrain with the heightmap with the modeling software (3ds max for example).

That’s what I do. Then I convert the 3ds max mesh into ground in babylon to use the ground class prototypes

Image of what it looks like:

3 Likes

Thanks a lot for the answer! For the heightmap, I found how to make it work (even managed to export the heightmap from my unity terrain), however the one thing I don’t understand is how to get the texture map that goes with the heightmap.

On your terrain on the image, how do you get and set the texture you have on the heightmap? How to do if I want not only one texture but several ones at different places on the map, to have different biomes and some beaches near water for example?

I have already worked a few months ago with a small heightmap + texture to do some small islands, but what I am mainly struggling with here is to get the several different textures, with natural transitions, on a very large ground - like we can do on unity by painting the textures we want where we want on the terrain.

1 Like

I use the mixMaterial and I created a class that allows to paint on the mix material.
Then you can save the painted textures.

See this PG

2 Likes

Okay thanks a lot, I will try this! :smile: