50
Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Embed Size (px)

Citation preview

Page 1: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Real-Time Rendering of Cartoon Smoke and Clouds

Real-Time Rendering of Cartoon Smoke and Clouds

Morgan McGuireAndi Fein

Paulo Ferreira

Page 2: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Gundam

Page 3: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Motivation

Real-time cartoon rendering for:

• NPR Video Games• Production Animation Preview• Visualization• Simulation and Training

These often contain smoke, fluids, and other amorphous shapes…

Page 4: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Captain Marvel, June 1947

Marvel Comics 1947

Outlines

Self-Shadowing

Cel Shading

Page 5: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Heart of Empire

Published by Dark Horse Comics 1999

Page 6: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

SuperMan/Batman #16

Page 7: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Teenage Mutant Ninja Turtles Cartoon (2004)

Page 8: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Worms 4 (Game 2005)

Page 9: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Algorithm

Page 10: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Simulation• Particle system

• Forces:— Buoyancy — Wind

— Drag — Gravity

— Vortices — Turbulence

• Size = smoke density

• ODE physics engine at 30 Hz— Compressible: 100,000 particles

— Incompressible: 1,000 particles

Page 11: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Simulation• Use Particles from the game “Avalanche”

Page 12: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Simulation• Instead of smoke and clouds, cartoon effect

applied on the avalanche of the game

Page 13: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Rendering steps

1. Precomputed Nailboards

2. Outlines

3. Cel Shading

4. Shadows

Page 14: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Elements of Style

Outlines Shading Self-Shadowing

Steps

Page 15: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Nailboards

Page 16: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Normal-mapped Nailboards

• Precompute extended billboard textures

• Several puff orientations for variety

• Each particle is assigned one variation

Normal Depth Color Opacity

Page 17: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Preprocessing step: Nailboard• Create two textures to store data such as:

unit camera-space surface normal N, signed camera space depth d, diffuse color C, and coverage mask alpha.

Page 18: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Outlines

• Edges of puff are deep and black

Viewer Actual BillboardNailboard DepthDepth

Color

Black

Shaded

Page 19: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Depth and Outline Pass

• Add d from the texture to the depth at the pixel and the depth buffer test automatically produces correct intersections.

Page 20: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Outlines

• Edges of puff are deep and black

Viewer Image1 Nailboard

Page 21: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Outlines

• Edges of puff are deep and black• Depth test suppresses excessive internal contours

Viewer Image2 Nailboards

No internal contour

Page 22: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Outlines

• Edges of puff are deep and black• Depth test suppresses excessive internal contours• Large depth discrepancy restores external contours

Viewer Image3 Nailboards

External contour distinguishing clouds

Page 23: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Outlines

• Use the alpha-shapes, which are slightly larger than the normal shapes, to create the outline, a flange of dark pixels slightly behind the billboard.

• The outline of these flange pixels is opaque because alpha is one, colored black because the C is black, and farther from the camera than the particle itself because d is zero.

Page 24: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Cel Shading

• Ambient: Gradient as function of y

• Diffuse:Arbitrary function, q(N · L)

• Pack both into a 2D texture, like X-Toon

q =

Example

Lambertian Selle04 Two-Tone Three-Tone

N · L

y

Page 25: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Explosion B & W

q =

Ambient

Page 26: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Explosion Color

q =

Ambient

Page 27: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Cel-Shading Pass

• Get N, C and alpha from the textures.

Page 28: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Cel-Shading Pass

• With ambient light color Ka, light color Kl, camera-space direction L to the light source, and diffuse color C from the texture map, the pixel at (x, y) is colored by a pixel shader using the following equation:

N · L

y

Page 29: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Shadow Volumes

1. Compute the silhouette of the caster

2. Extrude this to form a polyhedron bounding the volume of shadowed space

3. Shadows are intersection between the volume and the scene

Page 30: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Billboard Shadows• Caster is perpendicular to viewer and light• Volume is a rectangular prism• Four sides are parallel to the view vector

• Only 3 polygons to be rendered: one billboard and two shadow faces

Page 31: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Nailboard Shadows

• Apply the depth displacement to the shadow volume as well as the billboard

Shadow volume visualization

Page 32: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Shadow Volume Visualization

Page 33: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Shadowing

Page 34: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Results

Page 35: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Train

Page 36: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Magic Lamp

Page 37: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Purple Cloud

Page 38: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Explosion

Page 39: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Varying Puff Shape

Page 40: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Varying Puff Shape

Page 41: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Varying Puff Shape

Page 42: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Video

Page 43: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Video

Page 44: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Mimicking Artists

Page 45: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Lichtenstein

Estate of Roy Lichtenstein 1963

Estate of Roy Lichtenstein 1963

ArtistAlgorithm

Page 46: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Context

Page 47: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

ComparisonPublished by Dark Horse Comics 1999

Algorithm Artist

Page 48: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

50,000 particles

50,000 Particles on GeForce6800

Page 49: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira
Page 50: Real-Time Rendering of Cartoon Smoke and Clouds Morgan McGuire Andi Fein Paulo Ferreira

Depth Differences

• Image space outlining method [Saito and Takahasi]• Benefits:

– Rendering time independent of the scene

– Handles intersecting surfaces

• Drawbacks:– Can stall graphics pipeline

– Assumes one style for the entire scene