I’ve been working on a simple Minecraft-style procedural-world and user-building game using UE4. You might have seen it over in the Community Content forum, but now that I have a video I decided to post in WIP!
I’m releasing it under a BSD license (open source); the code and a build from last night are on GitHub:
What do you mean by “real voxels”? It stores a 3D grid of brick materials, which are technically voxels, but I am deliberately using the term “brick” to mean “voxels rendered as faceted cube” to distinguish it from the so-general-as-to-be-meaningless “voxel”.
I worked on ambient occlusion today. I got it working pretty well, but it needs some tweaking. The biggest problem is that since each brick can affect the ambient occlusion all the way to the bottom of the grid, changing a brick causes a hitch as it recreates the rendering data for a large number of bricks. There’s room to make that more efficient, as well as computing a tighter bounds for what needs to be updated.
I just trace straight down from the top of the grid, and mark all bricks above the first solid brick as having direct sky visibility (and those below, not). Then I apply a 5x5 box filter in the XY plane to that to get a fractional occlusion value. Finally, I turn it into a per-vertex value by averaging the occlusion of the 8 bricks adjacent to each vertex.
The code is here, but it’s poorly commented at the moment: /blob/master/Plugins/BrickGrid/Source/BrickGrid/Private/BrickAmbientOcclusion.cpp
I hacked LPV emissive to work last night, so my emissive bricks now light up the world:
However, the ambient occlusion value I use to prevent the sky ambient from affecting indoor areas also prevents those areas from being lit up by indirect and emissive lighting from the LPVs. I’m trying to figure out if there’s a good way to work around this, or if I just need to do an ambient occlusion style CPU-lighting hack.
This is pretty awesome stuff man, considering I didn’t think a game as dynamic as Minecraft could be done in the Unreal engine. Are you going to get chunk streaming in to do large, random worlds, or are you just messing around with the graphics side?
Hi @TheAgent, you can still access the source directory, and from there you can see that the file was slightly renamed: /blob/master/Plugins/BrickGrid/Source/BrickGrid/Private/BrickAmbientOcclusion.inl