about UV move only skin1 or skin2..... skinX etc.

Posted By: 20BN

about UV move only skin1 or skin2..... skinX etc. - 07/29/18 14:08

Hi all.
Is passable skin 2 UV moving, but skin 1 don't move?
Posted By: Superku

Re: about UV move only skin1 or skin2..... skinX etc. - 07/29/18 15:38

Apply 2 different materials to your object, use entity.material and ent_mtlset for one of the 2 skins.
For example with this effect code:
Code:
const float4x4 matWorldViewProj;
const float4x4 matWorld;
const float fAmbient;
const float4 vecSunDir;
const float4 vecSkill41;

texture entSkin1;

sampler ColorMapSampler = sampler_state 
{ 
   Texture = <entSkin1>; 
   AddressU  = Clamp; 
   AddressV  = Clamp; 
}; 
    
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+vecSkill41.xy;
} 
    
float4 DiffusePS( 
   in float2 InTex: TEXCOORD0, 
   in float3 InNormal: TEXCOORD1): COLOR 
{ 
	InNormal = normalize(InNormal);
   float Diffuse = saturate(dot(-vecSunDir, InNormal))*0.5+0.5;
   float4 Color = tex2D(ColorMapSampler, InTex); 
   float4 final = Color*Diffuse;
  
   return (1+fAmbient) * final; 
} 
 

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


Create 2 materials, duplicate this effect file, include the vecSkill41.xy part in only one of the materials. Then change the texture shift ("UV") by using:
entity.skill41 = floatv(entity.u);
entity.skill42 = floatv(entity.v);
© 2024 lite-C Forums