fmx2013: butterfly effect

49
Butterfly Eect: Workflow, Rendering & Shading Renaldas Zioma Unity Technologies @__ReJ__ Monday, April 29, 13 This talk will cover workflows and techniques that we adopted while working on the Butterfly Effect.

Upload: renaldas-zioma

Post on 22-Jan-2015

2.579 views

Category:

Technology


1 download

DESCRIPTION

FMX2013 presentation on challenges and solutions in transitioning from traditional offline CG production towards interactive approach used in creation of animated short Butterfly Effect. Butterfly Effect is a real-time CG-animated short developed in a collaboration between Unity Technologies, Passion Pictures, and NVIDIA.

TRANSCRIPT

Page 1: FMX2013: Butterfly Effect

Butterfly Effect:Workflow, Rendering & Shading

Renaldas ZiomaUnity Technologies

@__ReJ__

Monday, April 29, 13

This talk will cover workflows and techniques that we adopted while working on the Butterfly Effect.

Page 2: FMX2013: Butterfly Effect

Unite template2

What is it?Real-time animated shortCollaboration between Unity, Passion Pictures and NVIDIA

Monday, April 29, 13

If you haven’t seen Butterfly Effect is realtime animated short, developed in collaboration between Unity, Passion Pictures and NVIDIA

Page 3: FMX2013: Butterfly Effect

Opportunity to Learn

• Passion Pictures• New world of RealTime• No prior experience with Unity

• Unity Technologies• CG Pipeline• Huge amounts of Data

3

Monday, April 29, 13

Passion Pictures is a film and animation production company with broad experience in CG, stop-motion, documentary and traditional media. Passion Pictures have developed visual elements for animated rock band Gorillaz, cinematics for Rock Band video game and infamous (in UK) Meerkat advertisements.

Prior to this collaboration Passion Pictures had NO experience with Real Time rendering / Game technologies or any experience working with Unity tools.

We approached Passion Pictures in late Fall of 2011 looking for collaboration on a real-time short.Real-time was a completely new area for Passion Pictures thus presented a learning opportunity to adopt RealTime for internal pre-visualization and leverage experience for working with Interactive projects (studio is working on number of such projects since).

Passion Pictures: “We felt we had an opportunity to do something special that we hadn’t done before, get experience with the Unity real time engine and help drive Unity in a direction that could integrate it with our studio.”

Page 4: FMX2013: Butterfly Effect

Project Outline

• 30GB of source Assets• 5GB of runtime Data• 137 shots• 40 “scenes” in Editor

4

Monday, April 29, 13

Page 5: FMX2013: Butterfly Effect

Project Organization• Team of ~10 - first month

• pre production• research / tools

• Team of ~30 - next 2 months• content• tools / engine modifications

• Team of 5 - last 3.5 months• polish• optimizations

5

Monday, April 29, 13

Page 6: FMX2013: Butterfly Effect

Unite template6

Monday, April 29, 13

Passion Pictures presented a number of short film ideas and once Dan Sumich’s “Butterfly Effect” pitch was chosen - work started.Storyboard was developed from original pitch. Next storyboard was put into Animatronic - animated sequence of images in sync with music too capture flow and timing.

Example of the storyboards for Scooter section in development.

Page 7: FMX2013: Butterfly Effect

Unite template7

Monday, April 29, 13

Color Boards helped to capture mood and lighting.

It is worth noting how well Story and Color Boards resemble the final look of the short.

Page 8: FMX2013: Butterfly Effect

Previz• One Sequence• Goals

• Initial timings• Visualize Space

• Prime lenses • 10, 14, 18, 21, 24, 27, 35, 40, 50, 75, 100, 200

• Zoom lens • 18 to 150

8

Monday, April 29, 13

First pre-visualization was done in traditional to Passion Pictures way - directly in Softimage XSI.Only standard camera settings based on physically cameras and lenses as used in Live shoots (Prime/Zoom lenses) were used to capture the filmic feel.

Page 9: FMX2013: Butterfly Effect

Pipeline

• Connect Passion pipeline with Unity Editor• Main Goal

Minimal changes to Artist workflow!

9

Monday, April 29, 13

Very short production cycle (traditional to CG industry) required minimal changes to artist workflow.Both Passion pipeline (XSI scripts) and Unity Editor scripting capabilities proved to be flexible enough.

Passion Pictures: “After the creative challenge of finding the right director and script for the film, the two immediate challenges were making sure that we had the right tools in Unity for the job so that we could take our pipeline into Unity, and also making sure that we could still work in the way we normally do as a studio. If we break down our pipeline into animation, simulation, rendering and compositing then we wanted to be able to bring these as much as possible into Unity working with our existing content creation tools as normal.”

