scenekit

Is there a way to add an outline in scene kit?

一笑奈何 提交于 2019-12-05 01:10:24
问题 I've been making a game in scene kit, but the edges of objects are difficult to see, making some of the games details impossible to see. Is there a way to make a black outline around all the game objects? 回答1: you could use an SCNTechnique as mentioned in another answer (you can have a look at this article about cel shading, which has an edge-detection pass) but full-frame post-processes are quite expensive. On OS X you can also leverage geometry shaders (see this article). But it's not

What is Core Audio error 561015905 and why does it happen when I use the lock button?

情到浓时终转凉″ 提交于 2019-12-05 01:04:35
问题 Since upgrading to iOS 10 and Xcode 8, my iOS app has been throwing an error and crashing whenever I turn off the screen using the lock button. The error is: *** Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'error 561015905' I'm not explicitly using Core Audio, or any audio at all. But I am using SceneKit, which I assume uses Core Audio. Actually this behavior doesn't seem to be related to my code at all. It happens on a brand new untouched SceneKit

What are “Metal Flush” in the SceneKit stats display?

风格不统一 提交于 2019-12-05 00:09:49
问题 I'm trying to troubleshoot drops in FPS. I see that Metal Flushes are what takes up most of the rendering time. Is that a good thing? 回答1: I am not sure about this, since Apple does not seem to have documented what exactly a "Metal Flush" is anywhere, but I'll answer based on previous experience with OpenGL: During the execution cycle of a GPU-powered application, the CPU will push data to the GPU, wait for the GPU to finish operating on this data (possibly doing other work in the meantime),

SceneKit SCNNode init(mdlObject:) missing?

ε祈祈猫儿з 提交于 2019-12-04 23:39:15
I'm using Xcode 7.3.1, Swift 2.x, iOS target is 9.3. I can find convenience init init(MDLObject mdlObject: MDLObject) in Apple docs , but I don't see it in my project. I opened standard game project starter, SceneKit is imported. I've tried: Double checking iOS version Adding import ModelIO Finding "mdlObject:" in header files in SceneKit.framework - not found Looking for alternative methods (maybe Apple moved it somewhere) but there are no other inits with that parameter, no class function, nor I found any corresponding export function in MDLObject Cleaning project... I can see all SceneKit

Render a 3D model (hair) with semi-transparent texture in SceneKit?

和自甴很熟 提交于 2019-12-04 22:52:43
I'm trying to render a 3D model in SceneKit but it looks incorrect. For example this model (it's an SCN file with texture and you can reproduce it in your Xcode): In Xcode Scene Editor it is rendered like this: Transparency -> Mode -> Dual Layer Double Sided = true If I turn off the "Write depth" option, it will look like this: But there are also some issues because it I see only "the lowest layer" of haircut. I think this should be possible. How to do it right? The reason that in your 3D model some strands of hair popped out when viewed from different angles is quite usual for SceneKit: your

Get “[SceneKit] Error:” when set AVPlayer to SCNMaterial.diffuse.contents

一曲冷凌霜 提交于 2019-12-04 21:49:15
According Apple's docs, SCNMaterial.diffuse.contents can be a AVPlayer . In this case material appear content of video. Everything seems ok but I get several sceneKit error logs: [SceneKit] Error: Could not get pixel buffer (CVPixelBufferRef) Below is my code. Move [_player play] to viewWillAppear does't help. - (void)viewDidLoad { [super viewDidLoad]; self.boxNode = [self.sceneView.scene.rootNode childNodeWithName:@"box" recursively:YES]; NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/VRF_SuLie.MP4"]; AVURLAsset *asset = [AVURLAsset assetWithURL:[NSURL

added button to sceneKit view but it has a lag

梦想与她 提交于 2019-12-04 20:47:30
问题 I added a custom button to the sceneKit view. When it is touched, it plays an animation, indicating that it was clicked. The problem I'm facing is the delay between user touch and start of animation. My scene has 28.1K triangles and 84.4K vertices. Is that to much or do I need to implement buttons differently. The scene renders with 60fps. I added the button via sceneView.addSubview: Thanks for answers viewDidLoad(){ // relevant code starButton = UIButton(type: UIButtonType.Custom) starButton

Scenekit - physicsWorld setup to prevent kinematic nodes to intersect

点点圈 提交于 2019-12-04 19:37:22
I have several nodes in my scene which i can rotate and drag around. I've set up a physicsWorld delegate, added physicsBody with type kinematic to my nodes and check for physicsWorld didBeginContact - up to this point everything is ok, when i move the nodes , the contact begin/end fires. The way i'm trying to handle this is to set a bool var that change to true once the contact start to prevent further movement, but i'm running into cases (especialy if i drag the node too fast) , that the node gets a little bit inside of the other object. should i use different approach to this? I don't really

SceneKit unproject Z documentation explanation?

ε祈祈猫儿з 提交于 2019-12-04 19:25:16
I am going through some SceneKit concepts and one I am trying to solidify in my head is unprojectPoint. I understand that the function will take a point in 2D and return a point in 3D (so one with the proper Z value). When I read the documentation I read this: /*! @method unprojectPoint @abstract Unprojects a screenspace 2D point with depth info using the receiver's current point of view and viewport. @param point The screenspace position to be unprojected. @discussion A point whose z component is 0 (resp. 1) is unprojected on the near (resp. far) clip plane. */ public func unprojectPoint(_

How to use a shaderModifier to alter the color of specific triangles in a SCNGeometry

家住魔仙堡 提交于 2019-12-04 16:46:38
First, before I go on, I have read through: SceneKit painting on texture with texture coordinates which seems to suggest I'm on the right track. I have a complex SCNGeometry representing a hexasphere. It's rendering really well, and with a full 60fps on all of my test devices. At the moment, all of the hexagons are being rendered with a single material, because, as I understand it, every SCNMaterial I add to my geometry adds another draw call, which I can't afford. Ultimately, I want to be able to color each of the almost 10,000 hexagons individually, so adding another material for each one is