Gamestudio Links
Zorro Links
Newest Posts
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
1 registered members (Ayumi), 662 guests, and 3 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
Multitexture base blending #299921
11/28/09 05:42
11/28/09 05:42
Joined: Dec 2008
Posts: 528
Wagga, Australia
the_mehmaster Offline OP
User
the_mehmaster  Offline OP
User

Joined: Dec 2008
Posts: 528
Wagga, Australia
I have almost nil experience with shaders...

As you would know, the multitexture terrain shader (terraintex, not terraintex3) just 'splats' detail texture layers on top of the terrain, with no consideration for the texture underneath, which becomes invisible. What i would like to acheive is a shader with the same functionality, but where the detail textures are multiplied over the base texture.

Is this possible?

Re: Multitexture base blending [Re: the_mehmaster] #299924
11/28/09 06:26
11/28/09 06:26
Joined: Aug 2008
Posts: 482
B
bart_the_13th Offline
Senior Member
bart_the_13th  Offline
Senior Member
B

Joined: Aug 2008
Posts: 482
Sure, it's still possible...
You can use umm... I forgot the code but I think it should be:
Code:
ColorOps[X]=Add;//Where X is the stage number range from 0 to number of layers


You can change Add with Multiply, Multiply2X or Multiply4X...
Hope it helps laugh

[EDIT]
You can also add a bump map using
Code:
ColorOps[X]=DOT3//Or something like that



Sorry it's been a while since I do 3DGS and shaders...

Last edited by bart_the_13th; 11/28/09 06:28.
Re: Multitexture base blending [Re: bart_the_13th] #299926
11/28/09 06:52
11/28/09 06:52
Joined: Dec 2008
Posts: 528
Wagga, Australia
the_mehmaster Offline OP
User
the_mehmaster  Offline OP
User

Joined: Dec 2008
Posts: 528
Wagga, Australia
Here's what I need to modify:

Code:
//////////////////////////////////////////////////////////////////////
// terraintex.fx
// Terrain material for an unlimited number of terrain textures
// Tiled texture on RGB, mask on alpha 

Texture entSkin1; // basic tiled terrain texture
Texture LightMap; // lightmap created by the map compiler

bool PASS_SOLID; // enforce rendering on the solid pass

bool AUTORELOAD;

//////////////////////////////////////////////////////////////////////

// technique without lightmap
technique terraintex
{
   pass multi_repeat11
   {
      ZWriteEnable = True;
		AlphaBlendEnable = True;
		SrcBlend = SrcAlpha;
      DestBlend = InvSrcAlpha;
		
		Texture[0] = <entSkin1>;
		TexCoordIndex[0] = 0;
		AlphaOp[0] = SelectArg1;
		AlphaArg1[0] = Texture;
		
		Texture[1] = <entSkin1>;
		TexCoordIndex[1] = 1;
      ColorArg1[1] = Texture; 
	   ColorArg2[1]= Diffuse;
	   ColorOp[1] = Modulate4x;
	   AlphaArg1[1] = Current;
	   AlphaOp[1] = SelectArg1;

	   ColorOp[2] = Disable;
	   AlphaOp[2] = Disable;
	}
}

// technique with lightmap
technique terraintex_lm
{
	pass multi_repeat11
	{
      ZWriteEnable = True;
		AlphaBlendEnable = True;
		SrcBlend = SrcAlpha;
      DestBlend = InvSrcAlpha;
		
		Texture[0] = <entSkin1>;
		TexCoordIndex[0] = 0;
		AlphaOp[0] = SelectArg1;
		AlphaArg1[0] = Texture;
		
		Texture[1] = <LightMap>;
		TexCoordIndex[1] = 0;
      ColorArg1[1] = Texture; 
	   ColorArg2[1]= Diffuse;
	   ColorOp[1] = AddSigned;
	   AlphaArg1[1] = Current;
	   AlphaOp[1] = SelectArg1;

		Texture[2] = <entSkin1>;
		TexCoordIndex[2] = 1;
      ColorArg1[2] = Texture; 
	   ColorArg2[2]= Current;
	   ColorOp[2] = Modulate2x;
	   AlphaArg1[2] = Current;
	   AlphaOp[2] = SelectArg1;

	   ColorOp[3] = Disable;
	   AlphaOp[3] = Disable;
	}
}

// fallback if nothing works
technique fallback { pass one { } }



I tried what you said, but that just made the terrain brighter. Maybe i'm doing something wrong... can you modify it please? Thanks!

Re: Multitexture base blending [Re: the_mehmaster] #299930
11/28/09 07:21
11/28/09 07:21
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
If you don't have a terrain lightmap, I would use the lightmap technique because it already does what you want, multiply all detail textures with the lightmap texture. You just need to define the terrain base skin as a bmap, and then copy it into the terrain lightmap pointer

my.lightmap = baseskin_bmap;

Then you dont need to modify the shader. At least thats the general idea - haven't tried it but might be worth a try.

Re: Multitexture base blending [Re: Spirit] #299934
11/28/09 07:42
11/28/09 07:42
Joined: Dec 2008
Posts: 528
Wagga, Australia
the_mehmaster Offline OP
User
the_mehmaster  Offline OP
User

Joined: Dec 2008
Posts: 528
Wagga, Australia
Wow! Turns out you're right, that works perfectly.

Only issue is that the multiplication is a bit too harsh.. but I can resolve that myself.

Thanks Spiritsmile


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