Search Unity

Assets Voxel Play - infinite world generator

Discussion in 'Works In Progress' started by Thrawn75, Jan 2, 2018.

  1. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    Noise viewer and generator tool:
     
  2. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    Version 3.3 will be released tomorrow Wednesday with new tools and improvements.

    Cellular noise generator has also been added to the Noise Generator tool:
     
  3. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    Improvements coming to v3.4:

    Sunset & water speculars:


    Improved third person controller:
     
    digiross likes this.
  4. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    @Qmask this is fixed in latest beta version. The update will be available shortly on the Asset Store. Thanks for the heads up!

    EDIT: Update/fix on the Asset Store as well.
     
    Last edited: Mar 8, 2019
  5. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    Feature preview: model definitions as inventory items.

     
    Last edited: Mar 16, 2019
  6. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    Voxel Play 3.6 feature preview: curved projection.



    EDIT: 3.6 now available.
     
    Last edited: Mar 19, 2019
    HeadClot88 likes this.
  7. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
  8. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    831
  9. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    Hi,
    It’s quite easy to create such tool using Voxel Play. The asset includes a simple demo scene which allows you to paint/clear voxels in a similar fashion (like a voxel editor) and you can convert any 3D array of colours to optimised voxel gameobjects with a single function call.
    There’s in fact some voxel editors under development using Voxel Play AFAIK.
    Regards.
     
    jGate99 likes this.
  10. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    831
    Thanks for your reply, im gonna check and let you know my thoughts.
    Im personally not good at 3D programming (mostly 2d with canvas ugui expertise) so plugin like yours could be a huge life saver.
     
  11. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
  12. CodeHuang

    CodeHuang

    Joined:
    May 10, 2019
    Posts:
    1
    Hello, I want to make a voxel-based large-scale map, can I only use the map component. My game is a third-person shooter. Do I have my own voxel character model and action? Specifically, it means that you can simply export a voxel scene based on unity to my team to place what they want to design, and to place people or tasks. Thanks, I noticed that the community is very active. From Google Translate.
     
  13. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    Hi,

    if you don't need terrain destruction or transformation, then yes, exporting the world map into static meshes with optimal materials is a feature that will be introduced soon in Voxel Play and can help you. Basically this feature will generate and export the voxel chunks within a world area into regular gameobjects so you can afterwards remove Voxel Play and keep the generated terrain.

    Regards.
     
  14. bingofly

    bingofly

    Joined:
    Sep 15, 2018
    Posts:
    24
    @Thrawn75
    Hi,
    Happy to get this good asset. I have three questions.
    1st. Dose it support custom algorithm for terrain generator?
    For example: I don't know what kind of algorithm this asset use, maybe perlin noise, and can I use cellular automaton to replace it?
    2nd. In the document, I found every object is about cubes (voxel). For example the trees is constructed by cubes.
    My question is can I replace a cubed tree with other model without cubed structrue?
    3rd. It's not easy to handle pathfinding and local avoidance in a voxel-based large-scale map.
    Dose it have any solution?
     
  15. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    Voxel Play is extremely extensive in this matter. You can 1) customize the provided terrain generators, 2) clone them and modify/tweak their code or 3) completely write your own terrain generator from scratch and plug it into VP.
    Here're some useful resources:
    https://kronnect.freshdesk.com/support/solutions/articles/42000001906-terrain-generators
    https://kronnect.freshdesk.com/supp...42000001950-coding-your-own-terrain-generator

    It also includes a noise generator (which produces tileable textures) that supports Perlin and Cellular types.

    Yes, VP supports custom voxels. A custom voxel is a voxel that uses a custom mesh:
    https://kronnect.freshdesk.com/support/solutions/articles/42000049143-custom-voxel-types

    VP can generate NavMesh automatically for you for all visible chunks. It does automatically and it uses a greedy mesh algorithm to optimize vertex count - then they can be just used as they're for AI as shown in one of the demo scenes included in which some foes track the player round.
    Note that NavMesh are dynamically generated, they're not available in Editor time so its use can be limited atm. You can define which voxel types contributes to NavMesh generation (ie. exclude water voxels) but you cannot have different path-finding rules for different foes. It's one for all solution. If you need more control about AI you need to provide your own solution (or extend what VP does).

    Regards
     
  16. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    Hi everyone,

    Here's a nice introduction to Voxel Play from The Messy Coder. He shows how to convert an existing terrain (including vegetation and trees) into Voxel Play:


    Enjoy :)
     
    digiross likes this.
  17. futurewavecs

    futurewavecs

    Joined:
    Jul 26, 2012
    Posts:
    63
    I've played around with making Voxel Systems a few times. There were a few features I had been thinking of doing. Perhaps they are something you could do instead. I don't need the fame or time to support my own system. :) For all I know it may already do this.

    Since cubes are a set of specific vertices I had the idea to allow a variant cube type that allowed a person to specify the vertice coordinates for that type and spawn a new voxel type from it. I planned on keeping it constrained to the size of a cube. This could be useful for creating rough walls, ramps, etc while still essentially maintaining the same grid (voxel) reference.

    I also had an idea to make height dependent vertices like you appear to potentially be doing with liquid. That is what I was going to use it for as well. The idea was a height could be specified (I was either allowing 8 or 16 height variations depending upon the version of my project) For similar voxel types they would average where their edges met based upon adjoining heights. This could in theory be used to create rolling hills and more natural looking terrain. Yes, it skews from the Minecraft concept but it could have potential. Perhaps in making piles of ore or material that change in height.

    I also considered an inverted version of that where the height was from top down... good for making more natural cave ceilings, etc. This could be easily a concept applied in any direction to achieve more natural looks while still conforming to the voxel grid.

    Marching cubes of course would also address that which while being able to define the 256(actually less than this) styles of marching cube voxels might be useful, what I am proposing would be a little easier I believe.

    The final type I messed with quite a bit was a multi-voxel. I made it so I could mix dynamically defined voxels as per the specific vertices example above and create multiple voxels within the constraints of a single voxel grid position. This I then used to create trees, mushrooms, etc that still had the same look and feel but only would occupy the grid space I defined.

    I think that is about it for now. I'll dig into your system more soon. You did a lot of stuff I only dreamed of but never got around to doing (like the GPU portions). Your system runs quick and does a great job.

    Keep up the good work. Don't take any of this as criticism. When I find good asset creators who have already done a lot of the work needed on something I dream of having I'll often share those ideas to see if they are interested.


    Just so I back up my claim - here are screenshots from one of my earlier experiments from 5 or more years ago. The trees and some things under the water are made with the multi-voxel technique. I'd use it to make the trunk's of the trees slightly less wide than a normal voxels so even when trees were side by side there would be some visibility past the trunks.




    Then awhile later I did some other experiments... the stairs in this are also a multi-voxel. The tilted block was me just messing with fixed rotation which you have more than accomplished.



    I wrote about it a little more here if you wish to read any further about it.
     
    Last edited: Jul 9, 2019
  18. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    Hi! Thanks for sharing your previous work.

    In Voxel Play, anything different from the standard block types can be defined using "custom voxel definitions" as explained here:
    https://kronnect.freshdesk.com/a/solutions/articles/42000049143-custom-voxel-types
    (standard block types refer to the render types provided by regular blocks in Voxel Play, like opaque 3-sided, opaque 6-sided, cutout, etc.).

    A custom voxel definition uses the mesh from a given prefab. VP can either instantiate it (if you want to preserve the prefab colliders or any attached script) or just render it using GPU instancing or Compute Buffers for performance reasons.
    For example, scattered ramps could just be instantiated (dynamic batching will take care of draw calls). Custom voxel definitions are also used for custom vegetation.
    The custom voxels use a specific material/shader that respects certain lighting effects, like day/night cycle or integrated fog.

    The height is an attribute of each voxel but it's only used for water voxel types atm. Reason is that water voxels are transparent and don't cast shadows or AO (there're a few performance tricks that assume the standard blocks are cubes like integrated AO or face removal).
    Custom voxel definitions, since they can have any shape, can't do face removal of adjacent blocks nor cast AO on regular block types. In that case and if you want AO on those custom voxels you can use a screen space effect instead. However the integrated AO is super fast and designed for mobile (no full screen post effect).

    VP also generates optimized meshes for collision and NavMesh. It uses a greedy-mesh algorithm to reduce vertex count and optimize the physics/navmesh baking when chunks are updated. This algorithm assumes the blocks are fully regular so height-variant voxels would require to implement their own colliders which is why they fit well as custom voxel types and default instancing.
     
  19. futurewavecs

    futurewavecs

    Joined:
    Jul 26, 2012
    Posts:
    63
    Yeah, I ran into that too. I'd usually include some consider for occlusion bits in the 6 directions so that I'd know whether to treat a side of the custom voxel as fully occluding or not.

    Anyway, thanks for your response. I did read up on the custom voxel and watched your demo with the half-block but I hadn't put it fully to the test. I will do so.

    I really like your tool and am glad I purchased it. It does many things like I said that I only dreamed of. I made some nice looking scenes but as usual with voxels trying to optimize performance then became a big focus. The screens ended up looking well for the art direction I was seeking but that was largely due to good choice in textures.

    I look forward to seeing what I can do with Voxel Play. I'll end up replacing all of the textures, and I have a few things to try out with it. A lot of what I need to accomplish is not a problem within the confines of your tool. I need to implement longer distance pathing for NPCs rather than slaving them to a chunk.

    EDIT:
    One reason I did the multi-voxels instead of a separate model is that I built it using the same textures in the texture atlas so even though it was more complex it greatly reduced draw calls by being able to pull from that atlas. It also enabled me to mix and match different textures per face for each of the components of the multi-voxel. While it would not fit within the culling and such as you have them now... if used sparingly they can be a nice feature.
     
  20. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    New major update released!


    Key changes include realistic water option and improvements to override material option, third person character controller, see-through effect and much more under the hood. Many changes related to integration and API.
     
    digiross likes this.
  21. digiross

    digiross

    Joined:
    Jun 29, 2012
    Posts:
    204
    I found Voxel Play yesterday and I am quite impressed. I've watched all the videos and read everything in this thread and this asset is developing nicely. Well done! I own a couple of your other assets and like your commitment and being thorough. I will be purchasing soon. :)

    One quick question, would it be possible to add/modify to make procedural roads to go with the buildings?
     
  22. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    Absolutely, but you have to add your code to paint the road voxels. Voxel Play is quite flexible in terms of what you can do. It's designed so you can either customize, extend or provide your own terrain and detail generators.
    A detail generator is a special class that adds, removes or modifies contents in the voxel world as it's being generated. Voxel Play calls your detail generators when needed (as the player moves around the world) so you can for instance paint roads between two points in the world before those chunks are visible by the player. Certain complex content is easier to create in a detail generator.
    Or you can also customize, duplicate or add your own terrain generator. A terrain generator fills chunks as they're needed by the engine. So you could create a variant of the default terrain generator that in addition to plant bushes or trees, paint road voxels at the surface based on your own logic.
     
    digiross likes this.
  23. digiross

    digiross

    Joined:
    Jun 29, 2012
    Posts:
    204
    Wow quick response! For years there have been half-hearted asset store attempts at voxel worlds and this asset of yours seems amazing!
     
    Thrawn75 likes this.
  24. digiross

    digiross

    Joined:
    Jun 29, 2012
    Posts:
    204
    Can the standard cube size be changed? For instance, if they are currently akin to 1x1x1 meter can we change their size if I wanted them to be smaller so theoretically .5x.5x.5 for better detail?

    I'm trying to flesh out my design idea. LOL

    Thanks
     
  25. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    Nope. Basic unit is 1x1x1 and shaders, integrated AO and face culling are optimized for that. You can create voxel definitions that use custom meshes, including smaller or bigger geometries (usually for vegetation, trees or other objects), but terrain voxels are 1^3.
     
  26. digiross

    digiross

    Joined:
    Jun 29, 2012
    Posts:
    204
    ok thanks :)