天道酬勤,学无止境

modelio

SceneKit:如何从 Google Poly 为同一个 OBJ 文件重新创建照明?(SceneKit: how to recreate lighting from Google Poly for same OBJ file?)

问题 目标是为此 OBJ 文件重新创建照明:https://poly.google.com/view/cKryD9VnDEZ 将 OBJ 文件加载到 SceneKit 的代码(可以从上面的链接下载文件): let modelPath = "model.obj" let url = NSURL(string: modelPath) let scene = SCNScene(named: modelPath)! sceneView.autoenablesDefaultLighting = true sceneView.allowsCameraControl = true sceneView.scene = scene sceneView.backgroundColor = UIColor.white 到目前为止尝试过的选项: 1) 默认的环境光照比 Google Poly 光照强得多。 移除环境照明会使一切变得过于平坦。 2) 使用四个方向灯:一个在模型前面,一个在后面,一个在模型下面,一个在模型上面。 所有灯光都倾斜以指向模型。 这是最好的,但仍然留下了一些在 Google Polymer 上看不到的阴影和更粗糙的区域。 3) 在选项#2 中添加了另外两个灯,这次在左侧和右侧添加了灯。 这个比选项 #2 更糟糕,因为额外的灯与四个现有的灯结合并粉刷了模型。 遵循建议后更新:

2021-10-21 05:58:58    分类:技术分享    ios   3d   scenekit   modelio

如何通过 SceneKit 和模型 I/O 在 .OBJ 3d 模型上应用 .MTL 文件(How To Apply .MTL File on .OBJ 3d Model via SceneKit & Model I/O)

问题 我正在尝试通过 SceneKit & Model I/0 在 .obj 3d 模型上应用 .mtl 文件纹理。 当我尝试在其上应用 .jpg 纹理时,我下面的代码工作正常: let url = NSBundle.mainBundle().URLForResource("chair", withExtension: "obj") let asset = MDLAsset(URL: NSURL(string:url)!) guard let object = asset.objectAtIndex(0) as? MDLMesh else { //fatalError("Failed to get mesh from asset.") return } if shouldApplyTexture == true { var textureFileName = "chair.mtl" // Create a material from the various textures let scatteringFunction = MDLScatteringFunction() let material = MDLMaterial(name: "baseMaterial", scatteringFunction: scatteringFunction) material

2021-06-26 10:43:08    分类:技术分享    ios   swift   3d   scenekit   modelio

How To Apply .MTL File on .OBJ 3d Model via SceneKit & Model I/O

I am trying to apply an .mtl file texture on .obj 3d model via SceneKit & Model I/0. My code below works fine when I try to apply .jpg of a texture on it: let url = NSBundle.mainBundle().URLForResource("chair", withExtension: "obj") let asset = MDLAsset(URL: NSURL(string:url)!) guard let object = asset.objectAtIndex(0) as? MDLMesh else { //fatalError("Failed to get mesh from asset.") return } if shouldApplyTexture == true { var textureFileName = "chair.mtl" // Create a material from the various textures let scatteringFunction = MDLScatteringFunction() let material = MDLMaterial(name:

2021-04-26 18:25:42    分类:问答    ios   swift   3d   scenekit   modelio

SceneKit: how to recreate lighting from Google Poly for same OBJ file?

The goal is to recreate the lighting for this OBJ file: https://poly.google.com/view/cKryD9VnDEZ Code to load OBJ file into SceneKit (can download file from above link): let modelPath = "model.obj" let url = NSURL(string: modelPath) let scene = SCNScene(named: modelPath)! sceneView.autoenablesDefaultLighting = true sceneView.allowsCameraControl = true sceneView.scene = scene sceneView.backgroundColor = UIColor.white Options tried so far: 1) The default ambient lighting is much harsher than the Google Poly lighting. Removing the ambient lighting rendered everything too flat. 2) Using four

2021-04-20 01:10:03    分类:问答    ios   3d   scenekit   modelio