Posted By: Error014
matTexture not getting calculated - 08/04/12 20:55
Hello!
There's a strange bug concerning matTexture - it seems that it's not getting calculated. DoTexture (nor, of course, the direct multiplication of the vector with matTexture) does nothing.
Here is a rar that has a simple test model and code ready for testing: link.
The important code is:
It's worth pointing out that if you don't assign a new material to an entity, u and v work as expected (the right entity in the demo).
This has been tested in both 8.30.5, and, superku reports the same issue in the new 8.40 version in the original thread.
Additionally, it'd be great if the manual could be a bit more detailed about u,v and matTexture. Simply writing that matTexture is (what we assume, at least)
and then saying that DoTexture is a simple way to do texture shifting would be enough and much appreciated.
Thanks in advance!
There's a strange bug concerning matTexture - it seems that it's not getting calculated. DoTexture (nor, of course, the direct multiplication of the vector with matTexture) does nothing.
Here is a rar that has a simple test model and code ready for testing: link.
The important code is:
Code:
MATERIAL* uvcheck = {
effect =
"
const float4x4 matWorldViewProj;
float4x4 matTexture;
texture entSkin1;
sampler sBaseTex = sampler_state {
Texture = <entSkin1>;
AddressU = Wrap;
Addressv = Wrap;
};
void vs_uvshift(
in float4 InPos: POSITION,
in float2 InTex: TEXCOORD0,
out float4 OutPos: POSITION,
out float2 OutTex: TEXCOORD0)
{
OutPos = mul(InPos, matWorldViewProj);
OutTex = mul(float4(InTex.x,InTex.y,1,1),matTexture).xy;
}
float4 ps_uvshift(in float2 InTex: TEXCOORD0): COLOR
{
return tex2D(sBaseTex,InTex);
}
technique uvtest {
pass p0 {
VertexShader = compile vs_2_0 vs_uvshift();
PixelShader = compile ps_2_0 ps_uvshift();
}
}
";
}
function shiftuv() {
my.material = uvcheck;
while(1) {
my.u += time_step;
wait(1);
}
}
It's worth pointing out that if you don't assign a new material to an entity, u and v work as expected (the right entity in the demo).
This has been tested in both 8.30.5, and, superku reports the same issue in the new 8.40 version in the original thread.
Additionally, it'd be great if the manual could be a bit more detailed about u,v and matTexture. Simply writing that matTexture is (what we assume, at least)
Code:
1 0 u 0 0 1 0 v 0 0 1 0 0 0 0 1
and then saying that DoTexture is a simple way to do texture shifting would be enough and much appreciated.
Thanks in advance!

