游戏开发论坛

 找回密码
 立即注册
搜索
查看: 5783|回复: 0

???????????

[复制链接]

1万

主题

1万

帖子

3万

积分

论坛元老

Rank: 8Rank: 8

积分
36572
发表于 2019-12-16 11:31:45 | 显示全部楼层 |阅读模式
1.jpg

????GPU???Shader???????????????????????????????????????????????????

???????????????????????????????????????????????????????????????????????????????????

??????????????

?????????????????????????????????????????????????????????????????????????????????????50???????????????????????

1.        ???????Bump Mapping? [Schachters 1980]

2.        ????Sinusoids Wave?[Max 1981]

3.        ?????Fractal noise?[Perlin 1985]

4.        Gerstner ??Gerstner Wave?[Fournier 1986]

5.        ????????Fast Fourier Transform?[Mastin 1987]

6.        ?????Eulerian approaches?[Kass 1990]

7.        ???????Lagrangian approaches?[Stam 1995]

8.        ??-?????????Hybrid approaches?[Brien 1995]

9.        ???????Fractal Brownian Motion?FBM?[Addison 1996]

10.        ??????Procedural Shape?[Ebert 1999]

11.        ??-???????Spatial -Spectral Approaches? [Thon 2000]

12.        ????????Voxel-Based NSE Solutions? [Yann 2003]

13.        ?????????Vertex Height Map Displacement?[Yuri 2005]

14.        ???????2D Wave Equation?[Nishidate 2005]

15.        ???????Screen Space Mesh?[Muller 2007]

16.        ?????Wave Particles?[Yuksel 2007]

17.        ??????(Vector Displacement Map) [2009]

18.        ????Flow Map?[Vlachos 2010]

19.        ??FFT?????Offline FFT Texture?[Torres 2012]

20.        ??????????bake to flipbook?[Bowles 2017]

21.        ???????Water Wave Packets?[Jeschke 2017]

22.        ????????Water Surface Wavelets?[Jeschke 2018]

23.        ???????Water Wave Simulation?[Grenier 2018]

???????????????????????????????????????????????????????????????????????????

????????????????????????????????????????????????????????????

???????????????????

????????4??????????

2.jpg

??????????????????

3.jpg

????????5????????

4.jpg

?????4????????

5.jpg

???????????????????

6.jpg

??????????????????????????????Skull & Bones???gameplay???

????????????

?????3A????????????????????????????????????????????????

???????????????

?????????????????????

7.jpg

???????QianMo/Water-Rendering-Knowledge-Architecture.png

OK????????

?????????????

??????????????????????????????????????

1.        ????????

  • ????Sinusoids Wave?[Max 1981]
  • Gerstner ? ?Gerstner Wave? [Fournier 1986]


2. ??????

  • ????????Fast Fourier Transform?[Mastin 1987]
  • ??-???????Spatial -Spectral Approaches?[Thon 2000]


3. ??????

  • ????????Wave Particles? [Yuksel 2007]
  • ???????Water Wave Packets?[Jeschke 2017]
  • ???????Water Surface Wavelets?[Jeschke 2018]


4. ???????

  • ?????Eulerian approaches?[Kass 1990]
  • ???????Lagrangian approaches? [Stam 1995]
  • ??-?????????Hybrid approaches?[Brien 1995]


5. ?????

  • ?????????Vertex Height Map Displacement? [Yuri 2005]
  • ????Flow Map?[Vlachos 2010]
  • ??FFT?????Offline FFT Texture? [Torres 2012]
  • ??????????bake to flipbook?[Bowles 2017]


6. ????

  • ???????Bump Mapping?[Schachters 1980]
  • ?????Fractal Noise?[Perlin 1985]
  • ???????Fractal Brownian Motion?FBM?[Addison 1996]
  • ??????Procedural Shape?[Ebert 1999]
  • ????????Voxel-Based Solutions? [Yann 2003]
  • ???????2D Wave Equation?[Nishidate 2005]
  • ???????Screen Space Mesh?[Muller 2007]
  • ???????Water Wave Simulation?[Grenier 2018]


??????????????????

4.1 ????????

