ios - SpriteKit - SKEffectnode Blendmode, Rasterisation, and Frame Rate -
i'm trying simple lighting in side scrolling game using skeffectnode. first make fullscreen sprite node gray color, set it's blend mode additive, , add child effect node. add sprite nodes light texture, children of effect node. set effect node's blend mode multiply, , add child scene. this:
skeffectnode *effectnode = [[skeffectnode alloc] init]; skspritenode *overlay = [skspritenode spritenodewithcolor: [skcolor graycolor] size: [self.size]; skspritenode *light = [skspritenode spritenodewithimagenamed: @"lighttexture.png"]; [overlay setblendmode: skblendmodeadd]; [light setblendmode: skblendmodeadd]; [effectnode addchild: overlay]; [effectnode addchild: light]; [effectnode setblendmode: skblendmodemultiply]; [self addchild: effectnode];
so problem effect node's blend mode doesn't seem doing anything. it's stuck in alpha blend mode or something. however, if set shouldrasterize yes, blend mode starts working expected. know why is?
also adding fullscreen effect this, effect node, totally destroys frame rate. if start moving effect node (or create new 1 every frame). don't see other way of doing lighting in sprite kit. want create lighting mask every frame, , multiply scene's frame buffer. possible using sprite kit? or should cocos2d using custom shaders?
Comments
Post a Comment