scenekit

Can ARKit display WKWebview?

僤鯓⒐⒋嵵緔 提交于 2019-12-06 09:36:13
Tried ARKit to show WKWebView and all I got is a page that shows background but no foreground. The page can be scrolled though. I attached Apple web page as screenshot. Here's the code: DispatchQueue.main.async { let webView = WKWebView(frame: CGRect(x: 0, y: 0, width: 640, height: 480)) let request = URLRequest(url: URL(string: "https://www.apple.com")!) webView.load(request) plane.firstMaterial?.diffuse.contents = webView } Does that mean ARKit cannot display web page? I am using iOS 12 beta 2 running ARKit 2. I have also switch off App Transport Security Settings and allow arbitrary load. I

Passing Metal texture2d_array to SceneKit shader modifier

倾然丶 夕夏残阳落幕 提交于 2019-12-06 08:42:55
问题 I want to create shader modifier for SCNMaterial (with SCNShaderModifierEntryPointSurface ) and pass Metal texture2d_array as custom input. To achieve that I try to use key-value coding setting parameter of type SCNMaterialProperty . From SceneKit manual on SCNMaterialProperty property contents : You can set a value for this property using any of the following types: ... A texture (SKTexture, MDLTexture, MTLTexture , or GLKTextureInfo) ... So, I construct MTLTexture : Create

ARKit billboarding effect with SceneKit

a 夏天 提交于 2019-12-06 07:28:11
I am looking to add a billboarding effect that is similar to this application: https://twitter.com/marpi_/status/897130955105644544 I would like SCNodes that use SCNText geometry to always face the camera. I have attempted with out success: SCNLookAtConstraint with sceneView.pointOfView as the target, but this rotates the node to face away from the camera, resulting in backwards text, and unable to change the nodes position or euler angle. Out of the box, an SKLabelNode will always face the camera in ARKit, which is exactly what I want, except using SCNText. You were almost there! Just modify

SceneKit modification in 3D object and exporting file

谁说我不能喝 提交于 2019-12-06 07:24:26
In my Application, I am displaying 3D object in SCNView using SceneKit Framework and export the modified file with some small changes like color, Temperature etc. But I am getting the original file after exporting it to the document folder. Here I can display and do some modification in 3D objects, That looks good and I can see the changes in SCNView in Simulator. sceneView = [[SCNView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - 100)]; [sceneView setBackgroundColor:[UIColor orangeColor]]; [self.view addSubview:sceneView]; sceneView

Using Vuforia provided Projection Matrix and Marker Pose in SceneKit

半城伤御伤魂 提交于 2019-12-06 07:21:48
问题 Currently I'm trying to troubleshoot the use of the projection matrix and framemarker pose when rendering in SceneKit. The model in the scene and the camera image background appear without problems. However, once I change the projection matrix and framemarker pose matrix to match Vuforia everything is pushed offscreen. func didUpdateProjectionMatrix(projectionMatrix: matrix_float4x4) { let extrinsic = SCNMatrix4FromMat4(projectionMatrix) let camera = self.cameraNode?.camera camera?

How to build a multilevel game in SceneKit

风流意气都作罢 提交于 2019-12-06 06:50:01
问题 I'm an iOS developer and have plenty of business apps done. Some time ago I decided to try and write a 3D game for iPad using SceneKit. I understand how to create SCNView and SCNScene instances and how to load my scene from .dae files, but I'm having trouble understanding scene transition logic. Could someone explain the logic of transitioning between different game levels in SceneKit. I haven't found any transition methods between SCNView and SCNScenes For example: I have 2 levels of game

What unit is used by the Scene Editor in Xcode?

早过忘川 提交于 2019-12-06 06:31:44
问题 The Scene Editor in Xcode displays sizes but no unit. Is it a size in inches or a size in meters? For instance, when I select a node, e.g. a box, when I inspect its properties in the Node Inspector and I check its size in the "Transforms" section next to "Bounding Box", no unit is shown. The unit doesn't seem to be related to the system measurement units that are set in the "Language & Region" preference pane (in the "Advanced..." popover) because the numbers don't change in the Node

ARKit: Reproducing the Project Point function

北城余情 提交于 2019-12-06 06:30:44
问题 I'm attempting to reproduce the ARCamera's project point function, but for some reason the values are not matching up properly. I am taking the ARCamera's projection matrix and view matrix and applying basic CG perspective transform math, (PV) * p, but the NDC values do not match the pixel values given from the ARCamera's project point function. Any ideas? Am I forgetting something? Some more detail: Basically, I'm trying to take an ARFrame a the click of a button, and then trying to

Using a Metal shader in SceneKit

守給你的承諾、 提交于 2019-12-06 06:14:37
问题 I'd like to use a Metal shader to apply a toon/cell shading to materials used in the scene. The shader I'm trying to implement is Apple's own AAPLCelShader found in the MetalShaderShowcase. I'm a little new to implementing shaders in SceneKit so I could be doing everything completely wrong. From what I understand in the documentation a Metal or GL shader can be used to modify SceneKit rendering as of iOS 9 and Xcode 7. The documentation suggests that this is done in the same way as GL shaders

Pinch gesture scale resetting to 1?

浪尽此生 提交于 2019-12-06 06:11:41
I was looking at this repo https://github.com/mmohsin991/gestures/blob/master/gestures/ViewController.swift and this example http://www.raywenderlich.com/50398/opengl-es-transformations-gestures I have the following code @IBOutlet var pinchProperty: UIPinchGestureRecognizer! @IBAction func pinchAction(sender: UIPinchGestureRecognizer) { if(dbg){println("scale \(pinchProperty.scale)")} let pinch: CGFloat = pinchProperty.scale switch pinchProperty.state{ case .Began: println("pinch started") case .Changed: geometryNodeMain.scale = SCNVector3(x:Float(pinch),y:Float(pinch),z:Float(pinch)) case