SceneKit Cocoa Adding Stickers

Is there a sufficient way to add stickers (textures) to SCNNode? For now, all I can do is create a new one SCNNodewith the geometry, SCNPlane assign the texture a diffuse content for it and add it to the scene ... This approach is very inefficient.

I want to add stickers that will not be part of the scene - to improve game performance. because I want to have a relatively large number of stickers on the floor node.

Maybe a bit like how the particles inside work? Or some other approach to fast drawing images.

I already tried @rickster Offer No. 1

Use SKEffectNode as a buffer in the SpriteKit scene - throw splashes into the node effect until it reaches a certain number of children, then enable the shouldRasterize parameter so that it does not re-display its children anymore (and start using the new node effect for more splatters).

In the same project SceneKit showreel - this in itself brought good results, FPS are not discarded as 5 minutes of the continuation of the game, which is good.

We are waiting for the implementation of Proposal No. 2 - I believe that this will reduce the rendering time of the 2D scene (which is now quite large).

There are 5k captions in this screenshot

5k

+4
source share
1 answer

SpriteKit "" . Apple , , :

  • SpriteKit SceneKit.
  • - 3D- , SpriteKit.
  • SpriteKit , .

, , , ... , ,


: iOS 9/macOS 10.11 , splatter. , AAPLGameViewController.m:

    ball.physicsBody.collisionBitMask = ~(0x4);

:

    ball.physicsBody.contactTestBitMask = ~(0x4);

, , - SpriteKit 2D-, .

enter image description here (, , ?)

, "" . :

  • SKEffectNode SpriteKit - splatters node, , shouldRasterize, ( node ).

  • SK-, , . (, , , .) , "" - , , SpriteKit , - , " " . A quadtree .

  • SceneKit hit-test , , SpriteKit, (, № 3).

  • , .

  • , , : Core Image splatters MTLTexture, . ( SceneKit willRenderScene .)

+2
source

Source: https://habr.com/ru/post/1662547/


All Articles