Gamestudio Links
Zorro Links
Newest Posts
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (EternallyCurious, AndrewAMD, TipmyPip, Quad), 889 guests, and 8 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
searching for an multitexturing-shader + detailmap #59364
11/20/05 16:49
11/20/05 16:49
Joined: Nov 2005
Posts: 15
R
RaSTaFaRi_87 Offline OP
Newbie
RaSTaFaRi_87  Offline OP
Newbie
R

Joined: Nov 2005
Posts: 15
Hi,

im searching for an Multitexturing-shader with detailmap.
I've already tried a multitexturing-shader, but with only two texturemaps and one detailmap.

Is there a shader with 3(4) texturemaps and one detailmap?



RaSTaFaRi_87


VISIT CYBRAS AT www.cybras.de.tt
Re: searching for an multitexturing-shader + detai [Re: RaSTaFaRi_87] #59365
11/20/05 16:53
11/20/05 16:53
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline
Expert
Matt_Aufderheide  Offline
Expert
M

Joined: Oct 2003
Posts: 4,131
Textures are blended by thier alpha channel, just give the terrain 4 skins, and and then make sure youn define the detail texture somewhere and assign it to material skin 1.

Code:

//fixed function terrain shader, blends 4 color texture based on thier alpha channels,
// and blends a detail texture over that


////////////////////////////////////////////////////
// Assign the tile size of the Textures.
//

float Skin_Size1 = 60;
float Skin_Size2 = 60;
float Skin_Size3 = 50;
float Skin_Size4 = 40;

//detail texture
float Skin_Size5 = 400;

float4 vecLight;


/////////////////////////////////////////////////////////////////////////////////////
// Let's allow for adjusting the intensity of the ambient light color on the passes.
//
float ambientLightFactor = 0.5;


////////////////////////////////////////////////////////////////////
// Here we just create and plug some values into a matrix for
// use in multiplying during the stages.
//

float4x4 matTerrainTexSize = {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
};


float4x4 matAlphaMapSize = {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
};


Texture mtlSkin1; //detail texture
Texture entSkin1; //1st tile tex RGB
Texture entSkin2; //2nd tile tex RGB and blender in A
Texture entSkin3; //3nd tile tex RGB and blender in A
Texture entSkin4; //4nd tile tex RGB and blender in A


sampler s_ShaleTex = sampler_state
{
Texture = (entSkin1);
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
AddressW = Wrap;

MipMapLodBias=-0.2;
};


sampler s_SandTex = sampler_state
{
Texture = (entSkin2);
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
AddressW = Wrap;

MipMapLodBias=-0.2;
};


sampler s_GrassTex = sampler_state
{
Texture = (entSkin3);
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
AddressW = Wrap;

MipMapLodBias=-0.1;
};


sampler s_RoadTex = sampler_state
{
Texture = (entSkin4);
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
AddressW = Wrap;

MipMapLodBias=0;
};

sampler grass_detail = sampler_state
{
Texture = (mtlSkin1);
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
AddressW = Wrap;
MipMapLodBias=0;
};



technique technique_one

