Ok this is what I got so far (specular normalmapping):

 Code:
technique NormalSpec
{
   pass P0
   {
		VertexShader =
		asm
		{
			vs_1_1              // version instruction
			// c0-c3 contains composite transform matrix
			m4x4 oPos, v0, c0   // transform vertices by view/projection matrix
			
			// v2 texture coordination
			mov  oT0.xy, v2
			mov  oT1.xy, v2
			
			// c4 lpos
			// c6 eye
			// H = HalfVector = Normalize( VertexToEyeVector + LightVector )
			add  r0, c4, -v0	// L = lpos - vertex, L in object space
			add  r1, c6, -v0	// VertexToEyeVector
			add  r0, r0, r1		// HalfVector
			
			// v3 Tangent,  x
			// v4 Binormal, y
			// v1 normal,   z
			
			// matrix for object space to surface space
			// ( Tan.x  Tan.y  Tan.z ) = ( v3.x v3.y v3.z )   ( L.x )
			// ( Bin.x  Bin.y  Bin.z ) = ( v4.x v4.y v4.z ) * ( L.y )
			// ( nor.x  nor.y  nor.z ) = ( v1.x v1.y v1.z )   ( L.z )
			
			dp3  r1.x, v3, r0
			dp3  r1.y, v4, r0
			dp3  r1.z, v1, r0
			
			// r1 H vector in texture space
			
			// normalize vector in r1
			dp3  r1.w, r1, r1		// r1.w = |r1|^2
			rsq  r1.w, r1.w			// r1.w = 1/sqrt(r0.w) = 1/|r1|
			mul  r1.xyz, r1, r1.w	// r1 - normalized L vector in texture space
			
			// <-1, 1>  to  <0,1>
			// c5  0.5, 0.5, 0.5, 0.5
			mad  oD0, r1, c5, c5
		};
   }
}


There are a lot of errors like this one: "(13): error X5326: Read of uninitialized components(*) in v2: *x/0 *</1 z/2 w/3".
What am I doing wrong?

Thanks!


ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)!
get free version