Page 10: FMX2013: Butterfly Effect

Passion Pipeline

• No Change for Artists• Use Existing Asset Pipeline

• Sequences SB, BU• Shots SB_01_00, SB_02_00• Assets [Character/Camera/Layout]

• Export Models and Publish Shots as normal• Add Unity support

10

Monday, April 29, 13

Standard Passion Pictures asset pipeline could be mapped to Unity asset representation quite easily. Multiple shots were grouped into a single Unity scene - some scenes contained one shot, some multiple. Sequence of shots (SB - SkateBoard, BU - Bus) became a group of Unity scenes sharing same folder.

Standard Passion Picture pipeline (set of Softimage XSI scripts) was augmented with “publishing” shots to Unity project file structure and to incorporate SVN version control. SVN was a new tool for artists.

Page 11: FMX2013: Butterfly Effect

Unite template

Character Rig

• XSI Softimage Rig• Bones• Envelope• Face Shapes• Controls

• Unity Rig• Bones• Blend Shapes• Materials

11

Monday, April 29, 13

Page 12: FMX2013: Butterfly Effect

Unite template

Facial Rig

• Bones• Head, neck, jaw, eyes

• Blend shapes • Face

• Mocap shoot• Face markers

• Cubic motion • Retarget facial animation onto XSI controls

12

Monday, April 29, 13

Facial animations in Softimage XSI / Unity: combination of bones and blend shapes.Face markers were used for facial motion capture, retargeted on controls in Softimage XSI.

Page 13: FMX2013: Butterfly Effect

Unite template13

Monday, April 29, 13

Mocap facial shoot on the right. Animation transferred onto Softimage XSI character rig on the left.

We worked with Centroid for the motion capture shoot. Passion Pictures provided them with a FK rig containing just the bones and skin for our Hero character. Centroid sent FBX files for our FK rig send back FBX files of the FK rig from Centroid.

Using an intermediate rig Passion Pictures transferred the FK animation back onto our IK character rig in Softimage XSI. By keeping the shoot rig live in the scene, we were able to either keep the motion capture, animate on top of it or replace it with new animation, depending what worked in the shot.

Page 14: FMX2013: Butterfly Effect

Unite template14

Monday, April 29, 13

Facial animation controls in Softimage XSI after retargeting.

Page 15: FMX2013: Butterfly Effect

Non-linear time

• Treat Sequences as Live Shoot• Cover the action from different angles• Each sequence needs multiple cameras

15

Monday, April 29, 13

Action packed Butterfly Effect storyboard pushed Passion Pictures to treat film almost as a Live shoot. In traditional Live shoots multiple cameras are used to cover action from different angles. During the montage footage might overlap or jump in time according to Directors whim.

Film was broken down into sequences which correspond to a continuous action (such as Skateboard sequence).Description about every camera was created in Final Cut and exported to custom XML format (based on Edit Decision List or EDL file format of Final Cut).

Page 16: FMX2013: Butterfly Effect

Unite template

Non-linear time• Shot Description

• Final Cut edit• Export EDL as XML file• Camera in/out points

• Timeline in Unity

• Sequence Preview in RV• Using EDL from Final Cut• Play whole preview sequence in RV• Instant Feedback for Animators

16

Monday, April 29, 13

Action packed Butterfly Effect storyboard pushed Passion Pictures to treat film almost as a Live shoot. In traditional Live shoots multiple cameras are used to cover action from different angles. During the montage footage might overlap or jump in time according to Directors whim.

Film was broken down into sequences which correspond to a continuous action (such as Skateboard sequence).Description about every camera was created in Final Cut and exported to custom XML format (based on Edit Decision List or EDL file format of Final Cut).

Page 17: FMX2013: Butterfly Effect

Unite template

Timeline in Unity

17

Monday, April 29, 13

Next this data could be read in Unity and used to control cameras, animated objects and physical simulations. Custom timeline viewer was developed in Unity using Editor scripting. Changes to the film edit, jumping back and forward in time and reordering of the shots became possible without need to rebake animations in Softimage XSI.

Page 18: FMX2013: Butterfly Effect

Unite template

Timeline in Unity

18

Monday, April 29, 13

Next this data could be read in Unity and used to control cameras, animated objects and physical simulations. Custom timeline viewer was developed in Unity using Editor scripting. Changes to the film edit, jumping back and forward in time and reordering of the shots became possible without need to rebake animations in Softimage XSI.

Page 19: FMX2013: Butterfly Effect

Unite template

