---
title: Applying Shaders to a Sprite
framework: spritekit
role: article
role_heading: Article
path: spritekit/applying-shaders-to-a-sprite
---

# Applying Shaders to a Sprite

Write custom GLSL code that modifies the look of your sprite.

## Overview

Overview You can use the shader property of a sprite node to change the appearance of a texture with a custom OpenGL ES fragment shader embedded within a SKShader object. Custom shaders offer almost limitless possibilities, from adding blurs and color treatments to textures to generating imagery such as random noise. The following code shows a small custom shader which inverts the color of a texture while leaving the alpha or transparency unaffected: The following figure illustrates the effect of the shader. The original image, on the left, has its colors inverted by the shader:

## See Also

### Adding a Custom Shader to a Sprite

- [shader](spritekit/skspritenode/shader.md)
- [attributeValues](spritekit/skspritenode/attributevalues.md)
- [setValue(_:forAttribute:)](spritekit/skspritenode/setvalue(_:forattribute:).md)
- [value(forAttributeNamed:)](spritekit/skspritenode/value(forattributenamed:).md)
