Top Banner
#WWDC17 © 2017 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple. Nick Porcino, Game Technologies Engineer Nicholas Blasingame, Game Technologies Engineer From Art to Engine with Model I/O Session 610 Graphics and Games
115

•From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Jul 27, 2018

Download

Documents

phungdieu
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

#WWDC17

© 2017 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple.

Nick Porcino, Game Technologies Engineer Nicholas Blasingame, Game Technologies Engineer

•From Art to Engine with Model I/O • Session 610

Graphics and Games

Page 2: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Model I/O Apple's toolkit for building pipelines

Import and export 3D assets

Geometry, materials, lighting, cameras, voxels

Data format conversions

Processing tools

Page 3: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Model I/O What's new?

Improved Importers

Skinned Character Animation

Blend Shapes

Transform Stacks

NEW

Page 4: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Model I/O Intuitive Asset Traversal

Format independent graph

Logical

Consistent

MDLAsset

Painted metal

Rubber

Home Camera

Sun Light

Car Root

Chassis

Body

Suspension

Wheel

Wheel

Wheel

Wheel

Rubber

Rubber

Rubber

...

Page 5: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Art Assets

Models, materials, animations

Textures

Scenes composed of many files

Page 6: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

From Art to Engine

Art asset is like source code

Compiled for an engine

Page 7: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

From Art to Engine UI based tools

Easy the first few times

Overwhelming during revision

Page 8: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

How can the work be scaled?

Page 9: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Introducing the Pipeline Export the art

Exporter

Artwork Asset Engine-Ready Data

Page 10: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Introducing the Pipeline Transform the asset

Artwork Asset Engine-Ready Data

Tool

Page 11: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Introducing the Pipeline Load engine-ready data

Artwork Asset Engine-Ready Data

Engine

Page 12: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Introducing the Pipeline Export the art

Exporter

Artwork Asset Engine-Ready Data

Page 13: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Maya • Asset Exporter • Complex hierarchies of files • Export script in the sample

Introducing the Pipeline Exporter

Art Asset

Page 14: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Introducing the Pipeline Exporter

Art

Maya • Asset Exporter • Complex hierarchies of files • Export script in the sample USD

Page 15: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Universal Scene Description http://openusd.org

Page 16: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Wheel

Universal Scene Description Composition

Shot Layer Car

Tire Wall

Pit Building

Race Track

Master_1

Master_2

Pit Building

Race Track

Page 17: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Universal Scene Description Classes, Variations, and Overrides

shadingVariant

modelingVariant

Page 18: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Universal Scene Description Powerful Text Format, Fast Binary

over "World" {

over "anim" {

over "chars" {

def "Car" (

add references = @chars/car.usd@</Car> ) {

color3f displayColor = (0.9, 0, 0) }

} }

}

Page 19: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Introducing the Pipeline Scriptable command line tool

Tool

Artwork Asset Engine-Ready Data

Page 20: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Asset Engine-Ready Data

Introducing the Pipeline Scriptable command line tool

Page 21: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Asset Engine-Ready Data

Introducing the Pipeline Scriptable command line tool

Repeatable

Page 22: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Asset Engine-Ready Data

Introducing the Pipeline Scriptable command line tool

Repeatable

Consistent

Page 23: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Asset Engine-Ready Data

Introducing the Pipeline Scriptable command line tool

Repeatable

Consistent

Scriptable

Page 24: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Asset Engine-Ready Data

Introducing the Pipeline Scriptable command line tool

Repeatable

Consistent

Scriptable

Scalable

Page 25: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Asset Engine-Ready Data

Introducing the Pipeline Scriptable command line tool

Repeatable

Consistent

Scriptable

Scalable

Composable

Page 26: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Demonstrates principles • Simplified data • Uncompressed • Good jumping-off point

Introducing the Pipeline The sample

Asset Engine-Ready Data

Page 27: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Introducing the Pipeline Game engine

Artwork Asset Engine-Ready Data

Engine

Page 28: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Game Engine Simple renderer

Single-pass forward renderer

Physically-based shader

Mesh instancing

Skinned and animated meshes

Multiple materials

Page 29: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Render Loop

Set Transform Buffer

Set Skinning Data

Set Vertex Buffer

Set Pipeline State

Set Material Uniforms

Set Fragment Textures

Draw Indexed Primitive

C

D

Page 30: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

The Pipeline

Artwork Asset Engine-Ready Data

Baker

Page 31: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Baking Operations

