BrickGame

This is some really good stuff here. Well done again.

Greatly appreciate your work, I have been searching for this type of information since release and this is very useful to attempt to emulate and learn.
It is a bit more complex than just mesh.vertices and mesh.triangles as you would see in Unity and so it has been a slow start as a beginner.

I plan on taking similar approach using a circular array for a local density map. I plan for this since, unless I am mistaken, it seems useful for continuous terrain insertion/deletion and I believe I could assign LOD and other parameters to certain locations in the grid.

I hope that eventually we might see enough interest in the community to spur a procedural generation thread as useful as this one ( ://forum.unity3d/threads/63149-After-playing-minecraft )

Thanks for the kind words, everybody!

I’ve been tweaking fog/lighting. The LPV emissive only works if there’s an active directional light (the emissive tags along with shadow rendering), so I added a moon that takes over the directional light when the sun sets. I also nerded out a bit and rebuilt the time-of-day blueprint to track the orbit of the planet around the sun, and change the path of the sun through the sky based on season, made the moon light dependent on phase of the moon…

I also switched to ExponentialHeightFog from AtmosphereFog so that I could change the color to match the horizon color in the sky material:

I’m currently trying to figure out some problems with LPV performance when the sun is very low on the horizon.

It only draws chunks near the viewer so that the world can be much larger than what can be rendered, but it doesn’t do streaming to/from disk. That wouldn’t be much harder than the save game stuff I already did, but I’m not planning to do it for BrickGame; you can have a pretty huge world just in memory!

Yeah, the code was all there, but the inputs were just not hooked up in the shaders. I submitted a pull request, but Martin Mittring said he already fixed it in the next release: https://github/EpicGames/UnrealEngine/pull/57

You can go pretty far by just generating vertex and index buffers like CustomMeshComponent, so that’s a good way to experiment with procedural generation. However, the generality of CustomMeshComponent is leaving a lot of performance on the table, so you’ll be able to do substantially more bricks using a specialized solution like BrickRenderComponent.

I actually haven’t put enough effort into the procedural generation part of it. You can see the code here: /blob/master/Plugins/BrickTerrainGeneration/Source/BrickTerrainGeneration/Private/BrickTerrainGenerationLibrary.cpp

This is outstanding. Really beautiful, and I’ve always loved the micro detail one can add in minecraft. This is adding a new beautiful facade to all that. I hope that you put in lots and lots of textures so that users/players can really get creative with what they build.

mirror blocks and reflective metals would be nice, and water and lava “bricks” even better. Even fog producing bricks, to create atmosphere?

keeping my eye on this one. Well done!

Andrew, any plans to add marching cubes or dual contouring? I would love me some smooth landscape voxels.

I spent a lot of time on volumetric clouds:
v=rMqIZMjhh0k

There are some pretty mirror-y metallic blocks, but nothing that’s a perfect mirror. It’s limited by the screen-space reflections.

Water/lava would be cool, as would be glass, but I don’t support translucent bricks yet. That part’s easy, but it might be hard to get good lighting on translucent surfaces. It would also be a bit of work to make water/lava affect player movement, and flow like in Minecraft.

I’m not planning to do anything smooth, sorry! I’d be happy to write up what needs to be changed if you (or anybody else) wants to do it.

Those clouds are looking nice… I remember once I made a minecraft clone in unity but it didn’t work too well. :mad: Keep up the good work. :o

Here’s a build with the emissive bricks and the new sky (moon & clouds):
/releases/tag/v0.8

I was also able to push the draw distance out a bit by increasing the render chunk size. That was previously limited by the size of the regions, which was limited to what could be filled in with procedural terrain in a single frame. I optimized the terrain generation a bit, doubled the region size, and doubled the render chunk size.

This looks really awesome, thank you for sharing it.

Those new clouds look great man keep it up.

Looking really good. Now how bout a creeper? :slight_smile:

Amazing project btw. First noticed this game on Epic’s launcher. Would like to mess around with voxel (aka Bricks) one of these days. Will be in touch if I do eventually

Amazing work, thanks so much for sharing the source and your continued work on this. It really shows what is possible, I had initially worried things like this would be too problematic. I’m excited for this both as a “game” and as a plugin for future games.

Has anyone had a chance to check this out with the Oculus Rift? I’m still waiting for my DK2, but I have to imagine this would be excellent. The Minecraft Rift mod (Minecrift) is a current favorite amongst the released the demos.

Andrew, would it be a lot of work to allow editing the voxel world inside the UE Editor?

Those clouds are great how did you do them?

I don’t have a Oculus Rift, though I have ordered a DK2. I’ll have to tune some stuff (optimize the clouds, reduce the draw distance, and maybe shadow resolution or LPVs) to get the framerate high enough for VR.

Most of the effort would be in creating new editor tools to edit voxels. Are you thinking of something that works in conjunction with procedurally generated voxels, or an entirely authored world?

It’s all done in a material function called from the sky material and a light function applied to the main directional light. The material function, given a ray start point and direction, intersects it with four layers of a panning 3D noise function (I just use the fast gradient noise node). For the sky material, the ray start point and direction are the ray from the camera through the pixel being rendered, and in the light function the ray is from the point being lit toward the light.

The sky material also samples a second shadow ray, from the bottom of the cloud toward the directional light. That gives a shadowing factor, and the lighting is otherwise independent of direction. The sky’s horizon and zenith colors are also added as ambient lighting based on the opacity of the view ray.

A neat trick it does is using the DitherTemporalAA node. This allows it to jitter the sample planes per-pixel and frame. This is the same kind of trick used by the screen-space reflections to exploit temporal coherence to increase the number of apparent samples. It adds noise to the output for any individual frame, but the temporal AA blends together multiple frames to reduce the noise.

It’s an expensive shader, mostly because of the noise nodes. If I have time to optimize, I think the noise nodes could be replaced by texture lookups.

Great work!

But a lil question: (sorry for my bad english)
I download the Version from GitHub, Compile with Visual Studio and open it with U4 … then i become a error that the map is created with a newer version then my U4 is … where i can download U4.1?

You have to build UE4.1 from source right now, though I think Epic will release binaries soon. Additionally, to make the glowing bricks work I had to make some small changes to the UE4.1 source, so it’ll work best if you use this branch of the UE4.1 preview with BrickGame:
https://github/AndrewScheidecker/UnrealEngine/tree/LightPropagationVolumeAmbientOcclusionHack

It should mostly work with the unmodified UE4.1 engine binaries when they’re released (assuming Epic’s LPV emissive fix is in the final 4.1 build). However, there’s still a hack I made to the engine code required for the glowing bricks to illuminate caves and interiors, and I’m not sure I can generalize it to something that’s worth submitting a pull request for: https://github/AndrewScheidecker/UnrealEngine/commit/612d8860366771c3c235a677ade9c5eb02a5c795

The hack just makes the light propagation volumes ignore the ambient occlusion value written out by materials, and I think most games do NOT want to do that.

Thanks for the reply! Nice to hear you have a DK2 on the way as well. UE4 seems to be a bit of a heavy load in general at the moment, but the potential is there to scale quite well.

Hopefully in the coming months between optimizations to UE4 itself, to the Oculus SDK (Time Warp, etc), and to the demos being made by developers - we’ll start seeing a nice sweet spot of performance and quality emerge from the turbulence. A great deal of Unity devs are migrating over thanks to Epic’s amazing price compared to Unity Pro - so I’m sure they’ll be plenty of continued interest.

Looking forward to one day loading this up in the Rift and going exploring.

Question - Is there Biome support in your plugin?

Just curious