KeyShot Forum

Technical discussions => General discussion => Topic started by: cjwidd on August 31, 2018, 02:18:48 AM

Title: [RESOLVED] Substance Painter 2018.2.1 <> Keyshot 7.3.40
Post by: cjwidd on August 31, 2018, 02:18:48 AM
TL;DR: What is the correct mat graph configuration to achieve parity between Substance Painter's Iray with Keyshot 7.3.40?

I recently did an exploration of how to achieve visual parity between Substance Painter 2018.2.1 and Corona 2 using 3ds Max Slate Material Editor and shared those results on the Corona forum (https://corona-renderer.com/forum/index.php?topic=21481.0). To do this required an extensive amount of testing, especially for a process that should otherwise be automatic, and I am now confronted with an identical issue in Keyshot.

Fundamentally, the issue surrounds the fact that PBR textures cannot simply be slotted into a single shader in Keyshot to achieve the desired results. Instead, it seems that separate material labels are needed for metals and dialectric surfaces - if they are represented in a single object (i.e. single texture map) - and then mask blended.

I am including a link to the assets used in the aforementioned forum post with the hopes that Will, or Dries, or another Hero Member can describe how to replicate the following image in Keyshot 7.

[REFERENCE]
Substance Painter 2018.2.1 - IRay
(https://i.imgur.com/6tZkxly.jpg)

*link (https://www.dropbox.com/s/c5q5y55s2codcyn/pick_axe_keyshot.7z?dl=0) to assets
*link (https://hdrihaven.com/hdri/?h=graffiti_shelter) to source HDRI
Title: Re: Substance Painter 2018.2.1 <> Keyshot 7.3.40
Post by: cjwidd on August 31, 2018, 02:47:32 PM
Continuing to explore the issue and my best guess is there is linear / srgb conversion or gamma correction issue happening inside Keyshot that I cannot apprehend.
Title: Re: Substance Painter 2018.2.1 <> Keyshot 7.3.40
Post by: Rex on August 31, 2018, 04:10:30 PM
Hey Christopher,

Have you seen the documentation here? https://support.allegorithmic.com/documentation/display/SPDOC/Keyshot

Check out the scene here and let us know if this looks correct to you. https://we.tl/t-Wf3yATAOgW
Title: Re: Substance Painter 2018.2.1 <> Keyshot 7.3.40
Post by: cjwidd on September 01, 2018, 02:39:56 PM
Rex, thank you for taking the time to help me address this issue. I took a look at the scene you provided, but I cannot say the appearance of the asset is correct; if you view the object from a different angle you will notice extreme glossiness values throughout.

The textures that I provided in the previous post were exported from Substance Painter using the Corona export preset, which uses glossiness (glossiness^2) instead of roughness. As such, it would not have been possible to achieve the proper look anyway, even if you inverted the glossiness for roughness.

Exporting the texture set from Substance Painter using the Keyshot export preset and following the mat graph example provided by Allegorithmic's documentation does resolve the issue (see attached).

Title: Re: [RESOLVED] Substance Painter 2018.2.1 <> Keyshot 7.3.40
Post by: Rex on September 01, 2018, 02:59:34 PM
Hey Christopher,

Looks great. Glad to see you figured it out.

FYI there is actually a setting under Preferences > Advanced for "Use gloss instead of roughness for materials". This will change the Roughness slider to a Gloss slider that goes from 0-100.
Title: Re: [RESOLVED] Substance Painter 2018.2.1 <> Keyshot 7.3.40
Post by: bdesign on September 02, 2018, 09:49:40 PM
Here is an alternate setup using a single Advanced material. For the pick axe, it rendered 1.2x faster than the layered material; for the demo sphere, 2x faster. I used the Blend map as the Input of a Color To Number node, set Output From/To values to 1.5 and 10 respectively, and plugged it into the Refractive Index channel. For the pick axe single material, I set the Blend map Contrast to 4. In the texture assets folder for the pick axe, there is a MetalColor map, which I believe is intended for the Specular color of the metal. I used a Color Composite node to combine the two Specular maps (Reflection and MetalColor), using the Blend map as Source Alpha. The Gloss to Roughness inversion was done by first setting the texture map Contrast to zero (I later tweaked it to .4...higher contrast = rougher), then using a Color Gradient node created by Søren, found under reply #3 here: https://www.keyshot.com/forum/index.php?topic=13929.0. The renders below are:

1. Demo Sphere - single material
2. Demo Sphere - layered material
3. Pick Axe - single material
4. Pick Axe - layered material

Cheers,
Eric
Title: Re: [RESOLVED] Substance Painter 2018.2.1 <> Keyshot 7.3.40
Post by: cjwidd on September 02, 2018, 09:52:56 PM
Eric, this sounds *really* good, but can you post some screenshots of the render and associated mat graph?
Title: Re: [RESOLVED] Substance Painter 2018.2.1 <> Keyshot 7.3.40
Post by: bdesign on September 02, 2018, 11:00:01 PM
Hey Christopher-

^The images finally uploaded :)

Cheers,
Eric
Title: Re: [RESOLVED] Substance Painter 2018.2.1 <> Keyshot 7.3.40
Post by: cjwidd on September 02, 2018, 11:30:26 PM
This looks very promising. I would like to look over this more thoroughly in the morning, but it appears correct to me at first blush; although I think the normal map should be inverted (>1,  flip the green channel).

I am curious about the gloss to roughness conversion, however. As I understand it, gloss and roughness are simply inversions of one another, but due to gamma correction in Keyshot, a color invert node is not sufficient to achieve the correct conversion. Until now, I have been inverting based on the procedure described here (https://www.keyshot.com/forum/index.php?topic=21169.0), but what Soren has implemented is much different(?)
Title: Re: [RESOLVED] Substance Painter 2018.2.1 <> Keyshot 7.3.40
Post by: bdesign on September 02, 2018, 11:50:21 PM
Quote from: cjwidd on September 02, 2018, 11:30:26 PM
This looks very promising. I would like to look over this more thoroughly in the morning, but it appears correct to me at first blush; although I think the normal map should be inverted (-1, or flip the green channel).

I am curious about the gloss to roughness conversion, however. As I understand it, gloss and roughness are simply inversions of one another, but due to gamma correction in Keyshot, a color invert node is not sufficient to achieve the correct conversion. Until now, I have been inverting based on the procedure described here (https://www.keyshot.com/forum/index.php?topic=21169.0), but what Soren has implemented is much different(?)

EDIT: After checking again, I now think the normal map should be at +1 :). I will upload a new render, with bump height at 1 and glossiness texture map contrast at zero, which I think looks more like the IRay render. I tweaked it to .4 in the original renders to make it look rougher.

Hey Christopher-

The normal map Bump Height is set to -1 for the pick axe. Normal maps can be funky to gauge at times, almost creating an optical illusion as to what is the correct orientation, so I usually check them with extreme values (e.g. +10, -10) to easily see the effect. That's what I did with the pick axe. A positive value had the wood grain incorrect. The relationship between gloss and roughness is non-linear, which is why a Color Invert node will not produce correct results. Søren actually created the Color Gradient node based off of a study I did a while back (see reply #22 here: https://www.keyshot.com/forum/index.php?topic=13729.15 ). The whole thread is really informative.

Cheers,
Eric
Title: Re: [RESOLVED] Substance Painter 2018.2.1 <> Keyshot 7.3.40
Post by: cjwidd on September 03, 2018, 12:06:54 AM
After checking the original project, the normal map value should be positive (>1), so my suggestion was incorrect regardless. I've updated the post for consistency.
Title: Re: [RESOLVED] Substance Painter 2018.2.1 <> Keyshot 7.3.40
Post by: bdesign on September 03, 2018, 12:12:28 AM
We were typing at the same time :) See my edit above^
Title: Re: [RESOLVED] Substance Painter 2018.2.1 <> Keyshot 7.3.40
Post by: cjwidd on September 03, 2018, 12:17:59 AM
Quote from: bdesign on September 03, 2018, 12:12:28 AM
We were typing at the same time :) See my edit above^

Haha, very nice. I really appreciate you taking the time to provide your input. I know it can be a chore sometimes, testing mat graphs and organizing screenshots for a forum post. Hopefully the information in this thread will benefit others in the future.
Title: Re: [RESOLVED] Substance Painter 2018.2.1 <> Keyshot 7.3.40
Post by: bdesign on September 03, 2018, 12:22:21 AM
You're welcome, glad to help. The new render will be done shortly and I'll post it. It looks very close to your original IRay reference image.

Cheers,
Eric
Title: Re: [RESOLVED] Substance Painter 2018.2.1 <> Keyshot 7.3.40
Post by: bdesign on September 03, 2018, 12:36:52 AM
Here is the new render, with normal map Bump Height = 1, Glossiness map Contrast = 0.

Cheers,
Eric
Title: Re: [RESOLVED] Substance Painter 2018.2.1 <> Keyshot 7.3.40
Post by: cjwidd on September 03, 2018, 08:40:43 PM
Wow, the thread that you linked to, and sub-threads therein, was extremely helpful. Thank you for sharing. I feel as though some of that information (see attached) should be embedded in a context menu inside the Keyshot interface; I've been using Keyshot for almost a year and this is my first time seeing it.

I was able to replicate the mat graph based on your description (see attached), and I have to say, I'm very impressed. However, I did notice some hot spots in my render that do not appear in yours. Is your exposure set to about -.5? Also, is there a technical reason why you set the blend mask contrast to 4?
Title: Re: [RESOLVED] Substance Painter 2018.2.1 <> Keyshot 7.3.40
Post by: cjwidd on September 03, 2018, 09:00:29 PM
Also, do you know why the 0.1 stop of the color gradient node in the 'Approximate Gloss To Roughness Gradient' material is a desaturated red color?
Title: Re: [RESOLVED] Substance Painter 2018.2.1 <> Keyshot 7.3.40
Post by: bdesign on September 04, 2018, 10:09:13 AM
Quote from: cjwidd on September 03, 2018, 08:40:43 PM
Wow, the thread that you linked to, and sub-threads therein, was extremely helpful. Thank you for sharing. I feel as though some of that information (see attached) should be embedded in a context menu inside the Keyshot interface; I've been using Keyshot for almost a year and this is my first time seeing it.

I was able to replicate the mat graph based on your description (see attached), and I have to say, I'm very impressed. However, I did notice some hot spots in my render that do not appear in yours. Is your exposure set to about -.5? Also, is there a technical reason why you set the blend mask contrast to 4?

Hey Christopher-

Thank you for the kind words. I'm glad this has all been helpful. Your render looks great. Here are my Exposure/Environment settings for the last render I posted:

Image Style: Basic

•Exposure = 0EV
•Bloom: Intensity = .5, Radius = 20px, Threshold = .1

Environment:

•Brightness = .8
•Contrast = 1

There was no "technical" reason I set the Blend map Contrast to 4; it was just "eyeballing it" to get the Specular composite to match the original IRay reference image.

Quote from: cjwidd on September 03, 2018, 09:00:29 PM
Also, do you know why the 0.1 stop of the color gradient node in the 'Approximate Gloss To Roughness Gradient' material is a desaturated red color?

I'm not sure. I just took it to probably be an accidental oversight when it was created. I just put the saturation back to zero. It shouldn't really make a difference, as the Color To Number node in this case is only concerned with the Value (43%).

Cheers,
Eric