•1. Geometry + Transforms •2. Texture Paths + Materials •3. Instancing Data •4. Transform Animation •5. Skinning + Character Animation

Page 32: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Baking Operations

•1. Geometry + Transforms •2. Texture Paths + Materials •3. Instancing Data •4. Transform Animation •5. Skinning + Character Animation

Page 33: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Geometry + Transform A simple scene graph

Transform Hierarchy • Tree of nodes • Meshes and transform objects

C

D

B

A

Page 34: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Geometry + Transform Transform hierarchy

Moving the parent will move the children

C

D

B

A

Page 35: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Geometry + Transform Compactly encode transform hierarchy

C

D

B

A

Page 36: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

A

Geometry + Transform Array of local transforms

Local Transforms

A

C

D

B

A

Page 37: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

A

Geometry + Transform Array of local transforms

Local Transforms

A

B

C

D

B

A

Page 38: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

A

Geometry + Transform Array of local transforms

Local Transforms

A

B

C C

D

B

A

Page 39: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

A

Geometry + Transform Array of local transforms

Local Transforms

A

B

C

D

C

D

B

A

Page 40: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

A

Geometry + Transform Assign indices

Local Transforms

A 0

B 1

C 2

D 3

C

D

B

A

Page 41: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Geometry + Transform Array of parent indices

Parent Indices

-A

Local Transforms

A 0

B 1

C 2

D 3

C

D

B

A

Page 42: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Geometry + Transform Array of parent indices

Parent Indices

-A

Local Transforms

A 0

B 1

C 2

D 3

C

D

B

A

0

Page 43: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Geometry + Transform Array of parent indices

Parent Indices

-A

Local Transforms

A 0

B 1

C 2

D 3

C

D

B

A

0

1

1

Page 44: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Geometry + Transform Array of parent indices

Parent Indices

-A

Local Transforms

A 0

B 1

C 2

D 3

C

D

B

A

0

1

1

Page 45: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Geometry + Transform Array of mesh indices

Mesh Indices

2

Parent Indices

-A

Local Transforms

A 0

B 1

C 2

D 3

C

D

B

A

0

1

1

Page 46: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Geometry + Transform Array of mesh indices

Mesh Indices

2

Parent Indices

-A

Local Transforms

A 0

B 1

C 2

D 3

C

D

B

A

0

1

1 3

Page 47: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Geometry + Transform Mesh data

Descriptor

Descriptor

Vertex Buffers

Vertex Buffers

Index Buffer

Index Buffer

Page 48: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Geometry + Transform Vertex buffers

//for every mdlObject in MDLAsset: if let mesh = mdlObject as? MDLMesh { vertexDescriptors.append(mesh.vertexDescriptor) for vertexBuffer in mesh.vertexBuffers { let vertexBufferData = Data(bytes: vertexBuffer.map().bytes,

count: vertexBuffer.length) ...

} for submesh in mesh.submeshes! { if let indexBuffer = (submesh as? MDLSubmesh)?.indexBuffer { let indexBufferData = Data(bytes: indexBuffer.map().bytes, count: indexBuffer.length)

... } } }

Page 49: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Geometry + Transform Vertex buffers

//for every mdlObject in MDLAsset: if let mesh = mdlObject as? MDLMesh { vertexDescriptors.append(mesh.vertexDescriptor) for vertexBuffer in mesh.vertexBuffers { let vertexBufferData = Data(bytes: vertexBuffer.map().bytes,

count: vertexBuffer.length) ...

} for submesh in mesh.submeshes! { if let indexBuffer = (submesh as? MDLSubmesh)?.indexBuffer { let indexBufferData = Data(bytes: indexBuffer.map().bytes, count: indexBuffer.length)

... } } }

Page 50: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Geometry + Transform Vertex buffers

//for every mdlObject in MDLAsset: if let mesh = mdlObject as? MDLMesh { vertexDescriptors.append(mesh.vertexDescriptor) for vertexBuffer in mesh.vertexBuffers { let vertexBufferData = Data(bytes: vertexBuffer.map().bytes,

count: vertexBuffer.length) ...

} for submesh in mesh.submeshes! { if let indexBuffer = (submesh as? MDLSubmesh)?.indexBuffer { let indexBufferData = Data(bytes: indexBuffer.map().bytes, count: indexBuffer.length)

... } } }

Page 51: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Geometry + Transform Index buffer

