????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??????????
??????????????????
????????5????????
?????4????????
???????????????????
??????????????????????????????Skull & Bones???gameplay???
????????????
?????3A????????????????????????????????????????????????
???????????????
?????????????????????
???????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 ????????
??????????????????????????????????????????????????????????????
?????????????????Sinusoids Wave??Gerstner?(Gerstner Wave)????????????
4.1.1 ????Sinusoids Wave?[Max 1981]
????????????????????Sinusoids Wave??????????????????????????
? Unity??????????Sinusoids Wave????
1981??Max[Max 1981]??????????????????????????????????????????????????????Sinusoids Wave???????t?????x?z???????y = h?x?z?t????????
- ??
????? -
??i????? - ????
-
??????pulsation? -
????????
????Sinusoids Wave?????????????????????????????????Gerstner??
4.1.2 Gerstner ??Gerstner Wave? [Fournier 1986]
??????????Gerstner ??Gerstner Wave?????????????????????????????
? Unity??????Gerstner????
Gerstner ?(Gerstner Wave)?????Trochoidal Wave???????????????????periodic surface gravity waves????????????Gerstner?1802 ????????1863??Ranine????????1986??Fournier???????????
? Gerstner Waves??
? Gerstner Waves???????????
???????ki???Ai????i????i??? ?Gerstner Waves???????
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]????????????????????????????????
? 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????????????????????????
??FFT??????????????????????spectrum-based?????????????FFT??????????????????????????????????????????????[Tessendorf 2001]???Phillips???????????????????????????????????????FFT?????????????????????displacement map????????????????????????????????????Folding Map?
? ??FFT??????? [NVIDIA 2004]
??FFT????????90????????????????????2000????????????????????????????????????????????????????????????????????Crysis???????????????64 x 64???????????????????512 x 512?????????????????????????????FFT?????????????????????????????????????1997????????????????????????2048 x 2048????????
? ???????????????FFT????????????2048 x 2048???????
4.3 ??????
4.3.1 ?????Wave Particle? [2007]
?????Wave Particle??????Yuksel?2007?[Yuksel 2007]????????????????????????????????????????????????????????????????????????????????
?????Wave Particle???????????????????FFT??????????????????????????????????????????????
? Wave Particle ?????[Yuksel 2007]?
????????????Wave particles?????????????????????????????????????????amplitude?????radius??
???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
? ?a???b??????????????????????c???d??????????????????????????[Yuksel 2010]?
??????????????????????????????????????????????????????????????????????
? ???????????????????????????[Yuksel 2010]?
???Wave Particles????????????????????
2007?Yuksel?????Wave Particles???????????????????????????3?????????????????3???????????????????????????????????????????????????????????????vector displacement field??
? ?????3????????wave particles?????????? [SIGGRPAPH 2016]
?????4??????????Wave Particles??????????Wave Particles????????
? ?????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]
? ???????Water Wave Packets??????
? ???????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]
? ???????Water Surface Wavelets?????? [SIGGRPAPH 2018]
4.4 ???????
???????????????????????????????????????????????????????????????????????
??????????????????Navier-Stokes???Navier-Stokes Equations,NS????????Navier-Stokes????????????????????????????????????????????????????????????????????????????
Navier-Stokes?????
- ????????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?
? ??Flow Map????? [SIGGRAPH 2010]
? ??Houdini?Flow Map????? [SIGGRAPH 2010]
Flow Map???????????????????????????Flow Map???????????????
? ??Flow Map????? @Unity
? ??Flow Map????? @UDK
Flow Map?????????2D???????????????UV????????????
? ??Flow Map???
Flow Map????????????
- //get and uncompress the flow vector for this pixel
- float2 flowmap = tex2D( FlowMapS, tex0 ).rg * 2.0f - 1.0f;
- float cycleOffset = tex2D( NoiseMapS, tex0 ).r;
- float phase0 = cycleOffset * .5f + FlowMapOffset0;
- float phase1 = cycleOffset * .5f + FlowMapOffset1;
- // Sample normal map.
- float3 normalT0 = tex2D(WaveMapS0, ( tex0 * TexScale ) + flowmap * phase0 );
- float3 normalT1 = tex2D(WaveMapS1, ( tex0 * TexScale ) + flowmap * phase1 );
- float flowLerp = ( abs( HalfCycle - FlowMapOffset0 ) / HalfCycle );
- float3 offset = lerp( normalT0, normalT1, flowLerp );
复制代码
4.5.1.1 Flow Map????????3?Flow Map + Displacement
???Flow Map?????????????????????3???Flow Map + Displacement?
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]
4.5.1.3 Flow Map????????4?Flow Map + Wave Particles
???????4???Flow Map + Wave Particles[SIGGRAPH 2016, Rendering Rapids in Uncharted 4]????????????????????????
? ?????4???Flow Map + Wave Particles????flow map??????wave particle grids????????????????????????????????????flow map?????
????????4??Flow + Wave Particles?????
- timeInt = time / (2.0 * interval)
- float2 fTime = frac(float2(timeInt, timeInt * .5)
- posA = pos.xz - (flowDir/2) * fTime.x * flowDir
- posB = pos.xz - (flowDir/2) * fTime.y * flowDir
- gridA0 = waveParticles(posA.xz, freq0,scale0)
- gridA1 = waveParticles(posA.xz, freq1,scale1)
-
- gridB0 = waveParticles(posB.xz, freq2,scale0)
- gridB1 = waveParticles(posB.xz, freq3,scale1)
- float3 pos0 = gridA0 + gridA1 + gridA2 + gridA3
- float3 pos1 = gridB0 + gridB1 + gridB2 + gridB3
- pos = blend(pos0, pos1, abs((2*frac(timeInt)-1)))
- 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?
? ????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???????????????????????????????????????
? ????????????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???????????????
???????????BSSRDF???????????????????????????????????????????
?????3??2012?SIGGRAPH????????????????????????????
???????????????????
- ????Diffuse?
- ?????Specular?
- ?????Normal Map?
- ???Reflection?
- ????Translucency?
- ???????????Depth Based LUT Approach?
- ??????Subsurface Scattering?
- ?????Flow?
- ?????Underwater Haze?
????????????????????????????????????Flow????????????????
????????????????Translucency?????Foam/WhiteCap??????????
5.1 ??????Translucency??????
????????Translucency??????????????????????????
- LUT???Look-Up-Table Approach?
- ??????????Sub-Surface Scattering,SSS Approximation Approach??
- ?????? ????LUT???????????????????????????????3?
5.1.1 ???????????Depth Based LUT Approach?
Depth Based-LUT?????????????????????????????????/??LUT?Absorb/Scatter LUT?????????????????????????????
?????????????????????????????????????
? ????????????????????????
5.1.2 ??????????Sub-Surface Scattering Approximation Approach?
?????????????????Sub-Surface Scattering?SSS??????????????????
- [SIGGRAPH 2019] Crest Ocean System?????????SSS???
- [GDC 2011] ?????Fast SSS???
? ??????????????
5.1.2.1 [SIGGRAPH 2019] Crest Ocean System?????????SSS??
??Crest Ocean System??????????SSS?????????
- ?????????????????????
- ??FFT???????????????????mask
- ????????????mask????????????????????????????????????
- ?????Displacement???????????????????????????????
????????????
- float v = abs(i_view.y);
- half towardsSun = pow(max(0., dot(i_lightDir, -i_view)),_SubSurfaceSunFallOff);
- half3 subsurface = (_SubSurfaceBase + _SubSurfaceSun * towardsSun) *_SubSurfaceColour.rgb * _LightColor0 * shadow;
- subsurface *= (1.0 - v * v) * sssIndensity;
- col += subsurface;
复制代码
? ?Crest Ocean System????????????????
? ??????Sea of Thieves?????????????????
? ??????Sea of Thieves?????????????????
5.1.2.2 [GDC 2011] ?????Fast SSS??
[GDC 2011]??Frostbite?????Fast Approximating Subsurface Scattering????????????????
????????????
5.2 ???????
???Foam????????????Whitecap?White Water??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
? ??????
??????????????????????????????????????????????????????
?????????????????????????
- ???????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???
??????War Thunder?????CGDC 2015??????????????????M???????????????M~0.3...05?
? ??????War Thunder???????????M???????????? [CGDC 2015]
?????????Sea of Thieves?????SIGGRPAPH 2018???????????????????????????????????Progressive Blur???????noisy????????????????
? ??????????????? + ?????Progressive Blur?????????
5.2.2 ?????[GPU Gems 2] ??Saturate?????
?GPU Gems 2??????????????????????????????????H0????????????????????????????
- ???
??????????
??????
?????? - ?????????????????????????????????????????????????????????
- ??????????????????????????????
5.2.3 ?????[2012]?????3???Multi Ramp Map???
?????3??????????????????
- ?????????????????????????????
- ???????Perlin???????????????????????????
- ????????????R?G?B??????????????????????ramp???????????????????????????????????????????????ramp????????????????
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??????????????
? ??????Sea of Thieves????????
? ??????Sea of Thieves????????
5.2.5 ????&?????[GDC 2018]?????5???????????
GDC 2018??????5?????????????????????????????????Noise?????????????offset??Flow Map?????????????????Signed Distance Field?SDF??????????????????????????????
???????????????
????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
????????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
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
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
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
????
??????????????????????????????????????????????????????????????????????
??????????????????
???????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
|