karthik raj
karthik raj

Reputation: 31

Object appearing transparent after converting to USDZ

I've created two cubes as a single object in Blender and applied two different image textures for each cube and exported them as .OBJ file. I've converted .OBJ to .USDZ file using XCODE and uploaded the .png image texture file as material for my object using the color_map tag. The material is applied to two cubes. However, I see one cube is Opaque and another cube is Transparent.

Not sure why I am having this issue, Can anyone help me out on this?

Image showing one cube is Opaque

Image showing one cube is Transparent

OBJ File = PBR_Cube.obj

Image Texture file = Combined.png

Code:

xcrun usdz_converter PBR_Cube.obj PBR_Cube.usdz -v -a -l \

-color_map Combined.png

I expect both the cubes to be Opaque

Upvotes: 3

Views: 1954

Answers (1)

Luke Stilson
Luke Stilson

Reputation: 41

I know this is an old post, but I have the solution to this issue and have not found the answer anywhere online. The USDZ format (at least on mobile) interprets the base color rgba map as pre-multiplied alpha or rgb(a). If the model does not use any transparency it is safe and easy to simply use a 3-channel rgb output (jpeg works as a simple solution, or a png with a pre-multiplied alpha of 1). USDZ documentation recommends using separate material sets for transparent areas, but it is possible to use an opacity mask, this should be formatted as a png-24 with pre-multiplied alpha containing the opacity mask. In this rgb(a) format, the alpha is stored in relation to the rgb values, making the hex code for colors different than a straight rgba with alpha in the 'a' channel, but color values appear the same. This explains why colors are correct but transparency values are wrong. I used Substance Designer to combine my base color and opacity mask to a pre-multiplied png-24, and this worked perfectly. The process seems to be finicky/difficult in Photoshop or other image manipulation software, but is straightforward in Substance (I can give more details if anyone is interested). It could be possible to use an rgb jpeg colormap for the base color, and a single channel greyscale mask for opacity, but I'm not entirely sure if the USDZ converter would properly combine these, It is safer to use your own 4-channel png-24.

Upvotes: 4

Related Questions