scenekit

How to write a sceneKit shader modifier for a dissolve in effect

ε祈祈猫儿з 提交于 2020-07-28 06:17:07
问题 I'd like to build a dissolve in effect for a Scenekit game. I've been looking into shader modifiers since they seem to be the most light weight and haven't had any luck in replicating this effect: Is it possible to use shader modifiers to create this effect? How would you go about implementing one? 回答1: You can get pretty close to the intended effect with a fragment shader modifier. The basic approach is as follows: Sample from a noise texture If the noise sample is below a certain threshold

FPS drop when adding child to a scene ARKit/SceneKit

偶尔善良 提交于 2020-07-17 07:40:06
问题 I'm working on an ARKit project for 4 months now. I noticed that when adding a child to my scene rootNode, there is a FPS drop. The device freezes for less than a second. I did a lot of research and trials, noticed that all Apple's code examples have this FPS drop too when placing an object. It does not matter if the node is added directly (scene.rootNode.addChild(child)) or if it's added in the renderer loop at different phases (didUpdateAtTime, didApplyAnimations etc...). I found that once

SCNNode is not appearing in correct position

别来无恙 提交于 2020-07-10 05:59:08
问题 I downloaded the wall2.obj file from Google Blocks and then I used Blender to change the extension to .dae the wall node is not appearing where it should be. Where the wall node placed vs. where it should be placed: 回答1: It's a model's pivot point issue In Blender change a pivot point 's position to the desired one – move pivot point to the center of your model, and then at its bottom. If your model consists of several independent parts, group all parts and use just one composite pivot point.

SCNNode is not appearing in correct position

我是研究僧i 提交于 2020-07-10 05:58:21
问题 I downloaded the wall2.obj file from Google Blocks and then I used Blender to change the extension to .dae the wall node is not appearing where it should be. Where the wall node placed vs. where it should be placed: 回答1: It's a model's pivot point issue In Blender change a pivot point 's position to the desired one – move pivot point to the center of your model, and then at its bottom. If your model consists of several independent parts, group all parts and use just one composite pivot point.

SCNAnimationPlayer() Seems to be playing only small part of animation while using SceneKit

|▌冷眼眸甩不掉的悲伤 提交于 2020-06-29 05:06:45
问题 I made an animation in Blender and moved it to Xcode and it is converted from .dae file to .scn by Xcode. I can play the animation in scene graph of Xcode as it is designed in the Blender. I am loading geometry and animation and create node for animated object. I use SCNAnimationPlayer() to load animation. The code is below. let scene = SCNScene(named: "scene.scn")! let geometry = scene.rootNode.childNode(withName: "animatedGeo", recursively:true).geometry! let animationNode = SCNNode

SceneKit AR game fps getting low and the device getting hot with use

三世轮回 提交于 2020-06-27 16:16:42
问题 I'm developing a 3D game with ARKit and SceneKit. The game running smoothly at 60 fps but when I keep using it for a while the device get hot and the frame rate drop to 30 fps. The energy impact is very high and I noticed something in Instruments. I'll show the statistics and what I see in Instruments. This are the statistics when the game is running smoothly but I don't understand why I get 1.16K as the nodes count. I actually don't use so much nodes but it's just a simple level. This is

SceneKit AR game fps getting low and the device getting hot with use

徘徊边缘 提交于 2020-06-27 16:16:27
问题 I'm developing a 3D game with ARKit and SceneKit. The game running smoothly at 60 fps but when I keep using it for a while the device get hot and the frame rate drop to 30 fps. The energy impact is very high and I noticed something in Instruments. I'll show the statistics and what I see in Instruments. This are the statistics when the game is running smoothly but I don't understand why I get 1.16K as the nodes count. I actually don't use so much nodes but it's just a simple level. This is

Passing values between SCNShadable entry points

两盒软妹~` 提交于 2020-06-25 18:04:27
问题 In an OpenGL program you typical declare something like this in a vertex shader varying bool aBooleanVariable; and then read the value in the fragment shader. How do you do this within the framework of an SCNShadable entry point? For example from SCNShaderModifierEntryPointGeometry to SCNShaderModifierEntryPointFragment . Receiving the argument seems to be defined by using the pragma arguments, I provide my test SCNShaderModifierEntryPointFragment to illustrate. #pragma arguments bool

Unable to use Concave representation of physics shape

风流意气都作罢 提交于 2020-06-25 06:31:33
问题 Whenever I assign a Concave physics shape let physicsShape = SCNPhysicsShape(node: starNode, options: [SCNPhysicsShapeTypeKey:SCNPhysicsShapeTypeConcavePolyhedron]) starNode.physicsBody = SCNPhysicsBody(type: SCNPhysicsBodyType.Dynamic, shape: physicsShape) the starNode just falls through all other nodes. I created starNode in Blender. I also noticed that in Scene Editor I am unable to assign PhysicsShapeType of starNode to Concave. Why is this happening and how do I fix it? The Convex shape

Get the index of the face pointing up of SCNNode

只愿长相守 提交于 2020-06-16 19:12:11
问题 I am stuck in a difficult scenario as I had never worked with scenekit earlier. I had to create a dice that when rolled should print the number selected. I had implemented the dice using scenekit and then rolled it using the below function: func roll(dice: SCNNode) { let randomX = Float(arc4random_uniform(4) + 1) * (Float.pi / 2) let randomZ = Float(arc4random_uniform(4) + 1) * (Float.pi / 2) dice.runAction( SCNAction.rotateBy(x: CGFloat(randomX * 5), y: 0, z: CGFloat(randomZ * 5), duration: