ios intro to 3d graphics with metal

Post on 16-Jan-2017

445 Views

Category:

Mobile

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

METALQuick intro to 3D Graphics and GPU computing

www.sigmapoint.pl

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

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

HDR

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

Simple shadow changes perception a lot

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

Let’s do this!

SIMPLE PROJECTION

JUST KIDDING

But your program is really going to do this

VERTICES

FRAGMENTS

Decent per-fragment shading with very simple geometry

TEXTURING

More than just images

CPU VS GPU

Multipurpose vs streamlined

PIPELINE

PIPELINE IN CODE

RENDER PASS

SHADERS

DEMO TIME

OVER THE HUMPMeans it’s downhill from now on

TEXTURING AIN’T SO EASY

LET’S ADD SHADOWS

Surfaces shading themselves thanks to floating point errors

JUST ADD A MARGIN AND…

Our object appears to be floating above the ground

COSTLY DETAILS

Small color differences, big effect

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

DEBUGGING

“You forgot to unbind a buffer here”

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

Thanks!

Contact: grzegorz.sikorski@sigmapoint.pl

@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

top related