我正在玩場景套件。sketchup消失的scenekit模型
我對建模沒有太多瞭解,但是我創建了一個沒有材質或紋理的非常基本的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];
您的場景如何顯示在Preview或QuickLook中? (另外,默認燈光僅在沒有其他燈光時使用) – 2014-11-01 10:48:39