Page 1 of 1

Shininess Table

Posted: Sun Dec 19, 2010 12:13 am
by Scribe
Hi guys,

I'm finding myself wanting to port a standard shininess exponent over to the shininess table, what's the formula I should be applying? (what does each location in the table represent - what are the lookup factors?)

Many thanks

Re: Shininess Table

Posted: Sun Dec 19, 2010 2:45 am
by zeromus
i am a little disturbed that you havent looked for it in gbatek yet:

Code: Select all

  IF TexCoordTransformMode=2 THEN TexCoord=NormalVector*Matrix (see TexCoord)
  NormalVector=NormalVector*DirectionalMatrix
  VertexColor = EmissionColor
  FOR i=0 to 3
   IF PolygonAttrLight[i]=enabled THEN
    DiffuseLevel = max(0,-(LightVector[i]*NormalVector))
    ShininessLevel = max(0,(-HalfVector[i])*(NormalVector))^2
    IF TableEnabled THEN ShininessLevel = ShininessTable[ShininessLevel]
    ;note: below processed separately for the R,G,B color components...
    VertexColor = VertexColor + SpecularColor*LightColor[i]*ShininessLevel
    VertexColor = VertexColor + DiffuseColor*LightColor[i]*DiffuseLevel
    VertexColor = VertexColor + AmbientColor*LightColor[i]
   ENDIF
  NEXT i
But I believe gbatek is wrong,

http://desmume.svn.sourceforge.net/view ... iew=markup (line 1179) gives me better results