Upgrade to Pro — share decks privately, control downloads, hide ads and more …

OLM R&D祭 2020 11/26 プロダクションのための流体シミュレーション / matsuri2020-Fluid

OLM R&D祭 2020 11/26 プロダクションのための流体シミュレーション / matsuri2020-Fluid

撮影作業の中でエフェクトを短時間に作成しなくてはならい状況が発生します。そこでR&Dでは、流体エフェクト用のAfter Effectsツールの開発を進めています。現在の開発状況および技術詳細を紹介いたします。(辛口)

OLM Digital R&D

December 15, 2020
Tweet

More Decks by OLM Digital R&D

Other Decks in Technology

Transcript

  1. 目的 • 簡単に使える © OLM Digital, Inc. 11 • After

    Effects で完結する • 知見を積み重ねる(R&D)
  2. 目的 • 簡単に使える © OLM Digital, Inc. 12 • After

    Effects で完結する • 知見を積み重ねる(R&D) 内製しましょう
  3. 参考資料 © OLM Digital, Inc. 14 https://github.com/tunabrain/incremental-fluids 『github incremental-fluid』で検索 •

    上記の本の内容に沿った実装 https://developer.nvidia.com/gpugems/gpugems3/part- v-physics-simulation/chapter-30-real-time-simulation- and-rendering-3d-fluids 『nvidia 3d-fluid simulation』で検索 • NVIDIA のページ • Fluid Simulation for Computer Graphics [1] 気体から液体まで流体シミュレーションの基礎的な部分の解説 2015年に第2版が出版されている [1] Bridson, Robert. Fluid simulation for computer graphics. CRC press, 2008.
  4. Navier-Stokes方程式 © OLM Digital, Inc. 16 • 流体の速度 の方程式 •

    解析的には解けない = − ∙ ∇ − 1 ∇ + ∇2 +
  5. Staggered Grid (Marker And Cell Grid) © OLM Digital, Inc.

    19 • 速度場とその他の物理量でデータの位置をずらす • 相互に微分が必要な時に有効 , − 1 2 , + 1 2 , ,+ 1 2 ,− 1 2 , , ,
  6. Stam [2] の手法 • 4ステップに分割して方程式を解く • 最終ステップ以外は速度以外にも適用 © OLM Digital,

    Inc. 20 [2] Stam, Jos. "Stable fluids." Proceedings of the 26th annual conference on Computer graphics and interactive techniques. 1999. ∇ ∙ = 0 = − ∙ ∇ − 1 ∇ + ∇2 +
  7. © OLM Digital, Inc. 21 [2] Stam, Jos. "Stable fluids."

    Proceedings of the 26th annual conference on Computer graphics and interactive techniques. 1999. External Force ∇ ∙ = 0 = − ∙ ∇ − 1 ∇ + ∇2 + Stam [2] の手法 • 4ステップに分割して方程式を解く • 最終ステップ以外は速度以外にも適用
  8. © OLM Digital, Inc. 22 [2] Stam, Jos. "Stable fluids."

    Proceedings of the 26th annual conference on Computer graphics and interactive techniques. 1999. Advection External Force ∇ ∙ = 0 = − ∙ ∇ − 1 ∇ + ∇2 + Stam [2] の手法 • 4ステップに分割して方程式を解く • 最終ステップ以外は速度以外にも適用
  9. © OLM Digital, Inc. 23 [2] Stam, Jos. "Stable fluids."

    Proceedings of the 26th annual conference on Computer graphics and interactive techniques. 1999. Diffusion Advection External Force ∇ ∙ = 0 = − ∙ ∇ − 1 ∇ + ∇2 + Stam [2] の手法 • 4ステップに分割して方程式を解く • 最終ステップ以外は速度以外にも適用
  10. © OLM Digital, Inc. 24 [2] Stam, Jos. "Stable fluids."

    Proceedings of the 26th annual conference on Computer graphics and interactive techniques. 1999. Projection ∇ ∙ = 0 = − ∙ ∇ − 1 ∇ + ∇2 + Diffusion Advection External Force Stam [2] の手法 • 4ステップに分割して方程式を解く • 最終ステップ以外は速度以外にも適用
  11. Forward Euler 法 © OLM Digital, Inc. 28 = −

    ∙ ∇q ⟹ , +1 − , Δ = − ∙ ( +1, − −1, 2 , ,+1 − ,−1 2 ) • 解が発散しやすい • 離散値の微分による問題あり
  12. Projection © OLM Digital, Inc. 31 ∇ ∙ = 0

    = − ∙ ∇ − 1 ∇ + ∇2 + Diffusion Advection External Force
  13. Projection © OLM Digital, Inc. 32 Projection ∇ ∙ =

    0 = − ∙ ∇ − 1 ∇ + ∇2 +
  14. 問題点 1. 解法による誤差の蓄積 © OLM Digital, Inc. 37 2. 計算時間

    • サブピクセルの補間方法 • Advection による誤差
  15. Mac Cormack法 [3] Advectionの誤差を補正する © OLM Digital, Inc. 39 [3]

    Selle, Andrew, et al. "An unconditionally stable MacCormack method." Journal of Scientific Computing 35.2-3 (2008): 350-371. 真の値 +1
  16. Mac Cormack法 [3] Advectionの誤差を補正する © OLM Digital, Inc. 40 [3]

    Selle, Andrew, et al. "An unconditionally stable MacCormack method." Journal of Scientific Computing 35.2-3 (2008): 350-371. ෝ +1 真の値 +1 Advection ෝ +1 = (, ∆)
  17. Mac Cormack法 [3] Advectionの誤差を補正する © OLM Digital, Inc. 41 [3]

    Selle, Andrew, et al. "An unconditionally stable MacCormack method." Journal of Scientific Computing 35.2-3 (2008): 350-371. ෝ +1 真の値 +1 Advection 誤差 ෝ +1 = (, ∆)
  18. Mac Cormack法 [3] Advectionの誤差を補正する © OLM Digital, Inc. 42 [3]

    Selle, Andrew, et al. "An unconditionally stable MacCormack method." Journal of Scientific Computing 35.2-3 (2008): 350-371. ෝ +1 真の値 +1 誤差 ෝ 逆向きにAdvection ෝ +1 = (, ∆) ෝ = (ෝ +, −∆)
  19. Mac Cormack法 [3] Advectionの誤差を補正する © OLM Digital, Inc. 43 [3]

    Selle, Andrew, et al. "An unconditionally stable MacCormack method." Journal of Scientific Computing 35.2-3 (2008): 350-371. ෝ +1 = (, ∆) ෝ +1 真の値 +1 誤差 ෝ = (ෝ +, −∆) ෝ Advection 誤差2
  20. Mac Cormack法 [3] Advectionの誤差を補正する © OLM Digital, Inc. 44 [3]

    Selle, Andrew, et al. "An unconditionally stable MacCormack method." Journal of Scientific Computing 35.2-3 (2008): 350-371. ෝ +1 = (, ∆) ෝ +1 真の値 +1 = 1 2 ( − ෝ ) ෝ = (ෝ +, −∆) ෝ Advection 誤差2 +1 = ෝ +1 + 1 2 ( − ෝ )
  21. Mac Cormack法 [3] Advectionの誤差を補正する © OLM Digital, Inc. 45 [3]

    Selle, Andrew, et al. "An unconditionally stable MacCormack method." Journal of Scientific Computing 35.2-3 (2008): 350-371. • 計算量はSemi Lagrangianの2回分 • タイムステップに制約がつく ෝ +1 = (, ∆) ෝ = (ෝ +, −∆) +1 = ෝ +1 + 1 2 ( − ෝ )
  22. 計算速度の向上 © OLM Digital, Inc. 48 128×128 256×256 512×512 1024×1024

    Advection 78 311 1244 5081 Projection 106 371 1574 7746 シングルスレッド 単位:ms
  23. 計算速度の向上 © OLM Digital, Inc. 49 128×128 256×256 512×512 1024×1024

    Advection 78 311 1244 5081 Projection 106 371 1574 7746 シングルスレッド 128×128 256×256 512×512 1024×1024 Advection 28 85 320 1263 Projection 19 28 102 855 4スレッド+SSE サブサンプルが重い 単位:ms 単位:ms
  24. 燃料の拡散・燃焼 © OLM Digital, Inc. 53 - 燃料 - 熱

    - 煙 燃料と熱を扱う 1. エミッターから燃料を追加
  25. 燃料の拡散・燃焼 © OLM Digital, Inc. 54 - 燃料 - 熱

    - 煙 燃料と熱を扱う 1. エミッターから燃料を追加 2. 物理量を Advection
  26. 燃料の拡散・燃焼 © OLM Digital, Inc. 55 - 燃料 - 熱

    - 煙 1. エミッターから燃料を追加 燃料と熱を扱う 2. 物理量を Advection 3. 燃料を消費。熱と煙を追加
  27. 燃料の拡散・燃焼 © OLM Digital, Inc. 56 - 燃料 - 熱

    - 煙 1. エミッターから燃料を追加 燃料と熱を扱う 2. 物理量を Advection 3. 燃料を消費。熱と煙を追加
  28. 燃料の拡散・燃焼 © OLM Digital, Inc. 57 - 燃料 - 熱

    - 煙 1. エミッターから燃料を追加 燃料と熱を扱う 2. 物理量を Advection 3. 燃料を消費。熱と煙を追加
  29. 燃料の拡散・燃焼 © OLM Digital, Inc. 58 - 燃料 - 熱

    - 煙 1. エミッターから燃料を追加 燃料と熱を扱う 2. 物理量を Advection 3. 燃料を消費。熱と煙を追加
  30. 色 © OLM Digital, Inc. 59 燃料の残量に応じてマッピングを行う 0.6 0.5 0.6

    0.5 0.5 0.6 0.7 0.6 0.5 0.6 0.7 0.7 0.7 0.6 0.6 0.7 0.8 0.8 0.8 0.7 0.6 0.7 0.8 0.9 0.9 0.9 0.8 0.7 0.9 1 1 1 0.9 1 1
  31. Divergence Term • 可燃性気体の体積の膨張の調整 © OLM Digital, Inc. 62 •

    圧力計算時に影響を加味する 燃焼の外向きの速度が増す、はず
  32. Divergence Term • 可燃性気体の体積の膨張の調整 © OLM Digital, Inc. 63 •

    圧力計算時に影響を加味する 燃焼の外向きの速度が増す、はず
  33. 今後の方針 • Particle 法との併合(FLIP) © OLM Digital, Inc. 66 •

    GPU での実装 • アップレゾリューションの手法の実装 • 2D 版の AE への実装