2 registered members (AndrewAMD, kzhao),
901
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Move skin/material
[Re: Timothy]
#328300
06/11/10 18:06
06/11/10 18:06
|
Joined: Nov 2007
Posts: 1,143 United Kingdom
DJBMASTER
Serious User
|
Serious User
Joined: Nov 2007
Posts: 1,143
United Kingdom
|
In the shader you want to use the 'entSkin2' (entity skin 2) or 'mtlSkin2' (material skin 2) texture. The way to scroll/shift the texture is to change the texture coordinates. In the pixel shader there will probably be something like this...
return tex2D(sampler,inTex);
...so just modify the 'inTex' parameter...
float2 coords = float2(inTex.x + 0.5, inTex.y); // example shift in x
return tex2D(sampler,coords);
Last edited by DJBMASTER; 06/11/10 18:42.
|
|
|
Re: Move skin/material
[Re: Timothy]
#328305
06/11/10 18:49
06/11/10 18:49
|
Joined: Nov 2007
Posts: 1,143 United Kingdom
DJBMASTER
Serious User
|
Serious User
Joined: Nov 2007
Posts: 1,143
United Kingdom
|
Here, try this simple shader. Play around with the values of the 'coords' variable to shift the texture...
const matrix<float,4,4> matWorldViewProj;
texture entSkin2;
sampler map_sampler = sampler_state
{
Texture = <entSkin2>;
};
void ShiftPass_VS
(
in float4 inPos : POSITION0,in float2 inTex : TEXCOORD0,
out float4 outPos : POSITION0,out float2 outTex : TEXCOORD0
)
{
outPos = mul(inPos, matWorldViewProj);
outTex = inTex;
}
float4 ShiftPass_PS(in float2 inTex : TEXCOORD0) : COLOR
{
// play with these values
float2 coords = float2(inTex.x + 0.5,inTex.y);
return tex2D(map_sampler,coords);
}
technique ShaderTechnique
{
pass ShiftPass
{
VertexShader = compile vs_2_0 ShiftPass_VS();
PixelShader = compile ps_2_0 ShiftPass_PS();
}
}
technique fallback { pass one { } }
Texture coordinates lie within the range 0..1.
Last edited by DJBMASTER; 06/11/10 18:52.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|