2
votes

I cannot get a 3D model with texture transparencies to be rendered correctly in Xcode.

The 3D model of hair consists of two geometries (hair and cap) and was created in Maya. It was bought off-the-shelf from here.

The correctly rendered model looks like this (without the head): enter image description here

I exported the model to COLLADA format (DAE), put it into a folder model.scnassets together with its textures and added it to Xcode. However in Xcode Scene Editor it is rendered like this:

enter image description here

What is wrong here?


Update:

Setting Transparent > Intensity = 5, Settings > Transparency > Blend Mode = Double Sided, Settings > Transparency > Options > Writes depth = false gives this image where hair polygons against the blue sphere are rendered correctly, but above the blue sphere the rendered hair polygons are not the ones nearest to the camera but seem to be the ones on the back side of the hair model. This is apparently because of Writes depth = false, but it seems to be necessary to disable it to render the semi-transparent hair. (Using a brown texture here instead of the read one, but the result is the same regardless of the chose texture)

enter image description here

1
Do you managed to solve this problem?Joker

1 Answers

2
votes

If you want to see a correct result of Transparent slot in Xcode Scene Editor you need to use premultiplied TIFF or PNG files for transparent parts of your 3D object. TIFF and PNG file formats can hold four channels (RGBA), but JPEG can hold only three channels (RGB).

Premultiplied means RGB * Alpha = RGBA (the opposite of unpremult RGB, A).

After applying the premultiplied texture to Transparent slot, set its Intensity property to 1...5 and Components property to desired channel from drop-down menu (All, Red, Green, Blue, Alpha).

enter image description here

enter image description here

Apple Documentation.

By default, the transparent property’s contents object is a fully opaque black color, causing the property to have no visible effect. Setting the transparent property’s contents to any solid color uniformly fades the opacity of the material based on that color’s opacity value. To make parts of a material appear transparent, set the property’s contents to an image or other texture-mapped content whose alpha channel defines areas of full or partial opacity.

enter image description here

enter image description here

enter image description here