TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

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 String Catalog.

SPONSORED Get accurate app localizations in minutes using AI. Choose your languages & receive translations for 40+ markets!

Localize My App

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

Was this page useful? Let us know!

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.