Ok.. let me see. I stored my shader in a .fx file. Here is the assignment in my code:

Code:

bmap pSkin = <projector_sprite.pcx>;

material matProjector
{
skin1 = pSkin;
effect = "projector.fx";
}

action actProjector
{
my.material = matProjector;
}



And this is my .fx file. This is a copy and paste of the shader of the Wiki. The first skin of the cube which I use as projector is identical to the PCX file I declare in the material settings.. I wondered why there are two skins used.. well this is the code:

Code:

texture mtlSkin1;
texture entSkin1;

matrix matWorldViewProj;
matrix matWorld;
matrix matMtl;

technique projector {
pass p0 {

VertexShaderConstant[0] = <matWorld>; //World Matrix
VertexShaderConstant[8] = <matWorldViewProj>;
VertexShaderConstant[95] = <matMtl>;

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
};
}
}



Dont blame me for the copy and paste - I suspected that it doesnt work.

Well.. I dont know much about shaders and when I tried to get information about that VertexShaderConstant array, which I dont understand because later there is no reference to it for calculations, I didnt found anything useful or explaining on the MSDN. The ASM part is mostly not understandable for me.

In my test environment my model cube - which is the projector - is surrounded only by MDLs. When I run it, the cube has no shading at all, but you can see the texture. No projected sprite anywhere.

I don't beg that anyone explains me everything - but in the case of shaders I still need some help. AND I bought a book about it.. but the learning curve isnt that fast.

ciao
Christian

Last edited by HeelX; 05/21/06 09:05.