Marching Cubes Terrain/objects

I have been working on a port of PolyVoxto UE4 for a while and have had some pretty good results so far.

It took me awhile to figure out UE4’s geometry setup and stuff like collision but thanks to Rama I think what I have so far is pretty good.
I have a custom Tri-Planar shader that paints the terrain so that texture stretching is at a minimum.
It supports collision , only in the editor sim right now, and receives and casts shadows.
Each voxel object is rendered in chunks and only renders the 32 X 32 X 32 chunk that is in the view.
For terrain voxels the chunks are generated from a height map created from a noise library that is generated at run time from a seed value that can be generated by hashing any text string into a 32bit integer. In other words extremely complex terrain with rolling hills , mountain ranges , caves and lakes can be generated and replicated on all multiplayer connected clients simply by sending the seed text such as “cat”. All connected clients once the receive the seed text it will generate and exact copy of the terrain to play on.

Here is a short video I made a little while ago.

Just thought I would share this and see what peoples thoughts were.

Nice to see you post here, was following your progress earlier.

There’s a LOT of potential here.

For a persistent saved level, do you have a good way of saving/transmitting the modifications being made including multiplayer?

Personally I still like to have artist control with World Machine or GeoControl , at least when it comes to my mountains and certain features. I’d probably mix the methods unless there’s a way to make use of user-generated heightmaps as “stamps”, kind of like decals.

Looking forward to seeing updates! Lots of talented people here willing to answer questions, including Epic Devs, so don’t hesitate!

Do want!

Just thought I Would post a few more things from what I Would like to see from this plugin. If you plan on releasing it. :slight_smile:

  1. Customize-able Biomes - Allow us to make custom Biomes and inject them into this Plugin at runtime with blueprints or code (Preferably both).
  2. Optional Destructible terrain - Not everyone wants destructible / Deforming terrain. Make this optional via a tick box or something.
  3. Make this cross platform - Windows, MacOSX, Linux, Android, etc.
  4. Infinite Terrain - Infinite terrain in all directions.

I would pay for a Windows, Linux, and Android version of this plugin with full source code access.

Anyway I look forward in seeing what you come up with,

HeadClot

Saving/Transmitting changes.
Saving and loading data is pretty straight forward and easy.
Transmitting changes is just as easy.
The only complex part is sending data for a given chunk that is different from the precomputed noise data. This involves having a variable to track how many times a given chunk has been change from the time it was precomputed. Then when other clients connect to the server and start loading the level the start processing each chunk and send a request to the server saying it is about to load chunk X with a “timestamp” of Y, if the server find that chunk X’s timestamp matches the client then nothing changes. If the server finds a difference it sends the correct data along with the correct timestamp for X and when the client receives the data it updates the chunk data and timestamp and re-generates the chunk as needed.

As for loading something from World Machine or GeoControl this is not a problem.
As for the “stamps” idea , this is also doable. You could easily blend this to the noise data to make it look natural.

  1. Customize-able Biomes - Not a problem to do.
  2. Optional Destructible terrain - Already built in.
  3. Make this cross platform - Windows yes, Linux likely, MacOSX Android etc. As long as UE handles the file access it should be ok.
  4. Infinite Terrain - Built in. Only problem there is floating point precision.

Right now I am at a stop on this till Epic decides to do something about runtime collision.
I see it is on there roadmap but I can’t make assumption about when or what Epic will do.

I have a lot fleshed out but because the engine is being updated so frequently I have to wait till the runtime collision is address before I can commit more time to this project.
What I have is based on 4.2.

Update to 4.4 they have allot of awesome new features now including support for large worlds as of 4.3 via world compositor. I am pretty sure that you would be able to call world compositor via Code.

Also this will be of interest to you. :slight_smile:

EDIT:

Also - Would it be possible to Make planets in the way that I have described here?

I recently sent off an email to the guys over at Voxelfarm about potentially attempting to port it to UE4, but I haven’t heard back yet. But this looks promising! Keep it up :smiley:

I did the same a few days back asking if they were going to port it. No response.

I used the Procedural Mesh Generation tutorial as a basis for my voxel code. The Problem is that UE wants all the collision data “cooked” before runtime. There is a work around that allows you to do it at runtime with an editor build. As far as I can tell in 4.4 it still won’t let you do it in a release build.
Epic has it on there roadmap to allow runtime cooking and is marked as August for release so maybe 4.5?

As for your Planetary terrain plugin compatible with world composition tools Request.
This might be informative.

The Voxelfarm tech has been incorporated into EverQuest Next so I doubt it would be ported to UE.

That is awesome - Not the problems you are facing with Unreal. But the Planetary Terrain thing. Is there any chance of porting it over to Unreal?

Also - If you want to see a feature added to the engine sooner vote for it on Trello. But I am sure that you know that. :slight_smile:

Lastly can you link me to this feature that you need on Trello? I want to vote for it if I have not already.

Also - What platforms does this planetary terrain work? Just curious :slight_smile:

  • HeadClot

If it’s not a huge amount of effort, would be cool to see if you can voxelize the landscape demo and fix that blocked tunnel. Might make a good showcase.