Closed 61315 closed 3 years ago
We really need to test occlusionMetallicRoughness texture, Corset.glb
for example.
channel | texture |
---|---|
red | occlusion |
green | roughness |
blue | metallic |
<SCNMaterial: 0x10300bd00 'Corset_O'
diffuse=<SCNMaterialProperty: 0x283935200 | contents=<CGImage 0x10300c540> (IP)
<<CGColorSpace 0x28332c0c0> (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1)>
width = 2048, height = 2048, bpc = 8, bpp = 32, row bytes = 8192
kCGImageAlphaNoneSkipLast | 0 (default byte order) | kCGImagePixelFormatPacked
is mask? No, has masking color? No, has soft mask? No, has matte? No, should interpolate? Yes>
normal=<SCNMaterialProperty: 0x283935480 | contents=<CGImage 0x10300dcd0> (IP)
<<CGColorSpace 0x28332c0c0> (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1)>
width = 2048, height = 2048, bpc = 8, bpp = 32, row bytes = 8192
kCGImageAlphaNoneSkipLast | 0 (default byte order) | kCGImagePixelFormatPacked
is mask? No, has masking color? No, has soft mask? No, has matte? No, should interpolate? Yes>
ambientOcclusion=<SCNMaterialProperty: 0x283935580 | contents=<CGImage 0x10300d190> (IP)
<<CGColorSpace 0x28332c0c0> (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1)>
width = 2048, height = 2048, bpc = 8, bpp = 32, row bytes = 8192
kCGImageAlphaNoneSkipLast | 0 (default byte order) | kCGImagePixelFormatPacked
is mask? No, has masking color? No, has soft mask? No, has matte? No, should interpolate? Yes>
metalness=<SCNMaterialProperty: 0x283935300 | contents=<CGImage 0x10300d190> (IP)
<<CGColorSpace 0x28332c0c0> (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1)>
width = 2048, height = 2048, bpc = 8, bpp = 32, row bytes = 8192
kCGImageAlphaNoneSkipLast | 0 (default byte order) | kCGImagePixelFormatPacked
is mask? No, has masking color? No, has soft mask? No, has matte? No, should interpolate? Yes>
roughness=<SCNMaterialProperty: 0x283935400 | contents=<CGImage 0x10300d190> (IP)
<<CGColorSpace 0x28332c0c0> (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1)>
width = 2048, height = 2048, bpc = 8, bpp = 32, row bytes = 8192
kCGImageAlphaNoneSkipLast | 0 (default byte order) | kCGImagePixelFormatPacked
is mask? No, has masking color? No, has soft mask? No, has matte? No, should interpolate? Yes>
>
Our ambientOcclusion, metalness and roughness properties all point to same CGImageRef
, which is correct.
This PR fixes #1.
Codes related to channel masking are purged, since tinkering with
textureComponents
provides better option for channel masking in both resource/computation-wise ways.Notice the
textureComponents
property explicitly requires iOS 11.0 and above.Availability of
textureComponents
See: https://stackoverflow.com/a/40058657/13863074 See: https://developer.apple.com/documentation/scenekit/scnmaterialproperty/2865880-texturecomponents?language=objc
https://user-images.githubusercontent.com/46559594/115949243-a4ec3200-a50e-11eb-8f0c-39a0fdc0cecb.mp4