2016-12-01 22 views
1

3D視点が棚などScnViewの正確Scnviewノードは、半透明の

サンプル画像をブロックする必要が表示されます。 Scnviewを追加しました。追加されたScnnodes(図形とライト)

標準オムニタイプライトを使用します。

なぜ前面のオブジェクトは、後ろのオブジェクトをブロックしていないのですか?

ここCODEです:

[self.studioView addSubview:showTimeView]; 

showTimeView.frame = CGRectMake(self.paperView.frame.origin.x, 
           self.paperView.frame.origin.y, 
           self.paperView.frame.size.width, 
           self.paperView.frame.size.height); 

SCNView *sceneView = (SCNView *)showTimeView; 
sceneView.backgroundColor = [UIColor whiteColor]; 

sceneView.scene = [SCNScene scene]; 
SCNNode *root = sceneView.scene.rootNode; 
sceneView.allowsCameraControl   = YES; 
sceneView.autoenablesDefaultLighting = NO; 


// Add Camera 
SCNNode *cameraNode = [SCNNode node]; 
cameraNode.camera = [SCNCamera camera]; 
cameraNode.position = SCNVector3Make(0, 0, 100); 
cameraNode.eulerAngles = SCNVector3Make(0, -M_PI/8, 0); 
cameraNode.camera.zNear = 0; 
cameraNode.camera.zFar = thisModuleDepth; 
cameraNode.camera.xFov = thisWallWidth; 
cameraNode.camera.yFov = thisModuleHeight; 
[root addChildNode:cameraNode]; 

// Add Cabinet Piece 
SCNBox *cubeGeom = [SCNBox boxWithWidth:tW 
           height:tH 
           length:tD 
          chamferRadius:0.0]; 
SCNNode *cubeNode = [SCNNode nodeWithGeometry:cubeGeom]; 
cubeNode.position = SCNVector3Make(tX, tY, tZ); 

// Tag Material 
SCNMaterial *material = [SCNMaterial material]; 
material.diffuse.contents = [UIImage imageNamed:thisColor]; 
[material.diffuse.contents setAccessibilityIdentifier:thisColor] ; 
[material.diffuse.contents setAccessibilityLabel:thisID] ; 
cubeNode.geometry.firstMaterial = material; 
cubeNode.geometry.firstMaterial.locksAmbientWithDiffuse = NO; 
cubeNode.physicsBody = [SCNPhysicsBody staticBody]; 
[root addChildNode:cubeNode]; 

// Add spotlight 
SCNLight *spotLight = [SCNLight light]; 
spotLight.type = SCNLightTypeOmni; 
spotLight.color = [UIColor whiteColor]; 
SCNNode *spotLightNode = [SCNNode node]; 
spotLightNode.light = spotLight; 
spotLightNode.position = SCNVector3Make(thisWallWidth/2 ,thisModuleHeight, thisModuleDepth *2); 
spotLightNode.light.intensity = 1000; 
[root addChildNode:spotLightNode]; 
+0

あなたは、Interface BuilderでまたはコードでSCNViewを作成していますか?後者の場合は、それを提供してください。あなたのシーンはデプステストが無効になっているようですが、デフォルトではないと思います。 –

+0

すべてコードで終了しました...私は、Interface Builderで適切なビューを取得するためにIBOutlet SCNView * showTimeViewを追加しました。 – Juanra

答えて

1

おかげノア、

私は最終的に間違っていたものを考え出しは!

SCNCameraのautomaticallyAdjustsZRangeプロパティをtrueに設定すると、間違ったzNearまたはzFarが設定されているため、何もクリップされません。

よろしくお願いします!

HERE ITが固定されている:Perfect 3D Perspective

enter image description here

関連する問題