ios intro to 3d graphics with metal
TRANSCRIPT
![Page 2: iOS intro to 3D graphics with Metal](https://reader030.vdocuments.mx/reader030/viewer/2022021506/587bd42a1a28ab834d8b4c55/html5/thumbnails/2.jpg)
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](https://reader030.vdocuments.mx/reader030/viewer/2022021506/587bd42a1a28ab834d8b4c55/html5/thumbnails/3.jpg)
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](https://reader030.vdocuments.mx/reader030/viewer/2022021506/587bd42a1a28ab834d8b4c55/html5/thumbnails/4.jpg)
HDR
“Ahh, it’s nothing what it really looks like”
![Page 5: iOS intro to 3D graphics with Metal](https://reader030.vdocuments.mx/reader030/viewer/2022021506/587bd42a1a28ab834d8b4c55/html5/thumbnails/5.jpg)
Simple shadow changes perception a lot
![Page 6: iOS intro to 3D graphics with Metal](https://reader030.vdocuments.mx/reader030/viewer/2022021506/587bd42a1a28ab834d8b4c55/html5/thumbnails/6.jpg)
I really like these illusions and I need more slides with pictures
![Page 7: iOS intro to 3D graphics with Metal](https://reader030.vdocuments.mx/reader030/viewer/2022021506/587bd42a1a28ab834d8b4c55/html5/thumbnails/7.jpg)
Let’s do this!
![Page 8: iOS intro to 3D graphics with Metal](https://reader030.vdocuments.mx/reader030/viewer/2022021506/587bd42a1a28ab834d8b4c55/html5/thumbnails/8.jpg)
SIMPLE PROJECTION
![Page 9: iOS intro to 3D graphics with Metal](https://reader030.vdocuments.mx/reader030/viewer/2022021506/587bd42a1a28ab834d8b4c55/html5/thumbnails/9.jpg)
JUST KIDDING
But your program is really going to do this
![Page 10: iOS intro to 3D graphics with Metal](https://reader030.vdocuments.mx/reader030/viewer/2022021506/587bd42a1a28ab834d8b4c55/html5/thumbnails/10.jpg)
VERTICES
![Page 11: iOS intro to 3D graphics with Metal](https://reader030.vdocuments.mx/reader030/viewer/2022021506/587bd42a1a28ab834d8b4c55/html5/thumbnails/11.jpg)
FRAGMENTS
![Page 12: iOS intro to 3D graphics with Metal](https://reader030.vdocuments.mx/reader030/viewer/2022021506/587bd42a1a28ab834d8b4c55/html5/thumbnails/12.jpg)
Decent per-fragment shading with very simple geometry
![Page 13: iOS intro to 3D graphics with Metal](https://reader030.vdocuments.mx/reader030/viewer/2022021506/587bd42a1a28ab834d8b4c55/html5/thumbnails/13.jpg)
TEXTURING
More than just images
![Page 14: iOS intro to 3D graphics with Metal](https://reader030.vdocuments.mx/reader030/viewer/2022021506/587bd42a1a28ab834d8b4c55/html5/thumbnails/14.jpg)
CPU VS GPU
Multipurpose vs streamlined
![Page 15: iOS intro to 3D graphics with Metal](https://reader030.vdocuments.mx/reader030/viewer/2022021506/587bd42a1a28ab834d8b4c55/html5/thumbnails/15.jpg)
PIPELINE
![Page 16: iOS intro to 3D graphics with Metal](https://reader030.vdocuments.mx/reader030/viewer/2022021506/587bd42a1a28ab834d8b4c55/html5/thumbnails/16.jpg)
PIPELINE IN CODE
![Page 17: iOS intro to 3D graphics with Metal](https://reader030.vdocuments.mx/reader030/viewer/2022021506/587bd42a1a28ab834d8b4c55/html5/thumbnails/17.jpg)
RENDER PASS
![Page 18: iOS intro to 3D graphics with Metal](https://reader030.vdocuments.mx/reader030/viewer/2022021506/587bd42a1a28ab834d8b4c55/html5/thumbnails/18.jpg)
SHADERS
![Page 19: iOS intro to 3D graphics with Metal](https://reader030.vdocuments.mx/reader030/viewer/2022021506/587bd42a1a28ab834d8b4c55/html5/thumbnails/19.jpg)
DEMO TIME
![Page 20: iOS intro to 3D graphics with Metal](https://reader030.vdocuments.mx/reader030/viewer/2022021506/587bd42a1a28ab834d8b4c55/html5/thumbnails/20.jpg)
OVER THE HUMPMeans it’s downhill from now on
![Page 21: iOS intro to 3D graphics with Metal](https://reader030.vdocuments.mx/reader030/viewer/2022021506/587bd42a1a28ab834d8b4c55/html5/thumbnails/21.jpg)
TEXTURING AIN’T SO EASY
![Page 22: iOS intro to 3D graphics with Metal](https://reader030.vdocuments.mx/reader030/viewer/2022021506/587bd42a1a28ab834d8b4c55/html5/thumbnails/22.jpg)
LET’S ADD SHADOWS
Surfaces shading themselves thanks to floating point errors
![Page 23: iOS intro to 3D graphics with Metal](https://reader030.vdocuments.mx/reader030/viewer/2022021506/587bd42a1a28ab834d8b4c55/html5/thumbnails/23.jpg)
JUST ADD A MARGIN AND…
Our object appears to be floating above the ground
![Page 24: iOS intro to 3D graphics with Metal](https://reader030.vdocuments.mx/reader030/viewer/2022021506/587bd42a1a28ab834d8b4c55/html5/thumbnails/24.jpg)
COSTLY DETAILS
Small color differences, big effect
![Page 25: iOS intro to 3D graphics with Metal](https://reader030.vdocuments.mx/reader030/viewer/2022021506/587bd42a1a28ab834d8b4c55/html5/thumbnails/25.jpg)
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](https://reader030.vdocuments.mx/reader030/viewer/2022021506/587bd42a1a28ab834d8b4c55/html5/thumbnails/26.jpg)
DEBUGGING
“You forgot to unbind a buffer here”
![Page 27: iOS intro to 3D graphics with Metal](https://reader030.vdocuments.mx/reader030/viewer/2022021506/587bd42a1a28ab834d8b4c55/html5/thumbnails/27.jpg)
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](https://reader030.vdocuments.mx/reader030/viewer/2022021506/587bd42a1a28ab834d8b4c55/html5/thumbnails/28.jpg)
Thanks!
![Page 29: iOS intro to 3D graphics with Metal](https://reader030.vdocuments.mx/reader030/viewer/2022021506/587bd42a1a28ab834d8b4c55/html5/thumbnails/29.jpg)
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