Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (vicknick, VoroneTZ), 1,430 guests, and 13 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
help ! terrain shader dont works on 6.31 | 6.22 ok #37551
12/10/04 10:08
12/10/04 10:08
Joined: Mar 2003
Posts: 228
Loetkolben Offline OP
Member
Loetkolben  Offline OP
Member

Joined: Mar 2003
Posts: 228
hi,

this shader works on 6.22 fine, but not on 6.31
error error error error
need help

look at my projekt " LoetEd " leveleditor it works on 6.22 fine.

der shader läuft auf 6.22 super, aber nicht auf 6.31.
brauche hilfe.

der shader macht das was in meinem programm zu sehen ist.
3 texturen mit jeweils eigener detail-map im alphakanal.
alles wird über die erste skin der hmp die als blendmap benutzt und damit dargestellt.




Code:


bmap textur_cursor=<textur_cursor.tga>;
bmap stone = <stone.tga>;
bmap grass = <grass.tga>;
bmap sand = <sand.tga>;

material mat_terrain_multitexture
{
skin1=textur_cursor;
Skin2=sand;
skin3=stone;
skin4=grass;

effect=
"
texture entSkin1;
texture entSkin2;
texture entSkin3;
texture entSkin4;
texture mtlSkin1;
texture mtlSkin2;
texture mtlSkin3;
texture mtlSkin4;

matrix matWorldViewProj;
//----------
matrix matWorld;
matrix matWorldView;

vector vecSpecular;
vector vecSunDir;
vector vecDiffuse;
vector vecAmbient;
vector vecLight;
vector vecFog;

technique multitextureps11
{
// pass texture
pass p0
{
texture[0]=<mtlSkin3>;
texture[1]=<mtlSkin2>;
texture[2]=<mtlSkin4>;
texture[3]=<entSkin1>;

magFilter[0]=linear;
minFilter[0]=linear;
mipFilter[0]=linear;

magFilter[1]=linear;
minFilter[1]=linear;
mipFilter[1]=linear;

magFilter[2]=linear;
minFilter[2]=linear;
mipFilter[2]=linear;

magFilter[3]=linear;
minFilter[3]=linear;
mipFilter[3]=linear;

zWriteEnable=true;

vertexShaderConstant[0]=<matWorldViewProj>;
//------------------
vertexShaderConstant[4]=<matWorld>;
vertexShaderConstant[8]=<matWorldView>;

vertexShaderConstant[15]=<vecSpecular>;
vertexShaderConstant[16]=<vecSunDir>;
vertexShaderConstant[17]=<vecDiffuse>;
vertexShaderConstant[18]=<vecAmbient>;
vertexShaderConstant[19]=<vecLight>;
vertexShaderConstant[20]=<vecFog>;

//------------------

vertexShaderConstant[64]=(48.0f,48.0f);//texture scale
vertexShaderConstant[65]=(1024.0f,1024.0f);//detail scale

//-----------------
vertexShaderConstant[95]=(0.0f,0.0f,0.0f,0.0f);
//-----------------
vertexShader=
decl
{
stream 0;
float v0[3]; //position
float v3[3]; //normal
float v7[2]; //uv
}
asm
{
vs.1.0
m4x4 oPos,v0,c0 // transform position to clip space

mul oT0.xy,v7.xy,c64.xy // texture
mul oT1.xy,v7.xy,c64.xy // texture
mul oT2.xy,v7.xy,c64.xy // texture
mov oT3.xy,v7.xy // blend map
//-----------------
m3x3 r0,v3,c4 // transform normal to world space
dp3 r0.w,r0,r0 // renormalize it
rsq r0.w,r0.w
mul r0,r0,r0.w

dp3 r0,r0,-c16 // normal.light -> lighting constant
mul r0.xyz,r0,c17 // modulate against material diffuse color
add oD0.xyz,r0,c19 // add environment light



mov r1.w,c20.w // r1.w=1
dp4 r0,v0,c10 // distance to camera position
add r0,r0,-c20.x // distance-fog_start
mad r0.x,-r0.x,c20.z,r1.w // 1-(distance-fog_start)*(1/(fog_end-fog_start))
max oFog.x,r0.x,c95.w // clamp with custom max value
//---------------------

};

pixelShader=
asm
{
ps.1.1
def c0,1,1,1,1
tex t0 //sand mit mud textur
tex t1 //stein mit detail textur
tex t2 //grass mit dreck textur
tex t3 //blendmap

mov r1,t0
lrp r0.rgb,t3.a,r1,t1 // blend t0 with t1 depending on t3 alpha
+mov r0.a,c0

mov r1.a,t3.b
lrp r0.rgb,r1.a,r0,t2 // blend the result with t2 depending on t3 blue
+mov r0.a,c0

mul r0.rgb,r0,v0 // modulate with diffuse vertex lighting
};

}
//neuer pass textur detail
pass p1
{
texture[0]=<mtlSkin3>;
texture[1]=<mtlSkin2>;
texture[2]=<mtlSkin4>;
texture[3]=<entSkin1>;

magFilter[0]=linear;
minFilter[0]=linear;
mipFilter[0]=linear;

magFilter[1]=linear;
minFilter[1]=linear;
mipFilter[1]=linear;

magFilter[2]=linear;
minFilter[2]=linear;
mipFilter[2]=linear;

magFilter[3]=linear;
minFilter[3]=linear;
mipFilter[3]=linear;

vertexShader=
decl
{
stream 0;
float v0[3]; //position
float v3[3]; //normal
float v7[2]; //uv
}
asm
{
vs.1.0
m4x4 oPos,v0,c0 // transform position to clip space

mul oT0.xy,v7.xy,c65.xy
mul oT1.xy,v7.xy,c65.xy
mul oT2.xy,v7.xy,c65.xy
mov oT3.xy,v7.xy

//-----------------
m3x3 r0,v3,c4 // transform normal to world space
dp3 r0.w,r0,r0 // renormalize it
rsq r0.w,r0.w
mul r0,r0,r0.w

dp3 r0,r0,-c16 // normal.light -> lighting constant
mul r0.xyz,r0,c17 // modulate against material diffuse color
add oD0.xyz,r0,c19 // add environment light

mov r1.w,c20.w // r1.w=1
dp4 r0,v0,c10 // distance to camera position
add r0,r0,-c20.x // distance-fog_start
mad r0.x,-r0.x,c20.z,r1.w // 1-(distance-fog_start)*(1/(fog_end-fog_start))
max oFog.x,r0.x,c95.w // clamp with custom max value
//---------------------

};

pixelShader=
asm
{
ps.1.1
def c0,0,0,0,0.2 // texture alpha
tex t0
tex t1
tex t2
tex t3

mov r1,t0.a
lrp r0.rgb,t3.a,r1,t1.a // blend t0 with t1 depending on t3 alpha
+mov r0.a,c0

mov r1.a,t3.b
lrp r0.rgb,r1.a,r0,t2.a // blend the result with t2 depending on t3 blue
+mov r0.a,c0

mul r0.rgb,r0,v0 // modulate with diffuse vertex lighting
};
}

//new pass cursor
pass p2
{
texture[0]=<entSkin2>;
texture[1]=<mtlSkin1>;

magFilter[0]=linear;
minFilter[0]=linear;
mipFilter[0]=linear;

magFilter[1]=linear;
minFilter[1]=linear;
mipFilter[1]=linear;

vertexShader=
decl
{
stream 0;
float v0[3]; //position
float v3[3]; //normal
float v7[2]; //uv
}
asm
{
vs.1.0
m4x4 oPos,v0,c0 // transform position to clip space

mov oT0.xy,v7.xy
mul oT1.xy,v7.xy,c64.xy
};

pixelShader=
asm
{
ps.1.1
def c0,0,0,0,1
tex t0
tex t1

mul r0,t0,c0
lrp r0.rgb,t0,t1,t1
};
}



}
";
}


