Monday, January 23, 2017

Boxes to Voxels to Boxes

MagicaVoxel is an incredibly fun and popular voxel editor. It allows you to recreate that pristine volumetric 8bit look that never was, but we all remember so fondly. We are often questioned whether we could support that kind of look in Voxel Farm scenes, so the team quickly wrote an importer for MagicaVoxel models:


The following video shows the experience, from importing MagicaVoxel models to running a full environment inside Unreal Engine 4:


As you can see from the video, once we began importing these models into the scenes, we figured out it would be nice if the entire world was blocky too. This was now outside MagicaVoxel's realm, but it turned out quite simple to switch off the smooth surfaces in Voxel Farm and make it all look blocky.

A very interesting turn was how to handle the LOD. As I was posting work-in-progress images of this on Twitter I got some interesting feedback. Jens Blomquist, who wrote Blockscape, mentioned he chose not to use LODs in his block game since the larger blocks in the distance produced confusing distance cues. What he meant can be clearly seen in the following image:


Here the boxes in area A should be smaller than boxes in area B.

Paniq (Leonard Ritter) suggested an interesting experiment: What if we used smooth surfaces for distant LODs but keep blocks for near range? It did not turn out well, but it was worth a try:


I found another illusion-based trick that did introduce some improvements: Decrease LOD near player (+2), increase LOD (-2) for buildings, leave far away LOD unchanged (+0). Thanks to the adaptive scene density, the architecture did not need to be degraded so it could remain at the best LOD possible as well:


Then I realized all these were solutions to a problem we should not have in the first place. We were equating voxels to boxes and that was wrong. Instead, we should be using the variable-sized voxels to encode constant-sized boxes. Unfortunately, I did not get to test that theory because lunch was served. When I was done it was time to go back to non-boxy things. Maybe some day in the near future...

7 comments:

  1. Makes one wonder how well would an imported Minecraft world run.

    ReplyDelete
    Replies
    1. Yes, we should definitively give it a try.

      Delete
    2. An anvil world format importer might be a lot of work, but it would also be great PR if a world like this one http://i.imgur.com/i9WlZwc.jpg was displayed in real time and posted to /r/minecraft for example.

      Delete
    3. Anvil does not seem very complicated. There is also a C++ MIT-license library that may do the heavy lifting.

      It is tempting, but not sure if there is really a point in doing this. After the import it will look like Minecraft anyway (minus lights and other special blocks), why just not stay in Minecraft? Maybe build in Mincraft, then make a game in UE4 or Unity with that content...?

      Delete
    4. Why not stay in Minecraft? I see two main reasons:

      1) a filter can be applied to reimagine the world, for example smoothing the terrain or wrapping everything around a large sphere / torus / cube

      2) Minecraft never got LoD chunks, so it would be the only way to see far beyond 200m

      The amount of content created in Minecraft could surely be leveraged.

      Instagram is relying on egocentrism and simple filters. Would kids pay for an app that lets them apply simple filters to their worlds and show them off? Or use a minecraft world as an input for something like Worms 3D.

      Delete
    5. I see your points. I'm reading chunks from the King's Landing map already into Voxel Studio. Let's see how this goes, thanks for the suggestion! :)

      Delete
    6. It is mostly done now: https://twitter.com/miguelcepero/status/828854201308569600

      I'll write a post about this, there were a couple of interesting things about the import...

      Delete