Dot3 Mapping on level-blocks

Posted By: Freddy_dup1

Dot3 Mapping on level-blocks - 10/28/06 11:05

Hello,

I read the tutorials about shader and tried to change it
so I can use it to make dot3 Mapping on level-blocks.
I just can't make it work...
The engine says: unexpected token "~"

Code:
bmap dot_3map = <dot_3.bmp>;

material dot_3
{

skin3 = dot_3map;

effect
" texture entSkin1; // block texture
texture entSkin2; // shadow texture

texture mtlSkin3; // the bump map

technique bump_dot3
{
pass P0
{
Texture~[0] = <entSkin1>;
Texture~[1] = <entSkin2>;
~TextureFactor = <mtlSkill3>;

ColorArg1~[0] = Texture; // stage 0 = bumpmap
ColorOp~[0] = DotProduct3;
ColorArg2~[0] = TFactor;
ColorArg1~[1] = Texture; // stage 1 - skin texture
ColorOp~[1] = ~AddSigned;
ColorArg2~[1] = Current;
ColorArg1~[2] = Diffuse; // stage 2 - lighting
ColorOp~[2] = Modulate2x;
ColorArg2~[2] = Current;
}
}

";
}



Can someone please help me?
Posted By: broozar

Re: Dot3 Mapping on level-blocks - 10/28/06 11:12

delete all the "~"
Posted By: Freddy_dup1

Re: Dot3 Mapping on level-blocks - 10/28/06 12:22

Thank you,
but it still doesn't work.

I think the whole "pass P0" is wrong. It was made for
models and not for level textures.

Code:
bmap dot_3map = <dot_3.bmp>;

material dot_3
{

skin3 = dot_3map;

effect
" texture entSkin1; // block texture
texture entSkin2; // shadow texture
dword mtlSkill1; // a variable?
texture mtlSkin3; // the bump map

technique bump_dot3
{
pass P0
{
Texture[0] = <entSkin1>;
Texture[1] = <entSkin2>;
TextureFactor = <mtlSkill1>;

ColorArg1[0] = Texture; // stage 0 = bumpmap
ColorOp[0] = DotProduct3;
ColorArg2[0] = TFactor;
ColorArg1[1] = Texture; // stage 1 - skin texture
ColorOp[1] = AddSigned;
ColorArg2[1] = Current;
ColorArg1[2] = Diffuse; // stage 2 - lighting
ColorOp[2] = Modulate2x;
ColorArg2[2] = Current;
}
}

";
}


Posted By: broozar

Re: Dot3 Mapping on level-blocks - 10/28/06 13:38

hm, i have no idea where's the mistake, but i can provide some code which actually works on level geometry ( i assume you know how to use apply them via d3d_automaterial):

Code:
matrix matWorldViewProj;
matrix matWorld;

texture mtlSkin1;
texture entSkin1;
texture entSkin2;
vector vecLight;

technique dot3map
{
pass p0
{
Texture[0] = <mtlSkin1>;
Texture[1] = <entSkin2>;
Texture[2] = <entSkin1>;
TextureFactor = 0xFFFFFFFF;

COLOROP[0] = DotProduct3;
COLORARG1[0] = Texture;
COLORARG2[0] = TFactor;
TexCoordIndex[0] = 1;

COLOROP[1] = Modulate;
COLORARG1[1] = Texture;
COLORARG2[1] = Current;
TexCoordIndex[1] = 0;

magFilter[2]=Linear;
minFilter[2]=Linear;
mipFilter[2]=Linear;
COLOROP[2] = AddSigned;
COLORARG1[2] = Texture;
COLORARG2[2] = Current;
TexCoordIndex[2] = 1;
}
}



Code:
float4x4 matWorld;
float4x4 matWorldViewProj;
vector vecLight; // oder aber LightPos
texture entSkin1; // Wad Tex
texture entSkin2; // Light,Shadow Tex
texture mtlSkin1; // Normal Map
float4 BumpHeight = { 1.0, 0.0, 0.0, 0.0};
float4 LightPos = {1.0, 1.5, 1.0, 0.0 };

technique bump_diffuse
{
pass p0
{

VertexShaderConstant[0] = <matWorld>;
VertexShaderConstant[4] = <matWorldViewProj>;
VertexShaderConstant[8] = <matWorld>;
VertexShaderConstant[12] = <vecLight>;//<LightPos>;
VertexShaderConstant[13] = {1.0, 0.5, 0.7, 0.0}; // 1.0 und 0.5 Lichteinfall
VertexShaderConstant[14] = <BumpHeight>; // 0.7 Gesamthelligkeit
VertexShaderConstant[90] = {1.0,1.0,1.0,1.0};

VertexShader =
asm
{
vs.1.1

dcl_position v0
dcl_normal v3
dcl_color v5
dcl_texcoord1 v7
dcl_tangent v8
dcl_binormal v9
dcl_texcoord0 v10

m4x4 oPos, v0, c4 // Position Screen
mov oT0, v7 // Tex Coords Normal Map
mov oT1, v7 // Tex Coords Diffuse Map
mov oT2, v10 // Tex Coords Light&Shadow
mov oFog, c90.w

mov r0, c12
dp3 r0.w, r0, r0
rsq r0.w, r0.w
mul r0, r0, r0.w

// Licht zu Object
dp3 r2.x, v8, r0 // Tangent
dp3 r2.y, c9, r0 // Binormal
dp3 r2.z, c10, r0 // Normal

// Licht zu Tangent
dp3 r1.x, v8, r2 // Tangent
dp3 r1.y, v9, r2 // Binormal
dp3 r1.z, v3, r2 // Normal
sge r1.w, r1.x, r1.x

mov r0, c13
add r0, r0, r0
mul r0, r1, r0

mad oD0, r0, c13, c13
};

Zenable = true;
ZWriteEnable = true;

Texture[0] = <mtlSkin1>; // Normal map
MinFilter[0] = Linear;
MagFilter[0] = Linear;
MipFilter[0] = Linear;

Texture[1] = <entSkin1>; // Diffuse map (wad texture)
MinFilter[1] = Linear;
MagFilter[1] = Linear;
MipFilter[1] = Linear;

Texture[2] = <entSkin2>; // Licht & Schatten (wad texture)
MinFilter[2] = Linear;
MagFilter[2] = Linear;
MipFilter[2] = Linear;

ColorArg1[0] = Texture;
ColorArg2[0] = Diffuse;
AlphaArg1[0] = Texture;
AlphaArg2[0] = Diffuse;
ColorOp[0] = DotProduct3;
AlphaOp[0] = SelectArg1;

ColorArg1[1] = Current;
ColorArg2[1] = Texture;
ColorOp[1] = Modulate2x; //4x mehr glanz

AlphaOp[1] = SelectArg1;

COLORARG1[2] = Texture;
COLORARG2[2] = Current;
COLOROP[2] = Modulate4x;

}
}


Posted By: DWilki

Re: Dot3 Mapping on level-blocks - 10/28/06 17:00

Would anyone have an idea of how to have either of these shaders react to dynamic lights? Say 3 lights? I've tried both shaders and they work well on level blocks and the performance is pretty good (at least on my machine). The one problem is that when using these shaders, dynamic lights no longer react on surfaces where these shaders are applied. The lighting from standard wed lights looks great though.
© 2024 lite-C Forums