//for every mdlObject in MDLAsset: if let mesh = mdlObject as? MDLMesh { vertexDescriptors.append(mesh.vertexDescriptor) for vertexBuffer in mesh.vertexBuffers { let vertexBufferData = Data(bytes: vertexBuffer.map().bytes,

count: vertexBuffer.length) ...

} for submesh in mesh.submeshes! { if let indexBuffer = (submesh as? MDLSubmesh)?.indexBuffer { let indexBufferData = Data(bytes: indexBuffer.map().bytes, count: indexBuffer.length)

... } } }

Page 52: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Geometry + Transform Local transform

var localTransforms: [matrix_float4x4] = [] // for every mdlObject in MDLAsset: if let transform = mdlObject.transform { localTransforms.append(transform.matrix) }

Page 53: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Geometry + Transform Local transform

var localTransforms: [matrix_float4x4] = [] // for every mdlObject in MDLAsset: if let transform = mdlObject.transform { localTransforms.append(transform.matrix) }

Page 54: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Geometry + Transform

Local Transforms

DescriptorsVertex + Index Buffers

Parent Indices, Mesh Indices

Transform Data

Mesh Data

SceneComposition Data

Page 55: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Baking Operations

•1. Geometry + Transforms •2. Texture Paths + Materials •3. Instancing Data •4. Transform Animation •5. Skinning + Character Animation

Page 56: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Texture Paths + Materials Materials stored on MDLSubmesh

Fetch properties referenced by shader

Record texture paths and values

MDLMesh MDLSubmeshMDLMaterial

AO Base Color Metallic

Page 57: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Texture Paths + Materials

// for every submesh: if let material = submesh.material {

