![]() |
![]() |



Submitted by: falcon13efx
Date Submitted: 2005-03-26 17:21:09

This is a screen shot of the new cipher shader system in action.
What you see is per-pixel lighting combined with full TNL lighting and specular.
The bump mapping is running entirely on the GPU and the program is generated automagically in the shader parser.
Everything can be done on the GPU except animation right now, and I don't bother with normal mods either. Eventually skinning could be done on the GPU too. The only problem I have is that texture lod bias is not working, I am not sure where in the GPU pipeline that got evaluated.
Cipher is a cool engine, and with these additions it is upto speed and a very attractive engine.
Here is the vertex program it generated:
!!ARBvp1.0
ATTRIB iPos = vertex.position;
ATTRIB iNrm = vertex.normal;
ATTRIB iTC0 = vertex.texcoord[0];
ATTRIB idu = vertex.attrib[3];
ATTRIB idv = vertex.attrib[4];
OUTPUT oPos = result.position;
OUTPUT oClr = result.color;
OUTPUT oTC0 = result.texcoord[0];
OUTPUT oTC1 = result.texcoord[1];
PARAM MVP[4] = {state.matrix.mvp};
PARAM MV[4] = {state.matrix.modelview};
PARAM MIT[4] = {state.matrix.modelview.invtrans};
PARAM MT0[4] = {state.matrix.texture[0]};
PARAM MT1[4] = {state.matrix.texture[1]};
PARAM num_lights = { 1.000000,0,0,0 };
PARAM two = {2.0,2.0,2.0,2.0};
PARAM half= { 0.5,0.5,0.5,0.5};
PARAM lightPos0 = program.local[0];
TEMP R0,R1,R2,TC;
TEMP tTC0;
DP4 oPos.x, MVP[0], iPos;
DP4 oPos.y, MVP[1], iPos;
DP4 oPos.z, MVP[2], iPos;
DP4 oPos.w, MVP[3], iPos;
DP4 R1.x, MIT[0], iNrm;
DP4 R1.y, MIT[1], iNrm;
DP4 R1.z, MIT[2], iNrm;
DP4 R1.w, MIT[3], iNrm;
DP3 R1.w,R1,R1;
RSQ R1.w,R1.w;
MUL R1,R1,R1.w;
MOV R1.w,1;
DP4 R0.x, MV[0], iPos;
DP4 R0.y, MV[1], iPos;
DP4 R0.z, MV[2], iPos;
DP4 R0.w, MV[3], iPos;
RCP R2.x,R0.w;
MUL R2,R0,R2.x;
DP3 TC.w,R2,R2;
RSQ TC.w,TC.w;
MUL TC,R2,TC.w;
DP3 R0.w, R1,TC;
MUL R0.w, R0.w, 2;
MUL R0,R1,R0.w;
SUB R0,TC,R0;
MOV R0.w,1.0;
MOV R2,R0;
ADD R2.z, R2.z, 1;
DP3 R2.w,R2,R2;
RSQ R2.w,R2.w;
MUL R2.w,R2.w,0.5;
MAD tTC0.x, R0.x, R2.w, 0.5;
MAD tTC0.y, R0.y, R2.w, 0.5;
MOV tTC0.z, 0;
MOV tTC0.w, 1;
ADD R0,lightPos0,-iPos;
DP3 R2.x, idu, R0;
DP3 R2.y, -idv, R0;
DP3 R2.z, iNrm, R0;
DP3 R1.w,R2,R2;
RSQ R1.w,R1.w;
MUL R0,R2,R1.w;
MAD R1,R0,half,half;
MOV TC,R1;
MOV oClr,TC;
DP4 oTC0.x, MT0[0], iTC0;
DP4 oTC0.y, MT0[1], iTC0;
DP4 oTC0.z, MT0[2], iTC0;
DP4 oTC0.w, MT0[3], iTC0;
DP4 oTC1.x, MT1[0], tTC0;
DP4 oTC1.y, MT1[1], tTC0;
DP4 oTC1.z, MT1[2], tTC0;
DP4 oTC1.w, MT1[3], tTC0;
END
[Recent Contributions] [Recent Screenshots]
User Contributed Comments