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
    @DJ_Design Thanks for using Voxel Play. Yep, this asset is 100% focused on cubic shapes - the shaders, occlusion system, smooth illumination, ... all those systems are already in place around cubes, so the performance.
     
  2. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,390
    Any news on the LWRP support?
     
  3. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    Nothing new at this moment - we have some other works under development regarding the new SRP so this may come some time in the future.
     
  4. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,390
    ok then
     
  5. RealMTG

    RealMTG

    Joined:
    Jul 27, 2013
    Posts:
    229
    Hello!

    I just discovered your asset and it looks extremely promising! Many fun features, by the looks of it! But I have some questions I would like to have answered before I buy anything.

    1. This has been asked before, but I want to kind of build on it; how much control do I actually have? The game I'm planning to use this on doesn't need most of the features you provide here. What I'm after is basically just "high performance cube based levels". Can I completely disable biomes, "realistic" terrain generation, inventory, ambient occlusion on blocks, custom block lighting, etc? I just want to basically use the cubes and make them look like Unity's primitive cubes, but with much better performance if that makes sense.

    2. When it comes to saving and loading, how is it saved? My level editor uses JSON files to save level data, which of course is text. Is there a "text option" available or would I need to save all the voxel level data in a separate file?

    3. I got a few mixed signals about this; does it support Unity's built-in lighting system, like shadows and such, and Unity's standard colliders for physics and character controllers? Could I (theoretically) just put Unity's standard assets first-person player into a scene with these cubes and it would work?

    4. In the core features, it says I can automatically generate a NavMesh. Is this some custom NavMesh or is it's Unity's built in? And if it's Unity's own, how well does it handle going up and down blocks? Unity's NavMesh tend to generate some really awkward slopes, at least in my experience, and it doesn't look that good for AI.

    Thanks!
     
  6. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    @RealMTG thanks for your interest in Voxel Play.

    1.- You have plenty of control as most components are based on ScriptableObjects. That means that you can create a completely new terrain generator by just inheriting a base class and plugin your class into the World definition (another scriptable object). In this field you have a broad range of choices, from write your terrain logic from scratch (basically feed the contents of each chunk on demand) to parametrize the given multi-step terrain generator or use the Unity terrain generator which converts an existing landscape (like created with Gaia) into Voxels (including vegetation and trees!).
    Doc here: https://kronnect.freshdesk.com/solution/articles/42000001950-coding-your-own-terrain-generator

    2.- Saving uses a RLE based binary format (text format was deprecated to optimize file size). Here's the description:
    https://kronnect.freshdesk.com/solution/articles/42000036928-saved-games-file-format
    You can save current world into memory (byte array) or file. Also you can set a saved game as your starting world (like in Minecraft).
    The loading/saving methods are within a specific C# file, so it's easy to explore it / modify or clone and provide your own load/save APIs to extend the framework. More on extending the framework here:
    https://kronnect.freshdesk.com/solution/articles/42000033640-customizing-the-asset

    3.- It generates standard colliders. It also supports standard shadows. Lighting, for optimization purposes, is limited to Directional Light and Point Lights (using Vertex Lights). The torch uses a point light for example which combines with smooth lighting.

    4.- It's Unity builtin NavMesh. And yes, as far as its concerned the NavMeshes are standard, however it's true that on very abrupt terrain units can sort-of float on slopes since the NavMesh does not follow sharp corners. You can also configure NavMesh settings in the source file, for example, to produce more granular meshes. Depending on your scope, maybe it's more optimal to code your own AI logic to move your units.

    Cheers!
     
  7. RealMTG

    RealMTG

    Joined:
    Jul 27, 2013
    Posts:
    229
    Sounds very promising!
    I just got a bonus question that I thought about later.
    Is there a way to place multiple voxels at the same time? In my game, I want to place a whole lot of voxels at the same time, like big walls, huge floors, etc. I believe doing the voxel set method for every voxel would come with some performance problems because of chunk updates, but I could be wrong.
     
  8. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    Sure! VoxelPlace is an overloaded method that can accept a list of positions or indices (VoxelIndex struct containing chunk reference and voxelIndex inside the chunk's voxel array).
    Also chunk mesh updates occur in background thread and controlled by a priority queue, they are not triggered on every call.

    EDIT: just updated the documentation to reflect all VoxelPlace method overloads: https://kronnect.freshdesk.com/solution/articles/42000001939-methods
     
    RealMTG likes this.
  9. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
  10. Eewhukn

    Eewhukn

    Joined:
    Oct 25, 2016
    Posts:
    6
    hi, this asset allows create custom block as trigger? Me need handle action when character entered in block
     
  11. Thrawn75

    Thrawn75

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

    Eewhukn

    Joined:
    Oct 25, 2016
    Posts:
    6
    yes, as instance, in my case, me need transparent block, when player walks through, execute specific action, example show game over ui.
    how soon can you add this functionality?
     
  13. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    Will be added into next update. In the meanwhile if you know the location, you can just put a standard collider and use the OnTriggerEnter event.
     
  14. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,390
    What else is coming in the next release?

    Also any plans to smooth out the voxel lighting per block?

    mc schematic support import/export (ie like a select of blocks can be exported into the schematic format? and imported?)

    maybe with a basic block conversion from mc blocks to equivalent voxeldefinition of our own, or even just color tinted blocks for voxeldefinitions without textured block? And now that voxel block rotation is also in voxeplay it seems pretty much doable now. Just asking because I have a ton of schematic files of things I built on a mc server I used to run and would love to bring those into my maps without having to rebuild them all.
     
  15. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    Here's the wish-list in no particular order: https://kronnect.freshdesk.com/solution/articles/42000004943-wish-list-experimental-features-wip

    One thing that will be included for sure in next update (and has been requested before)is runtime voxel object creation (and updating) which will produce an optimized mesh based on a 3D array of colors, which can be updated as well - similarly, the ability to produce models from Qubicle format.

    Regarding mc schematic, do you have some example to share? Send me a pm with some stuff and I'll see if I can include support for that format in next version as well.
     
    eaque likes this.
  16. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    5,393
    No marching cubes, but do you use greedy meshing instead?
    Or any other merging method?

    ECS would definitely benefit here. Any plans on that?
     
  17. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,390
    Seems like you can use this c# library https://github.com/fragmer/fNbt for loading mc schematic files.. the schematic format is zipped and uses the nbt format.. is a few other github examples of its usage https://github.com/Miclebrick/Schematic2Json
     

    Attached Files:

    Thrawn75 likes this.
  18. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    @Antypodish Greedy meshing is used for colliders and navMesh generation, as well as for voxels that can be merged (ie. no ambient occlusion or per-vertex specific attributes). The qubicle importer also uses greedy meshing.

    Voxel Play is already multi-threading in chunk generation/meshing and performance-by-default principle has been considered from start, including linearization of arrays, centralized chunk management, optimal struct memory alignment, etc. I'm doing some tests with the C# Job system just in case some areas can be improved and sure, if it adds sound benefits to the existing code base it will be used.
     
    Antypodish likes this.
  19. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    The new update supports Empty blocks (just create a voxel definition specifying Empty as render type) and enable "Trigger Enter Event" which will raise an OnVoxelEnter event from the FPS controller. If you need help using this event, please send an email or join our Discord server for a quick chat.
     
  20. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    V2 is under development focused on visual improvements.

    First one is smoother lighting algorithm.



     
    digiross and RealMTG like this.
  21. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,390
    oh that is really nice to see :D
     
    Thrawn75 likes this.
  22. Pangeli70

    Pangeli70

    Joined:
    Mar 2, 2016
    Posts:
    7
    Don't look at the marching cubes implementation, but will be possible to reduce the size of the blocks like in stellar overload?
     
  23. Pangeli70

    Pangeli70

    Joined:
    Mar 2, 2016
    Posts:
    7
    By the way the game is unfinished and seems abandoned, but has many ideas. The LOD management and the amount of vertexes that this engine can handle are very impressive. So my previous question. Is it possible to reduce the size of the blocks in Voxel Play?
     
  24. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    Currently not as some rendering assume an AABB distribution of voxels with a size of 1m. I guess it could be modified to support custom voxel sizes with some extra effort but that's something not planned atm as there're other dev ongoing like better visuals and a few new API for building stuff.
     
  25. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    Added more nifty graphic options to beta 2 for those interested in a more detailed atmosphere: POM (relief mapping), normal map and emission/glow mask are now supported.

     
  26. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    Door creation tool:

     
  27. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,416
    I am using Unity 2018.3 f2 and .net 4.0

    And I get the following errors :

    upload_2018-12-14_15-30-27.png

    How can I fix this?
     
  28. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    Hi,
    That Unity version just dropped yesterday so we’re in the process of verifying all assets during this week. Expect an update today or tomorrow anytime soon.
    Cheers
     
  29. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,416
    Maybe beta version can work.. can you give me the access please? I have already sent the message.
     
  30. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,416
    Ugh, unfortunately, it didn't work.. :(
     
  31. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    The beta supporting Unity 2018.3 probably will hit the beta board in a few hours. You should receive an email notification when it's available.
     
    castor76 likes this.
  32. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,416
    Just tried beta 2.3 b7... Still not working. The same problem.
     
  33. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    That beta belongs to another branch. Support for 2018.3 is coming shortly.
     
  34. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    Just tested latest beta on 2018.3.0f2 and it builds correctly on PC (tested with .NET 4x scripting & API compat level + IL2CPP).
    Which platform are you building for? Can you post your player settings? Thanks.
     
  35. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,416
    I can see the new RC1 version... I will try that first.
     
  36. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,416
  37. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,416
    Arh... I think I found out what's wrong. I had another class name Action. Which I think it is a bad naming. It came from some other asset package. LOL.

    Darn. I will report here again once I have things running.
     
  38. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,416
    Good news, I was able to get the package running!

    However, when I was experimenting with normal, I get some weird result.

    upload_2018-12-15_0-18-13.png

    It seems like this happens on the top of the block, with normal like this

    upload_2018-12-15_0-19-23.png

    And there are no normal effects on the sides of the block at all.
     
  39. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,416
    Ok, after some fiddling again, I found that the normal map has to be imported as just texture not as normal map texture. Also the G channel of the normal map needed to be inverted. I think this is a little bit confusing to the Unity user as they are normally imported as normal map type and the G channel is using opengl format. This needs to be documented somewhere in the doc..?
     
  40. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    Please join our Discord channel, we have a quite active community there and shared insights will be appreciated:
    https://discord.gg/7HQgT3v
     
  41. Thrawn75

    Thrawn75

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

    Voxel Play is part of the ongoing Christmas Sale! Available at 50% off for limited time.

    Also, version 3 has just landed on the Asset Store with new features and lot of changes:

    - GPU Instancing options for Custom voxel types.
    Improved rendering speed for custom shaped voxels!
    New random rotation and offset options.

    - New lighting system.
    Up to 32 point lights can illuminate voxels and models.
    Realtime lighting computed in 1 pass in vertex or fragment shader.

    - Point light color alpha determines the light wrapping factor
    New global options allow you to control overall light intensities, ranges and falloffs.

    - Added shadows fade out
    Fixes the hard-cut shadow end based on shadow distance.

    - Improved water flood.
    New "drain" property in Voxel Definition.
    Sea water now expands farther.
    Water can now collected in fractional amounts

    Check it out on the Asset Store!
     
  42. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
  43. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
  44. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
  45. ecutruin

    ecutruin

    Joined:
    Aug 19, 2014
    Posts:
    36
    Checking back on this project and wondering if you ever looked at creating a Unity prefab voxel, that would allow us to use any prefab in place of a voxel definition. This would be extremely useful for animated objects, such as machines, chests, etc.
     
  46. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    Hi,
    Yes, you can create a voxel definition of “Custom” type to which you can assign a prefab.
    One example of these kind of objects is the door voxel which is also an interactive object. Check these links for more info:

    Door creation tool:
    https://kronnect.freshdesk.com/support/solutions/articles/42000047211-door-creation-tool

    Interactive objects: https://kronnect.freshdesk.com/support/solutions/articles/42000049602-interactive-objects

    Btw I recommend joining the Discord channel (link in signature) to also interact with other users.

    Cheers and happy new year!
     
  47. ecutruin

    ecutruin

    Joined:
    Aug 19, 2014
    Posts:
    36
    Interesting! To pair with that, I assume you can also set the voxel size of the custom voxel, in the even that you have a prefab that should take up multiple voxel spaces? Or is that not supported at this time (couldn't find it on your support site)?
     
  48. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    Yes, the custom voxel can occupy more than one voxel. Also the FPS controller uses the VoxelOverlaps method to check if that voxel can be placed or not.
     
  49. ecutruin

    ecutruin

    Joined:
    Aug 19, 2014
    Posts:
    36
    Thanks!
     
  50. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,209
    New Texture Voxelizer tool included in next update: