siggraph2010_vlachos_waterflow

Upload: william-pugh

Post on 09-Apr-2018

225 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/7/2019 siggraph2010_vlachos_waterflow

    1/54

    Water Flow in

    Alex Vlachos, Valve

    July 28, 2010

  • 8/7/2019 siggraph2010_vlachos_waterflow

    2/54

    Outline

    Goals & Technical Constraints

    How Artists Create Flow Maps

    Flowing Normal Maps in Left 4 Dead 2

    Flowing Color Maps in Portal 2

  • 8/7/2019 siggraph2010_vlachos_waterflow

    3/54

    Left 4 Dead 2

  • 8/7/2019 siggraph2010_vlachos_waterflow

    4/54

  • 8/7/2019 siggraph2010_vlachos_waterflow

    5/54

  • 8/7/2019 siggraph2010_vlachos_waterflow

    6/54

    Goals

    Visual

    Solve repeating texture artifacts

    Flow around obstacles

    Vary water speed and bump strength

    Technical Work with existing reflective surfaces

    Min hardware ps2.0b (6-year-old hardware) & Xbox

    Gameplay

  • 8/7/2019 siggraph2010_vlachos_waterflow

    7/54

    Gameplay

    Early Left 4 Dead 2 playtests showed players were con

    got lost often in the swamps Soft non-directional lighting

    Trees provided too much cover

    My theory was that water flow would improve gamepl

    highlighting the correct path We tested this theory through playtesting

    In practice, we found testers took 17% fewer wrong tu

    decreased the time it took to traverse the level!

  • 8/7/2019 siggraph2010_vlachos_waterflow

    8/54

    Technical Constraints

    Already at perf limits on the Xbox 360 & low-e

    Already at memory limits on the Xbox 360

    Our water shader had limited instructions left low end hardware ps2.0b

  • 8/7/2019 siggraph2010_vlachos_waterflow

    9/54

    Algorithm Overview

    Pixel shader flow, not geometric flow

    Continue to use a normal map for water

    ripples

    Artists author a flow map (a texture

    containing 2D flow vectors) Use this flow map in a pixel shader to

    distort the normal map in the direction of

    flow

  • 8/7/2019 siggraph2010_vlachos_waterflow

    10/54

    Flow Texture Mapped onto Surface

    Covers entire water surface

  • 8/7/2019 siggraph2010_vlachos_waterflow

    11/54

    Normal Map Mapped onto Surface

    Tiled over the water surface

  • 8/7/2019 siggraph2010_vlachos_waterflow

    12/54

    Artists Author Flow Maps

    Flow map provides a unique 2D vector for ever

    the water surface Relatively low resolution: ~4 texels/meter

    Impractical to paint directly

    We use Houdini to create vector flow maps

  • 8/7/2019 siggraph2010_vlachos_waterflow

    13/54

    Houdini Importing Level Geom

  • 8/7/2019 siggraph2010_vlachos_waterflow

    14/54

    Houdini Combing Vector Fie

  • 8/7/2019 siggraph2010_vlachos_waterflow

    15/54

    Houdini Procedural Masks

  • 8/7/2019 siggraph2010_vlachos_waterflow

    16/54

    Houdini Applying Masks

  • 8/7/2019 siggraph2010_vlachos_waterflow

    17/54

    Houdini Water Normal Maps

  • 8/7/2019 siggraph2010_vlachos_waterflow

    18/54

    Left 4 Dead 2

    Wanted to replace our scrolling normal maps w

    flowing normal maps

    Keep the rest of the water shader the same

    This algorithm ultimately provides a new per-p

    normal generated from the normal map and fl

  • 8/7/2019 siggraph2010_vlachos_waterflow

    19/54

    Related Work

    Nelson Max and Barry Becker 1995. Flow visua

    using moving textures. In Proceedings of theICASW/LaRC Symposium on Visualizing Time-V

    Data, 7787.

    Building on aspects of their algorithm and app

    approach to flowing normal maps

  • 8/7/2019 siggraph2010_vlachos_waterflow

    20/54

    Flow Visualization

    Inputs: flow field & noise texture

    Distort a noise texture to visualize a flow field

    The UV is offset by the 2D flow vector scaled b

  • 8/7/2019 siggraph2010_vlachos_waterflow

    21/54

    Flow Visualization Textures

    Flow Texture

    Noise Texture

  • 8/7/2019 siggraph2010_vlachos_waterflow

    22/54

    Flow Visualization Experiment

  • 8/7/2019 siggraph2010_vlachos_waterflow

    23/54

    Max & Beckers Observation

    The beginning of the distortion looks convincin

    Only distort a small amount

    In general, distortion looks reasonable for thefirst 1/3 of uv space

    hl l

  • 8/7/2019 siggraph2010_vlachos_waterflow

    24/54

    Smoothly Interpolating Layers

    Blend the short animated segment in two laye

    Each layer is offset half a phase so we can hiderestart for each layer

    hl l

  • 8/7/2019 siggraph2010_vlachos_waterflow

    25/54

    Smoothly Repeating Flow

    A G S

  • 8/7/2019 siggraph2010_vlachos_waterflow

    26/54

    A Great Start

    We now have a method to flow a normal map

    We want to apply this to a larger surface

    But applying this to a large surface means tilingnormal map which will cause artifacts

    P l 2 T M

  • 8/7/2019 siggraph2010_vlachos_waterflow

    27/54

    Portal 2 Test Map

    P l 2 T M (P A

  • 8/7/2019 siggraph2010_vlachos_waterflow

    28/54

    Portal 2 Test Map (Programmer Ar

    Fl V t W t S f

  • 8/7/2019 siggraph2010_vlachos_waterflow

    29/54

    Flow Vectors on Water Surface

    Si l L N l Di t ti

  • 8/7/2019 siggraph2010_vlachos_waterflow

    30/54

    Single Layer Normal Distortion

    D bl L N l Di t ti

  • 8/7/2019 siggraph2010_vlachos_waterflow

    31/54

    Double Layer Normal Distortion

    T M j P bl

  • 8/7/2019 siggraph2010_vlachos_waterflow

    32/54

    Two Major Problems

    Repetition The same normals will flow

    through the same point on the mesh

    Pulsing The surface appears to pulse in a

    repeating pattern

    R titi Vi li ti Si l L

  • 8/7/2019 siggraph2010_vlachos_waterflow

    33/54

    Repetition Visualization Single Lay

    Double Layer

  • 8/7/2019 siggraph2010_vlachos_waterflow

    34/54

    Double Layer

    Double Layer With Offset

  • 8/7/2019 siggraph2010_vlachos_waterflow

    35/54

    Double Layer With Offset

    Repetition Solved by Offset

  • 8/7/2019 siggraph2010_vlachos_waterflow

    36/54

    Repetition Solved by Offset

    Pulsing Solved by Noise

  • 8/7/2019 siggraph2010_vlachos_waterflow

    37/54

    Pulsing Solved by Noise

    Pulsing Solved by Noise

  • 8/7/2019 siggraph2010_vlachos_waterflow

    38/54

    Pulsing Solved by Noise

    Water Speed Affects Normals

  • 8/7/2019 siggraph2010_vlachos_waterflow

    39/54

    Water Speed Affects Normals

    We scale down the strength of the normal in tangent spa

    flow speed (Flow speed is the length of the 2D flow ve

    Performance

  • 8/7/2019 siggraph2010_vlachos_waterflow

    40/54

    Performance

    Compared to scrolling two normal maps:

    Additional texture fetches: 2 - flow & noise Additional arithmetic pixel shader instructions

    Water Flow in Portal 2

  • 8/7/2019 siggraph2010_vlachos_waterflow

    41/54

    Water Flow in Portal 2

    Wanted to also flow debris in dirty water

    Needed to modify our algorithm to support flo

    color map

    Debris Flow Example

  • 8/7/2019 siggraph2010_vlachos_waterflow

    42/54

    Debris Flow Example

    Debris Flow Example

  • 8/7/2019 siggraph2010_vlachos_waterflow

    43/54

    Debris Flow Example

    Debris Normal (Same as before

  • 8/7/2019 siggraph2010_vlachos_waterflow

    44/54

    Debris Normal (Same as before

    Flowing Debris Using Same Algorit

  • 8/7/2019 siggraph2010_vlachos_waterflow

    45/54

    Flowing Debris Using Same Algorit

    Flowing Normals

  • 8/7/2019 siggraph2010_vlachos_waterflow

    46/54

    Flowing Normals Flowing normals would repeat

    an interval from zero to some

    fraction with the peak (center)of the interval at half distortion

    Flowing Debris

  • 8/7/2019 siggraph2010_vlachos_waterflow

    47/54

    Flowing Debris Flowing colors works better by

    offsetting the interval from

    fraction to +fraction so thepeak of the interval is at zero

    (the at-rest position)

    Flowing Debris Using Offset

  • 8/7/2019 siggraph2010_vlachos_waterflow

    48/54

    Flowing Debris Using Offset

    Debris Flow

  • 8/7/2019 siggraph2010_vlachos_waterflow

    49/54

    Debris Flow

    Portal 2 Test Map

  • 8/7/2019 siggraph2010_vlachos_waterflow

    50/54

    Portal 2 Test Map

    Left 4 Dead 2

  • 8/7/2019 siggraph2010_vlachos_waterflow

    51/54

    Left 4 Dead 2

    Future Work

  • 8/7/2019 siggraph2010_vlachos_waterflow

    52/54

    Future Work

    Flow height maps and use tessellation hardwa

    Multiple frequencies of normal maps

    Render dynamic flow vectors per-frame so ani

    objects cause flow changes

    Use flow map with our physics simulation to h

    objects flow on the water surface using the sam

    Summary

  • 8/7/2019 siggraph2010_vlachos_waterflow

    53/54

    Summary

    Use an artist-authored flow map

    Flow the normals in two layers and combine

    Use noise to reduce pulsing artifact

    Offset each phase of animation to reduce repe

    Flowing debris uses an offset distortion range tless distortion than the normal flow

  • 8/7/2019 siggraph2010_vlachos_waterflow

    54/54

    Thank You!

    Water textures created by Alireza Razmpo

    Alex Vlachos, [email protected]