BoraFX Ocean Tool
User Guide
Wanho Choi
Chronology
Zephyrus ZFX ZarVis BoraFX
2018 2017
2016 2014
해적 서유기2 귀취등 ?
Bora (보라)
잘게 부스러지거나 한꺼번에 많이 가루처럼 흩어지는 눈이나 물 따위.
(Snow or water that is crumbled or scattered like powder at a time.)
C++ based in-house fluid framework for Dexter Studios
It includes plug-ins for Maya, Houdini, and RenderMan
눈보라
Zephyrus / ZFX / ZarVis Ocea Bora Ocean
FFTW 3.3.6 FFTW 3.3.7
OpenMP (Intel Open Multi-Processing) TBB (Inter Threading Building Block) - GLSL realtime shader
world space / uv space world space / (uv space)
domainSize physicalLength / geometricLength with sceneConvertingScale
Phillips / JONSWAP / TMA (ad hoc)
Phillips / PiersonMoskowitz / JONSWAP / TMA (more physically accurate)
directionality (ad hoc)
swell
(more physically accurate) waveScale amplitudeGain
choppiness pinch
foam crest
foamPower, foamScale, foamAdd crestGain, crestBias .exr ➜ .tex ➜ ZVOceanOceanLoader .exr ➜ PxrBoraOcean
What we do not deal with
breaking wave
Tsunami
swash & backwash
whitecaps
What we do deal with
Ocean surface waves
Wind waves
Ocean Wave Generation Mechanism
If a
fluctuation breaks the equilibrium water surface level,
1)
gravity pulls it down
2)
inertia acquired during the falling movement appears
3)
it causes the water to penetrate below its level of equilibrium
4)
and
buoyancy causes a bouncing motion.
gravity
Key Terms
MWL
(Mean Water Level)
2D Height Field Approach
Ocean Waves
A complex of
many different sets of waves of different
Wind(-generated) Waves
Waves
on the free surface of bodies of water
(like oceans, seas, lakes, rivers, canals, puddles or ponds)
They result from the
wind blowing over an area of water surface.
They can
travel thousands of miles before reaching shore.
Main factors
1)
wind
2)
gravity
Wind(-generated) Waves
Fetch
Fully Developed Sea
•
The waves of a fully developed sea have the
maximum height
Swell
Swell
When directly generated and affected by local winds,
a wind wave system is called a
wind sea.
After the wind ceases to blow, wind waves are called swells.
More generally, a swell consists of wind-generated waves
that are
not significantly affected by the local wind at that time.
Sinusoidal vs Real Ocean Wave
A real ocean wave has
1)
sharper crests
2)
flatter troughs
The FFTW Library
Fastest Fourier Transform in the West
www.fftw.org
m_fftPlan = fftwf_plan_guru_dft_c2r (
rank, dims, howMany, howManyDims,
reinterpret_cast<fftwf_complex*>(in), out, FFTW_ESTIMATE | FFTW_DESTROY_INPUT
);
A Ocean Tile
A
2D square on xz-plane with y=0
It is
repeatable.
Attribute Editor Controls
⊂
Display Controls
Display Mode: None / Wireframe / Shaded Surface
Deep Water Color: trough 부분의 색상
Shallow Water Color: crest 부분의 색상
Sky Texture File: dome light로 사용할 이미지 파일 (.exr, .hdr, .jpg)
Glossiness: sky texture의 반사정도 (0.0~1.0)
Draw Outline: ocean tile의 외곽선 표시 on/off
Outline Color: outline의 색상
Outline Width: outline의 두께
Show Tangles: normal이 뒤집히는 부분 표시 on/off
Tangle Color: normal이 뒤집히는 부분을 표시 색상
Basic Controls (1/3)
Time Offset: 시간에 대한 옵셋
Time Scale: 시간에 대한 배속
Looping Duration: 몇 초 마다 반복할 것인가
(10초로 설정되어 있으면 240 프레임 마다 반복됨)
(crestAccumulation이 on되어 있으면 비활성화됨)
(flowSpeed>0이면 비활성화됨)
Basic Controls (2/3)
Direction: 바람의 방향 (0˚: +x축, 90˚: +z축)
Speed: 바람의 속도 (m/s)
Wind Fetch Length: wind fetch의 길이 (km)
Swell: swell의 정도 (0: no swell, 1: 100% swell)
Non-physical Flow Speed: translation 속도
(물리적이지 않음)
Basic Controls (3/3)
Swell: swell의 정도 (0~1)
Amplitude Gain: 수직(y축) 방향으로의 displacement scale factor
Pinch: 수평(xz-평면) 방향으로의 displacement scale factor
Crest Gain: crest(alpha 채널)값에 곱해지는 계수
Crest Bias: crest(alpha 채널)값에 더해지는 계수
alpha값 = ( crestGain * crest값) + crestBias
Crest Accumulation: crest값을 누적시킬지에 대한 on/off
Crest Decay: crest값이 사라지는 정도
Scene Converting Scale
Maya: grid 1 unit = 1cm (default setting)
Dexter: grid
1 unit = 10 cm (=0.1 m)
Bora Ocean의 scene converting scale = 10
Houdini: grid 1 unit = 1 m (default setting)
Dexter: grid
1 unit = 1 m 로 간주하여 사용한다.
Bora Ocean의 scene converting scale = 1
180 cm
18 칸 (Maya) 1.8 칸 (Houdini)
Scene Converting Scale
Scene Converting Scale OceanTile의 한 변의 길이 Maya Grid의 칸 수 Maya Grid 한 칸의 길이
0.1 100 m 10 칸 10 m (1,000 cm) 1 100 m 100 칸 1 m (100 cm) 10 100 m 1,000 칸 0.1 m (10 cm) 100 100 m 10,000 칸 0.01 m (1 cm) default setting
Export & Import MEL Script
BoraOceanCmd -nodeName “BoraOceanShape1” -toolName “export” -filePath
“/home/wanho.choi/zzz” -fileName “MyOcean” -startFrame 1001 -endFrame 1234;
BoraOceanCmd -nodeName “BoraOceanShape1” -toolName “import” -filePath
“/home/wanho.choi/zzz” -fileName “MyOcean”;
export
The Result Data
Data Workflow
Maya RenderManBoraOcean
PxrBoraOcean
.oceanParams
.exr sequence
displacement
.tex sequence
Ocean Map Rotation
θ rotated map original map θ Q(x ,′ z )′ P(x, z)The coordinates should be rotated by -
θ
.
The vector should be rotated by +
θ
.
To Do List
Houdini VEX node
UV based displacement
Handling breaking waves
Interlocking with Bora water simulation
Fast peak detection for mist generation
Maya deformer
Key Classes
OceanParams
: parameters
OceanTile (resolution: 2
Nx2
N)
: ocean spectrum data, FFT result data
OceanTileVertexData (resolution: (2
N+1)x(2
N+1))
: ocean tile geometry data, interpolation
OceanGLSLShader
: GLSL shader
GLDrawOcean
OceanTile oceanTile;
OceanTileVertexData oceanTileVertexData;
Per Frame Update Code
Header
Body
OceanParams oceanParams;
if( oceanTile.initialize( oceanParams ) ) {
oceanTileVertexData.initialize( oceanTile ); }
oceanTile.update( time );
glDrawOcean.draw ( oceanTileVertexData, cameraPosition, lightPosition, lightColor, deepWaterColor, shallowWaterColor, glossiness, exposure );
GLSL Drawing Code
Header Body GLDrawOcean glDrawOcean;Interpolation Code
OceanTileVertexData oceanTileVertexData;
Header
Body
Vec3f GRD; // point before applying displacement Vec3f POS; // point after applying displacement Vec3f NRM; // normal
float WAV; // amount of displacement only in y-direction float CRS; // crest value
Vec3f wp; // world position being queried
oceanTileVertexData.lerp( wp, &GRD, &POS, &NRM, &WAV, &CRS );
oceanTileVertexData.catrom( wp, &GRD, &POS, &NRM, &WAV, &CRS ); oceanTileVertexData.lerp( wp, NULL, &POS, NULL, NULL, NULL );