2
$\begingroup$

I am trying to match the specularity size of an old Internal material (controlled by a Hardness value) and a new Cycles material (controlled by a Roughness value).

comparison of Cycles and Internal specularity sizes

As can be seen in the image, Internal Hardness is not nearly as linear as Cycles Roughness is. But I can't find out what sort of math to do to the hardness to make it match the roughness - the Blender source code from the 2.79 era is unsearchable because it's historical, and I can't find any other hints as to what the "Hardness" value logically represents that aren't dead links.

Notes:

  • I'm not going for perfect accuracy. I just need the average person to look at the two rows here and think "yeah the shiny part looks the same size".
  • The roughness numbers in the image are backwards because I'm actually working with gloss (the opposite).
  • The max hardness in the image is 130 because that's what the Hardness texture input does at 1.0 power. I used the default CookTorr, but if one of the others is easier to work with or more accurate for this, that's fine.
$\endgroup$
4
  • $\begingroup$ With what shader (Blinn, Phong, Cook-Torrence)? My guess is the 2.79 source code is this, which makes it look like Hardness corresponds to Phong shininess. Maybe see if this helps. $\endgroup$
    – scurest
    Oct 6, 2022 at 4:37
  • $\begingroup$ I mentioned using CookTorr in the notes, but that using something else is fine if the results turn out easier or better. That code looks weird because (if I understand it correctly) it seems to imply that hardness only takes effect in blocks of 2^n, I'll have to experiment with it. I'd seen that other question before but it's very generic and was hoping for a more Blender-specific answer. $\endgroup$ Oct 6, 2022 at 12:16
  • $\begingroup$ If you mean spec(inp, hard), it's just doing inp^hard plus some clamping using unrolled exponentiation by doubling. I think you'll still have to do swatch matching though. $\endgroup$
    – scurest
    Oct 6, 2022 at 13:18
  • $\begingroup$ Ah so it is, this explains a lot. I might be able to self-answer this later. $\endgroup$ Oct 6, 2022 at 23:16

1 Answer 1

3
$\begingroup$

Based on the code linked to in the comments, Hardness is basically applied as an exponent to the specularity value. So I started to try some formulas and got internal ~= 130*cycles^2, or cycles ~= sqrt(internal/130).

enter image description here

It's not all that close but it's a significant improvement - and because internal Hardness is locked to being an integer, I don't think it's possible to do any better on the rough end because no intermediate values exist.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .