NEW: My new book Pro SwiftUI is out now – level up your SwiftUI skills today! >>

ShaderKit adds special effects to SpriteKit in seconds

Use this new library of fragment shaders to add some excitement to your next project.

Paul Hudson       @twostraws

I just released a new open-source project called ShaderKit, which delivers 20 different fragment shader effects for use in SpriteKit games.

Fragment shaders are commonly used to provide effects such as water ripples, spinning black holes, flashing lights, embossing, noise, gradients, and more. They run directly on the GPU, which makes them a blazingly fast way to add special effects to games.

The problem is, most SpriteKit developers don’t use them – partly because writing shaders is a unique skill in its own right, but partly also because shaders are written in GLSL rather than Swift.

I built ShaderKit to solve that problem: it’s an open-source library of fragment shaders for SpriteKit that you can drop in to any game. All shaders come with example code so you can see how to use them, plus sandbox apps for both iOS and macOS so you can see how they look.

Here’s a brief video to whet your appetite:

Even better, each of the shaders is comprehensively documented: you get an explanation of how the algorithm works, plus line-by-line comments explaining what each line means in English. All being well this should mean even relative beginners can dive in and try shaders for themselves.

The great thing about shaders is that you can add them to any game without changing your logic – you just drop the shader code into your program and attach it to whatever node you want. So, the next time you want a water effect over your background, a black hole sucking players to their doom, or an infrared view to simulate being the Predator, give ShaderKit a try.

Link: ShaderKit.

Hacking with Swift is sponsored by Play

SPONSORED Play is the first native iOS design tool created for designers and engineers. You can install Play for iOS and iPad today and sign up to check out the Beta of our macOS app with SwiftUI code export. We're also hiring engineers!

Click to learn more about Play!

Sponsor Hacking with Swift and reach the world's largest Swift community!

Buy Pro Swift Buy Pro SwiftUI Buy Swift Design Patterns Buy Testing Swift Buy Hacking with iOS Buy Swift Coding Challenges Buy Swift on Sundays Volume One Buy Server-Side Swift Buy Advanced iOS Volume One Buy Advanced iOS Volume Two Buy Advanced iOS Volume Three Buy Hacking with watchOS Buy Hacking with tvOS Buy Hacking with macOS Buy Dive Into SpriteKit Buy Swift in Sixty Seconds Buy Objective-C for Swift Developers Buy Beyond Code

About the author

Paul Hudson is the creator of Hacking with Swift, the most comprehensive series of Swift books in the world. He's also the editor of Swift Developer News, the maintainer of the Swift Knowledge Base, and a speaker at Swift events around the world. If you're curious you can learn more here.

Was this page useful? Let us know!

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.