graphics and games - devstreaming-cdn.apple.com · prototyping test interaction model interpret...

145
#WWDC17 © 2017 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple. Michael DeWitt, Gem Collector Lemont Washington, Draw Call Blaster SceneKit in Swift Playgrounds Session 605 Graphics and Games

Upload: ngocong

Post on 15-Apr-2018

223 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

#WWDC17

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

Michael DeWitt, Gem Collector Lemont Washington, Draw Call Blaster

•SceneKit in Swift Playgrounds • Session 605

Graphics and Games

Page 2: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 3: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 4: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 5: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 6: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Prototyping Iterating Tuning

Page 7: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

•Prototyping

Page 8: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 9: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Early Feedback

Page 10: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Early Feedback

Change gem

Add border

Pivot camera at the end

Page 11: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 12: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

SceneKitSpriteKit

Page 13: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

SceneKitSpriteKitSKScene

SKNode

SKAction

Page 14: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

SceneKitSCNScene

SCNNode

SCNAction

SpriteKitSKScene

SKNode

SKAction

Page 15: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

SceneKitSCNScene

SCNNode

SCNAction

SpriteKitSKScene

SKNode

SKAction

Page 16: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Enhancements to SceneKit WWDC 2015

Page 17: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 18: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 19: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Effo

rt to

Cha

nge

Project Timeline

Page 20: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Effo

rt to

Cha

nge

Project Timeline

Prototyping

Page 21: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Effo

rt to

Cha

nge

Project Timeline

Prototyping

Page 22: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Prototyping

Page 23: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Prototyping

Test interaction model

Page 24: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Prototyping

Test interaction model

Interpret feedback

Page 25: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Prototyping

Test interaction model

Interpret feedback

Take the insights, leave the code

Page 26: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

•Iterating

Page 27: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 28: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

1

Page 29: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

1

2

Page 30: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

1

2

3

Page 31: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

1

2

3

4

Page 32: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Modeling the World

Page 33: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Modeling the World

Page 34: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 35: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

// World building API

let world = GridWorld(columns: 5, rows: 5)

Page 36: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

// World building API

let world = GridWorld(columns: 5, rows: 5)

// Add an actor to the scene. let actor = Actor() world.place(actor, facing: north, at: Coordinate(column: 0, row: 0))

Page 37: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

// World building API

let world = GridWorld(columns: 5, rows: 5)

// Add an actor to the scene. let actor = Actor() world.place(actor, facing: north, at: Coordinate(column: 0, row: 0))

// Place additional items. let gems = [ Coordinate(column: 0, row: 1), Coordinate(column: 1, row: 4), Coordinate(column: 3, row: 0), Coordinate(column: 4, row: 3) ] world.placeGems(at: gems)

let water = world.coordinates(inColumns: 1..<4, intersectingRows: 1..<4) world.placeWater(at: water)

Page 38: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 39: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Modeling the World Separate data and visuals

Page 40: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Modeling the World Separate data and visuals

Swap assets easily

Page 41: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Modeling the World Separate data and visuals

Swap assets easily

Send gameplay logic

User Code LiveView

Process 1 Process 2

Page 42: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Modeling the World Separate data and visuals

Swap assets easily

Send gameplay logic

Optimize the geometry

Page 43: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Modeling the World Separate data and visuals

Swap assets easily

Send gameplay logic

Optimize the geometry

Need debugging tools ⚠

Page 44: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Swap assets easily

Send gameplay logic

Optimize the geometry

Modeling the World Separate data and visuals

Need debugging tools ⚠

Page 45: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 46: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

1

Page 47: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

2

Page 48: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Animating Up

Page 49: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Animating Up

Page 50: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Animating Up

Use a ramp

Page 51: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Animating Up

Use a ramp

Page 52: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Animating Up

Use a ramp

Page 53: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Animating Up

Use a ramp

Page 54: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Animating Up

Use a ramp

Page 55: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 56: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 57: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 58: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 59: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Animating Up

Use a ramp

Page 60: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Animating Up

Use a ramp

Inverse kinematics

Page 61: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Animating Up

Use a ramp

Inverse kinematics

Page 62: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Animating Up

Use a ramp

Inverse kinematics

Displace Animation

Page 63: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Node

(0, 0, 0)

Page 64: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Geometry

Node

(0, 0, 0)

Page 65: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Geometry

Node

(0, 0, 0)(1, 0, 0)

Page 66: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Displace Animation

Geometry

Node

(0, 0, 0)

Page 67: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Displace Animation

Geometry

Node

(0, 0, 0)

Page 68: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Displace Animation

Geometry

Node

(1, 0, 0)

Page 69: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Displace Animation

Geometry

Node

(1, 0, 0)

Page 70: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Displace Animation

SCNTransaction

Geometry

Node

(1, 0, 0)

Page 71: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

// Synchronize animation completion and node position.

SCNTransaction.begin() SCNTransaction.animationDuration = 0.0

SCNTransaction.commit()

Page 72: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

// Synchronize animation completion and node position.

SCNTransaction.begin() SCNTransaction.animationDuration = 0.0 actor.position = newPosition

SCNTransaction.commit()

Page 73: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

//Synchronize animation completion and node position.

SCNTransaction.begin() SCNTransaction.animationDuration = 0.0 actor.position = newPosition

// Remove all animations. for key in node.animationKeys { node.removeAnimation(forKey: key) } SCNTransaction.commit()

Page 74: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 75: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

2

Page 76: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

3

Page 77: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Dynamic Scenery

Page 78: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Original Map

Page 79: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Designed MapOriginal Map

Page 80: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Save

