I try using codes from .fx files unsuccessfully, can anybody explain how to convert it for GameStudio?
I'm not programmer, what good beginner tutorials for understanding it?
technique ToonShade
{
pass p0
{
VertexShaderConstant[0] = <wvp>;
VertexShaderConstant[4] = <worldIT>;
VertexShaderConstant[8] = <world>;
VertexShaderConstant[12] = <lightPos>;
VertexShaderConstant[13] = {1.0,0.0,0.0,0.0};
VertexShaderConstant[11] = {1.1,1.1,0.6,0.0};
VertexShaderConstant[14] = <diffuseMaterial>;
VertexShaderConstant[16] = <viewInvTrans>;
VertexShader =
asm
{
vs.1.1
dcl_position v0
dcl_normal v3
dcl_texcoord0 v7
dcl_tangent0 v8
dcl_binormal0 v9
dcl_color0 v5
// Transform pos to screen space.
m4x4 oPos, v0, c0
// Normal to world space:
dp3 r0.x, v3, c4
dp3 r0.y, v3, c5
dp3 r0.z, v3, c6
// normalize normal
dp3 r0.w, r0, r0
rsq r0.w, r0.w
mul r0, r0, r0.w // r0 has normalized normal.
// vpos to world space.
dp4 r1.x, v0, c8
dp4 r1.y, v0, c9
dp4 r1.z, v0, c10
dp4 r1.w, v0, c11 // r1 has position in world space.
// eye vector, normalize.
add r2, c19, -r1
//mul r2, r2, c11 - temp fix for ogl.
dp3 r2.w, r2, r2
rsq r2.w, r2.w
mul r2, r2, r2.w // r2 has normalized eye vector.
add r3, c12, -r1
dp3 r3.w, r3, r3
rsq r3.w, r3.w
mul r3, r3, r3.w
// L dot N.
dp3 oT0.y, r3, -r0
// E dot N
dp3 oT0.x, r2, r0
mov oD0, c14
};
ZEnable = true;
ZWriteEnable = true;
AlphaBlendEnable = false;
CullMode = None;
Lighting = false;
Texture[0] = <toonshade>;
MinFilter[0] = Linear;
MagFilter[0] = Linear;
MipFilter[0] = Linear;
AddressU[0] = Clamp;
AddressV[0] = Clamp;
ColorOp[0] = Modulate;
ColorArg1[0] = Texture;
ColorArg2[0] = Diffuse;
AlphaOp[0] = SelectArg1;
AlphaArg1[0] = Texture;
AlphaArg2[0] = Diffuse;
}
}