NEW: Got a question? Get help on our new forums! >>

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 Instabug

SPONSORED Catch bugs as soon as they happen and know exactly why a crash occurred by integrating Instabug's SDK in one minute. You will automatically receive device data, network logs, and reproduction steps with every bug and crash report.

Learn more and get started for free

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

Snapthread is a casual video editor and slideshow maker that makes discovering, compiling and sharing your favorite memories effortless.

BUY OUR BOOKS
Buy Pro Swift 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 (Vapor Edition) 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 Server-Side Swift (Kitura Edition) 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!