Skip to content

TBC Shading

fallenoak edited this page Sep 10, 2016 · 7 revisions

Vertex Shaders

MapObjDiffuse

Permutation 30

!!ARBvp1.0
PARAM c1 = { 0, 1, 0, 0 };
PARAM c0 = { 0, 1, 2, 0 };
TEMP R0, R1, R2;
ATTRIB v19 = vertex.color;
ATTRIB v24 = vertex.texcoord[0];
ATTRIB v7 = vertex.attrib[7];
ATTRIB v17 = vertex.weight;
ATTRIB v18 = vertex.normal;
ATTRIB v16 = vertex.position;
PARAM c6[4] = { program.local[6..9] };
PARAM c13 = program.local[13];
PARAM c28[2] = { program.local[28..29] };
PARAM c17[11] = { program.local[17..27] };
PARAM c11 = program.local[11];
PARAM c10 = program.local[10];
PARAM c12 = program.local[12];
PARAM c2[4] = { program.local[2..5] };
PARAM c31[3] = { program.local[31..33] };
	MOV result.fogcoord.x, c0.x;
	DP4 R1.x, c31[0], v16;
	DP4 R1.y, c31[1], v16;
	DP4 R1.z, c31[2], v16;
	MOV R0.xyz, R1.xyzz;
	MOV R0.w, c0.y;
	DP4 result.position.x, c2[0], R0;
	DP4 result.position.y, c2[1], R0;
	DP4 result.position.z, c2[2], R0;
	DP4 result.position.w, c2[3], R0;
	DP3 R0.y, c31[0].xyzx, v18.xyzx;
	DP3 R0.z, c31[1].xyzx, v18.xyzx;
	DP3 R0.w, c31[2].xyzx, v18.xyzx;
	DP3 R0.x, R0.yzwy, R0.yzwy;
	RSQ R0.x, R0.x;
	MUL R0.xyz, R0.x, R0.yzwy;
	ADD R2.xyz, c17[4].xyzx, -R1.xyzx;
	DP3 R0.w, R2.xyzx, R0.xyzx;
	DP3 R2.y, R2.xyzx, R2.xyzx;
	RSQ R2.x, R2.y;
	MUL R0.w, R0.w, R2.x;
	MAX R1.w, R0.w, c0.x;
	MUL R0.w, R2.y, R2.x;
	MUL R0.w, R0.w, c17[9].x;
	MAD R0.w, R2.y, c17[10].x, R0.w;
	ADD R0.w, R0.w, c17[8].x;
	RCP R0.w, R0.w;
	MUL R1.w, R1.w, R0.w;
	DP3 R0.w, -c12.xyzx, R0.xyzx;
	MIN R0.w, c0.y, R0.w;
	MAX R0.w, c0.x, R0.w;
	MOV R2.xyz, c10;
	MAD R2.xyz, R0.w, R2.xyzx, c11.xyzx;
	MAD R2.xyz, c17[0].xyzx, R1.w, R2.xyzx;
	MIN R2.xyz, c0.y, R2.xyzx;
	MAX R2.xyz, c0.x, R2.xyzx;
	MOV R2.w, c0.y;
	MAD result.color.front.primary, v19, R2, c28[1];
	DP3 R0.w, R1.xyzx, R1.xyzx;
	RSQ R0.w, R0.w;
	MAD R1.xyz, R0.w, R1.xyzx, c12.xyzx;
	DP3 R0.w, R1.xyzx, R1.xyzx;
	RSQ R0.w, R0.w;
	MUL R1.xyz, R0.w, R1.xyzx;
	DP3 R0.xy, R0.xyzx, R1.xyzx;
	MOV R0.zw, c13.w;
	LIT R0.z, R0;
	MIN R0.x, c0.y, R0.z;
	MAX R0.x, c0.x, R0.x;
	MUL result.color.front.secondary.xyz, R0.x, c13.xyzx;
	MOV result.color.front.secondary.w, c0.y;
	DP4 result.texcoord[0].x, c6[0], v24;
	DP4 result.texcoord[0].y, c6[1], v24;
	MOV result.texcoord[0].zw, c1.xyxy;
END
# permutation:30 -DBONE_INFLUENCES=0 -DLIGHTS=1 -DLIGHT_ENABLE=1 -DSPEC_ENABLE=1 -DVERTEX_COLOR_ENABLE=1 -DFOG_ENABLE=0

Pixel Shaders

MapObjOpaque

!!ARBfp1.0
TEMP R0;
TEMP R1;
MOV R0.x, fragment.color.primary.w;
MUL R1.xyz, fragment.color.secondary, R0.x;
TEX R0.xyz, fragment.texcoord[0], texture[0], 2D;
MAD result.color.xyz, fragment.color.primary, R0, R1;
MOV result.color.w, fragment.color.primary;
END

Theory

main() {
  vec4 sampled0 = texture(textures[0], coordinates[0]);

  vec4 result;

  result.rgb = vertexColor.rgb * sampled0.rgb + (light.rgb * vertexColor.a);
  result.a = vertexColor.a;
}
Clone this wiki locally