scenekit

SceneKit view renders as phong instead of physically based materials

ε祈祈猫儿з 提交于 2019-12-08 02:25:46
问题 I have several objects in my scene, all of which had the "lighting model" of their material set to be physically based. When I run the app, the view I get looks nothing like the scene editor - it instead looks more like Phong materials. Is there a root node I need to change in order to have it render physically based from the get-go? I'm new to objective-c, so I'm not sure if I need to set the lighting model of the root node to physically based, and if so, how I would access the root node

SCNAction.rotateByAngle rotation is inverted in El Capitan or Metal

别来无恙 提交于 2019-12-08 01:44:58
问题 Using SCNAction.rotateByAngle(…) in my game I would press left/right/up/down keys or swipe to have an object rotate in that direction. But testing my game on El Capitan or with Metal as the renderer causes the 3D object to rotate the other way i.e. left becomes right and up becomes down. I haven't found any documentation mentioning that the rotation is "inverted" or "reversed" in El Capitan or Metal. The code is: Rotate up = SCNVector3(x:1, y:0, z:0) Rotate down = SCNVector3(x:-1, y:0, z:0)

SceneKit: Is it possible to cast an shadow on an Transparent Object?

余生长醉 提交于 2019-12-08 01:36:43
问题 i am trying to cast an shadow on an totally transparent plane in SceneKit on OSX. I am struggling with this problem since several hours and do not come to any solution. My Purpose is to generate an Screenshot of several objects with an transparent background and just the shadow on an invisible Plane. Do you have any suggestions for me how i can make this with apples SceneKit? Do i have to program my own shader, can i make this work with shadermodifiers or can i use built in functionallity?

How to get the advantages of Scenekit's level editor programatically

给你一囗甜甜゛ 提交于 2019-12-08 01:16:06
问题 I've just ran a couple of tests comparing the performance of different ways of loading/creating a scene to see the performance impact. The test was simply rendering a 32x32 grid of cubes and eyeballing the CPU usage, memory, energy and rendering times. Not very scientific but there were some clear results. The four tests consisted of... Load a .dae , e.g. SCNScene(named: "grid.dae") Converting a .dae to .scn file in XCode and loadinf that Building a grid in the Scnenekit editor manually using

UIView as SCNMaterialProperty on iOS

旧时模样 提交于 2019-12-07 23:25:33
问题 When using a UIView as an SCNMaterialProperty in a SceneKit scene, can that view be part of the responder chain? To clarify how: omg_you_can_use_an_actual_uiview_now = UIView(frame: CGRect(x: 0, y: 0, width: 500, height: 500)) material_plane.diffuse.contents = omg_you_can_use_an_actual_uiview_now let geom_plane = SCNPlane(width: 1, height: 1) geom_plane.materials = [material_plane] 来源: https://stackoverflow.com/questions/48425281/uiview-as-scnmaterialproperty-on-ios

SceneKit painting on texture with texture coordinates

跟風遠走 提交于 2019-12-07 21:24:25
问题 I have a Collada model that I load into SceneKit. When I perform a hittest on the model I am able to retrieve the texture coordinates of the model that was hit. With these texture coordinates I should be able to replace texture coordinates with a color. So this way I should be able to draw on the model Correct me if I am wrong so far. I read a lot of articles till now but I just don't get my shaders right. ( Though I did get some funky effects ;-) My vertex shader : precision highp float;

Drag SceneKit Node Along X-Axis while maintaining velocity? Swift 3

佐手、 提交于 2019-12-07 20:50:47
问题 Swift 3, SceneKit: In my game, I have an SCNSphere node in the center of the screen. The sphere drops by gravity onto an SCNBox node, and a velocity of SCNVector3(0,6,0) is applied to it once it collides with the box. A new box is created and moves forward (z+) towards my camera and towards the sphere as well. The sphere rises, peaks, and then falls back down (by gravity) towards the new box, and when it collides with the new box, a velocity of SCNVector(0,6,0) is applied to it. This process

SCNNode and Firebase

女生的网名这么多〃 提交于 2019-12-07 19:56:03
问题 I have 15 box and I add an image on each boxnode as first material. How can I load the images from Firebase and add an Image to each node. I already know how to load images from Firebase, I want to know the best way I can add an image on each 15 nodes, Thanks. Here's the view controller: class newsVC: UIViewController, presentVCProtocol { @IBOutlet var scnView: SCNView! var newsScene = NewsScene(create: true) var screenSize: CGRect! var screenWidth: CGFloat! var screenHeight: CGFloat! var

SceneKit Rigged Character Animation increase performance

大城市里の小女人 提交于 2019-12-07 15:58:49
问题 I have *.DAE files for characters each has 45-70 bones, I want to have about 100 animated characters on the screen. However when I have ~60 Characters the animations takes ~13ms of my update loop which is very costly, and leaves me almost no room for other tasks. I am setting the animations "CAAnimationGroup" to the Mesh SCNNode when I want to swap animations I am removing the previous animations with fadeOut set to 0.2 and adding the new Animation with FadeIn set to 0.2 as well. -> Is it bad

SCN shader modifier in metal - pass uniform to shader

眉间皱痕 提交于 2019-12-07 15:48:41
问题 I'm trying to use shaders modifiers with Metal. I cannot figure out to declare uniforms... So far my fragment modifier is: // color changes #pragma arguments float4x4 u_color_transformation; #pragma body _output.color.rgb = vec3(1.0) - (u_color_transformation * _output.color).rgb; This outputs a purple texture, with no log.. If I just have _output.color.rgb = (u_color_transformation * _output.color).rgb , things are ok. I think I'm following the doc but maybe not! The uniform is set with: