Is it possible create voxel terrain use buildin terrain tools?(MineCraft style)

Is it possible create voxel terrain use buildin terrain tools?(Looks like MineCraft style)

I’m using buildin terrain tools create a terrain by height map.

It looks good. But i wanna the voxel style. It’s too smooth for me.

Is here any method change the terrain to voxel style?

I was wrote a terrain generator (Procedual create mesh in runtime). The performance not good even use job system. My game build at WebGL, can’t use Multi-thread also.

So, I’m trying the buildin terrain tools.It’s have better performance.

I don’t need modify the terrain in runtime.

Please help, thanks~ :slight_smile:

It is impossible to make voxel terrain using builtin tools.

Built-in terrain uses heightmaps, meaning it is a subdivided flat plane extruded vertically according to altitude.

This approach cannot form voxels or minecraft cubes.

1 Like

Thanks~ I’ll look for other way.

You can sample the terrain height by raycast or by directly reading terrain data.
And generate voxels in proper position.

But yes you cannot change terrain to voxels since it is impossible to have vertical (90 deg) sides using terrain.

2 Likes

I see, thank you bro!

I used the help of ChatGPT to quickly generate a Unity script for generating Minecraft-like terrain. Well, the initial version was quick, but it took time to polish. More example images, the script itself, and a description of its creation can be found at this here Github page.

Be aware that this script has a lot of room for optimization, as it’s not currently utilizing multithreading/jobs. Increasing the voxel grid size slows down the world creation significantly, as does the number of flood-filling water sources and Perlin worms.

5 Likes

Wow, so cool~ The code even use ECS(Unity.Entities). Thanks!

An older release (0.51). ChatGPT isn’t aware of the newer releases. I hope they train it on newer data soon.

1 Like

Basically, you cannot make voxel terrain using unity terrain. Because it uses heightmaps.

You can absolutely generate minecraft-style meshes and build a landscape out of those.

1 Like

That is superb result of the effort, using modern tools.
More so exciting, it used ECS to some extend, and even 0.51, while I would expect some around 0.17. Great outcome.

How long did take you to build and modify terrain system, including giving ChatGPT right prompts.

How much time proportionally you spent on prompts itself, vs correcting the code, in its current state?

Thank you for the positive feedback Antypodish!

I started my experiments by querying GPT4 via OpenAI’s Python API via Python. I spent 3-4 hours with this, because I was solely focused on using only one prompt to deliver the script, and the answers often took several minutes to get back to me, while I also got frequent server disconnect errors. Therefore I wouldn’t add this time into the total duration. Those hours only taught me that I would need to do the script creation with multiple prompts, and that ChatGPT’s solution for entity creation (attaching the RenderMesh) didn’t work with ECS 0.51 and that I needed to fix it. Most of the time went into finding the fix, because there were no error messages, I was new to ECS and unable to use its debugging systems to figure out why the meshes wouldn’t render.

So after that first attempt, I switched to ChatGPT Plus and using multiple prompts. With this approach the “alpha” version of the terrain generation script didn’t take many minutes to create with ChatGPT Plus, as it was produced with the first 4 prompts (1 for template, 3 to implement the empty methods in the template). The whole dialogue can be viewed here:
https://github.com/ttakala/AI-Experiments/blob/main/GPT4_UnityTerrain/chat-gpt-unity-terrain-generation-with-ecs.md

At this point I only needed to fix the above-mentioned entity creation, which didn’t take long because now I knew exactly the 2-3 lines of code I had to change. So few minutes after the first prompt I was generating terrains that looked like this:

There are obvious issues here, but it didn’t take more than a few minutes to write two additional prompts, each asking for a different updated method, which would fix the placements of the trees and the grass/foliage, as well as make the water “mountains” into proper lakes with flood fill.

After those prompts there were still 2-3 bugs: the flood fill that I requested didn’t have proper end conditions etc., but these were quick to fix. My final prompt asked for more varied and better looking trees. At this point a total of maybe 30 minutes had passed.

Finally I wrote some vanity updates myself to make the trees look better and the terrain carving a bit more natural. I don’t remember how many minutes that took, because it was interspersed with many other tasks that took several hours to finish: I was simultaneously writing about my experience and generating maps the size of 512x512x64 (each took 10 minutes to generate).

3 Likes

Superb detailed respone @Tmtakala .
Many thx.

It is amassing way to utilise ChatGPT for generating soch code.

Briefly lurking through the git repo, it shows your deep understanding of the problem, you have aimed to solve.
Many technicalities expertise is involved here.
Well done.

1 Like