starter mat_terrain_multitexture_init
{
bmap_to_mipmap(mat_terrain_multitexture.skin1);
bmap_to_mipmap(mat_terrain_multitexture.skin2);
bmap_to_mipmap(mat_terrain_multitexture.skin3);
bmap_to_mipmap(mat_terrain_multitexture.skin4);
}




Re: help ! terrain shader dont works on 6.31 | 6.22 ok [Re: Loetkolben] #37552
12/10/04 10:32
12/10/04 10:32
Joined: Dec 2003
Posts: 1,097
Maryland, USA
Steempipe Offline
Serious User
Steempipe  Offline
Serious User

Joined: Dec 2003
Posts: 1,097
Maryland, USA
You can look at this to see what changes are needed.... This is pruned down so you can read it better.

Things to do are in red.

Code:

technique Pixelshader11
{
pass p0
{

vertexShaderConstant[64]= { 20.0,20.0,20.0,20.0};
vertexShader=

asm
{
vs.1.1

dcl_position v0
dcl_normal v3
dcl_texcoord0 v7


Typical stuff...............



// Fog
mov r1.w,c20.w
dp4 r0,v0,c10
add r0,r0,-c20.x
mad r0.x,-r0.x,c20.z,r1.w
max oFog,r0.x,c95.w
};

}




Re: help ! terrain shader dont works on 6.31 | 6.22 ok [Re: Steempipe] #37553
12/10/04 11:26
12/10/04 11:26
Joined: Mar 2003
Posts: 228
Loetkolben Offline OP
Member
Loetkolben  Offline OP
Member

Joined: Mar 2003
Posts: 228
hi,

thanks it works on all my 5 shaders NOW.
great 1.million stars.
but other thing´s dont works now.
need new sdk to fix other thing´s.


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