ios - sketchup 中的 scenekit 模型消失了

标签 ios scenekit sketchup

我正在玩场景套件。

我对建模了解不多,但我创建了一个非常基本的 Sketchup 模型,没有 Material 或纹理。

我从番茄酱中导出模型并将其导入到场景中。

当我将相机移向模型的一端时,后方消失,反之亦然。当相机向前旋转时,后方会变成黑色阴影。

这是什么原因?

照明?这是场景的代码。它是一个基本的 Xcode 游戏项目

// create a new scene
SCNScene *scene = [SCNScene sceneNamed:@"ship_transport.dae"];

// create and add a camera to the scene
SCNNode *cameraNode = [SCNNode node];
cameraNode.camera = [SCNCamera camera];
[scene.rootNode addChildNode:cameraNode];

// place the camera
cameraNode.position = SCNVector3Make(0, 0, 100);

// create and add an ambient light to the scene
SCNNode *ambientLightNode = [SCNNode node];
ambientLightNode.light = [SCNLight light];
ambientLightNode.light.type = SCNLightTypeAmbient
ambientLightNode.light.color = [UIColor whiteColor];
[scene.rootNode addChildNode:ambientLightNode];


// retrieve the ship node
SCNNode *ship = [scene.rootNode childNodeWithName:@"ship" recursively:YES];
ship.geometry.firstMaterial.diffuse.contents = [UIColor redColor];
ship.geometry.firstMaterial.specular.contents = [UIColor whiteColor];
SCNVector3 vector = SCNVector3Make(.1, .1, .1);
[ship setScale:vector];
//[scene.rootNode addChildNode:lightNode];

// animate the 3d object
[ship runAction:[SCNAction repeatActionForever:[SCNAction rotateByX:0 y:0 z:0 duration:1]]];

// retrieve the SCNView
SCNView *scnView = (SCNView *)self.view;
scnView.autoenablesDefaultLighting = true;

// set the scene to the view
scnView.scene = scene;

// allows the user to manipulate the camera
scnView.allowsCameraControl = YES;

// show statistics such as fps and timing information
scnView.showsStatistics = YES;

// configure the view
scnView.backgroundColor = [UIColor darkGrayColor];

最佳答案

尝试在相机上设置 zFar 属性。尝试更改的其他相关属性是 xFov 和 yFov。

关于ios - sketchup 中的 scenekit 模型消失了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26686782/

相关文章:

ios - 如何在 SCNPlane Geometry 的每一侧绘制不同的图像

three.js - 将交互式模型从 Sketchup 导出到 three.js

ruby - 表面离散化算法

iOS 检测 3G 或 WiFi

ios - 导航按钮不显示

ios - 将标签宽度增加到左侧 Titanium

ios - SceneKit View 呈现为 phong 而不是基于物理的 Material

swift - 如何使我实例化的 SCNCamera 仅放大到我在 SceneKit 中想要的节点

STL - 将 Sketchup (*.skp) 文件转换为 STL 或 OBJ

ios - 自定义 Apple map 注释无法正常工作