Gamestudio Links
Zorro Links
Newest Posts
no trade when there is a negative trained WFOcycle
by maxwellreturn. 08/24/19 22:33
Skip Stepcycle
by maxwellreturn. 08/24/19 22:27
Script filename
by MatPed. 08/24/19 20:49
Any Old Timers Still Around?
by pyramide. 08/24/19 18:23
Oanda FIFO issue?
by AndrewAMD. 08/24/19 12:10
IG plugin initial release
by Dalla. 08/24/19 06:06
Tutorial for Vector Graphics
by Dooley. 08/23/19 22:32
Issue with dataParse function
by byakuren81. 08/23/19 21:57
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
1 registered members (AndrewAMD), 633 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Ysbail, trader4321, GorgonzolaBYTE, Southqvist, tawin
18272 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Texture Shifting #476415
02/23/19 13:35
02/23/19 13:35
Joined: Oct 2008
Posts: 658
Germany
Ayumi Offline OP
User
Ayumi  Offline OP
User

Joined: Oct 2008
Posts: 658
Germany
I want to shift texture coords and i tryed this from Wiki:


Code:
BMAP* a = "alpha.pcx";
BMAP* b = "mtl2.pcx";

MATERIAL* mtl_UV_alphaClamp = 
{	

  skin1=a;
  skin2=b;
   effect = " 
      matrix matMtl;
		texture entSkin1;
		texture mtlSkin1;
		texture mtlSkin2;	
		
      technique uvspeed
      {
         pass p0
			{
				// For this we must reorder the textures
				 Texture[0] = <entSkin1>;       // block
				 Texture[1] = <mtlSkin2>;       // grass
				 Texture[2] = <mtlSkin1>;       // alpha
				
				 TexCoordIndex[0] = 1;          //
				 TexCoordIndex[1] = 1;          //
				 TexCoordIndex[2] = 1;          //
				
				 ColorArg1[0] = Texture;        // Get texture in 0
				 ResultArg[0] = Temp;           // and save it in temp
				
				 ColorArg1[1] = Texture;        // Get texture in 1
				 ColorOp[1] = SelectArg1;       // and make it current
				
				 TextureTransformFlags[2] = Count2; // Select shifting and set matrix values
				 TextureTransform[2] = 	{
							1.0, 0.0, 0.0, 0.0, // xscale, rotate, ------, ------
							0.0, 1.0, 0.0, 0.0, // ------, yscale, ------, ------
							2.0, 2.0, 0.0, 0.0, // xshift, yshift, ------, ------
							0.0, 0.0, 0.0, 0.0  // ------, ------, ------, ------
							};
				
				 ColorArg0[2] = Texture;        // Get texture in 2 (alpha)
				 ColorArg1[2] = Current;        // and the current (grass)
				 ColorOp[2] = Lerp;             // interpolate
				 ColorArg2[2] = Temp;           // and from temp (stone)
				
 
         }
      }";
}




Interpolation is right but no shifting.

I also tryed the FFP from HeelX but it also doesn t work.

HeelX Alpha Clamp FFP

Any idea or hint?

Re: Texture Shifting [Re: Ayumi] #476419
02/23/19 19:37
02/23/19 19:37
Joined: Sep 2003
Posts: 6,844
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,844
Kiel (Germany)
I don't know how to use those FFP things but you can use the following shader code which does UV shifting and add alpha blending with another texture or whatever you want to do:

Code:
const float4x4 matWorldViewProj;
const float4x4 matWorld;
const float fAmbient;
const float4 vecSunDir;
const float4x4 matTexture;

texture entSkin1;

sampler ColorMapSampler = sampler_state 
{ 
   Texture = <entSkin1>; 
   AddressU  = Wrap; 
   AddressV  = Wrap; 
}; 
    
void DiffuseVS( 
   in float4 InPos: POSITION, 
   in float3 InNormal: NORMAL, 
   in float2 InTex: TEXCOORD0, 
   out float4 OutPos: POSITION, 
   out float2 OutTex: TEXCOORD0, 
   out float3 OutNormal: TEXCOORD1) 
{ 
   OutPos = mul(InPos, matWorldViewProj); 
   OutNormal = mul(InNormal, matWorld);
   OutTex = InTex+float2(matTexture._m20,matTexture._m21);
} 
    
float4 DiffusePS( 
   in float2 InTex: TEXCOORD0, 
   in float3 InNormal: TEXCOORD1): COLOR 
{ 
	InNormal = normalize(InNormal);
   float Diffuse = saturate(dot(-vecSunDir, InNormal))*0.7+0.3; 
   float4 Color = tex2D(ColorMapSampler, InTex); 
   float4 final = Color*Diffuse;
  
   return (1+fAmbient) * final; 
} 
 

technique DiffuseTechnique 
{ 
   pass P0 
   { 
   cullmode = none;
      VertexShader = compile vs_2_0 DiffuseVS(); 
      PixelShader  = compile ps_2_0 DiffusePS(); 
   } 
}



"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Texture Shifting [Re: Superku] #476421
02/23/19 20:12
02/23/19 20:12
Joined: Oct 2008
Posts: 658
Germany
Ayumi Offline OP
User
Ayumi  Offline OP
User

Joined: Oct 2008
Posts: 658
Germany
Thanks for your response and code snipped:) I favorite FFPs but if there is no other way, i will go your way.

Re: Texture Shifting [Re: Ayumi] #476424
02/24/19 11:07
02/24/19 11:07
Joined: Oct 2008
Posts: 658
Germany
Ayumi Offline OP
User
Ayumi  Offline OP
User

Joined: Oct 2008
Posts: 658
Germany
I work hard and harder...and got it. grin
There seems a different between A8 and A7.

If you use A8, just set my.u/v and the material.

If you use A7, don t try to convert by floatd().

mtl.matrix31 = my.skill1; (or another value)
mtl.matrix32 = my.skill2;


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