Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Introducing Voxelform - voxel terrain (Marching Cubes) with real-time deformation.

Discussion in 'Assets and Asset Store' started by Mark-Davis, Jun 24, 2011.

  1. McDev02

    McDev02

    Joined:
    Nov 22, 2010
    Posts:
    664
    Very cool. Thats how i imagined Minecraft :)
    I´ll watch your progress.
     
  2. Mark-Davis

    Mark-Davis

    Joined:
    Jun 21, 2011
    Posts:
    156
    @EyecyArt - Thanks! :) Please feel free to ask if you have any questions.
     
  3. Rush-Rage-Games

    Rush-Rage-Games

    Joined:
    Sep 9, 2010
    Posts:
    1,997
    Man, to bad the frame rate is so bad on my computer!
     
  4. Mark-Davis

    Mark-Davis

    Joined:
    Jun 21, 2011
    Posts:
    156
    @Rush-Rage-Games - I'm hoping to optimize things further. At the moment though, the fill-rate (related to the shaders) appears to be the bottleneck on lower-end GPUs. When I have a chance, I'll kick out some more demos with lighter-weight shaders, that should run plenty fast on any SM3 GPU.

    @All - A few days ago, I posted an issue regarding a Unity Pro requirement for the editor. I don't want to say too much more until additional progress is made, but I may have a workaround for that. Support for Unity Free users is very important to me. Thanks.
     
  5. remix

    remix

    Joined:
    Dec 11, 2009
    Posts:
    61
    One question again : How do you manage to have no visible seams in the normals between your chunks ? For my own I merge all the chunks meshes with Mesh.Combine, but it doesn't merge vertices and normals on the edges of the chunks, so event if the vertices are exactly at the same position, since the normals are different the seams are visible due to the triplanar shader I use (based on normal orientation).
    What's your secret ? :D
     
  6. DayyanSisson

    DayyanSisson

    Joined:
    Aug 4, 2011
    Posts:
    623
    fast, but on my macbook pro, the mouse sensitivity was way too high
     
  7. Mark-Davis

    Mark-Davis

    Joined:
    Jun 21, 2011
    Posts:
    156
    @ReMix - Been there :) Try computing the normals from the volume data. There's not much more I can say without posting code worth many hours of R&D time.

    @nighthawx349 - Thanks - I wondered about that... but you're the first to mention it. I crank up the sensitivity for just about any game, so perhaps I'm not the best judge of that for the average joe. Suppose it might be time for settings menu in future demos.
     
  8. MoyaGames

    MoyaGames

    Joined:
    May 23, 2011
    Posts:
    86
    will this be for the editor? because the demo shows in game. i hope it is for the editor i would like to buy this
     
  9. Mark-Davis

    Mark-Davis

    Joined:
    Jun 21, 2011
    Posts:
    156
    @MoyaGames - Progress is being made on an editor built with Unity, but it will sit stand-alone (like Maya or Max) due to certain restrictions an editor extension would place on the product. It's possible to do an editor extension, but only for Pro users. I think most people will feel comfortable with this though, and updates should appear in Unity as soon a map is saved, so it should feel pretty natural.
     
  10. houndie

    houndie

    Joined:
    Nov 25, 2010
    Posts:
    146
    Will you be created the Editor Extension for Pro users? I'd really like to see that ability inside the Unity editor as opposed to a stand alone. But if not thats cool :)
     
  11. Mark-Davis

    Mark-Davis

    Joined:
    Jun 21, 2011
    Posts:
    156
    @Houndie - I'd like to make that a future plan.

    @All - Due to a heavy workload in other areas of life, the next release is going to take longer than expected, but progress is being made. Update on multi-material support... it's finally working in an organic way that I really like. Hopefully this will make everyone's day when the next release is finally out! :) There's too much code refactoring to include it in a small release, but I'll get it out to you as soon as possible. Thanks for the continuing interest everyone.
     
  12. Mark-Davis

    Mark-Davis

    Joined:
    Jun 21, 2011
    Posts:
    156
  13. imump

    imump

    Joined:
    Jul 3, 2011
    Posts:
    55
    Just curious Mark,

    I already have my terrain heightmap done have modeled a "mine" for resources to be had, now I was thinking if I can just put Voxelform into my terrain where the mine was for a truer mining experience?

    If that still isnt clear can I "Voxelform" a cube for instance and only have that cube be voxel based?
     
  14. Mark-Davis

    Mark-Davis

    Joined:
    Jun 21, 2011
    Posts:
    156
    @iMump - Definitely! You can bring Voxelform into any existing Unity environment, and use it for a specific item/area of interest. If you had a portal of some type in your terrain that took you into a Voxelform based mine, it would work as you'd expect... or even just a cube hanging out in the world... note, that would be a slightly beveled/organic cube. The usual disclaimer here is that Voxelform is very much a scripting package, and you'll need to be comfortable with the bit of custom scripting you'd need to perform in order to hook it up at run-time for your unique situation.
     
  15. houndie

    houndie

    Joined:
    Nov 25, 2010
    Posts:
    146
    This post just made me purchase your tool. You may not have it in the editor yet and I look forward to having it added, but the fact that I can add an area to my world with this ability = immediate purchase!!
     
  16. Mark-Davis

    Mark-Davis

    Joined:
    Jun 21, 2011
    Posts:
    156
    Thanks so much Houndie! Please let me know if you have any questions, including run-time integration, and I'll do my best to help. :)
     
  17. Mark-Davis

    Mark-Davis

    Joined:
    Jun 21, 2011
    Posts:
    156

    Hi All - Here's a very rough demo of the new (unreleased) multi-material support in the next version.
    I recommend playing with material keys: 1,2,3,4, and building... you can paint and dig too, and the materials will update accordingly.
    Note: Wheel adjusts cursor size.
     
    Last edited: Aug 26, 2011
  18. gordonramp

    gordonramp

    Joined:
    Sep 28, 2010
    Posts:
    53
    Interesting. Hard to tell a lot without collision. If you paint, will the map be able to be saved and then reloaded at a later date?
     
  19. Mark-Davis

    Mark-Davis

    Joined:
    Jun 21, 2011
    Posts:
    156
    @gordonramp - Yeah - this is just a very rough tech demo... just wanted to toss it out there for conversational purposes... I'd like everyone to know what I really mean when I say "decent" multi-material support is coming.

    One thing some folks with lower-end machines might notice with this demo... you should experience some faster frame rates with latest shaders in this demo. You'll need to let the map finish loading into view before making an accurate fps measurement, but I was able to hit a solid 16-18fps on my nearly 3 year old iMac in the web player which is always slower than a stand-alone app.

    Also of note... this "multi-material" support means any Unity material with an ability to work volumetrically. So you'll be able to create new materials in Unity, assign them to a material palette for a particular Voxelform terrain, and have at it. Currently the magic number is 256 materials. Chunks intelligently map to just the materials they require at a given point in time, and it just works.
     
  20. angel_m

    angel_m

    Joined:
    Nov 4, 2005
    Posts:
    1,160
    I get 39-43 FPS in the last demo but in a 2.2 Dual Core, 4 Gb Ram and Geforce 285 GTX - 1Gb Ram, Windows XP Pro.
    Good progress but I am afraid it is not enough for using in a full real game. I hope when using in a static terrain (with the future editor) the system (Voxelform) will be faster and more optimized.
     
    Last edited: Aug 26, 2011
  21. Rush-Rage-Games

    Rush-Rage-Games

    Joined:
    Sep 9, 2010
    Posts:
    1,997
    Really fun, and I got a much better frame rate!
     
  22. kondrup

    kondrup

    Joined:
    Apr 23, 2009
    Posts:
    205
    Amazing! I really enjoyd free-roaming :)
     
  23. Mark-Davis

    Mark-Davis

    Joined:
    Jun 21, 2011
    Posts:
    156
    @angel_m - Many thanks for the perf numbers! As for a game that requires higher performance, it'd likely just make sense to use a different shader/material. Voxelform will work with any custom shader that handles volumetric texturing. It is important to me though, to have a few built-ins to get folks started, and I'm constantly working to improve the performance on that front.
     
  24. Mark-Davis

    Mark-Davis

    Joined:
    Jun 21, 2011
    Posts:
    156
    @Rush-Rage-Games/kondrup - Thanks so much guys! :)
     
  25. Wox

    Wox

    Joined:
    Dec 14, 2009
    Posts:
    93
    This is so cool, like it a lot. Great work!
     
  26. Mark-Davis

    Mark-Davis

    Joined:
    Jun 21, 2011
    Posts:
    156
    @Wox - Thanks! Like your signature quote btw!

    @All - Not sure if I ever mentioned it... Voxelform received a mention by description in a July 1st Edge Magazine interview with Unity Technologies CEO, David Helgason.

     
    Last edited: Sep 2, 2011
  27. Broken-Toy

    Broken-Toy

    Joined:
    Jan 16, 2010
    Posts:
    455
    Awesome!

    After trying your system out I have only one thing to say, and it is related to the incoming LOD: Collider vs display meshes need to be processed separately (except for lowest LOD which uses the same mesh), using the lowest-resolution voxel array as a base and interpolating high-resolution marching cubes from it for higher LOD.
    • Besides the obvious performance gain due to calculating smaller PhysX collider meshes, you'll save on array size (and therefore startup time).
    • It will help the higher-detail meshes look smoother thanks to subdivision while being easier to dig through, the artifact bits being much larger and therefore easier to deal with.
    • The collider vs display mesh will remain more consistent in look and gameplay like this than if you went the other way around and decimated the array for lower LOD.
    • This will make the colliders much faster to compute on a server or in potential 'fast edit' modes, where the display mesh doesn't necessarly need high LOD.

    Even without a formal LOD system in place, I'd still like to see the option for independent resolution between collider and display meshes, because the advantages still apply.
     
    Last edited: Sep 3, 2011
  28. dyox

    dyox

    Joined:
    Aug 19, 2011
    Posts:
    619
    Hello mark.
    Let me first tell you congratulations for your work.

    Then, here are some problems I found.

    VoxelTerrain.xs (invalid return)
    Code (csharp):
    1.  
    2.     public Voxel GetVoxel(int x, int y, int z)
    3.     {
    4.         if (x < 0) x = 0;
    5.         if (x >= _xChunkCount) x = _xChunkCount - 1;
    6.        
    7.         if (y < 0) y = 0;
    8.         if (y >= _yChunkCount) y = _yChunkCount - 1;
    9.        
    10.         if (z < 0) z = 0;
    11.         if (z >= _zChunkCount) z = _zChunkCount - 1;
    12.        
    13.         return _voxels[x, y, z];
    14.        
    15.     }
    16.  
    To ->

    Code (csharp):
    1.  
    2.         if (x < 0) x = 0;
    3.         if (x >= _xChunkCount * _numVoxelsPerXAxis) x = _xChunkCount * _numVoxelsPerXAxis - 1;
    4.        
    5.         if (y < 0) y = 0;
    6.         if (y >= _yChunkCount * _numVoxelsPerYAxis) y = _yChunkCount * _numVoxelsPerYAxis - 1;
    7.        
    8.         if (z < 0) z = 0;
    9.         if (z >= _zChunkCount * _numVoxelsPerZAxis) z = _zChunkCount * _numVoxelsPerZAxis - 1;
    10.        
    11.         return _voxels[x, y, z];
    12.  
    VoxelTerrain.cs
    Code (csharp):
    1.  
    2.  
    3. _voxels[vx, vy, vz].Volume += volume;
    4.  
    5. _voxels[vx, vy, vz].Volume = _voxels[vx, vy, vz].Volume ;
    6.  
    _voxels[vx, vy, vz].Volume = _voxels[vx, vy, vz].Volume ; :D


    VoxelTerrain.cs
    Code (csharp):
    1.  
    2. LoadVoxels(terrain.voxterrain);
    3. SaveVoxels(voxel.raw);
    4.  
    SaveVoxels(voxel.raw); -> SaveVoxels(terrain.voxterrain); (just for users)


    That's all what I found so far.
    I'm waiting for the 1.2 with forward and thank you for your work.
     
  29. Mark-Davis

    Mark-Davis

    Joined:
    Jun 21, 2011
    Posts:
    156
    @Werewraith - Thanks for the tips. I'm planning on adding multi-threaded processing in a few key places there as well, where it doesn't interfere with Unity... likely for a 1.2.x release.

    @Dyox - Thanks for posting that fix! I try to test things thoroughly, but looks like a last minute bug slipped through there. For what it's worth, this code is removed in v1.2. Voxels are now accessed through an interface which allows any type of data source to sit on the other side. It can be an array as before, but it could also be a cache + stream, or even an infinite terrain generator.

    @All - Current work is on improving multi-material support, and adding free floating voxel brushes that allow you to layout the landscape on a 3D grid. You'll be able to switch back and forth between the current editing system, and a more precise system for greater control.

    There are a ton of features that I'd really like to add in v1.2, but in the interest of making a release date sooner than later, I'm going to try to get all the breaking changes into v1.2, and trickle more features into small v1.2.x increments.

    Thanks!
     
  30. runonthespot

    runonthespot

    Joined:
    Sep 29, 2010
    Posts:
    305
    Had great fun last night using Stanford volume data with VoxelForm.

    The results, here:
    http://www.youtube.com/watch?v=hssIjhsLCes

    Mark, great job with this library- the choice of making the voxel a simple float array makes it so easy to mess around with. Brilliant stuff.

    Mike
    @runonthespot
     
  31. solidcrash

    solidcrash

    Joined:
    Mar 27, 2011
    Posts:
    65
    nice. I like it. can it use other "painting"?

    in your demo all I can see square. ether build or dig.

    hope my English clear to ya..
     
  32. runonthespot

    runonthespot

    Joined:
    Sep 29, 2010
    Posts:
    305
    Yeah, the add/remove voxel could be altered to say add a ridge or a bulge shape, but really the voxel density isn't really high enough to do sculpting like zbrush, or similar programs if that's what you mean.
     
  33. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Looks interesting. What mobile performance?
     
  34. MrBurns

    MrBurns

    Joined:
    Aug 16, 2011
    Posts:
    378
    Great work ;). I did something similar just in minecraft style but with much higher resolution and deformations in structure. I think I will now try to combine this with your approach, then its perfect... ^^
     
  35. runonthespot

    runonthespot

    Joined:
    Sep 29, 2010
    Posts:
    305
    Not great for mobile at the moment, my 128x128x109 slice structure was generating 750k polys and 1.5m verts :)

    I've experimented with low voxel count and you can do *some* stuff (I did a sphere in 20x20x20 to generate around 7k polys, and believe it or not, 20x20x20 with appropriately set density can still produce a perfect sphere! Who knew?) but the other problem on mobile is the shaders- the tri-planar and simple shader don't seem to work on IOS. I'm planning to by Broken Toys' triplanar bunch and see if the SM2.0 shaders work.

    Mark is also apparently looking at how the voxel data is supplied- and if that becomes an interface, for example, data might be streamed in, which should make LOD a bit easier. Also something needs to be done about the mesh colliders being the same as the block geometry-- too high detail for complex stuff without some sort of culling in place.

    But, overall a huge amount of potential, and out the box, extremely easy to pick up and mess around with. Rumor has it that multimaterial support is coming in a later version too, which should make voxel minecraft quite an easy prospect ;-)
     
  36. solidcrash

    solidcrash

    Joined:
    Mar 27, 2011
    Posts:
    65
    aha cool!

    [Faint]
     
  37. runonthespot

    runonthespot

    Joined:
    Sep 29, 2010
    Posts:
    305
    Don't worry- that stuff will come. If Mark can sort out sparse voxel octrees, for example, most of those verts and polys will disappear and everything will become superfast.
     
  38. MrBurns

    MrBurns

    Joined:
    Aug 16, 2011
    Posts:
    378
    So what you really want is sculpting voxel terrain in realtime, with the resolution of ZBrush but over an area that passes as terrain for a game and naturally you want that stuff working on iOS ;)... Good luck!

    This is not going to happen anytime soon on PC platforms, at least not with Unity. And then you still have to wait about 10 years for iOS but hopefully these annyoing, time wasting mobile devices have disappeared until then... Sometimes I really praise the time when a handy (oops mobile phone) was only used for SMS and calling.
     
    Last edited: Sep 8, 2011
  39. dyox

    dyox

    Joined:
    Aug 19, 2011
    Posts:
    619
  40. Mark-Davis

    Mark-Davis

    Joined:
    Jun 21, 2011
    Posts:
    156
    WOW!!! I'm blown away... Thanks so much for posting this! I'd wondered about some of those Stanford models, but hadn't actually tried them yet. :)
     
  41. Mark-Davis

    Mark-Davis

    Joined:
    Jun 21, 2011
    Posts:
    156
    Awesome - love the explosions!!! :)
     
  42. Mark-Davis

    Mark-Davis

    Joined:
    Jun 21, 2011
    Posts:
    156
    3D brushes (at least box and sphere) are making it into v1.2.0, but to rehash what runonthespot said - yes you can script it to work however you like.
     
  43. Mark-Davis

    Mark-Davis

    Joined:
    Jun 21, 2011
    Posts:
    156
    Mobile isn't currently supported, although I've heard of some success with Android using simple shaders. I can't verify that though.
     
  44. Mark-Davis

    Mark-Davis

    Joined:
    Jun 21, 2011
    Posts:
    156
    Regarding LOD... I'd agree that ZBrush detail isn't happening anytime soon on a very large scale, but that's not really the point. Currently if you want multiple levels of detail, it is possible to use multiple VoxelTerrain objects within the same scene. Not that this is ideal, but it could work for some situations.

    Regarding multi-material... I think it's safe to say that with the current development build, Minecraft style multi-material is here, but with all the organic detail of Voxelform.
     
  45. Mark-Davis

    Mark-Davis

    Joined:
    Jun 21, 2011
    Posts:
    156
    Reposting from the last page:

    WOW!!! I'm blown away... Thanks so much for posting this! I'd wondered about some of those Stanford models, but hadn't actually tried them yet. :)
     
  46. Rush-Rage-Games

    Rush-Rage-Games

    Joined:
    Sep 9, 2010
    Posts:
    1,997
    Very cool!!!
     
  47. Mark-Davis

    Mark-Davis

    Joined:
    Jun 21, 2011
    Posts:
    156

    Just for fun... another look at multi-material using some new triplanar shaders w/ bump+spec support.
    To be clear... this is an upcoming feature.
     
    Last edited: Sep 21, 2011
  48. Rush-Rage-Games

    Rush-Rage-Games

    Joined:
    Sep 9, 2010
    Posts:
    1,997
  49. pixelsteam

    pixelsteam

    Joined:
    May 1, 2009
    Posts:
    924
    Really fantastic Mark! Once this is in I will buy!
     
  50. runonthespot

    runonthespot

    Joined:
    Sep 29, 2010
    Posts:
    305
    holy crap that looks awesome.