Search Unity

Liquid Voxels

Discussion in 'Works In Progress - Archive' started by Ellandar, Apr 26, 2014.

  1. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    I'm not really using it myself but I'm always interested to see what people are doing with voxels. But driving interest is hard - perhaps you should move to get it on the asset store (even in a limited form) to get more publicity?
     
  2. HeadClot88

    HeadClot88

    Joined:
    Jul 3, 2012
    Posts:
    736
    So just curious would it be possible to use this in a 2D Environment or even another asset like Pixel World Engine?

    Or is it a purely 3D approach to Voxel water?
     
  3. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Thanks David,
    You are right I probably should just clean up the doco & code and release it on the store. I'm really trying to drive features by feedback but the feedback is challenging to get :)

    @HeadClot88. Good question. Being a data driven simulator I don't see why it wouldn't work in Pixel World Engine.
    It's on sale today so I might grab a copy and see how it goes. I'm hoping that I just provide an interface and setup a region that is X,Y,1 in size and see how it goes.

    I'll let you know.

    - Ell
     
    HeadClot88 likes this.
  4. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Just took a look at Pixel World Engine. It doesn't give a clean way of retrieving voxels (pixels is what they call it) easily. I promised my wife we'd go to the movies in 30 minutes; so when I get back I'll build an interface to talk to it. I have a few ideas already so I don't think it'll be super hard.

    It will require a change to the Pixel World Engine, since I'll be using their water blocks to create water, we will need to turn off their own liquid engine for mine to work. Otherwise they will fight each other.

    - Ell
     
    HeadClot88 likes this.
  5. HeadClot88

    HeadClot88

    Joined:
    Jul 3, 2012
    Posts:
    736


    Awesome - Cannot wait to see what is going to come out of this. :D

    Hopefully that is all that is wrong with Pixel World Engine.

    I just bought it myself so - I am really looking forward to getting a decent liquid Voxel solution. The one in Pixel World Engine seemed a bit hackish TBH. But the overall asset fits my needs :)

    That said - I cannot wait to see what you come up with.

    I follow this with anticipation. Have a great time at the movies :)

    - Ben
     
  6. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Ok, back from movie.
    Interstellar is one long movie! By the end I felt like I was watching A Space Odyssey, it really had that 'looking at our inner humanity' feeling. IMO, good movie, go watch it if you have over 3 hours to spare.

    So, back again and starting on this integration with Pixel World. Like I said before, this should be fairly quick and I hope to have it wrapped up in an hour. Pixel World isn't written to have other scripts interact with it at all really, so I fully expect this to break the moment the author releases the next version :)

    Anyways, here goes, see you on the other side.

    - Ell
     
  7. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Managed to get it interfacing with the Pixel World engine, albeit a little bit buggy.
    My interface is not quite detecting solid pixels/voxels all the time reliably and due to the difficulty I had in determining how Pixel World defined it's bounds. My simulator happily simulated water right off the map, and when it tried to draw the water it failed due to going out of bounds.

    I'll drop a message on the Pixel World forum asking for a GetPixelAtWorldLocation, and SetPixelAtWorldLocation style public methods as that's far better than me editing the PixelWorld scripts because I really can't make those available to others.

    I'll give it another run over tomorrow night; but at this stage it's not really usable due to the above problem, I have to raycast a lot or dig into the code a bit more than I have the time for tonight.

    - Ell
     
  8. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Greetings everyone,

    I'll be releasing liquid voxels onto the store in the coming weeks. I'm working on documentation, some help pages and some demo scenes to get people interested in the engine and to show how it can be used.

    Today's neat tid-bit: I created a new interface for cubiquity that allowed me to render the liquid in a different terrain to the main terrain. This means the water won't cause the whole terrain mesh (in that chunk) to update each time it moves, and as a huge bonus, removing the collider from the water terrain will double your performance.

    Here's a couple of screenshots, the front page will be updated with a new demo exe too: LiquidVoxel Demo 4.jpg LiquidVoxel Demo 10.jpg LiquidVoxel Demo 11.jpg


    - Ell
     
  9. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Documentation coming along.

    I had a friend sit down with me and watched him during his first ever viewing of LiquidVoxels and basically wrote down all the problems/questions/trouble he had when first using the engine. I'm now going to do some re-factoring to simplify the engine a tad for those that want to interact with the simulation in code.

    Also looking into business names etc so I can begin the trek to the asset store.

    - Ell
     
  10. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    Looking very pretty! The new demo ran fine for me though I didn't see the clouds dropping any rain. Did I have to do something to make this happen? The waterfall looked nice though :)
     
  11. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Heyas David,

    Thanks very much. The clouds need to float over the voxel terrain before they will drop their water so you need to stick around long enough for the clouds to meander onto the landscape.

    I just finished adding transparency to the water terrain shader so I might upload a couple of screenshots using that shortly too.

    - Ell
     
  12. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    I got lucky, clouds spawned overhead :)

    CloudsPlusTransparentWater.png
     
  13. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Oh! I was supposed to supply the shader.

    For those that want water in their cubiquity terrain, first add a second terrain to the scene then add the attached shader to the terrain (by creating a material first, attaching the shader to it and then attach the material to the cubiquty terrain).. Then when adding/removing water to your game ensure you update the second terrain (the one dedicated to water) instead of the primary one. Whilst you are at it, why not use LiquidVoxels to do the water...shameless plug in my own thread! :)


    - Ell
     

    Attached Files:

  14. Jesse_Pixelsmith

    Jesse_Pixelsmith

    Joined:
    Nov 22, 2009
    Posts:
    296
    My question on Cubiquity forums led me here... still treading through the thread but all I can say is "Wow" this is quite awesome!

    In regards to my interest, I am planning to use Cubiquity with smooth voxel terrain, and I was curious about options to represent liquid with that. David mentioned that you might be considering supporting smooth terrain, and I was wondering what you might think of the method I described at the bottom of the post:

    http://www.volumesoffun.com/phpBB3/viewtopic.php?f=23&t=619&sid=defc45a55ab277d9d6a744cad843d4e0

    Cheers!
    Jesse
     
  15. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    G'day Jesse,

    Thanks very much. Still finishing off the asset, there's quite a bit to do. Being able to create regions (that contain water) at runtime as opposed to having them setup already is a big one, along with some way of serialising the data; at the moment there's no save functionality.

    Just had a read of your idea and it looks doable. I wasn't 100% sure if you were thinking of having cubic water on a smooth terrain or if you wanted smooth water on a smooth terrain?
    The smooth water is probably doable, but would need the renderer to fill the block from the bottom as opposed to the top of the cube, otherwise we'd end up with blobs of water floating in the air :)

    I have tried cubic landscape with smooth water before here: http://forum.unity3d.com/threads/liquid-voxels.242821/page-2#post-1774047
    but not the other way around. It wouldn't be super hard to flip the two once you are familiar with the way LiquidVoxels interfaces to other engines, it'll take a bit of learning though and the docs aren't around to help yet.

    I'm on holidays at the moment so if I can get some time in the next few days I can try it out as it would only take me an hour or so at most. I'm also working on an interface with UniBlocks as well at the moment (which is working, i'm just making it more performant now).

    - Ell
     
    Last edited: Dec 18, 2014
  16. Jesse_Pixelsmith

    Jesse_Pixelsmith

    Joined:
    Nov 22, 2009
    Posts:
    296
    Hey Ell,

    Thanks for the reply. My ideal situation is to have smooth water on smooth terrain, as close to "Realistic" in rendering as possible :) I hadn't seen some of the stuff you did with Cubiquity's smooth terrain for water when I posted.

    The reason for my crude illustration was just saying that in terms of accuracy I wouldn't expect to have the smoothed factor of the terrain to actually affect the displacement of the volume of the water - like something crazy like this:
    - but rather if it makes things easier, just do the volume/displacement calculations based on 3d array, rather than handling collisions for millions of particles, which seems to be what you're doing.

    I'm sure these techniques are worlds apart, but when I started investigating how to have 3d water that didn't look like Minecraft cubes, that was all I saw, and all indications are that that won't be possible on a game scale for quite a while.

    The closest thing I've seen to that level of realism in a game was in From Dust, and it looks like a similar technique is being used for Surface Waves in Unity: https://www.assetstore.unity3d.com/en/#!/content/19139 - however the major drawback to these approaches, if I understood correctly, is that water can only be mapped to a heightmap, similar to terrain - which obviously would cause issues in a freeform voxel type of game.

    However, looking at your link:
    - it seems you can do a similar technique to Minecraft etc for calculation but smooth the edges for rendering. And this is awesome in itself and probably usable in my game concept, it still has very noticeable hard edges. Is it possible to have some kind of filter on the edges to smooth that out or does that become too expensive?

    I'm still trying to wrap my head a bit on how the smoothing in cubiquity/marching cubes works I guess.

    For instance I did this yesterday:

    As I say in the video, I generate the island on a per voxel basis - and it's still somewhat jaggy - similar to your smooth water - but I can go in and manually smooth it and make it look better.

    I'm searching for a way to automatically smooth it to this degree, and maybe that same solution (if it exists?) could work with the liquid as well?

    That would be amazing :p
     
  17. Jesse_Pixelsmith

    Jesse_Pixelsmith

    Joined:
    Nov 22, 2009
    Posts:
    296
    Oh another caveat is that the games I'm doing are multiplayer - so I would imagine that the server can do the calculations for the water and pass on the updates to the clients. Any big issues with that?
     
  18. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Hi Jesse,

    That techdemo was one of the things I looked at when building the simulator, they are a good group! In fact, have a read of my water blogs (in my sig) if you want to see some of my approach decisions.

    Before getting too deeply into all of this, the simulator isn't finished yet and has some big holes that will cause you problems. It doesn't yet have a save option, or give you an easy way to request the state to save it yourself, whilst not hard to put in, it's not there yet. It also isn't released & fully supported yet, it's a hobby of mine and I'm still arguing with myself if I have the time to actually support this product properly.

    The two big questions you have:
    Can water be smoothed?
    Yes, absolutely. In fact David suggested that at one point in this thread. I've split the simulator up into 3 main areas: Interfaces with Voxel engines, simulator engine, plugins.
    The way it works is the simulator simulates the water in it's array, and that's all it does. Next the plugins all get run, one of which is a renderer plugin which uses an interface with a voxel engine to draw the voxels. There's two approaches you can do to smooth the voxels.

    1. In the renderer plugin copy the existing renderer and in it's draw loop, have it sample the water blocks around it and set a byte value that is the average of them all. This will give you fairly good smoothing at near 0 RAM cost.

    2. In the renderer plugin again, setup your own 3d array that takes a copy of the main simulators 3d array at the point in time you want to render, and run an averaging algorithm over that. Don't render the whole thing each time though, that'll be too costly. Instead call switchrenderupdatequeue on the liquidvoxels datasource, which will switch the internal cache, and then call GetRenderUpdateQueue and that will give you a List<LVMetadata> of blocks that were updated. Loop through the list calling .Location on each of the objects in that list, and that will tell you the array location that should be re-rendered.

    Point 2 would be a little more complicated to setup but would run faster and give a more accurate/smooth render.

    I'm not sure if I've exposed enough methods to do point 2 correctly (size of region, so you can create your own array, or a query to get all blocks, not just updated ones). I'll take a look once I get the kids breakfast sorted :)

    Multiplayer:
    Hmm, very good question, I don't see why it wouldn't work though. In fact the plugin system is perfect for this. I would take the existing renderer plugin and instead of rendering blocks have it serialize all the locations and send them to the client(s). The client can then have a renderer that updates the water there.


    Good luck, I'm here to help and will probably write some of these for you if I manage to get into it today. My son is sick today and he's fairly high maintenance due to a condition he has, so I probably wont get into it today or tomorrow.

    - Ell
     
  19. NathanHale1776

    NathanHale1776

    Joined:
    Mar 22, 2014
    Posts:
    46
    help with this for Uniblocks please?
     
  20. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Hi Winter,

    I had planned on having integration with Uniblocks done a couple of weeks ago. Unfortunately I've been really sick for the past week and a bit and unable to do much, let alone program (it lead to me being a bit of a disappointing dad this Christmas :( )

    I'm coming out the other side and can start looking at programming in the next few days. I actually have a working copy of liquidvoxels with uniblocks, there's just somethings that need optimising and bug fixing. Also i don't think i'm querying uniblocks in the most efficient manner yet either.

    How have your attempts worked out so far?

    - Ell
     
  21. NathanHale1776

    NathanHale1776

    Joined:
    Mar 22, 2014
    Posts:
    46
    Hi Ellandar, frankly I just have dynamic water in place right now, not proper voxel water because I've no clue how to do it lol. Looking forward to seeing yours when you can tyvm :)
     
  22. NathanHale1776

    NathanHale1776

    Joined:
    Mar 22, 2014
    Posts:
    46
    Hi Ellandar, any news?
     
  23. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Hey dude,

    It's taken me longer to get over this sickness and get motivation to do much other feel bad.
    I'll try getting into it again soon. The interface to uniblocks currently bogs down to 1 fps at around 800 water voxels; so whilst it's working okay I need to make it far more performant to be any use for anyone.

    Also this simulator isn't ready for prim-time yet, it still needs work to get it saving and spawning new regions at runtime etc.

    Getting there.
     
    NathanHale1776 likes this.
  24. Kilari

    Kilari

    Joined:
    Oct 20, 2013
    Posts:
    13
    Hey Ellandar, I just recently found this asset of yours and I've fallen in love. I've been looking for some way to get nice flowing liquid voxels for a while now, and now I want to see if I cant get this to integrate with Uniblocks, which is what my main project uses right now. Just so you know I would gladly throw a bit of money at this asset if it was for sale!

    Would it be possible for me to see what youve got working with uniblocks so far?
     
  25. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    G'day Kilari,
    I'm very pleased that you like it!

    I had to take a step back from the simulator for a while whilst work demands ramped up causing me to work a lot of personal time too (plus kids and partner needs some too, I guess, hehe). I expect this to drop off by mid May and I can begin enjoying and working on this asset again. This is the main reason why I haven't released it yet, as it would be totally unprofessional to release something and not support it. Having said that, I've had a few people getting in contact with me around Uniblocks integration so if I get time this weekend I'll have another look at it.

    Uniblocks integration has been a little challenging, mainly due to the load that the water simulator puts on the Uniblocks. It's not uncommon to have 5000 - 9000 water blocks being simulated, of which 60-70% are often active, this means a heavy number of calls into Uniblocks asking for terrain information (upwards of 60,000 per second). As the amount of water raises the FPS drops rapidly, quickly making any game unusable.

    The problem (I believe) is the call used to locate the block is one of the heavier calls in the Uniblocks asset, so I'll be looking at implementing a cache to deal with this as much as possible. Once I can pour more time into it, I'll get in direct contact with the Uniblocks creator to see if I'm just doing things badly. The Uniblocks creator is a great person and has been incredibly helpful with my first integration effort.

    - Ell
     
    Kilari likes this.
  26. Kilari

    Kilari

    Joined:
    Oct 20, 2013
    Posts:
    13
    Glad to see you're still around at least! And I would have to double up on that compliment of the Uniblocks creator. He's always been extremely quick to respond to any inquiries I have.

    Do you know if the interface LiquidVoxels has with Uniblocks would work well with the multiplayer server functionality Uniblocks has? Seems like it might work out of the box provided the server is the one doing the liquid calculations.

    Please keep us(me) updated!
     
  27. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    If the server is the one that controls what blocks appear and disappear and all the client does is receive updates then I expect running the simulator just on the server would do the trick, yes.

    The client would probably need to create water by sending a "create water" call to the server or handling that via your serialisation somehow as the server will need to inject the water into the simulator due to the simulator not running on the client. ie. a new water block being added by the guest would need syncing to the server in a way that the server could add it to the voxel world and the liquid simulator.
     
  28. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    A few weeks back I wrote a very simple data logger for liquid voxels which lets me send an array of information to a method, which will write that array to a new line in a csv file.

    The result is I'm now able to get some profiling from the simulation. The reason I did this is because it's very hard to use the Unity profiler to determine bottlenecks when the profiler itself is a significant factor in the time taken to do work as there are often 6-9k calls in a single frame is a tight loop that the profiler gets into and makes even bigger.

    The outcome is a CSV file that with some Excel manipulation can produce the below picture.
    Top color (left Y axis)= Water voxels in the simulator
    Bottom color (left Y axis) = Awake water voxels (voxels sleep when they aren't updating to save cycles)
    Line (right Y axis)= FPS


    LiquidVoxelsProfiling.png
     
  29. Kilari

    Kilari

    Joined:
    Oct 20, 2013
    Posts:
    13
    Looks extremely promising- Do you have any ETA before you'll be releasing this? Cant wait =)
     
  30. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    May/June will be the official release; although I might release a new beta considering how far away it is. It'll take quite a few hours to build a release due to the testing and cleanup that needs to happen for a release so I won't promise anything yet.

    Just a heads up that I've restarted some work on uniblocks today and will put some time in tomorrow as well. Fingers crossed I nail the interface quickly.

    - Ell
     
  31. Kilari

    Kilari

    Joined:
    Oct 20, 2013
    Posts:
    13
    Well I'm hoping you do get around to releasing a beta before then. Cant wait to add this to my project and get to playing with it. I'll definitely be buying this once it is out
     
  32. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Hi Kilari,

    I did work on the simulator on the weekend, I ended up starting the interface to Univox from scratch just to see if I hit the same outcome (very low FPS). I did.

    There's two things slowing this down to unusable levels:
    Locate block and read values.
    Write block and update mesh.

    The mesh updates I've handled by allowing the user (or application if you want it to be dynamic) to change the number of mesh rebuilds per second each chunk does. Even at 1 per second it's very demanding on uniblocks.
    I made it run at 15 FPS with approx 1k blocks on the screen by turning off the collision mesh but that isn't really a good solution if you want to run a game!

    The locate block and read values thing is going to need some help from Maap (uniblocks dev), as I can't see a way around it. I'll send him a PM tonight with some info to see if there's an alternative method I can use.

    Either way, I'll use some of the Easter break to clean up some of the code and test the latest builds in Cubiquity, Uniblocks and Voxwell. Once done I hope to release another beta so people can see the changes made so far.

    -Ell
     
    Last edited: Apr 3, 2015
  33. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Hi All,

    Have just released Beta 1. See front page for details.

    The readme doesn't have install instructions for Uniblocks so here they are:

    Follow normal steps for setting up the simulator, but in step 5, instead of opening Cubiquity in the VoxelEngineInterfaces, open uniblocks. Don't do step 6. onwards.

    Next, open the standard demo scene for Uniblocks.
    Now follow: "Steps to create your own scene" in the readme.

    Edit: Forgot some steps (thanks Kilari).
    • First, download the attached texture sheet and place it in: Assets/Uniblocks/UniblocksAssets/Textures&Materials/
    • Select the existing texture and note the settings, apply the same settings to the new sheet.
    • In the Project window, navigate to Assets/Uniblocks/UniblocksAssets/Textures&Materials/ Select the texture sheet material and change the texture to the new one.
    • Now go to Windows -> Uniblocks: Block Editor.
    • Click New Block.
    • In Name, type "WaterBlock"
    • in ID type: "10" current default, can change it if you like. Setting is in the uniblocks communications interface.
    • In texture, use 1, 5.
    • Click apply.

    Now it should be right to go. The texture looks a little gawdy, but I just threw it together then, i'm sure you can do much better!

    As mentioned above, performance in Uniblocks needs some major work. I believe I can get it to be per-formant but it'll require a bit of work in the interface.

    Please let me know if there are any issues with the release, I only spent just over an hour on the packaging and release this time, so there are likely things I missed!

    - Ell
     

    Attached Files:

    Last edited: Apr 5, 2015
  34. Kilari

    Kilari

    Joined:
    Oct 20, 2013
    Posts:
    13
    Just downloaded it to see how it goes in Uniblocks!

    Heads up to anyone else trying, you have to also create a water block type. You can do this via the Uniblocks Block Editor (Window->Uniblocks: Block Editor). Youll likely have to add a water texture type to the texture map and set it to voxel id of 10, which seems to be the default Ellandar made.


    It does seem a tad bit slow right now, but I'll look around what youve done so far!
     
  35. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Ahh, yes! Thanks Kilari, forgot that step!

    Will add the additional steps above.
    -Ell
     
  36. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Received some good info from Maap and have updated the interface.

    Will do another release once I've done more optimisation but the attached interface is 30+ times faster than the previous interface. Water now flows at 10 updates per second and fairly smoothly.

    Download this interface and replace your existing one in: Assets\LiquidVoxels\Scripts\VoxelEngineInterfaces\Uniblocks

    EDIT: Just included it in the Beta 1 (minor update to 1.01)
    - Ell
     

    Attached Files:

    Last edited: Apr 5, 2015
  37. Kilari

    Kilari

    Joined:
    Oct 20, 2013
    Posts:
    13
    So I must say, I'm quite amazed at how much you sped things up there. I was a bit worried initially, but A+++ on the new version for Uniblocks!

    I do have a quick question- I likely would be able to test this fairly easily but I haven't gotten around to it and I'm at work right now. Will the engine recognize water blocks already in the terrain at the start? Say I generate a world with lakes in it, would it recognize those blocks so long as they are still voxel ID of 10?
     
  38. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Hi Kilari,
    Thanks, yes it was a dramatic speed up wasn't it, I expect I can make it faster still but I doubt it'll be in the same order of magnitude this time.

    I did have terrain scanning in the first version but it put huge delays in the startup (i'm talking minutes on really big terrains).
    There are also a couple of implementation problems, how do we handle infinite terrains, I'd also need to extend the interface to query the capacity of a voxel (how much water is in that location).

    However, adding this for uniblocks would be a great way to get a feel for the simulator if you were interested. I'd attack this as a non-LiquidVoxels script. At first glance, this is how i'd structure it if i were doing it:

    1. Create a co-routine that is started in Start(), it's job is to periodically check for new chunks in uniblocks, and if it finds a chunk, it should pass off to another method called FindWaterInNewChunk()

    2. FindWaterInNewChunk queries every block in the new chunk and every time it finds a water block it does a LiquidVoxels.AddVoxelTypeToLocation(VoxelType.Water, worldlocation, volumeofLiquid, true)

    That will seed the simulator.

    I'd suggest that point 2 is a co-routine too, if the chunk is really big it may be slow (it may not though, could be really quick).

    - Ell
     
  39. Kilari

    Kilari

    Joined:
    Oct 20, 2013
    Posts:
    13
    Thanks for the tip. Sounds like a good way to get my hands on with what you've created. Another question that popped up in my head just now that is of a similar sort-- Does it handle unloading of chunks? I might have to make something similar for the reverse side if that is the case.

    Ideally I would want to make each chunk its own region for liquidvox so I dont have issues with water falling off the world at least!
     
  40. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Hehe, good point.

    Ok, a small challenge in there, but here's how liquid voxels handles regions first.
    First, when configuring liquid voxels, there's an option for Region Size in the inspector. Set this to the same chunk size as you set Uniblocks (defaults to 8 I think...).
    Now all liquid voxels data will be stored in arrays the same size as a Uniblocks chunk. Good win there for performance too.

    Here's the problem; I haven't exposed load/unloading of regions in Liquid Voxels yet. If you delete a region (DeleteRegionAtLocation) in the simulator, it'll just re-create next time water wants to fall into that region, on top of losing control of all the water previoulsy in the region.

    I'd suggest, for now, to pause the region by : LiquidVoxels.GetRegionAtLocation(worldLocation).Pause(); Then unpause it when you want that region to activate again.

    The saving and unloading/loading of regions (well for the whole simulator for that matter) is on the todo list at the moment, Sorry Kilari.

    - Ell
     
  41. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Morning everyone.

    I have good news, the project I've been working on at work has gone live and it went very smoothly! I will now have more time at home to work on personal projects.

    Work on Liquid Voxels will begin again next weekend with the following short term goals for release:

    1. Fully implement and test pausing a region (so water can be paused if the underlaying chunk is unloaded).
    2. Full support for Cubiquity, Voxwell and Uniblocks interfaces.
    3. Save and Load of individual regions and full simulator.

    This is the 3 main items I am going to work through for go live. I expect there'll be some inspector cleanup and such but I don't want the list to be too big. I'm not going to give a release date yet until I'm sure I know the amount of work required for the above three, I'm hoping a couple of months at most. I also have some other things to sort out to actually submit to the asset store.

    Thanks for all those people sending PM's of support, and for those responding on the forums. It's really important to get updates from people using the simulator.

    - Ell
     
  42. kinnik

    kinnik

    Joined:
    Sep 6, 2014
    Posts:
    17
    Hey Ell! Great work your doing! Interactive water is such a rare treat!

    I just pick up Cubeiquity for my project and am totally in love. :) After making my first little world, I made a separate volume to mold in some voxel water (by hand). Looks SOO pretty with the Unity5 advanced water shader but it took me over an hour to brush it all in.

    Sure enough, during my obsessive delving into Cubeiquity's forum thread, I found the author's post about your project here! Commence further obsessing. :D

    Unfortunately for me, I'm not planning on using the ColorCubes volumes, my game will be entirely in smoothTerrain volumes. I was hopeful at first that I might hack some magic into your code to start building LiquidVoxels on top of a smoothTerrain by using a second smoothTerrain to render the Liquid. My hope lasted about 3 hours before I rage-quit. (lol)

    I found the SmoothLandCubicWaterComm and thought maybe you'd gotten CubicLiquidVoxels rendering (with ColorCubesVolume) on top of SmoothTerrain but I found that the SmoothTerrain volumes array didn't seem to be making it's way into the LiquidVoxel for the collision to happen. ?? Liquid was spawning in the simulator but not showing in the ColorCubeTerrain. I tried the meshRenderer and I could see the Simulated Liquid but it was falling though the SmoothTerrain.

    I also found your older SmoothLiquidVoxels on top of ColorCube terrain and downloaded it all to try out but it seems to be no longer working with your newst beta release.. :(

    Needless to say, my efforts to patchwork my own version didnt get very far on my first try.

    Anyway, AWESOME ASSET! I'm stoked to watch this develop!

    If you have any tips on how I might start in the direction of making SmoothLiquidVoxel on SmoothTerrain, I'd love to hear it as it may give me the courage to fight my way into your code again.

    Elsewise, I'll be lurking around here in anticipation of such a feature.
    Thanks heaps! Keep it up! -Kin
     
    Last edited: May 5, 2015
  43. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    G'day @kinnik,

    I'm happy you are enjoying messing with water, and yes I agree cubiquity is a very good voxel engine!

    The SmoothLandCubicWaterComm was an attempt at doing what you want, as @JesseAlexander also was after it.
    My biggest challenge was the logic required to determine where to put the water and how it should react. It's not that it can't be done, it's more that I'll need to make a new engine plugin to handle it.

    The problem is that in the smooth world it's hard to tell where exactly within the block the material is. For example, material in a block in cubiquity can have a density/volume of 172(?) to 255. This value is really easy to get, what is difficult to get is "where in the block is the mesh". Is this a bit of dirt on the ground, or is it the bottom of an overhang, or is it the edge of a waterfall?

    This is where classical water simulators such as fluvio or physics based ones have an advantage over LiquidVoxels, they just raycast (or collide) with the terrain.

    This isn't a insurmountable problem, especially with @DavidWilliams work on the cubiquity "get neighbour" style requests in up-and-coming code as they will make the requests I need at the speed we need them. I'll take another look at water on smooth terrains after release, as I have some good ideaes on how to implement it.

    In regards to your other question about smooth water on cubic terrain; yes, I made some API breaking changes a release or two ago. I'll take another look at that today and see if I can get you a interface that works.

    -Ell
     
  44. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    Each material can be between 0 and 255, but the sum is also constrained to this range. The sum of the material weights determines the shape of the generated mesh, and the material weights themselves control the textures (but you don't care about those). If the sum of the weights is above the half-way point (i.e. above 127) then the voxel can be considered solid.

    The exact shape of the mesh is indeed determined by how far above the threshold a given voxel sum is, but for you purposes you should probably just care if it is above or below (assume the voxels is fully solid or fully empty).

    I realise now that I don't expose this sum. Of course you can compute it but maybe I should expose it directly.

    P.S. You probably notice Cubiquity is moving a bit slower than usual at the moment - this summer I am moving to the UK so I've been pretty busy preparing for that (house/job hunting). There are still changes going into PolyVox though, and they'll flow up to Cubiquity in due time.
     
  45. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,316
    Hello Ellandar,

    just had a look at your Liquid Voxels Demo 1, looking very good! Thanks a lot for this!

    I am using Uniblocks (I like it very much) and messed around trying to make water myself. Then maap pointed me to this Topic here.

    I had a look at the demo, then made an empty Project with Liquid voxels, then imported it to my existing uniblocks prototype.

    I add a gameobject "Liquidvoxels", added both Scripts for "Water Physics" and "Render in Terrain".

    Then I doubleclicked and imported LiquidVoxels/Scripts/VoxelEngineInterfaces Uniblocks.unitypackage was that still okay?

    I do not know how to continue. "Export the interface unitypackage." What does that mean? Where?
    Next step would be:
    "Now go to your "Liquid Voxels" game object, click Add Component, and add the new voxel comms component."

    Can you please help me out with theses two steps?

    A water spawner on a mountain would be nice, raining clouds would be nice but mot important for me is some small lakes in the landscape and a big ocean around my world :)

    Thanks a lot and have a nice day!

    Firlefanz
     
  46. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,316
    I also added "UniblocksVoxelComms" now to gameobject Liquidvoxels and set water id to 22 which is the blocks index for existing water blocks in my game.I renamed my water in the block Editor to "WaterBlock".
     
  47. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Hi All,

    I've been inactive on the forums for the past month and a bit. This has primarily been due to some snags i've hit with the simulator and my inexperience in dealing with these types of things. I have no excuse really for those that have been hoping for updates, and I apologise.

    I've backed myself into a bit of a design corner with LiquidVoxels due to my inexperience in designing sustainable and well written code structures. The design flaws are causing me to flip-flop between where activities should occur (should I cache in regions or in interfaces) and how the engine handles block types.

    The main three flaws are:
    1. using inheritance and an enum to define a block type (meaning user define blocks are a code change not a data change).
    2. data is not separated from actions and a bit of tight coupling because of that.
    3. not thinking about saving and serialization at the start.

    This is leading to very challenging (for me) implementation of serialization, and some awkward interfacing with the product from code. This is what has been keeping me busy on the simulator for the past month.

    I've been reading a lot on serialization and data driven structures, along with how to implement these things in code and have been building small prototypes to practice these skills. I'm now working out how to implement those structures in LiquidVoxels and how many changes will need to be made to get it going :)

    Just wanted to write this post to assure people that i'm still here and working on the simulator, I just got a little bogged there for a while.

    - Ell
     
    Last edited: Jun 23, 2015
  48. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Heyas Firlefanz73,

    How did you go in the end, did you get it going?
    - Ell
     
  49. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,316
    Hello Ellandar,

    nope, did not get it working in my game.
    Made my own Special water blocks in uniblocks, 10 different ones with different height.
    Wrote some water update class to make it "flowing" that way. Works okay for the Moment but is not perfect.

    I am unsure if I will use it in the future my way or some other way, maybe liquid voxels. Your sample was great!
    I will have an eye here and will have a look on your next Version :D

    Thanks and have a nice Weekend!
     
  50. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Glad you got a solution sorted. It sounds good!

    Anything I write will never be quite as good as a self implemented one. You will also be able to iteratively make yours better without the need to understand someone else's code first.
    - Ell