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

  Переглядів 22,892

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

КОМЕНТАРІ: 45
@antoniopalomba5123
@antoniopalomba5123 5 місяців тому
Thank you so much for this tutorial Paul! I was looking for some inspiration to start my Metal study.
@RBilsland
@RBilsland 5 місяців тому
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! 👍🏻
@WenzelStone
@WenzelStone 6 днів тому
Oh God, this is mind-blowing!
@DanielKasaj
@DanielKasaj 5 місяців тому
This was enlightening and inspiring. Btw I must have rewatched the part around 45:40 like 5 times
@NiclasJeppsson
@NiclasJeppsson 5 місяців тому
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 :)
@steveloengard5139
@steveloengard5139 5 місяців тому
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 5 місяців тому
Make sure and check out the Inferno repository - all contributions welcome! github.com/twostraws/Inferno
@leomarcotte4294
@leomarcotte4294 5 місяців тому
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.
@marcusziadev
@marcusziadev 5 місяців тому
Watched this over 2 morning coffees. Good stuff. Shared at work
@Coffeeology
@Coffeeology 5 місяців тому
Freshly baked Two Straws video. Perfect for my morning coffee.
@UnbekanntesSubjekt
@UnbekanntesSubjekt 4 місяці тому
I must admit that you, sire, are a didactic genius. Love your instructions, and your dogs are nice, too.
@atanamvari7610
@atanamvari7610 2 місяці тому
Just keep doing what you're doing man. So thorough
@AmitGupta-rt2gp
@AmitGupta-rt2gp 5 місяців тому
Thank you Paul. This video is super helpful. Thank you for always putting out such rich and helpful content.
@hoagy_ytfc
@hoagy_ytfc 5 місяців тому
Not something _every_ developer needs to know - but for those of us who do, this is a great tutorial. Thanks Paul.
@kbusse
@kbusse 5 місяців тому
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 ;-)
@oleksandrlohozinskyi3483
@oleksandrlohozinskyi3483 5 місяців тому
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.
@huwrowlands
@huwrowlands 5 місяців тому
The full sinebow effect reminds me of something used to advertise blank VHS tapes Great work!
@theblckbird
@theblckbird 5 місяців тому
congrats on 100K!!!
@hybridxdesign
@hybridxdesign 4 місяці тому
I have learn so much from this turtorial, thanks.
@mylaluna
@mylaluna 5 місяців тому
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.
@sg1885
@sg1885 5 місяців тому
amazing
@douglasaraujo9763
@douglasaraujo9763 3 місяці тому
Wow, amazing!
@zolanihogana
@zolanihogana 5 місяців тому
This guy goes above and beyond for us! Thank you
@johndoe276
@johndoe276 5 місяців тому
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?
@MarkEvans5
@MarkEvans5 5 місяців тому
😂 the windows shortcut was GOLD!!
@VladimirKim-cl3rh
@VladimirKim-cl3rh 5 місяців тому
Amazing !!!
@maksimums6819
@maksimums6819 5 місяців тому
Thank you!
@designckinet
@designckinet 20 днів тому
Really interesting!
@BlaineL
@BlaineL 5 місяців тому
Thank you done much for this Paul. Truly awesome ! Just don't know how you find the time! 👍
@olilarkin
@olilarkin 5 місяців тому
awesome!
@calmsz
@calmsz 5 місяців тому
Thank you Professor!
@LyndonMaydwell
@LyndonMaydwell 5 місяців тому
This is great! Is there a way to output values computed in a shader back to a state variable, etc?
@phantuananh2163
@phantuananh2163 5 місяців тому
Awesomeeeeeeeeeeeee
@gmebu
@gmebu 5 місяців тому
Wow Paul
@simpleinterest360
@simpleinterest360 5 місяців тому
Please make more content around computer graphics and metal
@emilvladov3216
@emilvladov3216 4 місяці тому
Adjusting the maxSampleOffset seems to get rid of the clipping at 25:19 instead of the padding
@arkadiusz6688
@arkadiusz6688 3 місяці тому
Wonder if there's something like shader language but for audio programming.
@AlanW
@AlanW 5 місяців тому
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 5 місяців тому
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 5 місяців тому
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 5 місяців тому
works on Intel too?
@williamsquires3070
@williamsquires3070 3 місяці тому
(@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 2 місяці тому
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 5 місяців тому
thanks Paul!
Making it Rain - Advanced Special Effects with SwiftUI
29:16
Paul Hudson
Переглядів 12 тис.
😱СНЯЛ СУПЕР КОТА НА КАМЕРУ⁉
00:37
OMG DEN
Переглядів 1,4 млн
JS99: Callbacks in JS
9:17
Smarix
Переглядів 2
An introduction to Shader Art Coding
22:40
kishimisu
Переглядів 883 тис.
Introducing Inferno: Metal shaders for SwiftUI
6:37
Paul Hudson
Переглядів 11 тис.
How I accidentally learned Python in 6 months
4:57
Thaomaoh
Переглядів 6 тис.
Георгий Остроброд - Введение в Apple Metal
1:11:48
5 Steps to Better SwiftUI Views
31:19
Paul Hudson
Переглядів 54 тис.
Introduction to shaders: Learn the basics!
34:50
Barney Codes
Переглядів 254 тис.
GPU Programming with The Metal Shading Language
23:44
2etime
Переглядів 16 тис.
What Are Shaders?
6:24
TheHappieCat
Переглядів 193 тис.
Главная проблема iPad Pro M4 OLED!
13:04
THE ROCO
Переглядів 15 тис.
Портативная PS 5 🎮 #ps5 #expressly
0:22
ExpresSLY Shorts
Переглядів 128 тис.
Broken Flex Repair #technology #mobilerepair
0:50
ideal institute aligarh
Переглядів 1,2 млн
Главная проблема iPad Pro M4 OLED!
13:04
THE ROCO
Переглядів 15 тис.