scenekit

SceneKit: advice on reproducing glowing light trail like with Tron light cycles

不想你离开。 提交于 2020-01-13 22:41:31
问题 The goal is to reproduce a light trail similar to the image below in SceneKit. The trail doesn't need to be as detailed, but the idea is to achieve a similar visual effect. We tried using thin cubes with opacity around 0.5. We strung about 200 together and attached them to a node to act as a light trail. That was not performant at all. This other post suggests using particle emitters, but we also need to detect collisions when another object hits the trail. Class documentation says collision

Can't display 3d file from cache directory

寵の児 提交于 2020-01-13 19:00:56
问题 Can you please help me determine the problem here? It seems that I can't display the 3d file from cache directory. I'm having this error SceneKit IO: error, COLLADA files are not supported on this platform. The zip file im saving in the cache directory contains .dae file and .png for the texturee. With Scene Kit you can: Import COLLADA 3D objects and build scenes composed by cameras, lights, and meshes. https://developer.apple.com/library/mac/documentation/3DDrawing/Conceptual/SceneKit_PG

How to determine if an ScnNode is left or right of the view direction of a camera node in SceneKit

我只是一个虾纸丫 提交于 2020-01-13 12:56:13
问题 I have a camera in the center of SceneKit scene at position(0,0,0) I'm rotation the camera around the y-axis to show different parts of the scene. I want to show arrows at the left/right side of my screen to show in which direction the user has to move to view a target object. How can I calculate if a ScnNode is positioned at the left of right side of my view direction? I know: position and rotation of the camera node position of the target node 回答1: Calculate the vector to the node relative

Swift Add Button to SCNNode

蹲街弑〆低调 提交于 2020-01-13 05:45:07
问题 I'm playing around with the ARKit and image detection. Now I have an app that detects images an places planes on the screen where the detected objects are. How can I add a clickable element like a button on the planes. I want to have a click event on each detected object. This is what my renderer function looks: func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) { guard let imageAnchor = anchor as? ARImageAnchor else { return } let referenceImage =

How are the ARKit People Occlusion samples being done?

好久不见. 提交于 2020-01-12 10:46:19
问题 This may be an obscure question, but I see lots of very cool samples online of how people are using the new ARKit people occlusion technology in ARKit 3 to effectively "separate" the people from the background, and apply some sort of filtering to the "people" (see here). In looking at Apple's provided source code and documentation, I see that I can retrieve the segmentationBuffer from an ARFrame, which I've done, like so; func session(_ session: ARSession, didUpdate frame: ARFrame) { let

How are the ARKit People Occlusion samples being done?

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-12 10:45:12
问题 This may be an obscure question, but I see lots of very cool samples online of how people are using the new ARKit people occlusion technology in ARKit 3 to effectively "separate" the people from the background, and apply some sort of filtering to the "people" (see here). In looking at Apple's provided source code and documentation, I see that I can retrieve the segmentationBuffer from an ARFrame, which I've done, like so; func session(_ session: ARSession, didUpdate frame: ARFrame) { let

How do I create a HUD on top of my Scenekit.scene

青春壹個敷衍的年華 提交于 2020-01-12 07:06:08
问题 I'm experimenting with Swift and Scenekit. Building a Mac OS X app. It seems quite easy to get a 3d-scene working. But what is scene without some kind of 2D hi-score, radar display, speed indicator, etc? I would expect a SpriteKit-scene to seamlessly integrate into a SceneView but I don't find the documentation very clear about this.. The most obvious and only way I can think of is to position a SKView over a SceneView and render each separately. But is there a more elegant way? 回答1: try

How to rotate or scale 3D model scn file in AR kit

[亡魂溺海] 提交于 2020-01-12 04:06:52
问题 this class render my SCN file as well. import UIKit import ARKit class SimpleViewController: UIViewController { @IBOutlet var sceneView: ARSCNView! override func viewDidLoad() { super.viewDidLoad() sceneView.scene = SCNScene(named: "duck.scn", inDirectory: "models.scnassets/furniture")! } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) sceneView.session.run(ARWorldTrackingConfiguration()) } override func viewWillDisappear(_ animated: Bool) { super

SceneKit - Threads - What to do on which thread?

荒凉一梦 提交于 2020-01-10 12:38:19
问题 When using SceneKit, the update method: func renderer(aRenderer: SCNSceneRenderer, updateAtTime time: NSTimeInterval) is not called on the main thead, but on some other thread. What am I supposed to do on the main thread, and what has to be done on this "SceneKit thread"? Where should I add new nodes / geometry? Where is it safe to modify position / etc of these objects? 回答1: The question is about scenekit. Nodes/geometry aren't actually added on the main thread even if that's where you do it

why is metal shader gradient lighter as a SCNProgram applied to a SceneKit Node than it is as a MTKView?

喜欢而已 提交于 2020-01-10 02:04:10
问题 I have a gradient, generated by a Metal fragment shader that I've applied to a SCNNode defined by a plane geometry. It looks like this: When I use the same shader applied to a MTKView rendered in an Xcode playground, the colors are darker. What is causing the colors to be lighter in the Scenekit version? Here is the Metal shader and the GameViewController. Shader: #include <metal_stdlib> using namespace metal; #include <SceneKit/scn_metal> struct myPlaneNodeBuffer { float4x4 modelTransform;