Non-linear Challenges

• Animation• Particles• Physics

• Rigid Body simulation

19

Monday, April 29, 13

Page 20: FMX2013: Butterfly Effect

Unite template

Point Cache

• Per-vertex Deformations• Cloth• Hair

20

Monday, April 29, 13

Two types of vertex animation: BlendShapes and Point Cache were introduced in Unity for Butterfly Effect.

Passion Pictures: “In our standard pipeline we create point caches for each animated model in the scene using .pc2 or alembic files. This creates a break in the pipeline so that when we’re rendering we don’t need all the animation rig in the scene. For software rendering the cache sizes and data throughput aren’t an issue but in a real time game engine we have to keep the enveloped characters and bake the animation on the bones per frame.”

Page 21: FMX2013: Butterfly Effect

21

Point Cache

Monday, April 29, 13

Point Cache used for extreme face deformation

Page 22: FMX2013: Butterfly Effect

Unite template

Tessellation

• CatmullClark• Now: on CPU• Future: OpenSubdiv library

22

Monday, April 29, 13

(Mostly due to multiple layers of resting cloth) CatmullClark tessellation was used to match DCC tools exactly. It is problematic to implement CatmullClark using DirectX11 hardware tessellation because of recursive nature of certain patches. Instead of approximation we went for exact CPU implementation for 1st level of subdivision.

Page 23: FMX2013: Butterfly Effect

Unite template

Hair

• Guide “strands” for modeling• GPU Tesselation and “Amplification”•

23

Monday, April 29, 13

Guide hair strands provide excellent control for animators.

Page 24: FMX2013: Butterfly Effect

Unite template24

Hair

Monday, April 29, 13

Final look of the hair.

Page 25: FMX2013: Butterfly Effect

25

MentalRay Architectural (MIA) Shaders• Familiar• Small set of parameters• Physically Based

• Micro facet• Energy conserving

Monday, April 29, 13

We aimed to provide PassionPictures artists with familiar tools, hence decision to implement realtime counterparts for MentalRay architectural shaders.

Page 26: FMX2013: Butterfly Effect

Unite template26

1 parameter for Diffuse

Monday, April 29, 13

Between Clay and Plastic.Screenshot from the Unity Editor.

Page 27: FMX2013: Butterfly Effect

Unite template27

2 parameters for Specular

Monday, April 29, 13

Roughness and ReflectivityScreenshot from the Unity Editor.

Page 28: FMX2013: Butterfly Effect

Unite template28

2 parameters for Reflectivity

Monday, April 29, 13

Reflectivity for depending on angle of incidence. Defined as pair of parameters - for ray hitting at Grazing angle (90) and for ray perpendicular to the surface.Screenshot from the Unity Editor.

Page 29: FMX2013: Butterfly Effect

Unite template

MIA Implementation

• Oren-Nayar• Diffuse

• Cook-Torrance• Specular• Geometric + Roughness + Fresnel term• Ward distribution for Roughness

• I think... ;)• Direct + Indirect illumination

29

Monday, April 29, 13

Page 30: FMX2013: Butterfly Effect

Unite template

Unity Implementation

• Oren-Nayar• very expensive• OK approximations

• Cook-Torrance• Normalized Blinn-Phong instead of Ward• Roughness to Phong exponent (n):

• n = 2 / roughness2 - 2 • Tweaked to match MIA look:

• n = 2 / roughness4 - 2• Schlick approximation for Fresnel

• Only direct illumination at RunTime

30

Monday, April 29, 13

Page 31: FMX2013: Butterfly Effect

Unite template31

MentalRay Unity

Monday, April 29, 13

Realtime implementation matches offline MentalRay implementation quite well. Note some small differences in size of specular and very glossy surfaces.

Page 32: FMX2013: Butterfly Effect

Unite template32

Monday, April 29, 13

Most of materials where setup by Passion Pictures in Softimage XSI and were transferred to Unity. Tweaks were necessary to achieve final look in Unity, but relative compatibility of the MIA and Unity shaders saved a bulk of the manual work for us.

Page 33: FMX2013: Butterfly Effect

Unite template33

Indirect Illumination (GI)

• Point Clouds for Dynamic Geometry• Spherical Harmonics for Diffuse Bounce• Cube Textures for Reflections

Monday, April 29, 13

For indirect lighting we went for very practical approach - storing secondary bounces in the low-resolution textures / Spherical Harmonics probes.

Page 34: FMX2013: Butterfly Effect

Unite template34

Indirect Illumination (GI)

• Textures for Static Geometry• Diffuse Bounce• AO

Monday, April 29, 13