for property in material.properties(with:<MDLMaterialSemantic>) { if property.type == .string || property.type == .URL { // texture } else if property.type == <MDLMaterialPropertyType> { // uniform value } } }

Page 58: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Texture Paths + Materials

// for every submesh: if let material = submesh.material {

for property in material.properties(with:<MDLMaterialSemantic>) { if property.type == .string || property.type == .URL { // texture } else if property.type == <MDLMaterialPropertyType> { // uniform value } } }

Page 59: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Texture Paths + Materials

Local Transforms

DescriptorsVertex + Index Buffers

Parent Indices, Mesh Indices

Transform Data

Mesh Data

SceneComposition Data

Page 60: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Texture Paths + Materials

Material Uniforms Texture Paths

Local Transforms

DescriptorsVertex + Index Buffers

Parent Indices, Mesh Indices

Transform Data

Material Data

Mesh Data

SceneComposition Data

Page 61: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Baking Operations

•1. Geometry + Transforms •2. Texture Paths + Materials •3. Instancing Data •4. Transform Animation •5. Skinning + Character Animation

Page 62: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Instancing

A mesh can be used multiple times

D

C

B

A

C

Page 63: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

A mesh can be used multiple times

Instancing

D

C

E

B

A

C

E

Page 64: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

A mesh can be used multiple times

Why store it multiple times?

Instancing

D

C

E

B

A

C

E

Page 65: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

MDLAsset has a masters array

Instancing Masters

Masters

D

C

E

Masters

B

A

C

E

Page 66: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

MDLObject instance pointers refer to masters

Instancing Model I/O support

Masters

D

E

C

B

A

Page 67: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Instancing

Masters

B

A

D

E

C

Mesh Indices

2

Parent Indices

-

A

Local Transforms

A 0

B 1

C 2

D 3

0

1

1 3

E 0 44

Page 68: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Instancing

Masters

B

A

D

E

C

Mesh Indices

2

Parent Indices

-

A

Local Transforms

A 0

B 1

C 2

D 3

0

1

1 3

E 0 44

Page 69: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Instancing

Masters

B

A

D

E

C

Mesh Indices

2

Parent Indices

-

A

Local Transforms

A 0

B 1

C 2

D 3

0

1

1 4

E 0 34

Page 70: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Instancing

Masters

B

A

D

E

C

Mesh Indices

2

Parent Indices

-

A

Local Transforms

A 0

B 1

C 2

D 3

0

1

1 4

E 0 34

Instance Count

2

1

Page 71: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Instancing

Material Uniforms Texture Paths

Local Transforms

DescriptorsVertex + Index Buffers

Parent Indices, Mesh Indices

Transform Data

Material Data

Mesh Data

SceneComposition Data

Page 72: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Instancing

Material Uniforms Texture Paths

Local Transforms

DescriptorsVertex + Index Buffers

Parent Indices, Mesh Indices Instance Count

Transform Data

Material Data

Mesh Data

SceneComposition Data

Page 73: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Nicholas Blasingame, Game Technologies Engineer

•Demo •Geometry, Materials, and Instancing

Page 74: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Baking Operations

•1. Geometry + Transforms •2. Texture Paths + Materials •3. Instancing Data •4. Transform Animation •5. Skinning + Character Animation

Page 75: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Transform Animation Transforms that vary over time

C

D

B

A

Page 76: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Transform Animation

C

D

B

A

Page 77: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Transform Animation Sample the animations

C

D

B

A

B

D

Animated Local Transforms

t0, t1 tn…

Page 78: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

var localTransforms: [matrix_float4x4] = [] // for every mdlObject in MDLAsset: if let transform = mdlObject.transform { localTransforms.append(transform.matrix)

}

Transform Animation

Page 79: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

var localTransforms: [matrix_float4x4] = [] // for every mdlObject in MDLAsset: if let transform = mdlObject.transform { localTransforms.append(transform.matrix)

if (transform.keyTimes.count > 1) { let sampledXM = sampleTimes.map{ transform.localTransform!(atTime: $0) } animatedLocalTransforms.append(sampledXM) ... } }

Transform Animation

Page 80: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Transform Animation

var localTransforms: [matrix_float4x4] = [] // for every mdlObject in MDLAsset: if let transform = mdlObject.transform { localTransforms.append(transform.matrix)

if (transform.keyTimes.count > 1) { let sampledXM = sampleTimes.map{ transform.localTransform!(atTime: $0) } animatedLocalTransforms.append(sampledXM) ... } }

Page 81: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Transform Animation

Material Uniforms Texture Paths

Local Transforms

DescriptorsVertex + Index Buffers

Parent Indices, Mesh IndicesInstance Count

Transform Data

Material Data

Mesh Data

SceneComposition Data

Page 82: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Transform Animation

Material Uniforms Texture Paths

Local TransformsAnimated Local Transforms

DescriptorsVertex + Index Buffers

Parent Indices, Mesh IndicesInstance Count

Transform Data

Material Data

Mesh Data

SceneComposition Data

Page 83: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Baking Operations

•1. Geometry + Transforms •2. Texture Paths + Materials •3. Instancing Data •4. Transform Animation •5. Skinning + Character Animation

Page 84: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Skinned Character Animation

Page 85: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Skinned Character Animation

Page 86: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Skinned Character Animation Mesh has geometry

Page 87: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Skinned Character Animation Embedded skeleton

Page 88: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Skinned Character Animation Vertex weighting to joints

Page 89: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Skinned Character Animation Vertex weighting to joints

Page 90: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Skinned Character Animation Vertex blending in shader

{ ... float4 position = vertex.pos; packed_uchar4 jIdx = vertex.jointIndices; packed_float4 w = vertex.jointWeights; float4 skinnedPosition = w[0] * (palette[jIdx[0]] * modelPosition) + w[1] * (palette[jIdx[1]] * modelPosition) + w[2] * (palette[jIdx[2]] * modelPosition) + w[3] * (palette[jIdx[3]] * modelPosition); ... }

Page 91: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Skinned Character Animation Input vertex attributes

{ ... float4 position = vertex.pos; packed_uchar4 jIdx = vertex.jointIndices; packed_float4 w = vertex.jointWeights; float4 skinnedPosition = w[0] * (palette[jIdx[0]] * modelPosition) + w[1] * (palette[jIdx[1]] * modelPosition) + w[2] * (palette[jIdx[2]] * modelPosition) + w[3] * (palette[jIdx[3]] * modelPosition); ... }

Page 92: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Skinned Character Animation Per vertex joint indices

{ ... float4 position = vertex.pos; packed_uchar4 jIdx = vertex.jointIndices; packed_float4 w = vertex.jointWeights; float4 skinnedPosition = w[0] * (palette[jIdx[0]] * modelPosition) + w[1] * (palette[jIdx[1]] * modelPosition) + w[2] * (palette[jIdx[2]] * modelPosition) + w[3] * (palette[jIdx[3]] * modelPosition); ... }

Page 93: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Skinned Character Animation Indexed bones for weight each vertex

{ ... float4 position = vertex.pos; packed_uchar4 jIdx = vertex.jointIndices; packed_float4 w = vertex.jointWeights; float4 skinnedPosition = w[0] * (palette[jIdx[0]] * modelPosition) + w[1] * (palette[jIdx[1]] * modelPosition) + w[2] * (palette[jIdx[2]] * modelPosition) + w[3] * (palette[jIdx[3]] * modelPosition); ... }

Page 94: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Skeleton

Root

Body

Wheel 1

Wheel 2

E

Skinned Character Animation

B

A

C

D

Page 95: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Skeleton

Root

Body

Wheel 1

Wheel 2

E

Skinned Character Animation

Page 96: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Skinned Character Animation

Skeleton

Root

Body

Wheel 1

Wheel 2

E

Page 97: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Skinned Character Animation

0

1

2

3

Skeleton

Root

Body

Wheel 1

Wheel 2

E

Page 98: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Skinned Character Animation

Joint Parent Indices

-

0

1

1

0

1

2

3

Skeleton

Root

Body

Wheel 1

Wheel 2

E

Page 99: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Bound Joint Indices

1

2

3

Inverse Bind Pose

B1-1

B2-1

B3-1

Skinned Character Animation Bind Poses + Joint Indices

0

1

2

3

Joint Parent Indices

-

0

1

1

Skeleton

Root

Body

Wheel 1

Wheel 2

E

Page 100: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Skinned Character Animation Bind Poses + Joint Indices

Bound Joint Indices

1

2

3

Inverse Bind Pose

B1-1

B2-1

B3-1

Joint Parent Indices

-

0

1

1

0

1

2

3

Skeleton

Root

Body

Wheel 1

Wheel 2

E

Page 101: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Skinned Character Animation Bind Poses + Joint Indices

Bound Joint Indices

1

2

3

Inverse Bind Pose

B1-1

B2-1

B3-1

Joint Parent Indices

-

0

1

1

0

1

2

3

Skeleton

Root

Body

Wheel 1

Wheel 2

E

Page 102: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Skinned Character Animation Time sample animation

Animation Clip

Body

W1

W2

Root

t0…tN

t0…tN

t0…tN

t0…tN

Bound Joint Indices

1

2

Inverse Bind Pose

B1-1

B2-1

Joint Parent Indices

-

0

1

1 3 B3-1

0

1

2

3

Skeleton

Root

Body

Wheel 1

Wheel 2

E

Page 103: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Skinned Character Animation

// for every mdlObject in MDLAsset: if let mesh = mdlObject as? MDLMesh { if let skin = object.componentConforming(to:MDLSkinDeformerComponent.self) as? MDLSkinDeformerComponent {

let inverseBindTransforms = skin.jointBindTransforms().map{simd_inverse($0)}

... }