??????????????????????????????????????????????????????????????

8.gif
? ??????????????????????????????????????????????????????????????????????????????????https://wikischool.org/divided_light?

?????????????????Sinusoids Wave??Gerstner?(Gerstner Wave)????????????

4.1.1 ????Sinusoids Wave?[Max 1981]

????????????????????Sinusoids Wave??????????????????????????

9.gif
? Unity??????????Sinusoids Wave????

1981??Max[Max 1981]??????????????????????????????????????????????????????Sinusoids Wave???????t?????x?z???????y = h?x?z?t????????

4.png

  • ?? 2.png ?????
  • 3.png ??i?????
  • ????
  • 5.png ??????pulsation?
  • 6.png ????????


????Sinusoids Wave?????????????????????????????????Gerstner??

4.1.2 Gerstner ??Gerstner Wave? [Fournier 1986]

??????????Gerstner ??Gerstner Wave?????????????????????????????

10.gif
? Unity??????Gerstner????

Gerstner ?(Gerstner Wave)?????Trochoidal Wave???????????????????periodic surface gravity waves????????????Gerstner?1802 ????????1863??Ranine????????1986??Fournier???????????

11.jpg
? Gerstner Waves??

12.gif
? Gerstner Waves???????????

???????ki???Ai????i????i???   ?Gerstner Waves???????

7.png

8.png

Gerstner Waves????????????????????????????????3A?????Gerstner Wave???????????????Wave Particles????????????3???????Gerstner Wave + Wave Particles??????????

4.2 ??????

4.2.1 ????????Fast Fourier Transform , FFT?[Mastin 1987]

??????????????????????????????????Fast Fourier Transform , FFT?????????????????????????????????????

?1986?[Mastin 1987]???FFT??????????????????2001?Tessendorf??????????Simulating Ocean Water?[Tessendorf 2001]????????????????????????????????

13 (1).gif
? Unity??????FFT???

??????Fourier transform??????????????????????????????????? ?Fast Fourier Transform?FFT?, ?????O?nlogn??????????????Discrete Fourier transform?DFT??????????????????????????????1805?????????????1965??Cooley?Tukey???????????????????????????FFT??????????????????????????FFT???????????????????????????????FFT??????

FFT??????????N?????????????????????DFT???????? ??????????????????????????DFT????????????????????????????????

??FFT????????????????????????

14.jpg

15.jpg

??FFT??????????????????????spectrum-based?????????????FFT??????????????????????????????????????????????[Tessendorf 2001]???Phillips???????????????????????????????????????FFT?????????????????????displacement map????????????????????????????????????Folding Map?

16.jpg
? ??FFT??????? [NVIDIA 2004]

??FFT????????90????????????????????2000????????????????????????????????????????????????????????????????????Crysis???????????????64 x 64???????????????????512 x 512?????????????????????????????FFT?????????????????????????????????????1997????????????????????????2048 x 2048????????

17.jpg
? ???????????????FFT????????????2048 x 2048???????

4.3 ??????

4.3.1 ?????Wave Particle? [2007]

?????Wave Particle??????Yuksel?2007?[Yuksel 2007]????????????????????????????????????????????????????????????????????????????????

?????Wave Particle???????????????????FFT??????????????????????????????????????????????

18 (1).gif

19.jpg
? Wave Particle ?????[Yuksel 2007]?

????????????Wave particles?????????????????????????????????????????amplitude?????radius??

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

20.jpg
? ?a???b??????????????????????c???d??????????????????????????[Yuksel 2010]?

??????????????????????????????????????????????????????????????????????

21.jpg
? ???????????????????????????[Yuksel 2010]?

???Wave Particles????????????????????

2007?Yuksel?????Wave Particles???????????????????????????3?????????????????3???????????????????????????????????????????????????????????????vector displacement field??

22 (1).gif
? ?????3????????wave particles?????????? [SIGGRPAPH 2016]

?????4??????????Wave Particles??????????Wave Particles????????

23.jpg
? ?????4???????Wave Particles [SIGGRPAPH 2016]

4.3.2 ???????Water Wave Packets?[SIGGRAPH 2017]