Page 35: FMX2013: Butterfly Effect

Unite template35

Indirect Illumination (GI)

• Calculated offline with Autodesk Beast• Path Tracer + Final Gather

• IBL for Sky• Fake Caustics

Monday, April 29, 13

Beast setup:. 500 Final Gather rays (1 bounce). Path Tracer (4 bounces). 1024 IBL sky raysFinal quality scene bake would take between 20 minutes and 8 hours depending on the size of the scene. Bake quality for all scenes in the short was carried on over-night on 4 machines.

Page 36: FMX2013: Butterfly Effect

Unite template36

Real Time Shadows

Monday, April 29, 13

Page 37: FMX2013: Butterfly Effect

Unite template37

Baked Shadows• Of course baked only for static environments

Monday, April 29, 13

Page 38: FMX2013: Butterfly Effect

38

Ambient Occlusion• HBAO - Screen Space

Monday, April 29, 13

Horizon-Based Ambient Occlusion - developed by NVIDIA.

Page 39: FMX2013: Butterfly Effect

39

Ambient Occlusion• Too Dark & Dirty

Monday, April 29, 13

Page 40: FMX2013: Butterfly Effect

40

Ambient Occlusion• Applied ONLY to Indirect Illumination• Colored to match Sky better

Monday, April 29, 13

Screen Space Ambient Occlusion information is calculated at the start of the frame and passed into the shaders, where it is applied to (occludes / darkens) indirect lighting only.Ambient Occlusion is tinted towards the sky to achieve more plausible look.

Page 41: FMX2013: Butterfly Effect

Unite template

Skin

• Texture Space Diffusion• 3 Layers

41

Monday, April 29, 13

Subsurface only scattering of the skin on the left side. Lighting in texture (unwrapped UV) space on the right.

Page 42: FMX2013: Butterfly Effect

Unite template

Back Scattering• Translucency Map• Adds intensity to sub-

dermal layer

42

Monday, April 29, 13

Page 43: FMX2013: Butterfly Effect

HDR

43

2 Specular lobes

Monday, April 29, 13

Page 44: FMX2013: Butterfly Effect

Unite template

HDR

44

Monday, April 29, 13

Final look of the skin.

Page 45: FMX2013: Butterfly Effect

Unite template45

Depth Of Field

• Antialiasing aware• FXAA based

• With Splatted Bokeh Texture

Monday, April 29, 13

Page 46: FMX2013: Butterfly Effect

46

Monday, April 29, 13

High variation of depth causes Depth of Field to produce noticeable aliasing on the edges of geometry. We married Depth Of Field filter with additional FXAA based antialiasing technique driven by radius of Circle of Confusion to blur neighboring pixels.

Example of aliasing caused by discontinuities in depth buffer on the left side. Our approach on the right side.

Page 47: FMX2013: Butterfly Effect

Monday, April 29, 13

Depth Of Field using “standard” blur - top image.Detecting bright pixels and “splattering” bokeh sprites on top - bottom image.

Page 48: FMX2013: Butterfly Effect

48

Thank you!Talented people, come join our team working on Showcases for Unity!http://unity3d.com/jobs

Monday, April 29, 13

Page 49: FMX2013: Butterfly Effect

References

49

[Bavoil08] Image-Space Horizon-Based Ambient Occlusion. L. Bavoil, M. Sainz, 2008

[Catmull78] Recursively generated B-spline surfaces on arbitrary topological meshes. E. Catmull, J. Clark, 1978

[CookTorrance82] A Reflectance Graphics Model for Computer graphic. R. L. Cook, K. E. Torrance, 1982

[Hoffman10] Crafting Physically Motivated Shading Models for Game Development. N. Hoffman, 2010

[Lottes09] FXAA. T. Lottes, 2009

[Mental07] mental ray Architectural and Design Visualization Shader Library. mental images GmbH, 2007

http://www.mentalimages.com/fileadmin/user_upload/PDF/arch_and_design.pdf

[Mikkelsen09] Microfacet Based Bidirectional Reflectance Distribution Function. M. Mikkelsen, 2009

[Nießner12] Feature-Adaptive GPU Rendering of Catmull-Clark Subdivision Surfaces. M. Nießner, C. Loop, M. Meyer, T. Derose, 2012

[Olano10] LEAN Mapping. M. Olano, D. Baker, 2010

[Schüler11] The Blinn-Phong Normalization Zoo. C. Schüler, 2011

http://www.thetenthplanet.de/archives/255

[Zhukov98] An ambient light illumination model. S. Zhukov, A. Inoes, G. Kronin, 1998

Monday, April 29, 13