{

pass p0
{
Sampler[0] = (s_ShaleTex);

AlphaBlendEnable = False;
AlphaTestEnable = False;
DitherEnable = True;
zWriteEnable = True;
zEnable = True;
Lighting=True;

Ambient = mul(vecLight, ambientLightFactor);

TextureTransformFlags[0] = Count2;
TexCoordIndex[0] = 1;
TextureTransform[0]= mul(matTerrainTexSize,Skin_Size1);

ColorOp[0] = Modulate2x;
ColorArg1[0] = Texture;
ColorArg2[0] = Diffuse;
AlphaOp[0] = Disable;


}


pass p1
{
Sampler[0] = (s_SandTex); // Blendmap is Alpha
Sampler[1] = (s_SandTex); // The Colormap

Lighting = True;

AlphaBlendEnable = True;

SrcBlend = SrcAlpha;
DestBlend = InvSrcAlpha;

zWriteEnable = True;
zEnable = True;

Ambient = mul(vecLight, ambientLightFactor);

TextureTransformFlags[0] = Count2;
TextureTransform[0]= (matAlphaMapSize);
texcoordindex[0]=0;
ColorArg1[0] = Texture;
ColorOp[0] = SelectArg1;
AlphaArg1[0] = Texture;
AlphaOp[0] = SelectArg1;

TextureTransformFlags[1] = Count2;
TextureTransform[1]= mul(matTerrainTexSize, Skin_Size2);
texcoordindex[1]=1;

ColorArg1[1] = Texture;
ColorArg2[1]= Diffuse;
ColorOp[1] =Modulate2x;
alphaarg1[1] = current;
alphaop[1]=Disable;

}

pass p2
{
Sampler[0] = (s_GrassTex); // Blendmap is Alpha
Sampler[1] = (s_GrassTex); // The Colormap

DitherEnable=True;

AlphaBlendEnable = True;

SrcBlend = SrcAlpha;
DestBlend = InvSrcAlpha;

DitherEnable = True;
zWriteEnable = True;
zEnable = True;

Ambient = mul(vecLight, ambientLightFactor);

TextureTransformFlags[0] = Count2;
TextureTransform[0]= (matAlphaMapSize);
texcoordindex[0]=0;
ColorArg1[0] = Texture;
ColorOp[0] = SelectArg1;
AlphaArg1[0] = Texture;
AlphaOp[0] = SelectArg1;

TextureTransformFlags[1] = Count2;
TextureTransform[1]= mul(matTerrainTexSize, Skin_Size3);
texcoordindex[1]=1;

ColorArg1[1] = Texture;
ColorArg2[1]= Diffuse;
ColorOp[1] =Modulate2x;
alphaarg1[1] = current;
alphaop[1]=Disable;

}

pass p3
{
Sampler[0] = (s_RoadTex); // Blendmap is Alpha
Sampler[1] = (s_RoadTex); // The Colormap

Lighting = True;

AlphaBlendEnable = True;

SrcBlend = srcAlpha;
DestBlend = InvSrcAlpha;

Ambient = mul(vecLight, ambientLightFactor);

TextureTransformFlags[0] = Count2;
TextureTransform[0]= (matAlphaMapSize);
texcoordindex[0]=0;
ColorArg1[0] = Texture;
ColorOp[0] = SelectArg1;
AlphaArg1[0] = Texture;
AlphaOp[0] = SelectArg1;

TextureTransformFlags[1] = Count2;
TextureTransform[1]= mul(matTerrainTexSize, Skin_Size4);
texcoordindex[1]=1;

ColorArg1[1] = Texture;
ColorArg2[1]= Diffuse;
ColorOp[1] =Modulate2x;
alphaarg1[1] = current;
alphaop[1]=Disable;

}

//detail texture pass
pass p4
{
Sampler[0] = (grass_detail); // Blendmap is Alpha
Sampler[1] = (grass_detail);
AlphaBlendEnable = true;
fogcolor={1.0,1.0,1.0,1.0};
fogstart = 100.0f;
fogend = 500.0f;
Ambient = mul(vecLight, ambientLightFactor);

//multiply blending
srcblend=zero;
destblend=srccolor;
lighting=false;

zWriteEnable = True;
zEnable = True;

TextureTransformFlags[1] = Count2;
TextureTransform[1]= mul(matTerrainTexSize, Skin_Size5);
texcoordindex[1]=1;

ColorOp[1] = modulate;
ColorArg1[1] = Texture;
ColorArg2[1] = diffuse;
AlphaOp[0] = Disable;

}

}




Sphere Engine--the premier A6 graphics plugin.
Re: searching for an multitexturing-shader + detai [Re: Matt_Aufderheide] #59366
11/20/05 20:47
11/20/05 20:47
Joined: Nov 2005
Posts: 15
R
RaSTaFaRi_87 Offline OP
Newbie
RaSTaFaRi_87  Offline OP
Newbie
R

Joined: Nov 2005
Posts: 15
Hey thanks, but it doesnt work fully.

i only can see the grey detailmap on the terrain and the FPS are very lowly (5-15 FPS)

is it possible to blend 3 or 4 detailmapts with an high FPS??



RaSTaFaRi


VISIT CYBRAS AT www.cybras.de.tt
Re: searching for an multitexturing-shader + detai [Re: RaSTaFaRi_87] #59367
11/21/05 00:42
11/21/05 00:42
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline
Expert
Matt_Aufderheide  Offline
Expert
M

Joined: Oct 2003
Posts: 4,131
This should run with a high fps.. also you must make sure you have made the blend maps in the alpha channels of each terrain texture.


Sphere Engine--the premier A6 graphics plugin.
Re: searching for an multitexturing-shader + detai [Re: Matt_Aufderheide] #59368
11/21/05 00:45
11/21/05 00:45
Joined: Nov 2005
Posts: 15
R
RaSTaFaRi_87 Offline OP
Newbie
RaSTaFaRi_87  Offline OP
Newbie
R

Joined: Nov 2005
Posts: 15
yes, this is done, but i still have a low FPS.
but i can only see the detailmap, no texturemaps.


VISIT CYBRAS AT www.cybras.de.tt
Re: searching for an multitexturing-shader + detai [Re: RaSTaFaRi_87] #59369
11/21/05 03:42
11/21/05 03:42
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline
Expert
Matt_Aufderheide  Offline
Expert
M

Joined: Oct 2003
Posts: 4,131
Well. what video card do you have?


Sphere Engine--the premier A6 graphics plugin.
Re: searching for an multitexturing-shader + detai [Re: Matt_Aufderheide] #59370
11/21/05 23:21
11/21/05 23:21
Joined: Nov 2005
Posts: 15
R
RaSTaFaRi_87 Offline OP
Newbie
RaSTaFaRi_87  Offline OP
Newbie
R

Joined: Nov 2005
Posts: 15
I have a Radeon 8500, this should reach right?


VISIT CYBRAS AT www.cybras.de.tt

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