scenekit

SceneKit water like in Badger example

安稳与你 提交于 2019-11-30 10:47:26
Does enybody know how to create water material like in badger example from Apple? There is a "geotherm_01" object in "scene.scn" and this object got materials "_1_terrasses_orange_water" and "_1_terrasses_eau" which creates water with slow animation that looks realistic. I've tried to repeat same materials in my testing project but can't get the same result. This water effect was achieved using shader modifiers as shown in the SceneKit Scene Editor within Xcode. The most important material property is the normal map that will be used to affect lighting in order to simulate wavelets on a

Using existing opengl texture with scenekit

限于喜欢 提交于 2019-11-30 09:59:57
According to Apple's documentation you can use NSColor, NSImage and CALayer to provide a texture to a SCNMaterialProperty. SCNMaterialProperty I am however wondering if there is a way to provide an existing OpenGL texture, which has been created with glGenTextures and rendered into separately. I can of course read the buffer of the texture, setup an NSImage, and provide that one to the SCNMaterialProperty; but for performance reasons that is obviously not optimal. It would make sense to implement the above by overriding the shader program(s) of the material I guess, but the documentation for

How To Apply .MTL File on .OBJ 3d Model via SceneKit & Model I/O

余生颓废 提交于 2019-11-30 08:30:27
I am trying to apply an .mtl file texture on .obj 3d model via SceneKit & Model I/0. My code below works fine when I try to apply .jpg of a texture on it: let url = NSBundle.mainBundle().URLForResource("chair", withExtension: "obj") let asset = MDLAsset(URL: NSURL(string:url)!) guard let object = asset.objectAtIndex(0) as? MDLMesh else { //fatalError("Failed to get mesh from asset.") return } if shouldApplyTexture == true { var textureFileName = "chair.mtl" // Create a material from the various textures let scatteringFunction = MDLScatteringFunction() let material = MDLMaterial(name:

What does the different columns in transform in ARKit represent?

落爺英雄遲暮 提交于 2019-11-30 07:52:51
问题 An ARAnchor has 6 columns of which the last 3 represent the x , y , and z coordinates. I was wondering what the other (first) 3 columns represent? 回答1: If you're new to 3D then these transformation matrices will seem like magic. Basically, every "point" in ARKit space is represented by a 4x4 transform matrix. This matrix describes the distance from the ARKit origin (the point at which ARKit woke up to the world), commonly known as the translation, and the orientation of the device, aka pitch,

COLLADA transformations in SceneKit

◇◆丶佛笑我妖孽 提交于 2019-11-30 07:43:59
We try to make viewer for models in Xcode and use SceneKit to render model. If we add COLLADA (.dae) file to Xcode, it transforms the model using scntool to c3d format (found this on the Internet). But we want to load models in runtime (we download them from server to iOS device). How can we transform .dae to this format not from Mac OS? Our server running Ubuntu, we can transform model and send it already converted to iOS devices. Thanks a lot! you can run scntool manually but you'll need a machine running OS X to do that. The compressed format used by SceneKit on iOS is not documented and

Does ARKit 2.0 consider Lens Distortion in iPhone and iPad?

谁说我不能喝 提交于 2019-11-30 07:25:50
ARKit 2.0 updates many intrinsic (and extrinsic) parameters of the ARCamera from frame to frame. I'd like to know if it also takes Radial Lens Distortion into consideration (like in AVCameraCalibrationData class that ARKit doesn't use), and fix the video frames' distortion appropriately ( distort / undistort operations) for back iPhone and iPad cameras? var intrinsics: simd_float3x3 { get } As we all know, the Radial Lens Distortion greatly affects the 6 DOF pose estimation accuracy when we place undistorted 3D objects in distorted by a lens real world scene. var lensDistortionLookupTable:

Camera pose estimation from homography or with solvePnP() function

流过昼夜 提交于 2019-11-30 07:02:25
问题 I'm trying to build static augmented reality scene over a photo with 4 defined correspondences between coplanar points on a plane and image. Here is a step by step flow: User adds an image using device's camera. Let's assume it contains a rectangle captured with some perspective. User defines physical size of the rectangle, which lies in horizontal plane (YOZ in terms of SceneKit). Let's assume it's center is world's origin (0, 0, 0), so we can easily find (x,y,z) for each corner. User

How can I export DAE files for use in Scene Kit without seeing “untitled-animations”?

丶灬走出姿态 提交于 2019-11-30 05:54:24
问题 I am trying to load animations created in Cheetah 3D and Blender 3D into Scene Kit, but all I get is a bunch of "untitled-animations" with each one being the same animation. Does anyone know how to properly export these from Blender or Cheetah 3D so that Scene Kit can use them? 回答1: I dug into this because it was annoying me too. All of the "untitled animations" are individual animations for each bone. You can get the id from the attributes inspecter in the panel on the right side of xcode.

Metal Shader with SceneKit SCNProgram

时光怂恿深爱的人放手 提交于 2019-11-30 05:36:38
I'm looking for just a working Metal shader that works in SceneKit with SCNProgram. Can someone show me the correct method declarations/how to hook this up? let program = SCNProgram() program.vertexFunctionName = "myVertex" program.fragmentFunctionName = "myFragment" material.program = program and then the shader //MyShader.metal vertex something myVertex(something) { return something; } fragment float4 myFragment(something) { return something } I'm just looking for the most basic example please. I clipped out all the 'unnecessary' stuff, this is about as basic as it gets and pretty much what

How to split out multiple animations from Collada file in SceneKit

余生长醉 提交于 2019-11-30 05:31:07
问题 I am loading a third-party .dae Collada file as a scene into a SceneKit project. The .dae file has many different animations in it, set at different times/frames. I am trying to figure out how I can split these out and reference each individual animation by reference name. There are no intelligible reference names in the dae file - the animations are all set as one single animation. I am able to parse out the animations into a CAAnimation object, and verify that I have successfully done so