Posted By: zSteam
asm => hlsl..... projection shader - 10/19/07 01:38
hello
I'm trying to build a texture projection demo. but the shader is in asm and i need it in hsl to increase the result. can me anyone explain/convert the shader?
I think the projection shader is very important for many 3dgs users.
Code:
I'm trying to build a texture projection demo. but the shader is in asm and i need it in hsl to increase the result. can me anyone explain/convert the shader?
I think the projection shader is very important for many 3dgs users.
Code:
texture mtlSkin1; //projector
texture entSkin1; //colormap
matrix matWorldViewProj;
matrix matWorld;
matrix matMtl;
technique projector
{
pass p0 //projector
{
//load matrices
//VertexShaderConstant[0] = <matWorld>; //World Matrix
VertexShaderConstant[8] = <matWorldViewProj>;
VertexShaderConstant[95] = <matMtl>;
//range constant
VertexShaderConstant[33] = {0.01f, 0.5f, 0.05f, 0.0f};
Texture[0] = <mtlSkin1>; //projection tex
Texture[1] = <entSkin1>; //projection tex
AddressU[0] = Clamp; // don't wrap around edges
AddressV[0] = Clamp;
AddressU[1] = Clamp; // don't wrap around edges
AddressV[1] = Clamp;
zWriteEnable=true; // enables writing to the z-buffer
VertexShader=
asm
{
vs_1_1
dcl_position v0
dcl_normal v3
dcl_texcoord0 v7
dcl_texcoord1 v8
; position in clip space
m4x4 oPos, v0, c8
; position in texture projection space
m4x4 r10,v0,c95
; Divide each component by the range value
mul r10, r10, c33.x
; multiply with 0.5 and add 0.5
mad r10, r10, c33.yyyy, c33.yyyy
; map the x and y components into the first texture
mov oT0.xy, r10.xy
mov oT1.xy, v7.xy; color
};
PixelShader=
asm
{
ps_1_1
tex t0
tex t1
mov r0,t0
mul r0,r0,t1
};
}
}