简体   繁体   English

Alpha Map在SceneKit Swift iOS中不起作用

[英]Alpha map is not working in scenekit swift ios

I have tray to apply diffuse, metalness, normal, roughness and Alpha map on model but all map are working but only alpha map is not working. 我有托盘可以在模型上应用漫反射,金属度,法线,粗糙度和Alpha贴图,但是所有贴图都可以使用,但是只有Alpha贴图不起作用。 How to make transparent glass in scenekit? 如何在Scenekit中制作透明玻璃? i have tray to below code in swift iOS. 我在快速的iOS中将托盘放在下面的代码中。 Can anyone tell me specific reason for this?. 谁能告诉我具体原因吗?

if let finishMap = finish.finishMap {
      if let diffuseTexturePath = finishMap.diffuseMapUrl {
            disPatchGroup.enter()
            self.dataProvider.fetchTextureFile(forpath: diffuseTexturePath, successBlock: { (success, imageObject) in
                material.diffuse.contents = imageObject
                disPatchGroup.leave()
            }, failureBlock: { (error) in
                disPatchGroup.leave()
            })
        }

       if let metalTexturePath = finishMap.metalnessMapUrl {
            disPatchGroup.enter()
            self.dataProvider.fetchTextureFile(forpath: metalTexturePath, successBlock: { (success, imageObject) in
                material.metalness.contents = imageObject
                disPatchGroup.leave()
            }, failureBlock: { (error) in
                disPatchGroup.leave()
            })
        }

        if let roughnessTexturePath = finishMap.roughnessMapUrl {
            disPatchGroup.enter()
            self.dataProvider.fetchTextureFile(forpath: roughnessTexturePath, successBlock: { (success, imageObject) in
               material.roughness.contents = imageObject
                disPatchGroup.leave()
            }, failureBlock: { (error) in
                disPatchGroup.leave()
            })
        }

        if let normalTexturePath = finishMap.normalMapUrl {
            disPatchGroup.enter()
            self.dataProvider.fetchTextureFile(forpath: normalTexturePath, successBlock: { (success, imageObject) in
                material.normal.contents = imageObject
                disPatchGroup.leave()
            }, failureBlock: { (error) in
                disPatchGroup.leave()
            })
        }
        if let transparentTexturePath = finishMap.transparentMapUrl {
            disPatchGroup.enter()
            self.dataProvider.fetchTextureFile(forpath: transparentTexturePath, successBlock: { (success, imageObject) in

               material.transparent.contents = imageObject

                disPatchGroup.leave()
            }, failureBlock: { (error) in
                disPatchGroup.leave()
            })
        }

        }

set your transparency map to rbgZero. 将您的透明度贴图设置为rbgZero。 there are a few transparency modes, the default is by alpha i think (not sure), if you want to use a grayscale image as a map then you need to use rgbZero 有几种透明模式,我认为默认值为alpha(不确定),如果您要将灰度图像用作地图,则需要使用rgbZero

material.transparencyMode   = .rgbZero

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM