首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Swift SceneKit -编辑器与仿真之间的色差

Swift SceneKit -编辑器与仿真之间的色差
EN

Stack Overflow用户
提问于 2019-01-11 10:54:45
回答 1查看 155关注 0票数 0

我正在为IOS开发一个基于3D SceneKit的基本游戏,我注意到我在编辑器中选择的颜色和模拟中显示的颜色不匹配(屏幕快照https://pasteboard.co/HVWdnnK.png)。

代码与默认的SceneKit游戏代码基本相同,只是我评论了配置灯和一切的部分,因为它们已经在编辑器中手动配置了(我觉得这里可能遗漏了什么)。

如果你能看一看就好了。

代码语言:javascript
复制
override func viewDidLoad() {
    super.viewDidLoad()        
    // create a new scene
    let scene = SCNScene(named: "art.scnassets/ship.scn")!       
    // create and add a camera to the scene
    let cameraNode = scene.rootNode.childNode(withName: "corner-camera", recursively: true)!
    // cameraNode.camera = SCNCamera()
    // scene.rootNode.addChildNode(cameraNode)        
    // place the camera
    // let camera = scene.rootNode.childNode(withName: "corner-camera", recursively: true)!
    // cameraNode.position = SCNVector3(x: 0, y: 0, z: 15)        
    // create and add a light to the scene
    // let lightNode = SCNNode()
    // lightNode.light = SCNLight()
    // lightNode.light!.type = .omni
    // lightNode.position = SCNVector3(x: 0, y: 10, z: 10)
    // scene.rootNode.addChildNode(lightNode)

    // create and add an ambient light to the scene
    // let ambientLightNode = SCNNode()
    // ambientLightNode.light = SCNLight()
    // ambientLightNode.light!.type = .ambient
    // ambientLightNode.light!.color = UIColor.darkGray
    // scene.rootNode.addChildNode(ambientLightNode)

    // retrieve the ship node
    // let ship = scene.rootNode.childNode(withName: "ship", recursively: true)!        
    // animate the 3d object
    // ship.runAction(SCNAction.repeatForever(SCNAction.rotateBy(x: 0, y: 2, z: 0, duration: 1)))        
    // retrieve the SCNView
    let scnView = self.view as! SCNView        
    // set the scene to the view
    scnView.scene = scene        
    // set camera to corner-camera
    scnView.pointOfView = cameraNode        
    // allows the user to manipulate the camera
    // scnView.allowsCameraControl = true
    // show statistics such as fps and timing information
    // scnView.showsStatistics = true

    // configure the view
    scnView.backgroundColor = UIColor.white

    // add a tap gesture recognizer
    // let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTap(_:)))
    // scnView.addGestureRecognizer(tapGesture)
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-01-11 11:33:47

一件事是模拟器使用OpenGL渲染器,而Xcode和iOS设备默认使用金属渲染器。

此外,Xcode编辑器有几个选项可自定义渲染中的场景和"默认照明“选项可能与应用程序使用的选项不匹配。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54145079

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档