??????Wave Particles?????? Jeschke?Wojtan[2017]?SIGGRAPH 2017??????????theoretical group speed?????????Water wave packets ????????????????????????????????????????????????????????????????????????????????

? ???????Water Wave Packets??paper demo [SIGGRPAPH 2017]

25.jpg
? ???????Water Wave Packets??????

26.jpg
? ???????Water Wave Packets??????

4.3.3 ???????Water Surface Wavelets? [SIGGRAPH 2018]

???[SIGGRAPH 2018]?Jeschke???Water Wave Packets??????????????????Water Surface Wavelets?????????Water Surface Wavelets????????????????????????????????????GPU??????????????????????????????????????????????????????????????????????????????

? Water Surface Wavelets paper Demo [SIGGRPAPH 2018]

28.jpg
? ???????Water Surface Wavelets?????? [SIGGRPAPH 2018]

4.4 ???????

???????????????????????????????????????????????????????????????????????

??????????????????Navier-Stokes???Navier-Stokes Equations,NS????????Navier-Stokes????????????????????????????????????????????????????????????????????????????

Navier-Stokes?????

11.png

  • ????????fluid velocity vector?
  • ??????fluid pressure?
  • ??????fluid density?
  • ????????kinematic viscosity coefficient?
  • ??????gradient differential?
  • ????????Laplacian operators?


?????Navier-Stokes???????????Eularian Method?????????Lagrangian Method????

  • ?????Eularian Method???????????????????????????????????????????????????????????????????????????????????????????????????????
  • ???????Lagrangian Method?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????(Smoothed Particle Hydrodynamics?SPH)?????????????????????????????????


? ??SPH?????????

? Houdini??????

?????????????????????-?????????Eularian-Lagrangian Hybrid approaches?????????????????????????????????????????????????????

FX Guide?????????????????????????????????????https://www.fxguide.com/fxfeatured/the-science-of-fluid-sims/

????????bake to flipbook???????????????flipbook???????????

4.5 ?????

4.5.1 ????Flow Map?

????Flow Map????????????Vector Field Map??????????????????????????????????UV????VALVE?Vlachos?SIGGRAPH 2010??talk?Water Flow in Portal 2???????????????VALVE?2010????????Houdini???flow map?

31.jpg
? ??Flow Map????? [SIGGRAPH 2010]

32.jpg
? ??Houdini?Flow Map????? [SIGGRAPH 2010]

Flow Map???????????????????????????Flow Map???????????????

? ??Flow Map????? @Unity

? ??Flow Map????? @UDK

Flow Map?????????2D???????????????UV????????????

35.jpg
? ??Flow Map???

Flow Map????????????

  1. //get and uncompress the flow vector for this pixel
  2. float2 flowmap = tex2D( FlowMapS, tex0 ).rg * 2.0f - 1.0f;
  3. float cycleOffset = tex2D( NoiseMapS, tex0 ).r;
  4. float phase0 = cycleOffset * .5f + FlowMapOffset0;
  5. float phase1 = cycleOffset * .5f + FlowMapOffset1;

  6. // Sample normal map.
  7. float3 normalT0 = tex2D(WaveMapS0, ( tex0 * TexScale ) + flowmap * phase0 );
  8. float3 normalT1 = tex2D(WaveMapS1, ( tex0 * TexScale ) + flowmap * phase1 );
  9. float flowLerp = ( abs( HalfCycle - FlowMapOffset0 ) / HalfCycle );
  10. float3 offset = lerp( normalT0, normalT1, flowLerp );
复制代码

4.5.1.1 Flow Map????????3?Flow Map + Displacement

???Flow Map?????????????????????3???Flow Map + Displacement?

36.jpg

4.5.1.2 Flow Map?????????Flow Map + Distance Fields + Normal Maps

??????????Flow Map + Distance Fields + Normal Maps [GDC 2019, Technical Artist Bootcamp Distance Fields and Shader Simulation Tricks]

37.jpg

4.5.1.3 Flow Map????????4?Flow Map + Wave Particles

???????4???Flow Map + Wave Particles[SIGGRAPH 2016, Rendering Rapids in Uncharted 4]????????????????????????

