|
From: Jose' C. <cru...@ce...> - 2007-04-27 12:45:19
|
Il giorno 27/apr/07, alle ore 12:30, Roger Holmes ha scritto:
>
> Well done! But please can you explain.
>
> With other renderers a specular control of 200 is matt, and a
> specular control of 0.2 is gloss.
>
> Not only are the values bigger, they are also inverted.
>
> Can't we make these compatible with other renderers?
>
mmm which other renderers?
I'm taking those values going back and forth from the values passed =20
in the open GL renderer in GL_SHININESS (it's not the same, I know, =20
but is clese anough)
I want the parameters in the geometry were used untouched by every =20
renderer, but I can be wrong - (not tested too much indeed)
this parameter controls how big is the reflection light spot on the =20
figure.
in GL it goes from
0 (no spot (because too big) and hence rough and hence not reflecting)
to
128 (pointy spot, hence polish hence reflecting)
in Rayshade it goes from
0 no reflecting
to
100 perfect mirror
seems obvious to map rayshade =3D GL_SHININESS / 1.28
now lets map this to Quesa specular control values (that BTW defaults =20=
to 4)
the mapping between Quesa-OGl is done in GLUtils.c 419:441
--8<------8<------8<------8<------8<------8<------8<------8<------8<----=20=
--8<------8<------8<----
//=20
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20
=3D=3D=3D=3D=3D
// GLUtils_SpecularControlToGLShininess :
// Map Quesa specular control to =
OpenGL shininess.
//----------------------------------------------------------------------=20=
-------
// This function was arrived at heuristically, but notice =
several =20
properties:
// 1. as long as specularControl >=3D 0, shininess >=3D 0.
// 2. as specularControl increases, shininess increases.
// 3. as specularControl tends to infinity, shininess =
approaches 128 =20
(the maximum
// allowed by OpenGL).
GLfloat GLUtils_SpecularControlToGLShininess( float =
inSpecControl )
{
GLfloat shininess;
=09
if (inSpecControl < 0.0f)
inSpecControl =3D 0.0f;
shininess =3D 128.0f - (20.0f * 128.0f)/(inSpecControl + 20.0f);
=09
return shininess;
}
--8<------8<------8<------8<------8<------8<------8<------8<------8<----=20=
--8<------8<-----
the default 4 value of specularControl, maps to 21 of shininess
but 17 is too reflecting for a default value, so instead of do a =20
linear interpolation, I've adjusted the curve of translation to
result->reflect =3D (128.0f - (100.0f * 128.0f)/(data-=20
>specularControl + 100.0f))*0.008;
of course all this reasoning is genuine out of my a**, so it can be =20
discussed
Pax et Bonum
# Dott. Jos=E9 Cruanyes Aguilar - C.E. Soft srl
# Pzza. Firenze,4 MILANO - XX Settembre 10, CREMONA
# 02,3923101 0372,460602
|