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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Fluid Simulation

176 点作者 nbaksalyar超过 1 年前

9 条评论

automatoney超过 1 年前
Extremely impressive, and VERY well explained. I can't overemphasize how much I wish there were way more stuff like this online. I also really like something about having the English and Japanese text right next to each other... maybe it's just the visual reminder that there's so much more internet outside of the English-speaking bubble.
infixed超过 1 年前
This topic is about fluid simulation, but it also references shaders as a way to performantly implement fluid simulation.<p>I&#x27;ve played around with shaders in the past to build particle simulations with millions of points, and it&#x27;s always really tickled my mind. You basically write functions that operate against a big 2d grid of colors. But because colors are represented by a 4x1 vector [r,g,b,a], you can repurpose this pattern to do general purpose computation (e.g. you can represent a point in a 3D coordinate space as a [r,g,b] color).<p>You can see this in the codepen in this post. It&#x27;s literally creating &quot;materials&quot; and &quot;render targets&quot; that are actually just intermediate computation steps in the fluid simulation.<p><pre><code> class Fluid { constructor(context) { this.context = context; this.speed = 4; this.forceInitMaterial = this.createShaderMaterial(forceInitFrag); this.divergenceMaterial = this.createShaderMaterial(divergenceFrag); ... this.divergence = this.createRenderTarget(); this.advection = this.createRenderTarget(); ...</code></pre>
评论 #37782266 未加载
jitl超过 1 年前
Wow, besides this fluid simulation note the site has a ton of discussion of other topics. I love to see personal notes wikis like this.<p><a href="https:&#x2F;&#x2F;kyndinfo.notion.site&#x2F;Sketching-with-Math-and-Quasi-Physics-837e231967134bb5a8307bb9f41c8ea1" rel="nofollow noreferrer">https:&#x2F;&#x2F;kyndinfo.notion.site&#x2F;Sketching-with-Math-and-Quasi-P...</a>
ivolimmen超过 1 年前
I once wrote a lava lamp thingy back in school when we were toying with 16bit C++ and 32bit assembly to get some nice demos on an mcga screen. It looks a bit like this but it was not a simulation we used three different buffers with pictures containing balls that we xor-ed over each other while the layers were moving in different directions using sin&#x2F;cos functions.
peter_d_sherman超过 1 年前
&gt;&quot;First, we will define the space as a grid of cells. We want to smoothly move paints, or different colors, around in this space. To do this, we will use <i>two maps</i>, specifically <i>two 2D arrays</i>, to capture the information for each cell. The <i>color map</i> stores the color values of each cell, while the <i>velocity map</i> stores a vector that represents the velocity, i.e. the information about the speed and direction of the water flow in each cell.&quot;<p>First of all, great article!<p>Second, there&#x27;s something <i>weird-but-interesting</i> going on in the quote I&#x27;ve highlighted, above...<p>First, we have Conway&#x27;s Game Of Life:<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Conway&#x27;s_Game_of_Life" rel="nofollow noreferrer">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Conway&#x27;s_Game_of_Life</a><p>To recap, Conway&#x27;s Game Of Life is sort of like a <i>one array</i> (representing the screen), 2D simulation.<p>Whereas the above fluid simulation uses <i>two arrays</i>, two maps, in 2D...<p>My question, my curiosity, is simply this:<p>What would happen if we used <i>three or more arrays</i>, <i>three or more maps</i>, in 2D?<p>Like, n-maps, n-arrays (the &quot;higher dimensional generalization&quot; if you will...) to represent things other than velocity...<p>What would our simulation look like, then?<p>For example, some interesting things to play with, in this space, might include (but not be limited to, as Lawyers would say!): <i>Acceleration</i>, <i>Jerk</i>, <i>Snap</i>, <i>Crackle</i> and&#x2F;or <i>Pop</i>:<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Fourth,_fifth,_and_sixth_derivatives_of_position" rel="nofollow noreferrer">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Fourth,_fifth,_and_sixth_deriv...</a><p>Basically, if velocity is the first derivative of position (and thus should go in the second (n+1) array or map), then maybe other derivatives can go in the higher dimensional map appropriate to them.<p>Oh sure, they could be computed on-the-fly too... but that&#x27;s no fun!<p>In fact, what might be interesting might be to see side-by-side graphics of higher-dimensional maps along with the base-level map, as the simulation (be it Life or Fluid Dynamics or ?) evolves!<p>What could be discovered?<p>Well, I as-of-yet don&#x27;t know obviously... but it seems like these concepts should mesh together somehow...<p>Anyway, great article!
boringg超过 1 年前
Fluids -- very demanding mech engineer course. I understand why now.<p>Also --&gt; those simulations would be pretty sweet screen savers :)
peter-m80超过 1 年前
Beautiful
评论 #37781726 未加载
thelastparadise超过 1 年前
Does this rely on the Navier-Stokes theory?
MilStdJunkie超过 1 年前
Marvelous work! I&#x27;m just starting to familiarize myself with CFD&#x2F;OpenFOAM in a CAD&#x2F;CAM context,and it&#x27;s sometimes remarkable how compact and elegant the math can <i>occasionally</i> be.<p>I&#x27;m reminded of the occasional notion in cosmology that many mysteries of existence go away if you regard spatial dimensions as emergent phenomenon arising from deeper quantum &quot;degrees of freedom&quot;. It makes me think of ancient assumptions - <i>atomos</i>, Arunic <i>kana</i> - that there is a thing - a space, a volume - too small to cut into. But doesn&#x27;t that seem a little contrived? How can something be too small to divide? I&#x27;d propose they&#x27;re coming at it from the wrong way. It&#x27;s not the <i>space</i>, it&#x27;s the fact that it can&#x27;t be cut any more. The system&#x27;s freedom of action restricted to a single vector - the future can be constrained no further - and subsequent knife cuts do nothing. The sum of these qualities in maco systems thus, in our minds, resolve into width, depth, length.<p>Similarly, stack up the CFD stuff fine enough and dense enough, and you get FEA emerging. Now, I&#x27;m . . ok, keep in mind I am a layman in <i>absolutely everything</i> . . but it seems like a not-horrible metaphor.
评论 #37782984 未加载