38.jpg

? ?????4???Flow Map + Wave Particles????flow map??????wave particle grids????????????????????????????????????flow map?????

????????4??Flow + Wave Particles?????

  1. timeInt = time / (2.0 * interval)  
  2. float2 fTime = frac(float2(timeInt, timeInt * .5)  
  3. posA = pos.xz - (flowDir/2) * fTime.x * flowDir  
  4. posB = pos.xz - (flowDir/2) * fTime.y * flowDir  
  5. gridA0 = waveParticles(posA.xz, freq0,scale0)  
  6. gridA1 = waveParticles(posA.xz, freq1,scale1)  
  7.   
  8. gridB0 = waveParticles(posB.xz, freq2,scale0)  
  9. gridB1 = waveParticles(posB.xz, freq3,scale1)  


  10. float3 pos0 = gridA0 + gridA1 + gridA2 + gridA3  
  11. float3 pos1 = gridB0 + gridB1 + gridB2 + gridB3  
  12. pos = blend(pos0, pos1, abs((2*frac(timeInt)-1)))  
  13. pos.y += heightMap.eval(uv)
复制代码

4.5.2 ??FFT?????Offline FFT Texture?

??FFT???Offline FFT Texture???????????3???????[Torres 2012]???????????????FFT??????????????????????????????vector displacement maps????????????FFT????????????????????tiling?

39.jpg
? ????FFT????????4??????

? ????FFT????????3??????

4.6 ????

????5??????????????????????????????

  • ???????Bump Mapping?[Schachters 1980]
  • ???????Fractal Brownian Motion?FBM?[Addison 1996]
  • ?????Procedural Shape?[Ebert 1999]
  • ?????Fractal Noise?[Gonzato 2000]
  • ????????Voxel-Based Solutions? [Yann 2003]
  • ???????Screen Space Mesh?[Muller 2007]
  • ???????Vector Displacement Map?[2009]


??????????Bump Mapping???????????????????????????????????????????????????????????????????????????????

??????Fractal Noise??????????????Perlin???????????????????????

???????Vector Displacement Map???????????????????????????????????????

41.jpg
? ????????????Vector Displacement Map? @Arnold Render

? ?????????Vector Displacement Map?????? @Arnold Render

??????????????????paper???????????????

????????????SIGGRAPH 2017? ,Crest Ocean System??????????Procedural Shape???????????????????????

????????????

???????????

???????Shading???????????????????????????????

????????????????????????????????????????????????????????????????Sub-Surface Scattering, SSS???????????????????????????BSSRDF?Bidirectional Surface Scattering Reflectance Distribution Function???????????????

43.jpg

???????????BSSRDF???????????????????????????????????????????

?????3??2012?SIGGRAPH????????????????????????????

44.jpg

???????????????????

  • ????Diffuse?
  • ?????Specular?
  • ?????Normal Map?
  • ???Reflection?
  • ????Translucency?


  • ???????????Depth Based LUT Approach?
  • ??????Subsurface Scattering?


  • ???Foam/WhiteCap?


  • ?????Flow?
  • ?????Underwater Haze?


????????????????????????????????????Flow????????????????

????????????????Translucency?????Foam/WhiteCap??????????

5.1 ??????Translucency??????

????????Translucency??????????????????????????

  • LUT???Look-Up-Table Approach?
  • ??????????Sub-Surface Scattering,SSS Approximation Approach??
  • ?????? ????LUT???????????????????????????????3?


45.jpg

5.1.1 ???????????Depth Based LUT Approach?

Depth Based-LUT?????????????????????????????????/??LUT?Absorb/Scatter LUT?????????????????????????????

v2-1dcd2811c3c1c1e6d74eb87399878ab3_hd.jpg

46.jpg

?????????????????????????????????????

47.jpg
? ????????????????????????

5.1.2 ??????????Sub-Surface Scattering Approximation Approach?

?????????????????Sub-Surface Scattering?SSS??????????????????

  • [SIGGRAPH 2019] Crest Ocean System?????????SSS???
  • [GDC 2011] ?????Fast SSS???


48.jpg
? ??????????????

5.1.2.1 [SIGGRAPH 2019] Crest Ocean System?????????SSS??

??Crest Ocean System??????????SSS?????????

  • ?????????????????????
  • ??FFT???????????????????mask
  • ????????????mask????????????????????????????????????
  • ?????Displacement???????????????????????????????


????????????

  1. float v = abs(i_view.y);

  2. half towardsSun = pow(max(0., dot(i_lightDir, -i_view)),_SubSurfaceSunFallOff);

  3. half3 subsurface = (_SubSurfaceBase + _SubSurfaceSun * towardsSun) *_SubSurfaceColour.rgb * _LightColor0 * shadow;

  4. subsurface *= (1.0 - v * v) * sssIndensity;

  5. col += subsurface;
复制代码


49.jpg
? ?Crest Ocean System????????????????

50.jpg
? ??????Sea of Thieves?????????????????

? ??????Sea of Thieves?????????????????

5.1.2.2 [GDC 2011] ?????Fast SSS??

[GDC 2011]??Frostbite?????Fast Approximating Subsurface Scattering????????????????

52.jpg

????????????

53.jpg

5.2 ???????

???Foam????????????Whitecap?White Water??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

54.jpg
? ??????

??????????????????????????????????????????????????????

?????????????????????????

  • ???????dynamic texture?
  • ???????particle system?


???????????????

  • ????
  • ????
  • ????


????????????????????????

  • ?????????[Tessendorf 2001]
  • ??Saturate??????? [GPU Gems 2]
  • ?????????? [Tessendorf 2001]
  • ?????? [Akinci 2013]
  • ????????? [Kozin 2018][Sea of Thieves]
  • ?????????? [GDC 2018][Far Cry 5]


?????????????????

5.2.1 ?????[Tessendorf 2001] ??????????

Tessendorf?????????paper?Simulating Ocean Water?[Tessendorf 2001]??????????????Jacobian??????????????????????????????????????????Folding Map???

55.jpg

??????War Thunder?????CGDC 2015??????????????????M???????????????M~0.3...05?

56.jpg
? ??????War Thunder???????????M???????????? [CGDC 2015]

?????????Sea of Thieves?????SIGGRPAPH 2018???????????????????????????????????Progressive Blur???????noisy????????????????

57.jpg

? ??????????????? + ?????Progressive Blur?????????

5.2.2 ?????[GPU Gems 2] ??Saturate?????

?GPU Gems 2??????????????????????????????????H0????????????????????????????

12.png

  • ???   13.png ?????????? 14.png ??????   15.png ??????
  • ?????????????????????????????????????????????????????????
  • ??????????????????????????????


5.2.3 ?????[2012]?????3???Multi Ramp Map???

?????3??????????????????

  • ?????????????????????????????
  • ???????Perlin???????????????????????????
  • ????????????R?G?B??????????????????????ramp???????????????????????????????????????????????ramp????????????????


58.jpg

59.jpg

5.2.4 ?????[SIGGRAPH 2018]???????????????????

??????Sea of Thieves?????SIGGRPAPH 2018?talk????????????????????

  • ????top-down?????????????????????????????mask???


half4 foamMask = 1 - saturate(_FoamThickness* (depth - i.screenPos.w )) ;

  • ????foamMask???texture?blend?
  • ???????????????????mask??????progressively blur??????????????


60.jpg
? ??????Sea of Thieves????????

61.jpg
? ??????Sea of Thieves????????

5.2.5 ????&?????[GDC 2018]?????5???????????

GDC 2018??????5?????????????????????????????????Noise?????????????offset??Flow Map?????????????????Signed Distance Field?SDF??????????????????????????????

62.jpg

???????????????

????2019??????3A????????????&?????????????????????

???????????????????????????????????????

6.1 Crest Ocean System

Crest Ocean System?Unity???????????????????SIGGRAPH?SIGGRAPH 2017?SIGGRAPH 2019??????????

???????https://github.com/crest-ocean/crest

demo???https://www.youtube.com/watch?v=ekng3c43Y1E

63.jpg

????????Crest Ocean System??????LWRP?????https://assetstore.unity.com/pac ... tem-lwrp-urp-141674

6.2 CryEngine????

????GPU?????????????CryEngine???????????????????????????????????????????CryEngine????????

???????https://github.com/CRYTEK/CRYENGINE/CryFX/Water.cfx

demo???https://www.youtube.com/watch?v=tZthI6M07iM

64.jpg

6.3 UE4 Dynamic Water Project

Dynamic Water Project ?Unreal???????????????????????????????????

???????marvelmaster/UE4_Dynamic_Water_Project


6.4 Ceto Ocean system

Ceto ?Unity??????????????????

???????https://github.com/Scrawk/Ceto

66.jpg

6.5 NVIDIA UE4 WaveWorks

GDC 2017??NVIDIA?Unreal Engine?????WaveWorks?????Unreal Engine 4.15?????????

???????https://github.com/NvPhysX/UnrealEngine/tree/WaveWorks

demo???https://www.youtube.com/watch?v= ... p;index=11&t=0s

67.jpg

6.6 Unity LWRP BoatAttack

BoatAttack?Unity?2018?5?13??????LWRP??????????????????????????????????Unity???????????????

???????https://github.com/Verasl/BoatAttack

demo???https://www.youtube.com/watch?v=7v9gZK9HqqI

68.jpg

????

??????????????????????????????????????????????????????????????????????

??????????????????

69.jpg

???????QianMo/Water-Rendering-Knowledge-Architecture.png

???GitHub?

???????????GPU???Shader???????????????GPU???Shader???????????????Game-Programmer-Study-Notes??GitHub Repo??

???GitHub??????

QianMo/Game-Programmer-Study-Notesgithub.com

Reference:


[1] FX Guide 2012, Assassins Creed III The tech behind or beneath the action, https://www.fxguide.com/fxfeatur ... beneath-the-action/
[2] SIGGRAPH 2001, Tessendorf J. Simulating ocean water[J]. Simulating nature: realistic and interactive techniques.
[3] SIGGPRAPH 2019, Multi-resolution Ocean Rendering in Crest Ocean System
[4] GDC 2008, Fast Water Simulation for Games
[5] GDC 2012, Water Technology of Uncharted
[6] GDC 2018, Water Rendering in FarCry 5
[7] Jeschke S, Wojtan C. Water wave packets[J]. ACM Transactions on Graphics (TOG), 2017
[8] 2010, Yuksel C. Real-time water waves with wave particles[M]. Texas A&M University
[9] SIGGRAPH 2016, Rendering rapids in Uncharted 4
[10] GDC 2019, Technical Artist Bootcamp Distance Fields and Shader Simulation Tricks
[11] https://zhuanlan.zhihu.com/p/21573239
[12] SIGGRAPH 2010, Water Flow in Portal 2
[13] GPU Gems2, Using Vertex Texture Displacement for Realistic Water Rendering
[14] SIGGRAPH 2013, Oceans on a Shoestring Shape Representation, Meshing and Shading
[15] SIGGRAPH 2018, The Technical Art of Sea of Thieves
[16] GDC 2015, An Introduction to Realistic Ocean Rendering through FFT
[17] CGDC 2015, Ocean simulation and rendering in War Thunder
[18] NVIDIA 2004, Ocean Surface Simulation nvidia
[19] SIGGRAPH Asia 2012, Real-time Animation and Rendering of Ocean Whitecaps
[20] TOG 2017, Water Wave Packets
[21] NVIDIA 2004, Ocean Surface Simulation nvidia
[22] GDC 2017, From Shore to Horizon Creating a Practical Tessellation Based Solution
[23] https://www.tek.com/fft
[24] https://www.youtube.com/watch?v=hzw-NOKeSRY
[25] https://www.youtube.com/watch?v=iBBQzs-7Ac4
[26] https://www.fxguide.com/fxfeatured/the-science-of-fluid-sims/
[27] https://graphicsrunner.blogspot. ... sing-flow-maps.html
[28] ??????????

??????
?????https://zhuanlan.zhihu.com/p/95917609

1.png
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-8-17 20:11

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表