Page 104: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Skinned Character Animation

// for every mdlObject in MDLAsset: if let mesh = mdlObject as? MDLMesh { if let skin = object.componentConforming(to:MDLSkinDeformerComponent.self) as? MDLSkinDeformerComponent {

let inverseBindTransforms = skin.jointBindTransforms().map{simd_inverse($0)}

... }

Page 105: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Skinned Character Animation

Material Uniforms Texture Paths

Local TransformsAnimated Local Transforms

DescriptorsVertex + Index Buffers

Parent Indices, Mesh IndicesInstance Count

Transform Data

Material Data

Mesh Data

SceneComposition Data

Page 106: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Skinned Character Animation

Material Uniforms Texture Paths

Local TransformsAnimated Local Transforms

Animation Clips

DescriptorsVertex + Index Buffers

Parent Indices, Mesh IndicesInstance Count

Transform Data

Material Data

Mesh Data

SceneComposition Data

Inverse Bind Transforms Joint to Palette Mapping Skeleton Parent Indices

Skinning Data

Page 107: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

•Demo •Instancing and Characters

Page 108: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Recap

Artwork Asset Engine Ready Data

USD

Page 109: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Enhancements

Light Mapping

Page 110: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Enhancements

Light Mapping UV Unwrapping

Page 111: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Enhancements

Light Mapping UV Unwrapping Ambient Occlusion

Page 112: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Enhancements Image-based lighting

Page 113: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

More Informationhttps://developer.apple.com/wwdc17/610

Page 114: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW

Related Information

Managing 3D Assets with Model I/O WWDC 2015

Introducing Metal 2 WWDC 2017

What’s New in SceneKit WWDC 2017

Page 115: •From Art to Engine with Model I/O - Development Videos€¦Model I/O What's new? Improved Importers Skinned Character Animation Blend Shapes Transform Stacks NEW