Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 20:05
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (Grant, dr_panther, AndrewAMD), 1,379 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Multitex - Shader #54036
09/02/05 11:01
09/02/05 11:01
Joined: Jul 2002
Posts: 185
T
TheZero Offline OP
Member
TheZero  Offline OP
Member
T

Joined: Jul 2002
Posts: 185
Hallo,
Vor einer Weile gab mir Oliver2S einen Multitexturing Shader. Er soll angeblich super laufen, bei mir gibt es jedoch ein Problem: Die Texturen werden zugleich als Alphamaps verwendet. Die eigentlichen Alphamaps nehmen keinen Einfluss auf den Shader.

(Die Texturen sind als externe Dateien gespeichert, die Blendmaps als Entity Skins 1-3, die 4.Skin ist eine Shadowmap)

Code:

BMAP detail1_bmp = "tex3.tga";
BMAP detail2_bmp = "tex4.tga";
BMAP detail3_bmp = "tex1.tga";
BMAP detail4_bmp = "tex2.tga";

FUNCTION mtl_terraintex_init()
{
mtl.matrix11 = float(27); // default u scale
mtl.matrix22 = float(27); // default v scale
bmap_to_mipmap(mtl.skin1);
bmap_to_mipmap(mtl.skin2);
bmap_to_mipmap(mtl.skin3);
bmap_to_mipmap(mtl.skin4);
}

