Some materials render black on visionOS (not simulator)

The new material ( the one which renders black) does use some swizzle, has mipmaps turned off and it’s used from a mask map exported by substance painter.

Is Ambient occlusion not supported?
Is Swizzling not supported?

I tried adding more info, but only allowed 1 embedd :expressionless:

Is this using Metal or RealityKit rendering? I’m assuming RealityKit; Metal should support all the features here. You can see the documentation for our RealityKit URP/Lit support here. Occlusion maps are supported, but texture swizzling is not.

So did some building and deploying to figure out what causes the black materials, and it is the ambient occlusion map.

Here is the material, along with the map import settings:

The texture is swizzled from a mask texture, and only using the green layer. It renders fine in editor, but not in build. I’m doing the same for metallic map, but on the red and alpha layer.

In a Build with base, metallic red swizzled map and normal map, models render correctly.
In a Build with base, metallic red swizzled, normal and ambient occlusion green swizzled maps, models render black.

Also, documentation says ambient occlusion is supported, but not intensity of it, should I set it to 0 or 1 default? Or does unity override that ?

Decided to try to bake the occlusion map into the base, that seems to work. Kept the metallic red layer from the mask map. On the right, there is the model with occlusion map assigned, on left and middle are the new models with AO baked into base.

We simply don’t read the intensity when we convert to a RealityKit PhysicallyBasedMaterial (and note that that’s because that material doesn’t support a separate occlusion intensity value), so you should probably leave it at the default value of 1 so that it looks the same in the editor as in a build.

For the swizzling in particular, it looks like visionOS 2.0 did add support for texture swizzling, so we can make a note to add support for that in a future version. However, another option would be for you to use a shader graph with a Lit target and the same properties that the URP/Lit shader has (_BaseColor, _BaseMap, etc.). That way, you can do whatever swizzling you want in the shader graph (as well as add support for things like detail maps, which RealityKit’s PBR material doesn’t support).

I should probably add that we don’t support the “Smoothness Source” option, since RealityKit’s material wants “roughness” in its own texture (so we only use the constant Smoothness value). Again, that can be handled in a shader graph. We eventually plan to switch to using shader graphs rather than RealityKit’s PBR material so that we can better match all of the features of the Unity shader.

Thanks so much for the input!

I will eventually have to learn shader graph, seems to be an extremely powerful tool!

1 Like