Download

Voxel support and procedurally generated terrain

I reckon this has already been discussed a lot, but I felt like starting a new thread as I ran into several problems trying to create my own voxel terrain implementation.

There are engines like Cubiquity and VoxelFarm, but they require licenses costing 200-300$, while I don’t even know if I’m ever going to release a game at all.

That’s why I worked myself through several tutorials and tried different demos and even complete projects, but somehow all of them seemed rather impractical to work with…

First I tried following this tutorial series by Brandon Garvin. He uses the PolyVox library to create a Minecraft-like voxel world. The well made tutorial explains everything to the extent that an Unreal novice can at least reproduce it. However, it only shows you how you can use PolyVox to render a cube based terrain. PolyVox also allows smooth voxel terrain through the Marching Cube Algorithm, but the documentation of PolyVox itself is rather scarce, so this might not be the perfect solution.

I also took a look at this project, which is a pretty good implementation of a smooth voxel terrain. I managed to build it for my version and could take a look at his code, but I can’t really learn anything from it. Although he did a decent job with the project itself, there aren’t any comments to explain what’s going on. The only comments you find originate from libraries and code pieces he took from an unknown source.

What is interesting: both of these projects render the mesh at runtime. You cannot build a map and design it in the editor (which could be an important to some user). On this blog, Rune de Groot demonstrates what he created for his college projects. He also shows the editor plugin he created so you can manipulate your map like you would with a classic terrain… Sadly, he only has a demo game, and not a project. There is one link to something like “see how the voxel terrain is made”, but it’s outdated and only gives me an error. :confused:

In these tutorials on 0fps.net I learned some stuff about Marching Cubes and other algorithms, but my intellect doesn’t seem to suffice for implementing this in code. There are other interesting posts by Paul Bourke, who seems to be well-known for working on this subject. He even provided code pieces, but I am not quite sure where to put these or how to use them. Nvidia has a thread on that topic, but… well. In one of these I read that if you’re already able to render cube terrain, you can render smooth terrain in just a few simple steps… The only difference is that your voxels won’t only store a boolean (wether there is volume or not), but instead holds a float in order to move the vertices so you get a smoother mesh. Interesting, but then again, I don’t know how to implement that…

I then stumbled upon this very interesting video which shows an implementation of a voxel based terrain in Unity. I tried to rebuild this for Unreal… I don’t know if I lack the C++ skills to actually work that out (I am more a C# guy) or if Unreal just isn’t suited for voxel meshes. The first problem I encountered was the lack of a Perlin Noise function. I tried the Simplex Noise plugin by DevDad but only got build errors so I gave up on it. Then again, I’m not sure if there is anything like Unity’s “TerrainMeshGenerator” shown in the video. You basically just have to feed it a voxel data cloud and it drops you a mesh. I am not familiar with how the ProceduralMeshComponent (or Koderz’ RuntimeMeshComponent) works, maybe it really is just that easy…

I guess, with a good bit of work, I’d manage to build my own voxel system, BUT I personally think voxel games are somewhat essential nowadays, and I think there should be an ‘official’ Unreal Engine 4 system to support them. I mean, people who are familiar with C++ might come up with a solution themselves, but other who are bound to Blueprint or just can’t comprehend the background of all this (like me) get stuck.

I’m dreaming of an easy-to-use system that works a bit like the Terrain editor. You could either start a new voxel mesh and manipulate it in-editor (or during runtime), or you can choose to make it procedurally generated (Perlin noise, other functions). There would be the option to make it cube based (with a few parameters like cube size etc.) or smooth (Marching Cube or something similar). Creating ingame manipulation tools would be much easier (drills for smooth terrain like in SpaceEngineers, picks for cube terrain like in Minecraft, or other things)…

As I said, I’d probably manage to work with the stuff I listed in this thread, but it requires C++, so it’s not suited for everyone. The “We Succeed When You Succeed” principle is great, you’re doing a great job and I just love Unreal Engine 4 and all the support and assets that come with it, but I really think voxel based games make a huge portion of modern gaming and there really should be support for it!

Cheers!
Lord :wink:

TL;DR: pwease bring voxels to UE4!! :o

EDIT: As you can see, I really dealt with this subject some time, gathered some information… please don’t turn this into some pointless, unhelpfull bashing with comments like “this has been asked before” or whatnot. Let’s keep this a clean discussion, I only wanted to state my opinion on this…

Look up Landscape Architect here on the forums.

Looks great, but it’s not released yet…

We might see a release soon, but we also don’t know how much it would cost.

Comparing it to his dungeon architect plugin, we can estimate it to around 100 bucks?

Don’t get me wrong, I’m really not stingy or anything, I just really do think something like this should be part of the engine.

Polyvox does not include infinite terrain generation, so you will have to do that on your own if you plan to use that :stuck_out_tongue:
I’ve been working on a voxel survival game that supports mobile devices. In my project, the chunk actors only render the surface blocks; when the player seeks to mine underground, the chunk actor updates its surroundings and renders blocks around the player.
Using procedural meshes is the best solution( although pmc does not provide runtime collision cooking for mobile devices ). Unreal tefel has a tutorial series on youtube( note: his tutorials are not very understandable )

For what it’s worth — while it does cost money — Voxel Farm is actually a very competent toolset (much moreso than when it launched, and it’s improving rapidly now). And the UE4 plugin is pretty solid. It’s not perfect, but it is likely to be your best out-of-the-box solution.

I’m also looking for some in-engine voxel landscape generation. I see that Voxel Farm is really cool, but it seems to not have in-engine + random/infinite landscape generation - all the landscapes must be pre-defined inside the voxel studio app, and then they can only be imported and re-generated from the template inside UE… At least that’s what I saw from the Voxel Farm documentation for UE.
All the other voxel solutions seem abandoned (like Polyvox), so I can’t find any alternative. The UE Landscape Architect seems ‘silent’ either… Looks like there’s some kind of curse on voxel-generated terrain projects :smiley:

I am making a voxel plugin: https://forums.unrealengine.com/showthread.php?151940-Voxel-plugin-for-UE4
It’s far more basic than Voxel Farm or Landscape Architect, but it is free and open source, and supports runtime editing with blueprints.