Tuesday, January 19, 2016

Riding voxels into the sunset

For creative sandboxes, one recurrent favorite topic is starships, airships and ships in general. It would be very cool if you could actually fly or sail them and, while you do so, continue to build and destroy them.

The clipmap system currently in Voxel Farm sees the entire world as a single monolithic entity. While fragments may be detached from the voxel world, they are kept as meshes and optionally voxelized back into the world when they stop moving.

We are working on a new system that breaks the scene in not only one clipmap, but as many clipmaps as necessary. Here is a video showing the basics of how this works:



The video uses spheres for simplicity. The key here is that each sphere is an object that lives in a different clipmap.

Just like with a single clipmap, portions closer to the camera will get greater resolution, but very unlike the single clipmap, these entities now can be moved around and placed at any arbitrary position, scale or rotation.

Even if the camera is not moving, a given entity may be moving respective to the camera. If the entity approaches it will get higher resolution representation.

I look forward to building a castle, lifting it with massive zeppelin-like devices and exploring the world while comfortably sitting next to a fireplace. Pretty much like Pixar's Up, but with siege weapons.

25 comments:

  1. Yay, 3d space, I know lots of people must have been bugging you about moving toward generating planets.

    I would be interested to see what sort of difference adjusting clipmap distances based on velocity makes on processing requirements as well as smoothing out the detail generation/lod phasing.

    ReplyDelete
    Replies
    1. Yes, also note you can have very different settings for these clipmaps. For instance a castle could be a different entity than the terrain (Earth). You could have the terrain clipmap run at much lower resolution than the castle.

      Delete
    2. Oh that's cool! So objects like trees/chairs/etc can all maintain higher mesh densities at further distances. It has the potential for adding a ton of computing resources say if your whole screen was populated with high density models... but at least it allows for that possibility.

      Delete
  2. Hi there. So, i saw the combination of letters "map" and it brings me up these only question.

    Most of the engines fails in "large maps", since the physical laws start to... how to put it?... "crumble"... god i love that word XD..
    There are lots of techniques available, but most of then seems to just get out of the hurry. And most of this techniques are useless if we think about more than one actor on this world. So even if some say "procedural generation".. at some point they admit (whispering) that only for 2 square km. Most of the problems for me seems to be because of the coordinate system they use...

    So, how Voxel Farm deals with the physics on this aspect?

    ReplyDelete
    Replies
    1. Before answering your question, my pet peeve with procedural generation: There is nothing wrong with only 2km^2 of procgen if it is properly done, that is, high entropy and information density. I would take that before entire galaxies of repetitive content. The quality of a procedural generator is not tied to the size of the content, but yes, sometimes we need very large spaces.

      Like you said dealing with massive spaces and allowing the camera to move seamlessly is a problem with traditional engines. You do not have to leave Planet Earth to hit this kind of problem. GPUs work with 32bit floats, this is something we cannot get around. The trick is to make everything relative to the viewer. In Voxel Farm this is possible because we can choose any node in the world octree to be the frame of reference. Once in this frame of reference you can have really large draw distances using 32bit floats. Then there are tricks to render even farther objects. Very distant stars are visible to the naked eye, but you still do not want a single draw call for every star in the sky. An option here is to use "detail recovery" which projects multiple, complex objects into a single object you can render very quickly. In this example the very distant night sky can be projected into a sphere, a skymap around the viewer.

      Delete
    2. Shure, "bigger" not always means "better". And i wasn't in favor of that either, i was just saying that physics seems to crumble and i could not understand why many engines fails at this (not that it is not possible to fail, but the numbers of fails). But make everything relative to the viewer what effect have on the world itself? (leaving aside rendering.. im not such fun of that subject). Some years back i propose the idea of make everything relative to the speed of the actions (keeping it on simple terms). Of course the objective of this was entirely different... I was trying to use it for some UAV response generation of control. But i suppose (mostly wondering) it could do the trick

      Delete
    3. "Make everything relative to the speed of the actions", that is very interesting. Where did you propose it, can you drop a link?

      Delete
  3. I'm sure you know about Space Engine. I was thinking about whether you could recreate or gloss some of its algorithms for generating accurate planet geology based on planet type, at least starting with terrestrial-type planets. Its planets look pretty good from orbit. Of course it doesn't hold water to VF up close, but it has the gross features down.

    ReplyDelete
    Replies
    1. Yes I love Space Engine. I am not sure which algorithms they use, I haven't really look it up. It seems to be local evaluation for the most part, which is not very interesting to me as a research topic.

      I do not think the current hardware generation can do planets that look real both in close and far range. The far range has been done a lot but it is mostly a set of hacks that break down as you get close. Because of the sizes and speeds involved you cannot do any interesting generation like rivers, lakes, weathering, etc.

      Space Engine does well the low entropy systems (like a star) but does not really address the entropy issue which would be the really interesting bit for me.

      Delete
    2. Well the Outerra planetary procedural terrain generation engine seems really capable of rendering landscapes that appear close to real in both scales. They have yet to incorporate a dynamic water system that allows for rivers which follow the terrain, but they are working on it.

      www.outerra.com

      Delete
    3. Rendering yes, I do not think rendering is a problem. But we are talking generation. For Outerra you need to feed an elevation map to the engine for your planet. Outerra will not generate planets in real time for you. They have some procedural detail added to the user-made low-res elevation maps, but that's it. It is a smart approach, thanks to not using procedural generation for terrain features they get to look quite good.

      Delete
  4. The "Heaven" VR experience is getting closer and closer. Angles, golden harps and you building castles in the clouds.

    btw, have you tested Voxel Farm in VR? Can it produce a stable 90fps? Can you trade voxel density for fps?

    ReplyDelete
    Replies
    1. Stable 90fps not a problem for the engine if you have the hardware specs. Our triangle counts are very low, very much similar to what you would find in static games.

      Yes it is always possible to trade density for fps. With this new approach you can have different densities for different objects, which helps greatly.

      We also have a new job scheduling system here. I have not blogged about this because it is not a sexy topic for most. Thanks to this the generation and voxel to mesh conversion happen much more smoothly now.

      Delete
    2. A job scheduling system is not a sexy topic for most people, but it is a sexy topic for people reading this blog.

      Delete
    3. Awe, it may lack visual appeal, but I think a post on how things are prioritized would be cool!

      Delete
    4. +1 for a post about the scheduling!

      Delete
    5. Couldn't agree more!! I'm just getting to the point in my own planet renderer / generator where I'm needing to implement some kind of LRU cache for terrain patches, so the subject is quite timely for me :) Looking forward to seeing how the master works his magic!

      Delete
  5. Sounds like your working on an engine for a solid Space Engineers competitor. :D

    https://www.youtube.com/watch?v=2FRu9p-3Ois

    Did you yet try to dig through a sphere that moves and rotates? I also wonder how much voxel data that would create on an earth sized planet.

    ReplyDelete
    Replies
    1. Hmmm, I saw no moving voxels in that video.

      In SE vehicles and ships are not voxel-based, it is more like a prefab assembly system. Everything looks pretty much the same for this reason. If you look at the ships built in Landmark by different players you'd see there is little connection to SE. This is what I'm interested in seeing, which I believe has not been done yet.

      Digging on a rotating Earth creates the same amount of voxel data than digging on a small flat static plane.

      Delete
    2. That's why I was asking. The VRage engine from SE can only handle static voxels as of now, so seeing you modify it while it moves would be an achievement.
      Have you coded some simple thrusters and tried to build a ship like in SE actually? The post makes it sound like this would be on your agenda. I really would like to see this in action.

      The same would go for your dynamic water I've seen in one video just earlier. That's probably more a physics challenge than a pure voxel challenge, but still would be interesting on a moving planet/grid.

      Yes, your engine in Landmark is the main reason I'm here. :D Sad that the game puffed up into well-wishes. I really hope someone else takes your engine and makes a Minecraft with it.

      Even if the planet doesn't move, digging 6371000m deep should create *some* MB of data, but you're right the rotation really only makes it harder to dig, not to store (Coriolis Force).

      Delete
  6. This would be very cool. I'm imagining an isometric 3d physics puzzle/basebuilding tactical strategy game which would be a mix of Clonk Rage/Lemmings/Commandos/Settlers 7/Medieval engineers.

    It would feature physics puzzle solving (Clonk/Lemmings), terrain modification (Medieval Engineers/Clonk), tactical combat (Commandos), basebuilding (Clonk/Medieval Engineers), economic management (Clonk/Settlers) and missions and objectives to pursue and accomplish (Clonk/Commandos), .

    I like the layered terrain of Settlers and it would be great if it were combined with dynamic terrain modification of Medieval Engineers or Castle Story, the RTS/Castle Builder, which allows for transparent terrain and structures

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. Hey, nice video. Just a quick inquiry, is it available in the engine right now or not? I would love to try it out as I'm willing to make a small space game with planets (already have indie package)!

    ReplyDelete
    Replies
    1. Thanks! This tech is not available, this is the next gen for Voxel Farm (version 3).

      While not to this level, you can do planets with V2 INDIE, please email support at voxelfarm.com so we can figure it out together.

      Delete