Author Topic: Substance Painter and Unity 5 Smoothness Map - Remapping  (Read 20972 times)

Hi,

In Unity 5. the PBR shaders both use a smoothness map (glossiness). You can export a gloss map from Painter using the Unity 5 presets. However, Unity still does a remapping of the smoothness map in their shader. This will result in Painter roughness being too smooth. You can adjust this in Painter.

Unity is using a custom remapping on the roughness channel. In Painter, you can adjust this in painter.

1. Add a layer at the top of the stack.
2. Add a levels effect to the layer.
3. Select roughness for the channel drop down list at the top of the stack.
4. On the levels node, set the affected channel to Roughess
5. Drop the midlevel value to about .75 - 8.0.
6. On the blending effect for the layer, set it to pass through.

Now, when you export, you're roughness will not be so shiny. You can create a smart material from this setup. Just place the levels layer in a layer group and save it as a smart material. This will allow you to simply drag and drop the correction at the top of your stack before export to Unity.

Cheers,

Wes

Last Edit: January 14, 2016, 05:15:36 pm
Integrations Product Manager / Training
wes.mcdermott@allegorithmic.com
Twitter: The3DNinja

Ha, that's an interesting discovery! :)

According to a comment in the code, they do it to be closer to Marmoset's behaviour.
I wonder - in which cases is this IFDEF enabled and in which the ELSE path is used?

Code: [Select]
inline half RoughnessToSpecPower (half roughness)
{
#if UNITY_GLOSS_MATCHES_MARMOSET_TOOLBAG2
// from https://s3.amazonaws.com/docs.knaldtech.com/knald/1.0.0/lys_power_drops.html
half n = 10.0 / log2((1-roughness)*0.968 + 0.03);
return n * n;

// NOTE: another approximate approach to match Marmoset gloss curve is to
// multiply roughness by 0.7599 in the code below (makes SpecPower range 4..N instead of 1..N)
#else
half m = roughness * roughness * roughness + 1e-4f; // follow the same curve as unity_SpecCube
half n = (2.0 / m) - 2.0; // http://jbit.net/%7Esparky/academic/mm_brdf.pdf
n = max(n, 1e-4f); // prevent possible cases of pow(0,0), which could happen when roughness is 1.0 and NdotH is zero
return n;
#endif
}

Hi,
Found this problem a while, the solution is fresh.
When you use Unity 5 in linear mode, it is automatically correcting the RGB channels but unfortunately leave the alpha channel (or the transparency) as it is.
You have to correct manually for example in Photoshop.
Basically a linearisation:
- Export from Painter as targa, the glossiness (aka smoothness) is an alpha channel (not transparency - like in png).
- Linearisation in Phostoshop (select the alpha channel -> levels -> change the mid value to 0.454)
- Save the file.

Voilà. Now you happy.

Cheers,
Danki
I'm an Environment Artist and R&D Generalist at Digic Pictures

wow, and I think, why in unity as in snot all  :)  Thanks for the tip!

I think I'm doing this right but getting strange results. I have a wood Log got it looking good in SP. Export the maps into unity and the specular map creates a whitish haze all over the log. As you can see on the right. If I turn off the specular map and reduce the specular color to black and turn down the smoothness it looks closer to SP. I'm probabbly just doing something wrong but I can't see what it is.
Last Edit: May 14, 2015, 03:32:42 pm

It really matters to have a matching environment in both Unity and Painter
Though I should admit even with matched (looking exactly the same) environments results do vary quite significantly

Would be great to have a workflow to make Unity and Painter give consistently similar results...

It really matters to have a matching environment in both Unity and Painter
Though I should admit even with matched (looking exactly the same) environments results do vary quite significantly

Would be great to have a workflow to make Unity and Painter give consistently similar results...

I solved this problem by the way. Its a global illumination issue in unity. If thats what yoru refering to.

https://forum.allegorithmic.com/index.php?topic=5235.0

Basically a linearisation:
- Export from Painter as targa, the glossiness (aka smoothness) is an alpha channel (not transparency - like in png).
- Linearisation in Phostoshop (select the alpha channel -> levels -> change the mid value to 0.454)
- Save the file.

Perfect solution. I especially like this because I didn't have to mess with the scene's lighting.

Sorry for digging this up, but isn't this something that could be handled automatically by Painter when selecting Unity as the preset? My rusty metal object looks shiny like a freshly waxed apple as soon as I apply my roughness map in Unity.
Last Edit: August 31, 2015, 12:59:18 am

Thank you very, very, very, very, very much!
3D art is magic.

By the way Wes, is that image of your personal work? It's f**king amazing. I want to see more.
3D art is magic.

Hi, new user here , hope i got the right thread.

Has this been solved ? as in : updating the unity export preset so it automatically applies the correct curve for unity ?.
I encountered this recently and It seems so, the channel to use is "glossiness2 (squared)" , right ? (though it's not the default for unity, or i just messed my presets..)

That seems to do the trick ( same effect as manually applying a darkening curve / gamma correction to output file).
link to wip personal project thread , see last post for example pics : http://www.polycount.com/forum/showthread.php?p=2355436

By the way Wes, is that image of your personal work? It's f**king amazing. I want to see more.

https://www.artstation.com/artist/michaelpavlovich

I,ve got also strange result in unity 5.2.1.f1 and Substaince Painter 1.5.7,
I've change at linear workflow in unity, change Smoothness map in ps_>level .454, and completely have strange result, see at atachments



If you are referring to blue color maybe it is a material color in Unity.