SwiftUI + Metal - Create special effects by building your own shaders

  Рет қаралды 24,557

Paul Hudson

Paul Hudson

Күн бұрын

In this video I show you how to write your own Metal shaders for use with SwiftUI, so you can create beautiful special effects that run at blazing fast speeds. Get the code here: github.com/twostraws/Inferno
00:00 Introduction
09:19 Passthrough
14:50 Recolor
16:09 Invert Alpha
17:04 Gradient Fill
18:35 Animated Gradient
21:57 Wave
26:07 Relative Wave
32:25 Loupe
40:57 SwiftUI transitions
43:10 Shape transitions
53:00 Crosswarp transition
1:00:13 Generating everything with Metal
1:14:03 Where to find more resources
1:15:30 Get the code for this video

Пікірлер: 47
@antoniopalomba5123
@antoniopalomba5123 7 ай бұрын
Thank you so much for this tutorial Paul! I was looking for some inspiration to start my Metal study.
@leomarcotte4294
@leomarcotte4294 7 ай бұрын
This is by far the best tutorial that can currenlty be found on the internet, thank you so much for taking the time to explain every bit of metal shaders.
@steveloengard5139
@steveloengard5139 7 ай бұрын
Thanks, Paul. I wrote some shaders in C++ many years ago and I've been wondering how to incorporate them into SwiftUI and Metal for macOS. This is perfect!
@twostraws
@twostraws 7 ай бұрын
Make sure and check out the Inferno repository - all contributions welcome! github.com/twostraws/Inferno
7 ай бұрын
This was enlightening and inspiring. Btw I must have rewatched the part around 45:40 like 5 times
@hoagy_ytfc
@hoagy_ytfc 6 ай бұрын
Not something _every_ developer needs to know - but for those of us who do, this is a great tutorial. Thanks Paul.
@RBilsland
@RBilsland 6 ай бұрын
Thanks Paul, after attempting to start Metal shaders a number of time I now feel like I actually have a good base to start exploring from this time! 👍🏻
@UnbekanntesSubjekt
@UnbekanntesSubjekt 6 ай бұрын
I must admit that you, sire, are a didactic genius. Love your instructions, and your dogs are nice, too.
@kbusse
@kbusse 6 ай бұрын
Great tutorial, thanks a ton! This single video will explode the number of metal shaders used in iOS Slight real life nitpick on the flag animation: The waves run from right to left in your example, so the waves run upwind ;-)
@NiclasJeppsson
@NiclasJeppsson 6 ай бұрын
Love this, more Metal videos! Im currently in the process of learning Metal, and you are completely right, it’s hard. However, with the power we have in our iPhones, there’s so much creativity that can be unlocked by learning it :)
@Coffeeology
@Coffeeology 7 ай бұрын
Freshly baked Two Straws video. Perfect for my morning coffee.
@huwrowlands
@huwrowlands 6 ай бұрын
The full sinebow effect reminds me of something used to advertise blank VHS tapes Great work!
@AmitGupta-rt2gp
@AmitGupta-rt2gp 6 ай бұрын
Thank you Paul. This video is super helpful. Thank you for always putting out such rich and helpful content.
@oleksandrlohozinskyi3483
@oleksandrlohozinskyi3483 6 ай бұрын
Hey, Paul, i just want to say that love your person as a content creator and will to wish even more imagination in the created content, etc etc.
@atanamvari7610
@atanamvari7610 3 ай бұрын
Just keep doing what you're doing man. So thorough
@marcusziadev
@marcusziadev 6 ай бұрын
Watched this over 2 morning coffees. Good stuff. Shared at work
@hybridxdesign
@hybridxdesign 5 ай бұрын
I have learn so much from this turtorial, thanks.
@theblckbird
@theblckbird 7 ай бұрын
congrats on 100K!!!
@mylaluna
@mylaluna 6 ай бұрын
Good stuff. I have never touched shaders before and I thought only game developers care about it. Now I think I may able to use shaders on my app.
@WenzelStone
@WenzelStone Ай бұрын
Oh God, this is mind-blowing!
@MarkEvans5
@MarkEvans5 7 ай бұрын
😂 the windows shortcut was GOLD!!
@sg1885
@sg1885 7 ай бұрын
amazing
@zolanihogana
@zolanihogana 7 ай бұрын
This guy goes above and beyond for us! Thank you
@johndoe276
@johndoe276 6 ай бұрын
Great video! Thanks, Paul (as always 😀) Question on the relative wave shader: Shouldn't it be pos.x instead of pos.y within the sin function?
@designckinet
@designckinet Ай бұрын
Really interesting!
@douglasaraujo9763
@douglasaraujo9763 5 ай бұрын
Wow, amazing!
@BlaineL
@BlaineL 7 ай бұрын
Thank you done much for this Paul. Truly awesome ! Just don't know how you find the time! 👍
@maksimums6819
@maksimums6819 7 ай бұрын
Thank you!
@VladimirKim-cl3rh
@VladimirKim-cl3rh 6 ай бұрын
Amazing !!!
@LyndonMaydwell
@LyndonMaydwell 6 ай бұрын
This is great! Is there a way to output values computed in a shader back to a state variable, etc?
@olilarkin
@olilarkin 7 ай бұрын
awesome!
@calmsz
@calmsz 7 ай бұрын
Thank you Professor!
@phantuananh2163
@phantuananh2163 7 ай бұрын
Awesomeeeeeeeeeeeee
@arkadiusz6688
@arkadiusz6688 4 ай бұрын
Wonder if there's something like shader language but for audio programming.
@simpleinterest360
@simpleinterest360 6 ай бұрын
Please make more content around computer graphics and metal
@gmebu
@gmebu 7 ай бұрын
Wow Paul
@emilvladov3216
@emilvladov3216 5 ай бұрын
Adjusting the maxSampleOffset seems to get rid of the clipping at 25:19 instead of the padding
@RyuuzakiJulio
@RyuuzakiJulio 18 күн бұрын
Really amazing effects! But the alpha 0 value for transparency doesn't show transparent if the image is on top of a colored background like a gradient or an image. How can we make it actually transparent on top of another object?
@RyuuzakiJulio
@RyuuzakiJulio 17 күн бұрын
Figured the answer: [[stitchable]] half4 recolor(float2 position, half4 color) { if (color.a > 0) { color.rgb = half3(1.0, 0.0, 0.0); } return color; }
@AlanW
@AlanW 6 ай бұрын
Is it possible to use this as the equivalent of a UIVisualEffectView? Our designers continue to insist on Figma, which has no regard for the built in blurs iOS can provide, and this would be great for getting the exact tinted gaussian blurs they keep dreaming up!
@Desertbynight
@Desertbynight 6 ай бұрын
I couldn't find how to make .float(elapsed) work. Tried to swap it with (time) but Generic parameter 'Content' could not be inferred
@brucknerdevilliers
@brucknerdevilliers 6 ай бұрын
Mine worked with time, but you need the @State private var start = Date.now and only one instance of 'let time = start.distance(to: tl.date)'
@michaelprenez-isbell8672
@michaelprenez-isbell8672 6 ай бұрын
works on Intel too?
@williamsquires3070
@williamsquires3070 4 ай бұрын
(@38:35) You forgot to define ‘offset’. As a result, the code won’t compile. Error is: (on the line with “TimelineView(.animation) {tl in”) Generic parameter ‘Content’ could not be inferred Explicitly specify the generic parameters to fix this issue. because nothing defines ‘offset’ as something that can be converted to a float2. Also, the loupe() function takes 4 arguments, but only two have been passed in (“.float2(proxy.size)” and “float2(offset)”) Where’s the reference to the SwiftUI::Layer (2nd argument) and the float2 touch (4th argument)?
@thebrokenpenguin1
@thebrokenpenguin1 3 ай бұрын
It was my understanding that the position and layer automatically get passed in so we don't have to worry about those. As for the "offset" parameter, this should be the "touch" variable that he defines on the previous slide. You may find that the maxDistance and zoomFactor are too big (I certainly did), so you can experiment with making those smaller.
@bartleby222
@bartleby222 7 ай бұрын
thanks Paul!
Why I NEVER Took Notes While Learning to Code
5:10
Kunal Kushwaha
Рет қаралды 52 М.
WWDC23: Meet Object Capture for iOS | Apple
20:06
Apple Developer
Рет қаралды 113 М.
FOOTBALL WITH PLAY BUTTONS ▶️❤️ #roadto100million
00:20
Celine Dept
Рет қаралды 17 МЛН
Increíble final 😱
00:37
Juan De Dios Pantoja 2
Рет қаралды 36 МЛН
В ДЕТСТВЕ СТРОИШЬ ДОМ ПОД СТОЛОМ
00:17
SIDELNIKOVVV
Рет қаралды 3,8 МЛН
Build your next website in Swift
24:45
Paul Hudson
Рет қаралды 31 М.
3D Content in iOS & visionOS apps with Spline (Xcode & SwiftUI)
16:21
Good APIs Vs Bad APIs: 7 Tips for API Design
5:48
ByteByteGo
Рет қаралды 207 М.
Swift Exam Question: Struct vs Class - Quick explanation for Beginners - iOS Development
2:49
MobileMasters: Android & iOS Development Unleashed
Рет қаралды 7
SwiftUI Tooltips with TipKit (Popover & Inline Tips)
16:17
Sean Allen
Рет қаралды 12 М.
iOS 18: BEST Features Announced at WWDC 2024
9:02
MacRumors
Рет қаралды 21 М.
An introduction to Shader Art Coding
22:40
kishimisu
Рет қаралды 914 М.
5 Steps to Better SwiftUI Views
31:19
Paul Hudson
Рет қаралды 55 М.
Урна с айфонами!
0:30
По ту сторону Гугла
Рет қаралды 5 МЛН
Bluetooth Desert Eagle
0:27
ts blur
Рет қаралды 5 МЛН
Best Beast Sounds Handsfree For Multi Phone
0:42
MUN HD
Рет қаралды 340 М.
Main filter..
0:15
CikoYt
Рет қаралды 3,2 МЛН
Carregando telefone com carregador cortado
1:01
Andcarli
Рет қаралды 2,6 МЛН