Ios sketchup中的scenekit模型消失

Ios sketchup中的scenekit模型消失,ios,scenekit,sketchup,Ios,Scenekit,Sketchup,我正在玩场景工具包 我对建模知之甚少,但我创建了一个非常基本的Sketchup模型,没有材质或纹理 我从番茄酱中导出模型并将其导入到场景中 当我将相机移向模型的一端时,后部消失,反之亦然。当摄像机向前旋转时,后面会被黑色阴影笼罩 这是什么原因 照明?这是场景的代码。这是一个基本的Xcode游戏项目 // create a new scene SCNScene *scene = [SCNScene sceneNamed:@"ship_transport.dae"]; // create and

我正在玩场景工具包

我对建模知之甚少,但我创建了一个非常基本的Sketchup模型,没有材质或纹理

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

当我将相机移向模型的一端时,后部消失,反之亦然。当摄像机向前旋转时,后面会被黑色阴影笼罩

这是什么原因

照明?这是场景的代码。这是一个基本的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。

您的场景在预览或QuickLook中是如何显示的?(另外,默认照明仅在没有其他灯光时使用)zFar修复了它。对不起,我不是一个游戏程序员,我现在正在搞清楚这件事。但是谢谢你!在一个简单的应用程序(如模板)中,您甚至可以删除添加相机的代码(SceneKit将在运行时自动添加一个,自动使整个场景可见)或设置,相机将自动确保场景的深度范围在视图中。