tag:blogger.com,1999:blog-7487967624215307336.post694044641965674982..comments2022-12-05T17:20:28.749+01:00Comments on Marek Rosa - dev blog: VRAGE: Volumetric WaterMarek Rosahttp://www.blogger.com/profile/02675819792454369037noreply@blogger.comBlogger16125tag:blogger.com,1999:blog-7487967624215307336.post-17425099287879879772022-08-17T15:45:59.438+02:002022-08-17T15:45:59.438+02:00Thanks, Mr. Marek Rosa!
Petr,
I have sent you an ...Thanks, Mr. Marek Rosa!<br /><br />Petr,<br />I have sent you an e-mail with my Discord account. Looking forward to discussing with you!<br /><br />Regards,<br />AnthonyAnthonynoreply@blogger.comtag:blogger.com,1999:blog-7487967624215307336.post-66612271089959684562022-08-15T12:36:18.262+02:002022-08-15T12:36:18.262+02:00Hi Anthony,
it is really good progress! Have you a...Hi Anthony,<br />it is really good progress! Have you also implemented some kind of stabilization/optimization?<br /><br />Keep the solids outside the water, in separate structure. For our 2D water I have used simple octree - that way you can render huge square areas of cells as single big squares. In the water cell I just keep info, if the cell is solid or not.<br /><br />I have used COM mainly to have nice flow on diagonals. I believe a proper COM will also improve the round shape around the gravity center.<br /><br />The lodding itself is quite more complex, especially tweaking the pressure and forces generally per different lod size and their edges.<br /><br />Feel free to contact me directly on email/discord and we can discuss the algorithm in more details.<br /><br />Best!<br />PetrPetr Minarikhttps://www.blogger.com/profile/13308090498027131306noreply@blogger.comtag:blogger.com,1999:blog-7487967624215307336.post-70085543107929123442022-08-15T12:29:17.060+02:002022-08-15T12:29:17.060+02:00Hi Anthony,
regarding surface tension, calculate ...Hi Anthony,<br /><br />regarding surface tension, calculate the force per direction and add the force calculated from difference between the neighbour and the cell itself. Then it will start to create bigger blobs and attract smaller to bigger blobs.<br /><br />It is very similar to pressure force calculation, just use compression treshold as a trigger and reference amount to push forces.<br /><br />Do it in two passes - as it is in my diagram, each block is one pass. In the first pass just calculate velocities (keep them per cell) and in the second pass do the diffusion. We also keep COM per cell and calculate new COM for cell during the diffusion pass.<br /><br />Velocity clamping is correct, it is needed. We dont propagate velocities, new velocity per cell is also updated in diffusion pass.<br /><br />Hope it helps! :)Petr Minarikhttps://www.blogger.com/profile/13308090498027131306noreply@blogger.comtag:blogger.com,1999:blog-7487967624215307336.post-60448924136873876832022-08-13T10:54:27.029+02:002022-08-13T10:54:27.029+02:00Very cool simulation Anthony👍Very cool simulation Anthony👍Marek Rosahttps://www.blogger.com/profile/16960832628849493781noreply@blogger.comtag:blogger.com,1999:blog-7487967624215307336.post-14896286995477810052022-08-12T23:34:12.815+02:002022-08-12T23:34:12.815+02:00Greetings, Petr!
I have the "full-scale"...Greetings, Petr!<br />I have the "full-scale" algorithm working (pressure and surface tension). It is not as fluid, realistic or stable as yours, though. Would love to hear how you did them. I will e-mail you my algorithm soon.<br /><br />Here is a demo, with a little planet, gravity, and an ocean:<br />https://streamable.com/djzgv2<br /><br />Also, I still don't have COM figured out. The current algorithm uses the cell's grid position, plus 0.5.<br />The renderer is not optimized (it is a primitive batcher, it builds the render list every frame, even for the static terrain), but the simulator does have some tricks. It deletes clusters which have too little fluid and no walls. This prunes some instability related to excessive diffusion (gas-like behavior, even when under force). Red clusters are active, while gray ones are not.<br /><br />I am curious about your accelerated quadtree for solids. It would be quite useful to have (the solids waste a lot of memory and processing time (memory access time). I assume your solids are totally separate in the quadtree, and your cluster collection only houses liquid). I did not do this originally because I am unfamiliar with spatial indices.<br />Also, how did you do LOD? A naive idea I had was to get the liquid from a 4 cell square, rebuild the grid (make it 2x smaller on each dimension) and transfer the quantity in 4 old cells to 1 new, larger cell.<br /><br />On another note, thanks for all the help. My simulator is pretty fun to play with, even in its current state.Anthonynoreply@blogger.comtag:blogger.com,1999:blog-7487967624215307336.post-37673101281043146712022-08-11T17:39:15.778+02:002022-08-11T17:39:15.778+02:00Hi Petr!
I have some forces working!
This is the ...Hi Petr!<br /><br />I have some forces working!<br />This is the force algorithm:<br />https://pastebin.com/qsedQrsQ<br /><br />U, D, L, R are the neighbors, and data is the current cell.<br /><br />It actually looks... good in a way.<br />Using a small surface tension creates a thick stream of water falling down, but increasing it makes it thin. I guess that is correct? <br /><br />With 0 gravity, it does look kind of... right. Here is a video demo (uses 1 for the surface tension coefficient):<br /><br />https://streamable.com/3qo1hd<br /><br />But I don't like how it only forms small blobs. I believe you actually made neighbors come towards the cell. I made the cell go towards the neighbors. Is this correct? This could also be because my "brush" (cursor) only edits a single cell instead of a large circle.<br /><br />Also, how did you calculate the pressure force? I tried doing it based on amounts in neighbor cells and a threshold, but it looked choppy (hovering around the threshold).<br /><br />On another note, the code linked above is executed in the same pass as diffusion. You probably have multiple passes, like in the diagram. To do this, I need to add a velocity vector to my cell data. I will then iterate once, to accumulate velocities in the vector, and a second time, to apply diffusion (and a third time, to apply deltas).<br /><br />In the code linked above, I also clamped the velocity to between -1 and 1, because high values broke the diffusion algorithm (I calculate the center of diffusion by adding the velocity vector to the COM)<br /><br />You mentioned computing COM and velocity of neighbor cells. This leads me to believe you did not store COM and velocity in cells, and you calculate them when applying diffusion. That would be great, it would reduce memory access time. I am still looking for a good way to calculate COM.<br /><br />Also, does the simulator "propagate" velocities? I.E if you apply a force to a cell, does that affect the velocities of neighbors? <br /><br />AnthonyAnthonynoreply@blogger.comtag:blogger.com,1999:blog-7487967624215307336.post-13016374397155449912022-08-09T15:57:48.161+02:002022-08-09T15:57:48.161+02:00Hi Petr,
I got part of the algorithm to work.
My...Hi Petr,<br /><br />I got part of the algorithm to work.<br /><br />My cell structure contains an amount (a float), cell type (wall or liquid), a delta (float), a COM (vector), initialized (bool). When I add fluid to the simulator, I set the COM to grid coordinates plus 0.5 and amount to 1. "Initialized" is used when getting a neighbor cell. If it is false, we calculate the COM to be grid coordinates + 0.5, then set it to true (I don't like this very much)<br />To do diffusion, I iterate trough the cells. If the cell is not liquid or is empty, I skip it. Otherwise, I calculate a diffusion area. It is a rectangle centered at the cell's COM, with a width and height equal to diffusion radius * 2. I use a diffusion radius of 0.6.<br />I then calculate rectangles for T/B/L/R and the source cell. Then I calculate the area of intersection between those rectangles and the diffusion area. I then calculate the sum of these areas. I then normalize the areas using this sum. I then calculate amounts to transfer (normalized area * the source cell's amount). I then add these to the neighbor's deltas. I subtract the sum of these 4 normalized areas from the source's delta. <br />I am not sure how to calculate the new center of mass using a weighted sum. I only know of linearly interpolating a vector to another vector using a coefficient. I also don't know how I would defer these changes.<br /><br />Finally, I iterate once more, add the cell's delta to the cell's amount, and set the delta to 0. Maybe I could calculate a COM here.<br /><br />This is the diffusion part of the algorithm:<br />https://pastebin.com/566C0FVU<br /><br />Thank you for your patience. I am getting closer to solving this.<br /><br />AnthonyAnthonynoreply@blogger.comtag:blogger.com,1999:blog-7487967624215307336.post-44148311734407313552022-07-28T17:23:03.280+02:002022-07-28T17:23:03.280+02:00Hello Anthony,
the quantity of fluid transfered t...Hello Anthony, <br />the quantity of fluid transfered to neighbour cell is determined by area of diffusion radius covering the neighbour cell. The bigger area is, more fluid is transfered. The same applies for the fluid what stays in the source cell.<br />For computing velocity or COM of neighbour cell use a weighted sum, where amount of fluid is a "weight". <br /><br />All features like pressure, gravity, surface tension etc. are just forces, which means you calculate velocity changes per cell to achieve the effect. The effect of a pressure is to keep fluid level same across all cells with fluid amount above the treshold. Petr Minarikhttps://www.blogger.com/profile/13308090498027131306noreply@blogger.comtag:blogger.com,1999:blog-7487967624215307336.post-89595331593996626522022-07-24T15:49:20.341+02:002022-07-24T15:49:20.341+02:00Hello Petr,
I started working on velocity diffusio...Hello Petr,<br />I started working on velocity diffusion. How did you calculate the new center of mass, and how did you select the quantity of fluid to transfer, based on diffusion radius?Anthonynoreply@blogger.comtag:blogger.com,1999:blog-7487967624215307336.post-6390792925248584582022-07-21T01:25:14.746+02:002022-07-21T01:25:14.746+02:00Hello Petr,
I wasn't able to fully grasp what ...Hello Petr,<br />I wasn't able to fully grasp what you explained. <br />I believe that the velocity part will calculate the future position and then transfer the liquid to that cell (or the closest cell along the path). Diffusion will distrubute liquid to all 4 cells (presumably, it will distribute it's liquid / 4 * some coefficient)<br />I am not sure how to calculate the correct center of mass.<br />Surface tension would check all 4 neighbors and, if they are a liquid, it will add some velocity to them, towards the cell.<br />I am not sure how pressure would work.<br />Regards,<br />AnthonyAnthonynoreply@blogger.comtag:blogger.com,1999:blog-7487967624215307336.post-88873306009664039352022-07-18T14:26:11.912+02:002022-07-18T14:26:11.912+02:00Hello Anthony, what exactly you have problems with...Hello Anthony, what exactly you have problems with? Regarding clusters, they operate on a grid level, not cell level. Whole connected areas of grids with changes below treshold then can be put into a sleeping state, which saves a lot of performance.Petr Minarikhttps://www.blogger.com/profile/13308090498027131306noreply@blogger.comtag:blogger.com,1999:blog-7487967624215307336.post-62123785569008092932022-07-18T00:18:15.527+02:002022-07-18T00:18:15.527+02:00Greetings, Peter! Could you give me some direction...Greetings, Peter! Could you give me some directions for implementing it? I really liked what you showed on your stream, and I would like to make a demo like yours just to play with.I did successfully implement a system using my own reasoning, but I am having trouble implementing your approach. I would also like to know how you implemented sleeping clusters. I suspect it has something to do with that quadtree. I was able to create a "stilling" system which skips processing of individual cells, but it cannot skip large regions. It also is... not consistent. I did, however, optimize it a bit by separating cells into different sets. The collections are also tightly packed structs so I got good cache performance. <br />Thank you for your time and your great work on SE.Anthonynoreply@blogger.comtag:blogger.com,1999:blog-7487967624215307336.post-39409124795416432382022-07-14T00:35:20.417+02:002022-07-14T00:35:20.417+02:00Brother, my dearest friend, it is for a space game...Brother, my dearest friend, it is for a space gameAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-7487967624215307336.post-48126107283440067152022-06-25T16:57:09.091+02:002022-06-25T16:57:09.091+02:00Do you really need to consider zero gravity scenar...Do you really need to consider zero gravity scenario? How are you going to use that in game?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7487967624215307336.post-45908864134104467282022-06-09T16:25:55.639+02:002022-06-09T16:25:55.639+02:00Hello,
there is no final decision on this problem...Hello, <br />there is no final decision on this problem yet. We will decide according to user feedback and priorities, so far there are two possible solutions:<br /><br />1. If the pump is static (const input and output), then we are able to simulate water even without flow simulation, just analytically based on source/sink sizes. Otherwise such case will not be simulated (concealment).<br /><br />2. For player structures, we can reduce maximum LOD around to allow water machines still work and water flow as needed. <br /><br />Best!<br />PetrPetr Minarikhttps://www.blogger.com/profile/13308090498027131306noreply@blogger.comtag:blogger.com,1999:blog-7487967624215307336.post-64101002766823968872022-06-09T00:28:13.622+02:002022-06-09T00:28:13.622+02:00This all looks quite intriguing!!
What's the...This all looks quite intriguing!! <br /><br />What's the solution for small holes and LODs? Say the player builds a pump and walks away from it. Now the cells are too large to recognize parts of the pump as holes/viable routes to flow through. What's the solution to this??<br /><br />Overall though, this looks incredibly promising and I look forward to seeing what comes of it!! notjordansimehttps://www.blogger.com/profile/10512885423513395011noreply@blogger.com