skeffectnode

Metal crash upon adding SKSpriteNode to SKEffectNode

牧云@^-^@ 提交于 2020-01-01 08:18:16
问题 -[MTLDebugRenderCommandEncoder setScissorRect:]:2028: failed assertion `(rect.x(0) + rect.width(1080))(1080) must be <= 240' I am getting this crash when adding a simple SKSpriteNode to a SKEffectNode with the following code SKSpriteNode *warpSprite = [SKSpriteNode spriteNodeWithImageNamed:@"art.scnassets/symbol.png"]; SKEffectNode *entryEffectsNode = [[SKEffectNode alloc] init]; [entryEffectsNode addChild:warpSprite]; [self addChild:entryEffectsNode]; I have not touched these nodes anywhere

On iOS, can you add multiple CIFilters to a SpriteKit node?

南楼画角 提交于 2019-12-11 07:33:29
问题 On iOS, can you add more than one CIFilter to a SKEffectsNode ? CIFilterGenerator seems like what I want but it isn't available on iOS. I know you can use multiple filters on an image by passing the output of one as the input of the next, but that's not helpful if you want to affect non-image nodes. Does this mean I have to create an artificial hierarchy of SKEffectNode and add a filter to each of them, with my actual content at the very bottom? Is there a better way? 回答1: Where it's

Applying a CIFilter with SKEffectNode to a SKSpriteNode

大憨熊 提交于 2019-12-11 06:25:07
问题 I am trying to apply a CIFilter with SKEffectNode to a SKSpriteNode. Can't get this to work and not sure why. I got this working using a blur but cannot get the mono photo effect. Anyone have any insight? Thanks again. //Mono Effect (not working) let filter = CIFilter(name: "CIPhotoEffectMono") filter?.setDefaults() effectsNode.filter = filter self.addChild(effectsNode) effectsNode.addChild(SKSpriteNode) //Blur Effect (working) let filter = CIFilter(name: "CIGaussianBlur") let blurAmount = 4

SKEffectNode to an SKTexture?

南笙酒味 提交于 2019-12-09 03:38:55
问题 SKEffectionNodes have a shouldRasterise "switch" that bakes them into a bitmap, and doesn't update them until such time as the underlying nodes that are impacted by the effect are changed. However I can't find a way to create an SKTexture from this rasterised "image". Is it possible to get a SKTexture from a SKEffectNode ? 回答1: I think you could try a code like this (it's just an example): if let effect = SKEffectNode.init(fileNamed: "myeffect") { effect.shouldRasterize = true self.addChild

how do I cut a hole in a sprite image or texture to show what is behind it using spriteKit in swift

南笙酒味 提交于 2019-12-07 19:30:19
问题 I would like to display a bunch of draggable images in spriteKit. Some of the images will require me to cut a hole in the graphic dynamically so I can see what is behind the images. And as I drag around the images I'll be able to see the other images through the holes I've cut in the images. If you need a visual, think of jigsaw puzzle pieces. This stack exchange link below looked very simple and promising, but the white circle cutout doesn't seem to display. At least not in the simulator. I

Metal crash upon adding SKSpriteNode to SKEffectNode

我们两清 提交于 2019-12-04 02:13:39
-[MTLDebugRenderCommandEncoder setScissorRect:]:2028: failed assertion `(rect.x(0) + rect.width(1080))(1080) must be <= 240' I am getting this crash when adding a simple SKSpriteNode to a SKEffectNode with the following code SKSpriteNode *warpSprite = [SKSpriteNode spriteNodeWithImageNamed:@"art.scnassets/symbol.png"]; SKEffectNode *entryEffectsNode = [[SKEffectNode alloc] init]; [entryEffectsNode addChild:warpSprite]; [self addChild:entryEffectsNode]; I have not touched these nodes anywhere else in my project, when i change the sprite the value in (must be <=value) changes within the error.

How to apply full-screen SKEffectNode for post-processing in SpriteKit

核能气质少年 提交于 2019-12-01 05:27:24
I'm trying out SpriteKit with the following setup: An SKScene with two child nodes used merely for grouping other nodes: foreground and background. background is really empty as of now, but would eventually hold some type of background sprite / layers. foreground is a SKEffectNode and whenever the user taps on the screen, a new intance of a SKnode subclass which represents a game element is added as child to it. This SKNode subclass basically creates 3 SKShapeNodes and two labels: an outter circumference, an inner circumference, 2 labels and an inner quarter circumference. The inner quarter

How to apply full-screen SKEffectNode for post-processing in SpriteKit

六眼飞鱼酱① 提交于 2019-12-01 03:58:35
问题 I'm trying out SpriteKit with the following setup: An SKScene with two child nodes used merely for grouping other nodes: foreground and background. background is really empty as of now, but would eventually hold some type of background sprite / layers. foreground is a SKEffectNode and whenever the user taps on the screen, a new intance of a SKnode subclass which represents a game element is added as child to it. This SKNode subclass basically creates 3 SKShapeNodes and two labels: an outter

How can you create a glow around a sprite via SKEffectNode

一曲冷凌霜 提交于 2019-11-27 17:24:44
I have a SKSpriteNode that I'd like to have a blue glow around it's edges for highlighting purposes. I am guessing that I would need to make my sprite a child of a SKEffectNode and then create/apply a filter of some sort. UPDATE : I have investigated this quite a it with the chosen answer's approach, and discovered that SKEffectNode has a sizeable hit on performance even if you have it set to shouldRasterize and 'no filter' defined. My conclusion is that if your game requires more than 10 moving objects at one time, they can't involve a SKEffectNode even if rasterized. My solution will likely

Add glowing effect to an SKSpriteNode

假装没事ソ 提交于 2019-11-27 11:36:44
I have a moving black image on a dark screen, to make it easier to see I would like to add in a white glow to the image. This is my code for the moving image: Ghost = SKSpriteNode(imageNamed: "Ghost1") Ghost.size = CGSize(width: 50, height: 50) Ghost.position = CGPoint(x: self.frame.width / 2 - Ghost.frame.width, y: self.frame.height / 2) Ghost.physicsBody = SKPhysicsBody(circleOfRadius: Ghost.frame.height / 1.4) Ghost.physicsBody?.categoryBitMask = PhysicsCatagory.Ghost Ghost.physicsBody?.collisionBitMask = PhysicsCatagory.Ground | PhysicsCatagory.Wall Ghost.physicsBody?.contactTestBitMask =