TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Simulating water over terrain

387 点作者 ibobev3 个月前

22 条评论

joproulx3 个月前
Another take on fluid simulation (Coding Adventure):<p>Rendering Fluids: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=kOkfC5fLfgE" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=kOkfC5fLfgE</a><p>I Tried Putting my Fluid Simulation on a Planet: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=8nIB7e_eds4&amp;t=817s" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=8nIB7e_eds4&amp;t=817s</a><p>GitHub: <a href="https:&#x2F;&#x2F;github.com&#x2F;SebLague&#x2F;Fluid-Sim?tab=readme-ov-file">https:&#x2F;&#x2F;github.com&#x2F;SebLague&#x2F;Fluid-Sim?tab=readme-ov-file</a>
评论 #42964976 未加载
评论 #42967560 未加载
lwansbrough3 个月前
One of the challenges with simulated hydrology, especially in procedurally generated games that I’ve found, is that water accumulates and can affect nearby cells, which affects other nearby cells, and so on.<p>So although procedural generation is often a great case for parallelizing, one of the cases you’d most want parallelization for can’t really be parallelized on unbounded domains.<p>I haven’t seen a lot of exploration of this topic.<p>One of my favourite people on the internet working on this stuff is <a href="https:&#x2F;&#x2F;nickmcd.me" rel="nofollow">https:&#x2F;&#x2F;nickmcd.me</a> — he’s got some of the best procedurally generated terrain I’ve seen.<p>But his work is also domain-constrained due to the simulation design.<p>I’ve thought about potential solutions and I think the best way would be to procedurally generate water shed boundaries that can’t be broken. Then you can parallelize and simulate an entire water shed at once.<p>It’s such an interesting problem, but it’s also way out of my knowledge domain so I’m mostly just an observer.
评论 #42971583 未加载
评论 #42968638 未加载
评论 #42972390 未加载
评论 #42971728 未加载
评论 #42968818 未加载
评论 #42975231 未加载
bodge50003 个月前
Off topic, but the post mentions needing terrain manipulation for resource gathering.<p>I always thought animal crossing had a clever and efficient approach to this without any terrain manipulation. You can chop a tree, and it&#x27;ll dispense logs, but only so many before it essentially has a cooldown. You get the feedback and the finite resources, without expensive terrain manipulation.<p>Of course that doesn&#x27;t work for every game, and really works better on smaller maps, but something worth considering. Terrain manipulation is pretty expensive, if your game doesn&#x27;t need it it&#x27;s probably better to do without (again, a generalisation)
评论 #42965359 未加载
TheGRS3 个月前
Neat dive on this topic, and I appreciate calling out Timberborn! I&#x27;m obsessed with that game currently, big big big recommendation if you haven&#x27;t checked it out yet. The water physics are like another character in the game and figuring out how to dam up a bunch of water to use in your engines and to water your fields is an essential part of the gameplay loop.
Agentlien3 个月前
This was fun and really nicely executed. By far the biggest risk when developing this stuff is just wasting hours looking at the pretty results and playing around with tweaking parameters.<p>This brought back memories of implementing my own GPU-based fluid dynamics in 2011 for my thesis. It was also for fluid (blood) across a surface (tissue) and was simulated in 2D but projected across the mesh with considerations for gravity and surface inclination. Even put a short video of it on YouTube: <a href="https:&#x2F;&#x2F;youtu.be&#x2F;4vGrNc-GGW8" rel="nofollow">https:&#x2F;&#x2F;youtu.be&#x2F;4vGrNc-GGW8</a>
elliotbnvl3 个月前
This is super, super cool!<p>I was experimenting with a similar idea recently with the help of o3-mini-high. I talked it through my idea for an algorithm, and it implemented and rendered it in 3D with no manual intervention (although I did prompt it a number of times):<p><a href="https:&#x2F;&#x2F;3d-water-sim.netlify.app&#x2F;" rel="nofollow">https:&#x2F;&#x2F;3d-water-sim.netlify.app&#x2F;</a><p>It&#x27;s not perfect yet because I stopped playing with it, but it was improving significantly with each iteration.<p>Fun fact, it implemented a working version of perlin noise correctly from scratch instead of pulling it from a CDN or something as part of this, for the terrain generation.
评论 #42968346 未加载
gus_massa3 个月前
&gt; <i>Of course, this model isn&#x27;t perfect. One of the most obvious problems is that it doesn&#x27;t have inertia and velocity diffusion. A fast water stream entering a lake won&#x27;t propagate further inside the lake, but will instead spread out in all directions, ignoring all accumulated inertia. Two parallel water streams going in opposite directions can exist and not interact with each other (provided the water levels are equal).</i><p>I guess that can be solved averaging he value of a flow arrow with the 6 neighbor arrows in the same direction. With a big weight with the arrows that are in the front and back, and a small weight for the arrows that are on the sides. For example with these arrows<p><pre><code> -a-&gt; -b-&gt; -c-&gt; -d-&gt; -e-&gt; -f-&gt; -g-&gt; </code></pre> then<p><pre><code> New_d = d * (1 - 2*.1 - 4*.01) + (c+e)*.1 + (a+b+f+b)*.01 </code></pre> Where .1 and .01 are weight that I just invented but must be tweaked, perhaps with a power like the one they use to kill osculations. That coefficient can also be included:<p><pre><code> New_d = d * (1 - 2*.1 - 4*.01 - .001) + (c+e)*.1 + (a+b+f+b)*.01</code></pre>
评论 #42971705 未加载
评论 #42970863 未加载
Aperocky3 个月前
Crude plug of a curiosity I had a few years ago: <a href="https:&#x2F;&#x2F;aperocky.com&#x2F;hydrosim&#x2F;" rel="nofollow">https:&#x2F;&#x2F;aperocky.com&#x2F;hydrosim&#x2F;</a><p>I couldn&#x27;t figure out erosion before this project moved to the cold shelf of personal project storage.. I liked how author mentioned this and attached the equations.
Ono-Sendai3 个月前
I also released something similar recently, with random heightfield generation and sediment transport and erosion too: <a href="https:&#x2F;&#x2F;github.com&#x2F;Ono-Sendai&#x2F;terraingen">https:&#x2F;&#x2F;github.com&#x2F;Ono-Sendai&#x2F;terraingen</a>
评论 #42968597 未加载
dugmartin3 个月前
You can play with an educational flooding simulation a great developer (not me) at my company built as part of a research project:<p><a href="https:&#x2F;&#x2F;flood.concord.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;flood.concord.org&#x2F;</a><p>NOTE: you need to change the model values in the bottom toolbar to see big effects.<p>It is a cell-based simulation that uses WebGL to calculate cell values based on adjacent cells. The shader that does that is here:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;concord-consortium&#x2F;flooding-model&#x2F;blob&#x2F;master&#x2F;src&#x2F;models&#x2F;engine&#x2F;calc-water-depth-shader.glsl">https:&#x2F;&#x2F;github.com&#x2F;concord-consortium&#x2F;flooding-model&#x2F;blob&#x2F;ma...</a>
NnnomNom433 个月前
How about simulating water, then sending bombs into it?<p>That&#x27;s Creeper World for you.<p><a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=XCyPT2e95zY&amp;t=420s" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=XCyPT2e95zY&amp;t=420s</a>
vladms3 个月前
Nice explanation. I like the viscosity part, I implemented something similar a couple of years ago in an open source RTS game engine (test video at: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=cQW8WXNpYXk" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=cQW8WXNpYXk</a>), and without viscosity water was spreading thin and due to floating point, at some point it was spreading on flat surfaces and &quot;evaporating&quot;.<p>Also, the grid resolution required to obtain nice waves was a bit too much for the effort I put 5 years ago (probably needed another thread, etc.)
评论 #42967092 未加载
h1fra3 个月前
Game developers are truly on an other level
评论 #42964868 未加载
pornel3 个月前
Storing values at the edges of cells makes the math simpler, but unfortunately makes a GPU implementation harder.<p>In this setup one edge update affects two cells, so the cells are no longer trivially independent. It&#x27;s still possible to update cells in parallel, but it requires splitting the update into two checkerboard-like passes.
评论 #42965881 未加载
FrustratedMonky3 个月前
Guess this explains why water effects in Minecraft are bit kludgy. It isn&#x27;t so simple.
评论 #42965227 未加载
评论 #42965051 未加载
matheist3 个月前
The waves when the water is first entering the area is called numeric dispersion, it&#x27;s a consequence of discretizing. It can be mitigated somewhat by smoothing the entering wall of water so that there&#x27;s not a sharp discontinuity.
评论 #42966022 未加载
评论 #42970711 未加载
评论 #42965537 未加载
wiz21c3 个月前
What the author implemented is a specific case of Saint Venant shallow water equations (in case you want to know where it comes form).
评论 #42970790 未加载
tithe3 个月前
I like that analogy, rules are pipes through which behavior flows.
esafak3 个月前
The author might enjoy Populous, Powermonger, Realms, etc.
jordanmorgan103 个月前
Yup I’ll just take your word for it
amelius3 个月前
I always find it a bit of a disappointment when the focus is only on how a simulation looks rather than if it is physically accurate.
评论 #42968506 未加载
hgomersall3 个月前
It&#x27;s nothing like that complicated. They just need to retuculate the splines.