Post

Replies

Boosts

Views

Activity

Reply to Apple Developer account for free
I may be mistaken, but I think that by the fact that you can post on this forum, you have an Apple Developer Account. You should be able to set your plugged-in iPhone as the build target and then cmd-R to run it on your phone. It will tell you to go into settings and turn on developer mode, after which you need to restart your phone, and I think there are few more steps, but it is totally possible. As somebody who does not have a paid Apple Developer account, I can confirm that it is possible to do this.
Jan ’23
Reply to Sprites with same shader but different uniform values
I doubt anyone is reading this six years later, but I just ran into this and it is not working. For some reason, it is applying the SKAttribute to all copies of the sprite node. The sprite with shader is initialized like this: birdFillShader = shaderWithFilename( "birdFill", fileExtension: "fsh", uniforms: uniforms ) birdFillShader.attributes = [SKAttribute(name: "a_rand", type: .float)] self.birdNode = SKShapeNode( rect: CGRect(x: -100, y: -100, width: 200, height: 200) ) if let birdNode = self.birdNode { birdNode.strokeColor = .clear birdNode.fillShader = birdFillShader } Later on, the sprite is cloned and the SKAttribute is set: if let birdNode = self.birdNode?.copy() as! SKShapeNode? { let aRand = Float.random(in: 0.0...1.0) birdNode.setValue(SKAttributeValue(float: aRand), forAttribute: "a_rand") /* ... set position of node ... */ } For the moment, the shader is doing this: void main() { gl_FragColor = vec4(vec3(a_rand), 1.0); } I am cloning multiple sprites and they all seem to share the same value for a_rand as noted by the color being uniform and changing across all created sprites.
Topic: Graphics & Games SubTopic: SpriteKit Tags:
Jan ’23