Monday, May 20, 2013

Going off-grid

Here is a teaser of a series of screenshots and videos to come very soon:


This is not Minecraft on LSD.

Once you have a voxel system that is capable of representing surfaces in any direction and curvature, the real challenge becomes UI mechanics. Creating content has to be simple and rewarding. It has to feel like a game. You cannot expect players to pickup a manual or become experts in full voxel edition systems like Z-brush or 3D Coat.

But the potential is definitively there. Going off-grid allows for more interesting creations. If the system is intelligent enough to adapt to whatever is already there, you could be creating all sort of angled and curved content without busting any veins in your forehead.

What is even more interesting: there is no reason why you would limit this only to cubes. These elements you place could be anything: column disks, rocks, crystal shards, archways, statues. They could be even portions of stuff you or someone else has done before.

I'll leave it there for now. Hopefully you will be intrigued enough to come back later checking for more.

29 comments:

  1. You are as quick as Jet Li, as fast as Usain Bolt, as smart as Christopher Langan, and as narrative with your voice as Morgan Freeman. I appreciate your pursuit of intelligence, knowledge, wisdom, and the betterment of creative sandbox video games. Repetitive redundancy aside, you are awesome. At least... your brain is

    ReplyDelete
  2. Did you see Sauerbraten's level editor? Is it too non-gamey? I had a lot of fun building a big city with some internet folks.

    ReplyDelete
    Replies
    1. I watched a few YouTube videos about it, including their tutorial series. It works nicely as an editor but you still have to mind a lot of things.

      Delete
  3. Wow that looks amazing. Can this system also be used to randomly generate rocks / bolders on the terrain surface as well?

    ReplyDelete
    Replies
    1. Yes. You could be creating overhangs in no time with a brush that takes your cursor position and places a random block model with some random rotation added to it.

      Delete
  4. I really hope there would be a copy&paste tool otherwise creating (for example) a building with tens of identical arched windows would be a nightmare. Consider me intrigued, though.

    ReplyDelete
    Replies
    1. If you look closely there is a hint of that in the post: "They could be even portions of stuff you or someone else has done before."

      Delete
  5. :O, is Almost all corner possiblity possible?, also i really really hope you will include movable/rotateable/separate chunks for use as physics objects or just entitys for merging in other engines. Cause that would be like a GRB from the head.
    also, are you using some kind of CSG approach for the molding of the objects? in that case, what kind of shapes would you include?

    ReplyDelete
    Replies
    1. Every corner is indeed possible. The real limit is in the frequencies the voxel data can represent. With smaller voxels you can reconstruct higher frequency features.

      I did not get into physics yet. In theory the resulting volume may break or behave in a different way than how it was put together. For instance, someone may build an obelisk section after section. Once it is built it could break at different points than just the sections joints.

      I do not use CSG at all. This is voxel data, the identity of the object being imprinted into the voxel data is lost right after the imprinting is done. This is like a 2D bitmap... think of MS Paint for instance. You may draw a circle or a rectangle, but this is only a drawing tool to set the pixels. After the operation is done, the circle or rectangle is not remembered anymore, only the pixels remain.

      So it is more like a bush. You could use any closed 3D geometry for the things you imprint. You could not only add voxels, you could subtract them as well.

      Delete
    2. I meant it is more like a "brush"

      Delete
    3. thats great ;D, but how far can you push the "resolution" of the "bitmap", If lets say a octree leaf of 1x1x1m, how much would the smallest cell be?
      It must be alot of data just to make that cube sculpture on the picture, If the resolusion was low, that must have been massively scaled compared to the player.

      I really like the fact that you put in rotation in the brush. But as you said, 3d building is very complicated with how the player uses it. I'll try to give my input later. will do a powerpoint or something.

      Delete
    4. This is not scaled in any form compared to the player. The voxel size in this demo is 0.3 meters. With that size you can only reconstruct features that are 0.6 meters (see Nyquist frequency). Beyond that you will get aliasing.

      So you won't be doing a glass chandelier with this, but it is good enough for doorways, arches, larger windows, etc.

      Delete
    5. Do you have any plans for separate objects or something simular to be able to do smaller details?
      I can imagine how you can build cars and wheels and connect them to a rigid body physics system.
      It could be the greatest sandbox world.

      Delete
    6. Are your voxels always that `big`? I had the feeling that your buildings had much smaller features, with bricks showing details at the centimeter scale. I imagined that you were working with a very deep octree allowing millimeter-sized features, but that you collapsed it optimally, resulting in a coarse geometry when high frequencies weren't needed.

      Delete
    7. how do you actually achieve this clean meshing on these rotated brushes?
      Are you creating a new voxelset and applying the rotation matrix of the brush to that voxelset as it's identity matrix so you can still mesh it as if it were straight? or are you doing something way smarter?

      very interesting stuff indeed!!!

      Delete
  6. I bet most of us are always intrigued enough to come back next time, I come back daily! XD.

    ReplyDelete
  7. I wonder of it would be possible to include meta or material data on a per voxel level. I know you haven't started with physics yet but I feel the whole edeting in a game world requires that in a fundamental way. Maybe fundamental is a too strong word but at least it would be more intuitive and fun :).

    Because chopping down a tree could be made dynamicly depending on where your axe hits. Then processing the tree into planks could also be dynamic depending on the source tree. Then using physics you would have to place the planks in a correct structure or everything would collapse, and even include the use of nails.

    Maybe I'm totally crazy but I for one would find that a fun and intuitive way of moddefying the world.

    And then when the build process is over the and the simulation is solid the whole structure could be converted into a rigid body.

    Just thinking out loud, please don't ridicule me ;)

    ReplyDelete
    Replies
    1. Well I already have material and meta material information per voxel. The real problem is what to do with it.

      Computers are still very primitive on what they can achieve, they are essentially slow as snails. We need another 10 or 20 years of Moore's law before you can have fine grained voxel-based physics on desktop systems everywhere.

      What you describe is the holy grail of computing: an alternative reality (aka the Matrix). Since the time of PONG we have been trying to build it. Getting closer, but not really there yet...

      Delete
  8. I think you've provided the answer to this question earlier in your blog, but I can't find it at the moment, so I apologize in advance for the repetition:

    Since your cube-shaped 'brushes' in the posted image clearly aren't aligned with the underlying voxel grid structure, what method are you using to preserve such sharp edges? It seems like you must be making at least a 1st- if not 2nd- order numerical approximation of the surfaces defined by the voxel data, then extrapolating to determine in which grid cell the intersection edge occurs, if at all - but the implementation likely has to deal with a lot of complexities and subtletties. If you have any links to papers on the technique, I would be greatly appreciative!

    -Bryan

    ReplyDelete
    Replies
    1. It is called dual contouring. Here is the paper for it: http://www.frankpetterson.com/publications/dualcontour/dualcontour.pdf

      Delete
  9. Impressive Miguel, as always ...

    I've been trying to piece together bits of how you produced this incredible world and think i'm getting somewhere (its a lot to understand) am i right in understanding that you don't hold "model definitions" in voxel form? sort of like saying "this group of voxels represents a ..." I gather that you simply "select" from a database (in the loosest possible meaning of the word) the voxels in front of the camera at any given frame and build a mesh from them?

    Would this make animation a problem or have i misunderstood what I think your implementation is?

    ReplyDelete
    Replies
    1. Yes, it is something like that. It does not only get the voxels in front of the camera, also all the voxels around it. The reason why is you can turn your head very quickly, generating the required meshes is slower than that.

      Delete
    2. Yeh, the mesh detail looks quite high but looking at the samples given in GPU gems 3 I see that there is potential for a lot more and most of the common GFX cards these days will handle it no problem.

      I guess the real issue is when you want to alter that detail in some way (say by knocking down a wall), reproducing a changing mesh based purely on voxels could be a major problem if you hold no imformation on what represents a single entity like the wall.

      You say you have "metadata" associated with each voxel, i'm guessing this has to be kept very small or the performance would drop hugely due to ram excess but i'm wondering if there might be a simple way to say "this selection is a wall and when X happens run function Y to break it".

      I'm thinking it could be as simple as holding some form of "object id" on every voxel, then you can do object type bindings to say "when a wall is hit with a cannon ball do ...".

      I'm thinking this is likely something not beyond you Miguel :)

      Delete
    3. Interesting, this is getting into the question of destruction mechanics.

      What if there were a combined voxel and instance based system? I am not suggesting that there be polygon-based props, but rather the possibility of entities that have their own voxel grid. Then, the physics of each entity could be calculated into polygons that can be pushed into a physics engine. Then, wouldn't each 'shard' of the destroyed object be able to retain the same detail, while moving through space?

      Paul Ward, I am not sure that making such a changing mesh as you describe to model something like destruction would work in a purely voxel grid even if there were a way to track pieces as different groups of voxels. The only way to do that would be with cellular automaton rules, which are not known for their ability to simulate Newtonian physics.

      Perhaps cellular automata would have a place in modeling the beginning of the destruction where the cracking of the material occurs? Or by iterating through the mesh to determine where cracks form. Either way, it seems this would require some way to separate groups of voxels that are not physically connected, because of cracks between them, but are still in place.

      Delete
    4. Yes, I see a system where different groups of voxels can have their own reference frame for position, rotation, velocity etc.

      You can compute newtonian physics for these rigid bodies as whole entities. You could detect collisions between them, crack them into smaller pieces etc. This is not difficult in particular.

      The challenge I see is in simulating the forces that keep stuff together. For instance, imagine you have sculpted a large slab on top of a column. It is all the same homogeneous material, including the column.

      Now image you do a slant cut to this column. At this point you need to detect there is a new solid. You would need to know which voxels will be moved into this solid. This may take considerable time, it could be an entire castle sitting on top of the last column you cut.

      These are not intractable problems. At the same time any satisfactory solution will take some serious development and the hardware you will need to run it may be beyond the average you can find today.

      Delete
    5. Would the octrees help at this point?
      Any larger chunk of voxels whose represented area does not intersect the slice could be moved all at once, without processing individual voxels of that region. Any that do intersect, and the algorithm goes down the octree to the next level of detail. With this, the majority of the matter that needs to be moved would lie in one or two chunks that could just be swapped over to the new solid. As I see it, the only heavy lifting on the part of the hardware would be at or around the slice itself.

      I am not sure that I am using these terms correctly.

      Delete
    6. Yes, octrees would help a lot. Even with octrees you would need to search for solids or keep track of what is connected to what.

      Delete
  10. There was a neat feature in the latest Sim City (yeah the bad one) where you make a curved road and then the game shows you parallel curved lines that any new roads would snap to.

    Something similar could make it easy for people to use non standard shaped/oriented voxels.

    ReplyDelete
  11. Can you show us a wireframe version of this?

    ReplyDelete