Quixel textures vs. Unity Standard Shader w/ Metal workflow

I have a set of textures from Quixel megascans. (for example, the free mud: Quixel Muddy Ground)

When I select a metalness/gloss settings in Quixel, I get a set of textures like this: albedo, ao, cavity, displacement, gloss, and normal.

Generally, I’m wondering how I map these textures to the shader slots for Unity’s standard shader. Some textures are self explanatory, others are not. Specifically, I wonder what to do with the Quixel gloss and cavity textures.

For the quixel gloss texture, I presume it should go in Unity’s metallic slot, but based on the description of this slot from Unity (R = metallic, A = smoothness), I question whether this is correct because the Quixel texture’s gloss alpha looks completely opaque (1.0).

For the quixel cavity texture, is there even a slot for this in the Unity standard shader? It looks ok in the occlusion slot, but I have been using the quixel ao texture for this as it seems more appropriate.

Edit - Follow up: I’m also curious what the correct sRGB settings are for these textures. Albedo is presumably sRGB, but should any other textures be marked sRGB? I assume displacement should not, but not sure for the others.

As you noticed Unity’s Standard shader stores the smoothness (aka gloss) in the alpha channel of the Metallic or Specular texture. That particular megascan doesn’t come with a metallic texture because the metallic value is zero, so to use the Standard shader and that gloss texture you would have to create a black texture and copy the gloss into the alpha channel. Alternatively in 5.4+ you can store the gloss in the alpha channel of the albedo texture, which would be more efficient in this case.

You can do this in a graphics editor like Photoshop or Gimp, or you can write a tool in the editor to do this. Or you can buy this asset:

Cavity textures are not used by Unity’s standard shader, it is in effect “micro-AO”. Unreal Engine 4 uses it, but Unity doesn’t. You could use it by multiplying the albedo texture with the cavity map and saving out a new albedo texture. This is roughly what Unreal does with it (though it only applies this to the specular highlights and reflections as best I can tell).

3 Likes

Thanks bgolus, any idea about the color space conventions used by Quixel (or more genreally, PBR textures)? i.e., when to mark the texture as sRGB and when not to?

Albedo - sRGB
Gloss - ?
Specular - ?
Displacement - ?
Occlusion - ?

Generally your question can be answered by answering a different question : “Is it a color or data? Use sRGB for color, otherwise use linear.”

Albedo and Specular for Unity’s Standard shader are set as colors, so they should always be sRGB.

Gloss, or “smoothness” in Unity terminology, is data, and for Unity is stored in a texture’s alpha channel, which is always linear regardless of what setting you choose.

Displacement is also data, so should be linear, though Unity’s shader doesn’t actually support displacement by default. The height texture the standard shader has is for offset mapping, and will take a displacement texture, but it’s a flimsy approximation of the more accurate displacement or parallax occlusion mapping techniques, so use whatever looks good to you. (My opinion is what looks best is to not use it at all.)

Metalness and occlusion are the odd ones where this falls down a bit.

Generally speaking metalness is data, but Unity expects it to be used as sRGB, perhaps for convienence more than anything else. Different engines go different ways with it, so there’s no real right or wrong here, arguments can be made either way.

Occlusion could also be argued both ways, but generally I think of it as a color because it’s usually applied by just multiplying it on top of the albedo or ambient light color. Some engines even allow for full color textures to be used for the occlusion map to fake bounced ambient light, though Unity’s Standard shader does not. The idea is still popular with some SSAO implementations. Ambient occlusion is just a gross approximation and isn’t really physically based in any sense, it’s just way cheaper than real ambient shadowing (ie: actually plausible for real time) and looks good enough, so again, use what ever looks good to you.

3 Likes