O'Reilly logo

iOS Game Development By Example by Samanyu Chopra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Shaders

Shaders in Sprite Kit facilitate SKScenenode to appear with a special, customized, drawing behavior. This can be achieved by creating the SKShader objects and assigning a custom OpenGL ES fragment shader.

If a custom shader (the SKShader object) needs to provide a uniform shader, then you need to create one or more SKUniform objects and associate them with your shader objects. Shader programs are primarily divided into:

  • Vertex shaders
  • Fragment shaders

Let's discuss about both of these in detail:

  • Vertex shaders: These shaders work on each vertex and most of the calculation is done on the vertex part. They are set by Sprite Kit automatically. As the computation of these shaders are mostly done on the vertex part, not much of the CPU's resources ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required