MATERIAL mat_ffp_multitex
{
event = mtl_terraintex_init;
skin1 = detail1_bmp; //Textur 1
skin2 = detail2_bmp; //Textur 2
skin3 = detail3_bmp; //Textur 3
skin4 = detail4_bmp; //Textur 4

effect
"
TEXTURE entSkin1; //Blendmap1
TEXTURE entSkin2; //Blendmap1
TEXTURE entSkin3; //Blendmap1
TEXTURE entSkin4; //Shadowmap

TEXTURE mtlSkin1;
TEXTURE mtlSkin2;
TEXTURE mtlSkin3;
TEXTURE mtlSkin4;


matrix matMtl;

technique ffp_terrain_tex
{

pass P0
//////////////////////////////////////////////////////
//// Lets lay the first TEXTURE down. no alpha work
//// This will tile across the entire HMP
//////////////////////////////////////////////////////
{

LIGHTING = false;
CULLMODE = CCW;
alphablendenable=false;
alphatestenable=false;
zenable=true;
zwriteenable=true;

////////////////////////////////////////
// Stage 0
///////////////////////////////////////

TEXTURE[0] = <mtlSkin4>;

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

zenable=true;
zwriteenable=true;

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


TEXTURETransformFlags[0] = Count2;
TEXTURETransform[0] = <matMtl>;
texcoordindex[0]=1;

COLORARG1[0] = TEXTURE;
ColorOp[0] = MODULATE;
ALPHAARG1[0] = CURRENT | ALPHAREPLICATE;
alphaop[0]=disable;

//////////////////////////////////////
//stage 1
//////////////////////////////////////

colorop[1]=disable;
alphaop[1]=disable;

}

pass P1
//////////////////////////////////////////////////////
//// Now we blend another TEXTURE using an alphamap
//// This TEXTURE will be blended
//////////////////////////////////////////////////////
{

//////////////////////////////////////
// Stage 0 - Setup the alphamap
//////////////////////////////////////

// We need to enable alphablending
LIGHTING = false;
CULLMODE = CCW;
alphablendenable=true;
srcblend=srcalpha;
destblend=invsrcalpha;

// AlphaTestEnable uses the AlphaRef and AlphaFunc to
// determine which pixels get drawn.
// In this case, anything greater that 0 will be drawn.
alphatestenable=true;
alpharef=0x00000000; //Reference Value
alphafunc=Greater; //Comparison Function

TEXTURE[0] = <entSkin1>;

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

//
// We don't want the alphamap to tile
//
TEXTURETransformFlags[0] = disable;

texcoordindex[0]=0;

COLORARG1[0] = CURRENT;
ColorOp[0] = SELECTARG1;
ALPHAARG1[0] = TEXTURE | ALPHAREPLICATE;
alphaop[0]=selectarg1;

//////////////////////////////////////////////
// Stage 1 -- This is the TEXTURE to splat
//////////////////////////////////////////////

TEXTURE[1] = <mtlSkin1>;


// Zenable is supposed to default to true.
// This enables depth testing to determine what pixels
// are visible to the viewer

zenable=true;
zwriteenable=true;

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


TEXTURETransformFlags[1] = Count2;
TEXTURETransform[1] = <matMtl>;
texcoordindex[1]=1;

COLORARG1[1] = TEXTURE;
ColorOp[1] = MODULATE;
ALPHAARG1[1] = CURRENT | ALPHAREPLICATE;
alphaop[1]=disable;

///////////////////////////////////////////////
// Stage 2
///////////////////////////////////////////////
colorop[2]=disable;
alphaop[2]=disable;


}

pass P2
////////////////////////////////////////////////////
//// A ditto of Pass p1 but with different a different
//// TEXTURE and alphamap
///////////////////////////////////////////////////
{

////////////////////////////////////////
// Stage 0
////////////////////////////////////////
LIGHTING = false;
CULLMODE = CCW;
alphablendenable=true;
srcblend=srcalpha;
destblend=invsrcalpha;
alphatestenable=true;
alpharef=0x00000000;
alphafunc=Greater;

TEXTURE[0] = <entSkin2>;

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


TEXTURETransformFlags[0] = disable;

texcoordindex[0]=0;

COLORARG1[0] = CURRENT;
ColorOp[0] = selectarg1;
ALPHAARG1[0] = TEXTURE | ALPHAREPLICATE;
alphaop[0]=selectarg1;

/////////////////////////////////////////
// Stage 1
/////////////////////////////////////////
TEXTURE[1] = <mtlSkin2>;

zenable=true;
zwriteenable=true;

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


TEXTURETransformFlags[1] = Count2;
TEXTURETransform[1] = <matMtl>;
texcoordindex[1]=1;

COLORARG1[1] = TEXTURE;
ColorOp[1] = modulate;
ALPHAARG1[1] = CURRENT | ALPHAREPLICATE;
alphaop[1]=disable;

////////////////////////////////////////
// Stage 2
////////////////////////////////////////
colorop[2]=disable;
alphaop[2]=disable;

} // End of Pass P2


pass P3
////////////////////////////////////////////////////
//// A ditto of Pass p1 but with different a different
//// TEXTURE and alphamap
///////////////////////////////////////////////////
{

////////////////////////////////////////
// Stage 0
////////////////////////////////////////

LIGHTING = false;
CULLMODE = CCW;
alphablendenable=true;
srcblend=srcalpha;
destblend=invsrcalpha;
alphatestenable=true;
alpharef=0x00000000;
alphafunc=Greater;

TEXTURE[0] = <entSkin3>;

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


TEXTURETransformFlags[0] = disable;

texcoordindex[0]=1;

COLORARG1[0] = CURRENT;
ColorOp[0] = selectarg1;
ALPHAARG1[0] = TEXTURE | ALPHAREPLICATE;
alphaop[0]=selectarg1;

/////////////////////////////////////////
// Stage 1
/////////////////////////////////////////
TEXTURE[1] = <mtlSkin3>;

zenable=true;
zwriteenable=true;

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


TEXTURETransformFlags[1] = Count2;
TEXTURETransform[1] = <matMtl>;
texcoordindex[1]=0;


COLORARG1[1] = TEXTURE;
ColorOp[1] = modulate;
ALPHAARG1[1] = CURRENT | ALPHAREPLICATE;
alphaop[1]=disable;

////////////////////////////////////////
// Stage 2
////////////////////////////////////////
colorop[2]=disable;
alphaop[2]=disable;

} // End of Pass P3

pass p4
{
LIGHTING = false;
CULLMODE = CCW;
alphablendenable=true;
srcblend=zero;
destblend=srccolor;
zenable=true;
zwriteenable=true;
ditherenable=true;
COLORARG1[0] = DIFFUSE;
ColorOp[0] = Modulate2x;
ColorArg2[0] = Current;
alphaop[0]=disable;

Texture[1] = <entSkin4>;
magFilter[1]=linear;
minFilter[1]=linear;
mipFilter[1]=linear;
COLORARG1[1] = TEXTURE;
ColorOp[1] = Modulate2x;
TexCoordIndex[1]=0;
TextureTransformFlags[1]=Count2;
TextureTransform[1]=
{
1.0,0.0,0.0,0.0,
0.0,1.0,0.0,0.0,
0.0,0.0,0.0,0.0,
0.0,0.0,0.0,0.0
};
}
} // End of Technique
";
}


An der Graka kanns doch nicht liegen, dass die falschen Texturen als Blendmaps verwendet werden?!

Bitte helft mir weiter,
zero

Re: Multitex - Shader [Re: TheZero] #54037
09/20/05 11:23
09/20/05 11:23
Joined: Sep 2005
Posts: 274
Switzerland - Zurich
zwecklos Offline
Member
zwecklos  Offline
Member

Joined: Sep 2005
Posts: 274
Switzerland - Zurich
Hi
Ich hatte auch eben ein paar Probleme mit Multitexturing =).
Weiss nicht genau ob es dir weiterhilt aber wieviele skins hat dein terrain?
Nur weil du was von texturen als externe dateien gesagt hattest, bin mir aber nicht sicher ob ich dich richtig verstanden hab.
Die texturen müssen alle auf dem terrain/hmp zugeordnet sein. Nur die blendmaps benötigst du als externe dateien.

Ich hoffe das hilft dir weiter

cheers


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