Search Unity

Cubiquity - A fast and powerful voxel plugin for Unity3D

Discussion in 'Assets and Asset Store' started by DavidWilliams, Jun 2, 2013.

  1. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    Hi guys, I'm sorry for the slow replies at the moment. I'm still in the process of moving house so it takes a little longer than usual.

    Cubiquity is unfortunately not supported on Android or webplayer because it depends on a native-code library. However, it should work on all desktop platforms. Perhaps you can send we a simple Unity project which demonstrates the problem, and also the built version so I can try running it myself?

    Right, yes, that's actually what I'd recommend as a first approach. Literally just copy the .vdb file across the network.

    You probably don't need to use the picking class at all in this case. Just choose your start position, and then iterate over the voxels in a for loop and check if they are occupied (check (x,y,z), (x,y-1, z), (x,y-2,z), etc).

    As I recall, the voxels are centered on integer positions and the picking returns such integer positions.

    I don't think it has to be so complicated... can't you just do the networking equivalent of a 'file copy' operation? You shouldn't have to look inside the file or understand it contents at all.

    The colored cubes editing is extremely limited at the moment - basically just showing it is possible. I would like to improve it in the future, but you should probably use an external tool if you can. Otherwise, all the source code to the editor is in a single file (ColoredCubesVolumeInspector.cs) so you can try tweaking it yourself if you like ;-)
     
  2. bigd

    bigd

    Joined:
    Feb 14, 2014
    Posts:
    40
    Hi David,

    This past weekend, I was successful in transferring the vdb file from the server to the client via a byte[] stream. Sweet success! It was actually fairly easy once everything is all said and done. Just a matter of working through it line by line. I believe this same method can be used for transferring voice / microphone input over the network as well.

    So now that I have the vdb file on the client, I have to build the volume. I have a quick question around the wrapper class that Unity uses to point to the vdb file. Does there need to be a separate wrapper for each volume or can I just have one wrapper and change it's path depending on which volume I want to build with? If the latter is possible, is there an easy function to change it's path to the vdb?

    Once the wrapper path points to the newly created vdb, I can pass it into ColoredCubeVolume.data and Voila! We should be golden. (I think)
     
    Last edited: Jul 14, 2015
  3. TheXWolf

    TheXWolf

    Joined:
    Dec 13, 2013
    Posts:
    85
    @DavidWilliams Will you ever implement a way to lock to an axis? For example, I hold the mouse and it only draws on X or Y or Z (maybe via check in the inspector) rather than freeform?

    Also, has there been a chunk system implemented to the unity version to load what's in visual range yet?
     
    Last edited: Jul 14, 2015
  4. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    Great!

    Honestly I can't quite remember, but I think you need to create a seperate wrapper for each volume. They are very lightweight though and you can create them on the fly (no need to save to disk, though you can). If you want to change the path you might be able to hack the C# code - really it depends why you only want a single wrapper?

    Also check out the various source code comments in this file: https://bitbucket.org/volumesoffun/...ts/Cubiquity/Scripts/VolumeData.cs?at=develop

    You asked this already (maybe you missed my response?) but no, such a lock option does not exist. Ther are lot's of changes which you be added to the editor as it is really quite basic!

    Unfortunaly not - the system always displays the whole volume (though only part of the voxel data is loaded into memory at a time).
     
  5. TheXWolf

    TheXWolf

    Joined:
    Dec 13, 2013
    Posts:
    85
    @DavidWilliams Yes I actually missed ur post when I asked that, forgetting I'd asked it the first time. lol
    Yes I've been fooling around with it for a while now and I can understand how to do it I believe, just haven't had the time to finish it.

    Also, as for removing a block, I looked through all the code for the explosion example (clever btw) and noticed you're
    Code (CSharp):
    1. coloredCubesVolume.data.SetVoxel(voxel.x, voxel.y, voxel.z, new QuantizedColor(0,0,0,0));
    is setting the color and alpha to 0 actually removing it, or simply placing a blank one in it's place? That's how we're supposed to "delete" on correct?
     
  6. bigd

    bigd

    Joined:
    Feb 14, 2014
    Posts:
    40
    @TheXWolf

    That's my understanding on how it works. You aren't actually deleting anything, you're turning the alpha of the cube on/off and removing it's collider within the given volume.
     
    TheXWolf likes this.
  7. TheXWolf

    TheXWolf

    Joined:
    Dec 13, 2013
    Posts:
    85
    Thanks I just wanted to make sure I was doing it correctly and not wasting memory because I missed something simple. lol

    Now it's been mentioned multiple times not to have multiple terrain volumes; is it a memory thing or something interference based? Can I have say; 5, if only 1 of them will actually be active in a scene at one time etc.?
     
  8. bigd

    bigd

    Joined:
    Feb 14, 2014
    Posts:
    40
    @TheXWolf
    I believe it's interference-based. What you can do is make multiple wrapper classes (I believe they are called ColoredCubesVolumeData) and point to one voxel database file. Or make duplicates of the vdb file for each volume in your scene. Easiest way to do this is to duplicate them within Unity.

    Atleast that's my experience, otherwise you'll get a warning saying you are creating multiple instances of the same volume.
     
  9. bigd

    bigd

    Joined:
    Feb 14, 2014
    Posts:
    40
    @DavidWilliams

    Hi David, thanks for your response up above, I'm really making progress! Currently I can send the voxel database information over the network, reconstruct it on the client, and send edit events to the other players.

    One problem I'm experiencing; however, is when a client makes edits to a voxel volume, the server makes edits to it's local copy. When a new client enters the game, they are sent the server's copy of the database but none of the edits are included with that database. Why not?

    My question is...how does the voxel SetVoxel information at runtime get stored into the vdb file? Does it need to have write permissions to do so? In essence, I need to send the new client the server's "edited" voxel database. Right now, the edits I'm making at runtime to the volume aren't being updated into the voxel database currently, so the clients aren't getting the latest copy.

    Hope that makes sense and your move is going stress-free!

    EDIT: Nevermind, found the CommitChanges() function. Now I'm getting a sharing violation error because I'm trying to read a file that has read/write permission set on it. Hmmm... Are you able to change the write permissions of a database on the fly?

    EDIT2: Nevermind again, ha, figured it out. These forums posts must be like therapy for me as I usually figure out what's been bothering me afterwards.:) I basically ended up committing the changes to the edited volume, making a copy (seems to not whine about sharing violations using the copy function), and then send the copy over to the client. Works like a dream! I'll post a video up sometime for anyone who's interested. End goals is to convert this over to a Terrain volume (currently using coloredcubes) and enable the "unsafe" mode. I'm a bit worried about performance with all this copy/pasting and streaming of information but I'll have to test it out with a 20 clients and see if it matters.
     
    Last edited: Jul 21, 2015
  10. TheXWolf

    TheXWolf

    Joined:
    Dec 13, 2013
    Posts:
    85
    @bigd That's what I've been doing with error so far. I'm creating multiple volumes, with separate volume data objects.
    My goal is to allow players to dig really deep, so I'd have a volume say 25-50 deep at a time, then 2 more for the remaining heights.
     
  11. bigd

    bigd

    Joined:
    Feb 14, 2014
    Posts:
    40
    Could you not just make a really large volume that's just large in the y-direction? I can imagine if you're using multiple volumes that are supposed to be seamlessly connected (like I would imagine digging through ground to be), that stacking them on top of each other might be troublesome.
     
  12. masterchafe

    masterchafe

    Joined:
    Oct 2, 2011
    Posts:
    59
    Hey there, loving this plugin, it's perfect for what I'm doing (adding 3d walls to a racing game), but I've had a problem with corruptions happening to scene files.

    I'm not sure what causes it to happen, but it's happened 3 times now. I've tried hiding everything in the scene hierarchy, but I can still see the remnants of voxel sides which shouldn't exist. I even tried deleting everything from the scene hierarchy, yet somehow they persist and are still sitting there in the scene view. :/

    voxelcorruptions.png

    Not sure what else to do. Is there a way to flush the voxel corruptions, or are these scene files now broken beyond repair?

    [EDIT]
    I just realised, as deleting everything didn't work, none of those objects were corrupted and I could just copy all of the gameobjects from the corrupted scene, and paste them into a fresh new scene, and everything is fixed. That "solves" that one! :)
     
    Last edited: Jul 21, 2015
  13. TheXWolf

    TheXWolf

    Joined:
    Dec 13, 2013
    Posts:
    85
    @bigd Ya I was considering that, but being as there's no chunk system at, and whole integers are being used, I could just place them directly above/below one another, and unload/load the volumes as a player approaches them. Similar to a chunk loading, and this will keep ALL the collision and rendering from being active at once.
     
  14. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    Hey guys, it's really good to see people supporting each other and sharing their knowledge of the system!

    Yes, this is the correct way to 'delete' a block (actually the color shouldn't matter, just set that alpha to zero). You can't truly delete a voxel from a volume in the same way that you can't truly delete a pixel from an image - all you can do is set the opacity so that it isn't shown.

    Cubiquity does support multiple volumes, but it may not be appropriate to use them (depending on exactly what you are trying to do). First of all see here: http://www.cubiquity.net/cubiquity-for-unity3d/1.2/docs/page_duplication.html

    Overall I try to discourage people from using multiple volume to limit the view distance because it is not as efficient as if Cubiquity handled this for you (which it hopefully will in the future). But at the moment Cubiquity doesn't handle this for you, so I understand that people are going to hack their way around these limitations :)

    Indeed, I would encourage this approach unless testing really shows that multiple volumes is faster or easier.

    Yep, that's pretty common! Glad you are making good progress anyway. The need for CommitChanges() is basically related to being able to make changes in play mode and then have them discarded on returning to edit mode (which is how all Unity scenes work). Looking to the future, I would like to make this a multi-level system so that it can be used to implement 'undo' functionality.

    I don't think you can change a read-only volume to be read-write but actually I'd have to check the SQLite documentation. But actually I've never seen this done outside of Cubiquity either... if you open a file in standard C (or C#) in read-only mode then can you usually promote it to read-write? I've never actually tried, and it may be an OS limitation?

    Really hard to say regarding the performance as I don't have any networking experience here. But you are only copying the volume once, and then streaming changes or user actions somehow? Also I don't know how much difference the unsafe mode will make - it's faster in principle but probably not bottleneck.

    Does the problem disappear if you restart Unity? Also, what size is your volume, and does it make a difference whether it is a power-of-two or not?

    Also, if you search the Cubiquity code you will find some references to 'HideFlags' which stop objects showing up in the scene hierarchy. If you disable this behaviour it might be possible to see what is going on (again maybe after a restart?)?[/user]
     
  15. JonnyHilly

    JonnyHilly

    Joined:
    Sep 4, 2009
    Posts:
    749
    Hi, just downloaded and tried this out on unity 4.6.6 on a mac. With build settings as CP/Mac standalone, with OSX as the target.
    ...after importing from the asset store, into a fairly empty project , I get these errors...

    Assets/Cubiquity/Examples/CreatingVolumesFromCode/MazeFromImage/ColoredCubeMazeFromImage.cs(27,151): error CS1729: The type `Region' does not contain a constructor that takes `6' arguments
    Assets/Photon Unity Networking/Plugins/PhotonNetwork/ServerSettings.cs(13,14): (Location of the symbol related to previous error)
    Assets/Cubiquity/Examples/CreatingVolumesFromCode/MazeFromImage/ColoredCubeMazeFromImage.cs(27,58): error CS1501: No overload for method `CreateEmptyVolumeData' takes `1' arguments

    any ideas what to do please ?

    Is this something to do with the 'unsafe code' setup ?
    I read the setup docs, which says I need to copy the files , but it does not specify where to copy them to or what to do with them, only where to find them.
    http://www.cubiquity.net/cubiquity-for-unity3d/1.2/docs/page_installation.html
     
    Last edited: Jul 21, 2015
  16. JonnyHilly

    JonnyHilly

    Joined:
    Sep 4, 2009
    Posts:
    749
    hrrrmm looks like there is a class Region, and same named class in Photon networking. shazbot!
     
  17. TheXWolf

    TheXWolf

    Joined:
    Dec 13, 2013
    Posts:
    85
    Those are all only examples, you can reference from them and write your own code without needing them actually in your project folder. Maybe keep a copy on your dtop or some folder to look through. The normal cubiquity system doesn't use a 'region' method.

    Edit: Oh good no one replied I don't have to post again.
    Just curious, is there a way to create a cube type terrain from the normal terrain volume?
    Since the MaterialSet is what I would really be using the noise with, is there a way to normalize it? (I don't mean the same functions of course, just wondering if that would work.)
     
    Last edited: Jul 22, 2015
  18. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    Right, thanks, I wasn't aware of this problem. All of the Cubiquity code is contained in the 'Cubiquity' namespace which should prevent such conflicts, but I suspect the problem is that the examples contain a 'using Cubiquity' directive. This means it is actually the Cubiquity examples which are failing to build and the main system itself is probably working fine (as @TheXWolf said). I should still this, but in the meantime just try not importing the examples.

    I still don't have access to my main dev machine so I haven't been able to verify the above, but I've logged it here: https://bitbucket.org/volumesoffun/.../81/using-cubiquity-causing-build-problems-in

    I'm afraid I don't quite understand what you are trying to achieve here. Given a TerrainVolume you could create a ColoredCubesVolume of the same size, and you could then iterate over each voxel and copy a value across. Of course, you then have to convert a MaterialSet to a single color and it's not quite clear what is expected here.

    You refer to noise, but you can also use noise directly to fill a ColoredCubesVolume. Can you elaborate on what you re trying to do?
     
  19. pushingpandas

    pushingpandas

    Joined:
    Jan 12, 2013
    Posts:
    1,419
    Hello, your asset is awesome. I have a question. I opened ColoredCubesExampleScene and Iam blown away - but - how do I modify the voxel map? I added blocks in the editor and saved but as soon as I press play again my changes are gone. I understand its loading a voxel database? But how can I change the database?!?
     
  20. TheXWolf

    TheXWolf

    Joined:
    Dec 13, 2013
    Posts:
    85
    I was actually thinking the other way around, create a cube shaped Terrain volume, but I'm not sure how I would do that with a material set. I can easily use noise over a colored cube volume and set the color based on where I'm placing it, but I'm not sure how the weights and material sets work if I were to make everything square-ish. I'm not saying convert one to another, just how would I create a TerrainVolume and have it shaped that of a ColoredCubeVolume (not the colors.)

    I just really like the system and I'm experimenting with stuff.
     
  21. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    Thanks! This reminds me, it would be great if experienced users could rate Cubiquity on the Unity asset store :) You can also leave a review if you like, but just rating should only take a moment.

    I recall that the examples are set to read-only mode (you might see a warning by the editing tools)? See the third and fourth paragraph of 'Rules for VolumeData instances and assets'. If I remember correctly you can change this through the editor, but you might need to close the scene and possibly restart Unity. Any new volumes you create should not have this issue.

    MaterialSets are actually fairly complicated (but flexible) and do take a lot of getting used to. Make sure you read 'Practical tips for procedurally generating MaterialSet values' on this page. The main points are to start off working with only a single material, and to make every voxel fully on or fully off.

    A single voxel cannot be a cube when working with MaterialsSet/TerrainVolume, but you can build a large cube out of multiple voxels (e.g. 10x10x10). Note that the edges won't quite be right angles but it should be close enough as the cube gets large.

    Experimenting is the best way to learn :)
     
  22. JonnyHilly

    JonnyHilly

    Joined:
    Sep 4, 2009
    Posts:
    749
    Hi I just bought this tool. Great stuff ! just learning and playing now....
    nice performance !

    I have a few of questions....

    1. The color cubes seem to use a normal mapped shader... I'm assuming the UV's on every voxel are 0,0 to 1,1 on opposite corner of each quad face. How hard would it be to make that material an atlas of say 4x4 = 16 textures and normal maps.... so that as well as color, a different texture could be on each cube ?

    2. is it possible to have any semi transparent colored cubes ?

    3. When taking about importing external voxel data, the docs say... "Note that these maps are expected to have dimensions of 512x512x64 voxels."
    Does that apply to all of the different import formats ? or just the Voxlap format ?
    What happens if the data is not in this size ?

    4. the docs say to import from Magica...
    ProcessVDB.exe -import -magicavoxel input.vox -coloredcubes output.vdb
    But I am on a mac... How do I do this on a mac. Using Terminal and browsing to the OSX folder... trying to execute ProcessVDB results in error "command not found"
    any ideas ?
    Thanks
     
    Last edited: Jul 23, 2015
  23. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    Great! But you didn't actually buy it, right? It is a free download on the asset store. I'd hate to think someone else was reselling it somewhere?

    The real problem here is that the cubic voxels only contain color data and do not contain any kind of material identifier (Cubiquity is not intended to look like Minecraft). I'm not intending to change this, but you may be able hack together something which maps particular colors to particular textures. you'll be outside of the intended usage though ;-)

    The colored voxel have an alpha channel which you can set but it is not currently used. Basically it's just reserved for if/when we implement transparency in the future.

    That's just for the voxlap format as I've only tested with maps from the game 'Build and Shoot'. I think those maps have a hard coded size.

    If you have changed into the required folder then you probably need to add './' at th start of the command. This probably works on Windows too so I should probably change the docs.

    Code (CSharp):
    1. ./ProcessVDB.exe -import -magicavoxel input.vox -coloredcubes output.vdb
    Please do let me know if that works.
     
  24. JonnyHilly

    JonnyHilly

    Joined:
    Sep 4, 2009
    Posts:
    749
    Thanks much for the quick answers, haha no I didn't buy it, but I bought several other items off the asset store at the same time... (you should sell it though, or maybe when finished, if it is still under development)

    Understood about hacking the UV's. I'm looking for more of a borg spaceship look than mine craft ;)

    I'll try out the import a bit later and report back, thanks much !
     
  25. JonnyHilly

    JonnyHilly

    Joined:
    Sep 4, 2009
    Posts:
    749
    No luck I'm afraid.

    After browsing to the SDK, or SDK/OSX folder ... typing ./ProcessVDB gets a Permission Denied response...
    if I use sudo to force admin privileges, I just get a 'command not found' error

    If I just double-click ProcessVDB, it opens a garbled text file in TextEdit... I'm pretty sure a program shouldn't do that ?

    where should the .vox files be ? I've tried both in the SDK/ folder and in SDK/OSX

    btw, it does not have .exe extension on mac (it has none) but I think thats ok on mac, but the instructions say .exe

    tried copying whole SDK folder outside the unity project, got same results.

    Any otter thoughts appreciated .

    Have any other mac users tried this tool?
     
    Last edited: Jul 24, 2015
  26. JonnyHilly

    JonnyHilly

    Joined:
    Sep 4, 2009
    Posts:
    749
    ok got it to work on a PC, with the added instructions, of CD to the x86 or x86-64 folder, and copy the .vox file into that folder (for easy path directory)
    Still no luck on a Mac though

    When trying to create new asset in the game though.. I get error '"VoxelDatabase does not have the expected VoxelType of 'MaterialSet'" is there a way to ensure this exists when making a Magica file ?
     
    Last edited: Jul 24, 2015
  27. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    About to lose WiFI so have to be quick, but this means you have tried to add ColoredCubesvolumeData to a TerrainVolume. You need to add it to a ColoredCubesVolume instead.

    I'll answer the other questions soon.
     
  28. JonnyHilly

    JonnyHilly

    Joined:
    Sep 4, 2009
    Posts:
    749
    Thanks again for the prompt replies ! :)


     
  29. masterchafe

    masterchafe

    Joined:
    Oct 2, 2011
    Posts:
    59
    Yeah, restarting Unity didn't get rid of them, even restarting windows didn't help, and with no gameObjects in the scene at all they were still visible in the editor and in play mode. The only solution was to copy all gameObjects from the scene, and paste into a new scene file. It hasn't happened again since then, but I also haven't been editing any of them either! :D
     
  30. JonnyHilly

    JonnyHilly

    Joined:
    Sep 4, 2009
    Posts:
    749
    OK Got it working ! yay !
    Yep a few steps, but gotta make sure both steps use ColoredCubesVolume. From both the Create-> menu and the Gameobject-> menu. !! Thanks much!

    If anyone manages to get ProcessVDB working on a mac though... would appreciate the info on how.

     
  31. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    Hi guys,

    Good news - I finally have access to my development machine and proper internet again! I'm living back in the UK and things are starting to get a bit settled, but the next couple of weeks are still going to be busy with unpacking, the new job, etc.

    Actually we were, but then we decided to release it for free. We're still undecided what commercial opportunities to pursue in the future. We won't actually take anything away though. See a bit more here: http://www.volumesoffun.com/cubiquity-for-unity3d-is-now-free/

    I've logged this as an issue but it may be a while before I look at it as I will have to work through a virtual machine (no access to a real Mac). I'm pretty sure I did test it as part of the release process but I'm really not a OS X expert and may have inadvertently tied it to my own setup (hardcoded paths, or something like that).

    By it's very nature Cubiquity creates, deletes, and modifies a large number of meshes and I am aware of a few problems and places where this could be improved. Most importantly it should make proper use of pooling to reduce resource usage. Once I refactor some I these things I hope the issue will get resolved.
     
  32. Daimonicon

    Daimonicon

    Joined:
    Jul 27, 2015
    Posts:
    3
    I have a little playing around with the " Terrain volume ".
    I'm really excited what you can do with it all.

    With the script "ClickToCarveTerrainVolume.cs" you can blow up holes in the terrain, but my question would be ?

    Would it be possible to remove a fixed amount of terrain by script ?
    To realize a dig with a shovel or pickaxe ?

    So almost cutting out a solid block of the same size ?
     
  33. TheXWolf

    TheXWolf

    Joined:
    Dec 13, 2013
    Posts:
    85
    That right now is my only limitation, I'm creating a volume that's 500x500x100
    and even a section that's 100x100x50 shows some slowing. Design time I can simply
    do it in pieces, but at some point during run time I'm going to have to fill those holes and
    it can get slow, even on a machine like mine, so someone without a good PC would suffer.

    Is there a "good" way to go about using setvoxel on large areas at a time?
     
  34. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    Yes, you can do something like this. It's basically just a scaled-down version of the code for the explosions. You need to determine where the user has clicked in 3D space and then add or remove material to the surrounding voxels.

    The biggest issue to be aware of is the resolution of the voxel data. If each voxel is one metre (the default) then of course you cannot make holes which are 10cm big, but you can make holes which are 2-3m big. If you want smaller holes you can scale the terrain but this reduces the maximum size of the terrain (which is already quite limited).

    If you are creating a world by calling SetVoxel() on every voxel in the scene then this is indeed going to be slow. Instead you should save your data to a VDB file and simply load that at runtime. Loading an existing .VDB is *much* faster than trying to build up a scene via calls to get voxel (try loading the built-in city map to see how that compares)

    Of course, this won't help if you are trying to generate your scene so that it is different each time. Cubiquity is much more optimised for loading a pre-designed map from a .VDB file. There are improvements which can be made to SetVoxel() (e.g. so that you could provide an array of voxels all at once to reduce the number of function calls) but you cannot make these improvements yourself.

    If that doesn't answer your questions then you will need to be a bit more specific about exactly what you are trying to do.
     
  35. TheXWolf

    TheXWolf

    Joined:
    Dec 13, 2013
    Posts:
    85
    I'm trying to do a bit of both, my terrain's are huge and just clicking to build the underground part (which is close to 100 deep and 500 wide) takes too long to do via SetVoxel() and even harder to do in the editor because of the way the Add system is. Once it's made I won't have to edit more than 5-10 blocks at a time during runtime; but I need either a better way to form large areas, or a way to edit information within the VDB.

    Right now I'm importing a vdb from terravox but the problem is Qubicle and VoxelShop don't import or export vox properly, and the processvdb you have doesn't import vox unless it's from MagicaVoxel. So I can basically only edit the top of the terrain. The whole issue I'm having is placing the large area under the terrain. If there way a way to merge data or combine volumedata's or VDB files...any of those solutions would be great. It's simply the problem of the amount to draw.

    Right now, even a Y of 1 is 250k blocks to edit.
     
    Last edited: Jul 30, 2015
  36. Daimonicon

    Daimonicon

    Joined:
    Jul 27, 2015
    Posts:
    3
    Ah, thanks for answer

    Good starting point - Have a look for explosion stuff
     
  37. TheXWolf

    TheXWolf

    Joined:
    Dec 13, 2013
    Posts:
    85
    Another good way to bypass that is to use the explosion example, without the force of course. But instead of scaling the terrain you could scale up the player. That way the terrain appears smaller, and instead of a player taking up a single meter (1 block) of space, the player could then be standing on 2-3.
    If you want the player to be similar in size to MC, you could of course use loops to go over the amount of blocks, or use a method to cut out a shape. :cool:
     
  38. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    @TheXWolf - VDB files are indeed SQLite databases and can be opened in any SQLite viewer. However this isn't much use as each chunk is just chunk of binary data and there is no documentation of the format (this is basically all still implementation details). It's not a secret though and isn't encrypted, but properly exposing more details takes time.

    However, what you can do is create VDBs through C# code in Unity and save them to disk as .vdb files. See this example:
    So if you can get you data into Unity in any way at all (proc gen, your own custom import scripts, etc) then you can convert it to a VDB. Note that the example is actually for a TerrainVolume but similar ideas apply for a ColoredCubesVolume.

    Before you get started I would recommend you try some of the sample .vdb files to make sure the performance is enough for you.

    Hope that helps?
     
  39. d4

    d4

    Joined:
    Jul 4, 2014
    Posts:
    2
    Hello, is it possible to render voxels up to specific Y-level to create a similar effect as shown here
    ?
     
  40. TheXWolf

    TheXWolf

    Joined:
    Dec 13, 2013
    Posts:
    85
    The problem still entails using SetVoxel() for everything, and when a volume is 500,50,500 it locks up unity (even with the 32g of ram on my system) because it can't compute that much data. I can do it 10x10x10 at a time, but that would take way too long for a volume that size, especially if I need more than one. Unless I'm missing something, is there a way to set all that information without using setvoxel?
     
  41. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    I think you can do this already with a custom clipping plane and/or shader tricks. I don't think you should actually add or remove voxels to achieve this effect. The most difficult part will probably be 'closing off' the top of the mesh after you have used a clipping plane to slice the volume in half, but I'd still suggest that such rendering tricks are preferable to actually modifying the voxels.

    I think something else must be wrong here because it should not be that slow. Can you try the 'Assets\Cubiquity\Examples\CreatingVolumesFromCode\MazeFromImage' example? It uses SetVoxel() to build a volume which is 320x32x320 and it only takes a few seconds on my machine. How long does it take for you? Can you see what your code is doing differently?

    We should fix the above first, but if it is still too slow then my previous point was that you can run the slow generation on your machine, write the result to a .vdb file, and give that to your end users. So in this case they don't need to run the generation themselves.

    There are only two ways to fill a volume with data. Either you attach it to a .vdb file or you fill it via SetVoxel(). There is currently no way to set multiple voxels at once although that might be an interesting future addition (e.g. from an array).
     
  42. TheXWolf

    TheXWolf

    Joined:
    Dec 13, 2013
    Posts:
    85
    @DavidWilliams Well I tried a chunk in for(int x = 0; x <= 100; x++) loops for x z and then y <=59 and that took 3.5 mins, if I try the 500x59x500 I'm trying to actually do it will act like it's working for 5-10mins but not respond.

    I looked through the mazefromimage script, and all I see SetVoxel() and yet Idk what the difference is from what I'm doing.
    I'm going to PM you the basic script I'm using, and u can tell me if u see an issue.
     
  43. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    I don't see anything obviously wrong with your script, though I that you call 'new QuantizedColor(...)' with every call to SetVoxel(), whereas my code creates the QuantizedColors in advance (just a few of them) and passes these existing objects. It doesn't actually seem to be the problem through.

    I suggest you start from the maze example (assuming it does run fast for you?) and simply modify it a bit at a time to bring across your changes.
     
  44. d4

    d4

    Joined:
    Jul 4, 2014
    Posts:
    2
    Thanks. Modified the colored cubes shader, added clipping plane. Filled top voxels (although the mesh generation needs to be optimized, currently every voxel has its own mesh). The lighting/shadows are currently affected by the clipping plane, need to see if I can fix it. Here's the result:
     
    TheXWolf likes this.
  45. TheXWolf

    TheXWolf

    Joined:
    Dec 13, 2013
    Posts:
    85
    @DavidWilliams So I took a moment to try to figure out why ur example was so fast and mine wasn't, turns out it was just the [ExecuteInEditMode] which I missed the first time I read through it. For all of that to happen during runtime is painful for unity, but in editor takes less resources. I did a 500x50x500 are in about 3 secs. Thanks very much.

    @d4 That's awesome, I wish I knew about shaders, I'd like to fiddle with what Cubiquity uses.
     
  46. CommunityUS

    CommunityUS

    Joined:
    Sep 2, 2011
    Posts:
    240
    I noticed PolyVox source is out there from you guys: http://www.volumesoffun.com/polyvox-about/

    How modified is PolyVox compared to the DLL in Cubiquity? What if you opened up only the portions of the code that would let others help make this work on mobile since mobile is such a low priority?

    I agree with the sentiment that Unity is popular because you build once and can deploy everywhere. If you Unity is your target I hope mobile support gets more attention soon. You may be loosing people by not addressing it. For instance I am going to start playing with the library you mentioned earlier in this thread rather than this because it doesn't have mobile on any timeline. I am sure I am not the only one.

    Many can help with shader support, and nowadays there are a lot of strong C++ users of Unity.
     
  47. tawdry

    tawdry

    Joined:
    Sep 3, 2014
    Posts:
    1,357
    Time for some necro thread skillz. Just dl this using unity 5.2 and when i try to add terrain volume or the colored one nothing happens does not add to the hierarchy either.
     
  48. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    Sorry I didn't reply to this, because it is really, really, cool. It's a shame you have to generate so many additional quads but I wonder whether you can use a rendering trick to draw a single large texture mapped plane, and then cut away using the stencil buffer or something. I haven't thought through the details but I feel something should be possible.

    Cubiquity is built on an unmodified version of PolyVox. PolyVox provides the core algorithms (surface extraction, etc) and Cubiquity links this together with SQLite, adds (currently limited) octree support, provides a C API, etc. PolyVox alone is not enough.

    We have recently released Cubiquity for Unity for free and it is quite possible that we will open more things up in the future. But it's really undecided at the moment, and I'm not finding time to give it the thought and investigation it needs. I know it's frustrating if you use another system and then we open things up in a few months, but it's better than if we promise something and don't deliver. So for now you just have to accept the system as-is.

    Do you have a TerrainVolumeRenderer or ColoredCubesVolumeRenderer attached? Does the Quick Start guide work if you go through it step-by-step?
     
  49. CommunityUS

    CommunityUS

    Joined:
    Sep 2, 2011
    Posts:
    240
    Perhaps an idea of what the price point and license would be if you decided to sale the full source for the C++ bits, would help people make a determination ahead of time.

    If this open source buy in group, had their own private repo they could contribute to as a community. And you started being able to put together a rough timeline. You might get past some of the road blocks you have setup now for newcomers.

    So long as the source code price was slated to be no more than $X.00 and I felt I was okay with X. And I knew I could affect the timeline with a community of others. I might buy in. But now, I am left without enough information that I can't really make any engine decisions or even road map version 2 of the internals and slate this for that...as we have nothing to go off of.
     
  50. tawdry

    tawdry

    Joined:
    Sep 3, 2014
    Posts:
    1,357
    I first run the empty scene with lighting this gives a empty scene with a camera and light.Then i select Gameobject Create other terrain volume and nothing happens.The demo scenes have a terrain in the hierachy but no terrain visible.. Don't see a terrainvolumerenderer anywhere to attach and as mentioned don't have a terrain to attach anything too.. Creating a terrain and selecting terrain volume also does nothing. Is this a support product for some other voxel package?