Thursday, March 23, 2017

Destroy The Block

"Destroy The Block" is a new demo we put together to showcase the new Unreal Engine 4 plugin. In this post, I will go over what this took.

The demo will soon be included in Voxel Farm's demo package, meanwhile here is a video:



If 20 min of that was not enough, here is an earlier video of just driving around town in different cars:



We did not create this town model. It was a Minecraft import. Following a comment in this blog by Piotr Kucharczyk, I took a look at Minecraft's Anvil format. It turned out to be quite reasonable and easy to use. 

After a few hours of work, I was able to see Minecraft levels in Voxel Studio. I started with the King's Landing model, I was curious if our systems would be OK with such a complex model. It turned out to be alright:


This model was not a good option for several reasons, mainly it was too crowded for any first person gameplay to happen. Maybe riding a voxel dragon and setting the city on fire, but that would be too obvious.

So we settled on the town level. The natural environment, which is not blocky but rather smooth, was created with a single Smart Biome in Voxel Studio in a few minutes:


We then imported this project into Unreal Engine 4, using the new Voxel Farm plugin. It took some time to figure out what would be the right scale for the scene. Since Voxel Farm's voxels are much smaller, the default configuration felt closer to a Godzilla/Kaiju simulator. That would have been a nice demo, but I was looking for a more human-level experience.

Minecraft levels may appear simple in the mind's eye, but a level like this town is insanely complex. All buildings, without exception, have intricate interiors. Here you can see a cross section of a residential tower:


As you can see each apartment is fully defined, they even have little beds!

To further complicate things, the draw distance needed to be insanely high so detail like windows would appear when from viewed far away:


This tall building is 1.5 Km away, but it is still rendered in full detail. The player can use the sniper scope at any time, and the switch must be immediate. There is not enough time to load a higher definition of the building.

Mesh optimization really helped here. Any surface that contains multiple voxels of the same material can be heavily optimized. The following image shows how this makes a big difference in triangle counts:


I do not think vanilla Minecraft does this. Just thinking about how many triangles they need to push gave me a new sense of respect for their rendering engine.

The main goal of this demo was to tune the UE4 plugin and in particular the physics. We also spent some effort making sure the whole scene, including terrain, would load in 10 seconds or so. The demo's behavior and interaction with the Voxel Farm plugin were done using UE's blueprints. There is not a single line of C++ in this project. 

I can say the demo is quite fun. My girls have spent countless hours just driving around and destroying stuff. At the beginning, they were quite afraid of breaking anything, as if the police would come after them. Once they realized there were no consequences, they were able to fully unleash their destructive instincts.

One last thing I would like to point out in these videos is what you cannot see: LOD changes and framerate hitches. This is achieved thanks to our new scene management system, which I began to cover here and here (third and final part of this series coming next).

The Minecraft import should become a standard Voxel Farm feature soon, also depending on the interest we see around it. If you would like to do the same for one of your projects, just let us know.

It was great that this entire exercise was triggered by a reader's comment to another post. As usual, I look forward to your comments and feedback.

18 comments:

  1. Very impressive, Minecraft itself has a lot of difficulty rendering such distances! Or is that more because it's doing other things?

    ReplyDelete
    Replies
    1. Minecraft does other things, at the same time their shading is much simpler. For instance, this demo uses max quality settings in lights, the same scene is rendered many times from the light's point of view to create each cascade in the shadow map.

      I think it boils down to the triangle count. Minecraft can have a simplified lighting model because it uses its dense geometry to pin light information to vertices. The mesh simplification we do ignores lighting since no light information is baked into the geometry.

      Delete
    2. Also I am not sure if Minecraft is doing occlusion culling. This is something that makes a big difference in this demo.

      Delete
    3. https://tomcc.github.io/2014/08/31/visibility-2.html

      This is the kind of occlusion culling that minecraft uses.

      Delete
  2. Just thought I would register my interest for Minecraft Import for Voxel Farm.

    Got a question - Can we Isolate Objects (Buildings for example) and place them in the world in Voxel Studio?

    ReplyDelete
    Replies
    1. The importer currently loads the entire Minecraft level. Once you have this, you can select any portion of it (a building for instance) and copy-paste it to a file or to a blank Voxel Studio project in any location you want. Would that work for you?

      Delete
    2. That would work perfectly :)

      Delete
  3. Whoa! Fantastic stuff. Mentioned this at the time for Landmark as I'm sure it'd have been a fantastic lure for people to import their MC constructions into Landmark to place monsters/smooth things out. Got there in the end and looks like was worth the wait.

    ReplyDelete
  4. Sometimes I see some strange things in gravity, like object is falling and hangs in air, not on the ground

    ReplyDelete
    Replies
    1. This is because the physics collisions to some of these models is set to a simple box. This can leave gaps between the visual representation of these objects.

      Delete
  5. 8:08 - first video

    ReplyDelete
  6. Any plans on replicating this demo scene for unity? There's a lot of interesting stuff happening in here, a surprising amount of fun too I found it hard not to be distracted by making tunnels with the gun.

    ReplyDelete
    Replies
    1. Yes the demo is quite fun. We do not have plans to remake it in Unity at the moment, although all the pieces required for it are already in place. With the next update, Unity will have higher feature support than UE4, since we just moved it to texture arrays and implemented full PBR texture support.

      Delete
  7. i would like to see it refined enough that you get true bullet holes in walls much like rainbow six siege and different materials behaved differently to forces applied to them

    ReplyDelete
  8. when will this be available in the demos?

    ReplyDelete
    Replies
    1. This is available in the demos since mid April 2017: http://www.voxelfarm.com/demos.html

      Delete
  9. WesterosCraft would greatly benefit of using this plugin.

    How can we contact you for licencing? Of course, Minecraft support is a must-have.

    ReplyDelete
    Replies
    1. You can email me directly: miguel at voxelfarm.com

      Alternatively, you can drop us a line using the contact form in the Voxel Farm website:

      http://www.voxelfarm.com/contact-us.html

      Delete