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.
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!
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.
Make this cross platform - Windows yes, Linux likely, MacOSX Android etc. As long as UE handles the file access it should be ok.
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.
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
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.
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.