Sketchfab Forum

SpecularHardness and Glossiness

api

(Klaasnienhuis) #1

Hi,
I'm trying to convert some of the material properties from 3dsMax to the classic shader in sketchfab. In sketchfab itself there's a slider for Glossiness which goes from 0 to 100. But when I look at the material channels in the API this property is called SpecularHardness and its factor runs from 0 to 10000. Could you tell me how I can convert between these two? It's not a linear or exponential correlation.


#2

Hi Klaas,

I thought the relationship was logarithmic, but maybe I'm mistaken.

As always I ask @stephomi :smile:


(Stephomi) #3

inout.widgetToModel = function ( val ) {
  return Math.pow( Math.abs( val ), pow ) * ( val < 0.0 ? -range : range );
};
inout.modelToWidget = function ( val ) {
  var v = val / range;
  return Math.pow( Math.abs( v ), 1.0 / pow ) * ( v < 0.0 ? -1.0 : 1.0 );
};

With range = 0.0001 and pow = 4.

If possible, we prefer to favor pbr materials.