Is it possible to run an openGL Shader Program with both vertex and fragment shaders in SpriteKit?
It seems only fragment Shaders are available.
SceneKit offers it via the SCNProgram class
Actually vertex shaders are useful for much more than just transformations and projection. One of the most useful features is making calculations at each vertex, and then have the hardware interpolate the results, passing them to the fragment shader via 'varying' variables. (This is significantly more efficient than trying to calculate the interpolated values in the fragment shader itself.)
The simplest example is gouraud shading: You can calculate lighting in the vertex shader, and have the hardware interpolate these values, to be used in the fragment shader. This is much more efficient than calculating the lighting in the latter. (However, this is just a simplistic example. There are much more useful examples of this as well. Eg. many blurring shaders use this technique because it's much more efficient.)
The cocos2d library supports vertex shaders (and these techniques can be used with it.) So it's not like it's something that nobody uses.
There is probably no way of using vertex shaders currently in SpriteKit. You might have better luck by using SceneKit objects (which can be seamlessly embedded in a SpriteKit scene.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With