ios intro to 3d graphics with metal

29
METAL Quick intro to 3D Graphics and GPU computing www.sigmapoint.pl

Upload: sigmapoint

Post on 16-Jan-2017

438 views

Category:

Mobile


1 download

TRANSCRIPT

Page 1: iOS intro to 3D graphics with Metal

METALQuick intro to 3D Graphics and GPU computing

www.sigmapoint.pl

Page 2: iOS intro to 3D graphics with Metal

SOME NUMBERS

• One frame of 1920x1080 is over 8MB of data

• 60fps gives ~ 17ms to render a frame

• Witcher 3’s world area is about 136km2 - one meter spaced grid (awful) takes over 2GB alone

• 7

Page 3: iOS intro to 3D graphics with Metal

AND SOME PHYSICS• Light is weird - and really complicated (also computationally)

• Luminosity has a VERY big range, which your eyes can somewhat cope with - but you monitor can’t

• Atomic structure of an object heavily influences it’s interaction with light

• Water has no color - but it reflects, refracts and diffracts light

• Modelling water (liquid, gas) movement is hard

Page 4: iOS intro to 3D graphics with Metal

HDR

“Ahh, it’s nothing what it really looks like”

Page 5: iOS intro to 3D graphics with Metal

Simple shadow changes perception a lot

Page 6: iOS intro to 3D graphics with Metal

I really like these illusions and I need more slides with pictures

Page 7: iOS intro to 3D graphics with Metal

Let’s do this!

Page 8: iOS intro to 3D graphics with Metal

SIMPLE PROJECTION

Page 9: iOS intro to 3D graphics with Metal

JUST KIDDING

But your program is really going to do this

Page 10: iOS intro to 3D graphics with Metal

VERTICES

Page 11: iOS intro to 3D graphics with Metal

FRAGMENTS

Page 12: iOS intro to 3D graphics with Metal

Decent per-fragment shading with very simple geometry

Page 13: iOS intro to 3D graphics with Metal

TEXTURING

More than just images

Page 14: iOS intro to 3D graphics with Metal

CPU VS GPU

Multipurpose vs streamlined

Page 15: iOS intro to 3D graphics with Metal

PIPELINE

Page 16: iOS intro to 3D graphics with Metal

PIPELINE IN CODE

Page 17: iOS intro to 3D graphics with Metal

RENDER PASS

Page 18: iOS intro to 3D graphics with Metal

SHADERS

Page 19: iOS intro to 3D graphics with Metal

DEMO TIME

Page 20: iOS intro to 3D graphics with Metal

OVER THE HUMPMeans it’s downhill from now on

Page 21: iOS intro to 3D graphics with Metal

TEXTURING AIN’T SO EASY

Page 22: iOS intro to 3D graphics with Metal

LET’S ADD SHADOWS

Surfaces shading themselves thanks to floating point errors

Page 23: iOS intro to 3D graphics with Metal

JUST ADD A MARGIN AND…

Our object appears to be floating above the ground

Page 24: iOS intro to 3D graphics with Metal

COSTLY DETAILS

Small color differences, big effect

Page 25: iOS intro to 3D graphics with Metal

WHY LEARN METAL

• Multicore machines are standard, OpenGL is inherently one thread only, pipeline stall is still a thing

• OpenGL started as an abstraction that hid the GPU altogether - your program might still revert to CPU rendering without a warning

• Deprecated APIs everywhere, nothing was ever removed

• Backwards compatibility means magic arguments to functions that used to do something completely different

• Really hard for beginners, practically impossible/inviable to master

Or why you shouldn’t bother with OpenGL

Page 26: iOS intro to 3D graphics with Metal

DEBUGGING

“You forgot to unbind a buffer here”

Page 27: iOS intro to 3D graphics with Metal

MEANWHILE, IN METAL• Designed for multithreaded processing

• Simplifies interaction with GPU instead of pretending it’s not there

• Clean, well documented API

• Helpful assertions everywhere, compile-time errors for shaders, debugging facilities

Page 28: iOS intro to 3D graphics with Metal

Thanks!

Page 29: iOS intro to 3D graphics with Metal

Contact: [email protected]

@Sigmapoint_pl

Images from the Interwebs:http://www.moline.com/equip%20cutters%20dies.htm

http://computersnetto.blogspot.com/2015/02/old-computers.htmlhttp://smashinghub.com/amazing-optical-illusion-photos.htm

http://http.developer.nvidia.com/GPUGems/gpugems_ch25.htmlhttps://www.opengl.org/discussion_boards/showthread.php/162308-per-vertex-lighting-vs-per-pixel-lighting/page2

http://www.3dgep.com/rendering-and-special-effects-in-unity-3-5/https://commons.wikimedia.org/wiki/File:Swiss_army_knife_closed_20050612.jpg

http://www.game-debate.com/blog/?b_id=1943&author=TeroMarsu&title=Graphical%20Effects%20Explained&page=2http://www.fabiensanglard.net/shadowmapping/index.php

http://www.independentdeveloper.com/archive/2007/12/08/ac3d-plugin-nmf-ati-normal-map-exporterhttps://www.flickr.com/photos/sudhee/82891943

www.sigmapoint.pl