Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, Quad, EternallyCurious, 1 invisible), 726 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Dot3 Mapping on level-blocks #96329
10/28/06 11:05
10/28/06 11:05
Joined: Feb 2003
Posts: 211
Unna
F
Freddy_dup1 Offline OP
Member
Freddy_dup1  Offline OP
Member
F

Joined: Feb 2003
Posts: 211
Unna
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?

Re: Dot3 Mapping on level-blocks [Re: Freddy_dup1] #96330
10/28/06 11:12
10/28/06 11:12
Joined: Jun 2005
Posts: 4,875
broozar Offline
Expert
broozar  Offline
Expert

Joined: Jun 2005
Posts: 4,875
delete all the "~"

Re: Dot3 Mapping on level-blocks [Re: broozar] #96331
10/28/06 12:22
10/28/06 12:22
Joined: Feb 2003
Posts: 211
Unna
F
Freddy_dup1 Offline OP
Member
Freddy_dup1  Offline OP
Member
F

Joined: Feb 2003
Posts: 211
Unna
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;
}
}

";
}



Last edited by Freddy; 10/28/06 12:36.
Re: Dot3 Mapping on level-blocks [Re: Freddy_dup1] #96332
10/28/06 13:38
10/28/06 13:38
Joined: Jun 2005
Posts: 4,875
broozar Offline
Expert
broozar  Offline
Expert

Joined: Jun 2005
Posts: 4,875
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;

}
}



Re: Dot3 Mapping on level-blocks [Re: broozar] #96333
10/28/06 17:00
10/28/06 17:00
Joined: Apr 2004
Posts: 83
DWilki Offline
Junior Member
DWilki  Offline
Junior Member

Joined: Apr 2004
Posts: 83
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.


Moderated by  Blink, Hummel, Superku 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1