<arbvp>
  <description>parallax vertex program</description>
  
  <variablemap variable="light 0 position" destination="register 0"/>
  <variablemap variable="light 0 diffuse" destination="register 1"/>
  
  <program>
    <![CDATA[
    !!ARBvp1.0

PARAM mvi[4] = {state.matrix.modelview.inverse};
PARAM mvit[4] = {state.matrix.modelview.invtrans};
PARAM mvp[4] = {state.matrix.mvp};
PARAM lightPos   	= program.local[0];
PARAM lightDiffuse 	= program.local[1];

ATTRIB iTex0	= vertex.texcoord[0];
ATTRIB iTang	= vertex.texcoord[1];
ATTRIB iBiNorm	= vertex.texcoord[2];
ATTRIB iNorm	= vertex.normal;
ATTRIB iPos	    	= vertex.position;

OUTPUT oPos		= result.position;
OUTPUT oTex0	= result.texcoord[0];
OUTPUT oLightDir	= result.texcoord[1];
OUTPUT oEyeVec	= result.texcoord[2];

TEMP light0pos, light0vec;
TEMP eyevec, tangEye;
TEMP temp;
TEMP objLight, tangLight;


#Transform vertex to viewspace
DP4 oPos.x, mvp[0], iPos;
DP4 oPos.y, mvp[1], iPos;
DP4 oPos.z, mvp[2], iPos;
DP4 oPos.w, mvp[3], iPos;

#Just pass on texture-coordinate
MOV oTex0, iTex0;


#Transform light to object space
DP4 objLight.x, mvi[0], lightPos;
DP4 objLight.y, mvi[1], lightPos;
DP4 objLight.z, mvi[2], lightPos;
DP4 objLight.w, mvi[3], lightPos;

ADD objLight, objLight, -iPos;

#Transform light to tangent space
DP4 tangLight.x, iTang, objLight;
DP4 tangLight.y, iBiNorm, objLight;
DP4 tangLight.z, iNorm, objLight;
SGE tangLight.w, tangLight.x, tangLight.x;

MOV oLightDir, tangLight;


# vector pointing to eye
SUB eyevec, mvit[3], iPos;

#Transform eyevector into tangentspace
DP4 tangEye.x, iTang, eyevec;
DP4 tangEye.y, iBiNorm, eyevec;
DP4 tangEye.z, iNorm, eyevec;
SGE tangEye.w, tangEye.x, tangEye.x;
MOV oEyeVec, tangEye;

MOV result.color, vertex.color;

END
]]>
  </program>
</arbvp>