Designed MapOriginal Map

Page 81: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 82: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 83: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 84: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 85: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

zon_barrier_waterfall_1x1.scn

Page 86: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 87: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 88: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 89: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 90: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 91: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

3

Page 92: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 93: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

VoiceOver Support

Page 94: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

VoiceOver Support

Great non-visual experience

Page 95: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

VoiceOver Support

Great non-visual experience

Enable all interactions

Support custom actions

Describe important elements

Media and Gaming Accessibility Grand Ballroom A Wednesday

Page 96: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

VoiceOver Support

Great non-visual experience

Enable all interactions

Support custom actions

Describe important elements

Page 97: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

// Making accessible coordinates

class CoordinateAccessibilityElement: UIAccessibilityElement {

}

Page 98: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

// Making accessible coordinates

class CoordinateAccessibilityElement: UIAccessibilityElement { var world: GridWorld var coordinate: Coordinate

override var accessibilityLabel: String? { get { return world.speakableContents(of: coordinate) } ... } }

Page 99: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

// Setup accessibility elements.

// 1. Create accessibility element. let accessibilityElement = CoordinateAccessibilityElement(coordinate: coordinate)

// 2. Find coordinates in view’s coordinate space. let upperLeft = scnView.projectPoint(SCNVector3(...)) accessibilityElement.frame = ...

// 3. Add element to the view. view.accessibilityElements!.append(accessibilityElement)

Page 100: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

// Setup accessibility elements.

// 1. Create accessibility element. let accessibilityElement = CoordinateAccessibilityElement(coordinate: coordinate)

// 2. Find coordinates in view’s coordinate space. let upperLeft = scnView.projectPoint(SCNVector3(...)) accessibilityElement.frame = ...

// 3. Add element to the view. view.accessibilityElements!.append(accessibilityElement)

Page 101: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

// Setup accessibility elements.

// 1. Create accessibility element. let accessibilityElement = CoordinateAccessibilityElement(coordinate: coordinate)

// 2. Find coordinates in view’s coordinate space. let upperLeft = scnView.projectPoint(SCNVector3(...)) accessibilityElement.frame = ...

// 3. Add element to the view. view.accessibilityElements!.append(accessibilityElement)

Page 102: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

// Setup accessibility elements.

// 1. Create accessibility element. let accessibilityElement = CoordinateAccessibilityElement(coordinate: coordinate)

// 2. Find coordinates in view’s coordinate space. let upperLeft = scnView.projectPoint(SCNVector3(...)) accessibilityElement.frame = ...

// 3. Add element to the view. view.accessibilityElements!.append(accessibilityElement)

Page 103: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

// Setup accessibility elements.

// 1. Create accessibility element. let accessibilityElement = CoordinateAccessibilityElement(coordinate: coordinate)

// 2. Find coordinates in view’s coordinate space. let upperLeft = scnView.projectPoint(SCNVector3(...)) accessibilityElement.frame = ...

// 3. Add element to the view. view.accessibilityElements!.append(accessibilityElement)

AccessibilityExtensions.swift

Page 104: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Iterating

Page 105: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Iterating

Separate data and visuals

Page 106: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Iterating

Separate data and visuals

Value flexibility

Page 107: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Iterating

Separate data and visuals

Value flexibility

Audit accessibility support

Page 108: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

•Tuning

Page 109: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 110: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 111: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Rendering Statistics

gameView.showsStatistics = true

Page 112: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Rendering Statistics

gameView.showsStatistics = true

Page 113: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Rendering Statistics

gameView.showsStatistics = true

Page 114: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Rendering Statistics

gameView.showsStatistics = true

Page 115: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

•Reduce Draw Call Count

Page 116: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Reducing Draw Calls

Geometry

Materials

Lighting

Page 117: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 118: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

1 draw call per mesh

Page 119: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Geometry A Geometry B

Flattening Geometry

Grass Material Grass Material

Page 120: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Flattened Geo.

Flattening Geometry

Grass Material

Page 121: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Flattened Geo.

Flattening Geometry

grassNode.flattenedClone()

Grass Material

Page 122: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 123: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Flattening Geometry Tips

Store nodes to be flattened in a parent node

Save flattened scene

Page 124: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Caveat

Large environments

Page 125: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Reducing Draw Calls

Geometry

Materials

Lighting

Page 126: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 127: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Geometry BGeometry A

Reducing Materials

Sand Material Grass Material

Page 128: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Reducing Materials

Sand Material Grass Material

Flattened Geo.

Page 129: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Reducing Materials

Texture Atlas

Flattened Geo.

Page 130: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 131: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

14

5

Page 132: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

14

5 1 Material

Page 133: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Reducing Draw Calls

Geometry

Materials

Lighting

Page 134: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Spotlight 1

Omni-Directional 4

Ambient 1

Lights

Page 135: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Spotlight 1

Omni-Directional 4

Ambient 1

Spotlight 1

Lights Baked lighting

Page 136: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Spotlight 1

Lights Baked lighting

Page 137: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 138: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 139: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 140: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 141: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code
Page 142: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Optimizing Performance

Flatten geometry

Use a texture atlas

Use light maps

Page 143: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Related Sessions

Enhancements in SceneKit WWDC 2015

Advanced in SceneKit Rendering WWDC 2015

SceneKit: What’s New WWDC 2017

Page 144: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code

Labs

Creating Content for Swift Playgrounds Lab Technology Lab E Thur 12:00PM–3:10PM

Page 145: Graphics and Games - devstreaming-cdn.apple.com · Prototyping Test interaction model Interpret feedback Take the insights, leave the code