Posted By: Error014
Tell me about matTexture - 08/04/12 15:31
Hello, everyone!
The manual is a bit foggy about what exactly matTexture does and holds. They say:
u,v
Pixel offsets of sprite and model textures in horizontal and vertical direction. They affect the matTexture texture transformation matrix. By changing these offsets in real time, effects like streaming water can be achieved.
Or this:
matTexture
The texture transformation matrix, determined by the entities' uv values.
Which may be the worst description ever.
Alright, so after googling this problem, I saw that apparently, one needs to use DoTexture. Which is really just this:
return mul(float4(inTex.x,inTex.y,1,1),matTexture).xy;
Okay, sweet. So apparently, there's something in the first 2x2-block of that 4x4-matrix that gives us the texture, neat.
The problem is, though, it doesn't work. I'm using a slightly adapted version of the fx_mirrorfloor version, and in there (in the vertex shader), I have:
(I've also defined matTexture, don't worry about that)
And with that, I see no texture shifting. Neither do I see something with that:
If I instead use, say, this:
I see the expected texture shifting.
But I need to have individual u,v-offsets.
It's very possible I just don't understand how matTexture is to be used.
So can anyone help me with this? When exactly is matTexture (re)calculated? How do I use it for shifting a texture?
Thanks!
The manual is a bit foggy about what exactly matTexture does and holds. They say:
Quote:
u,v
Pixel offsets of sprite and model textures in horizontal and vertical direction. They affect the matTexture texture transformation matrix. By changing these offsets in real time, effects like streaming water can be achieved.
Or this:
Quote:
matTexture
The texture transformation matrix, determined by the entities' uv values.
Which may be the worst description ever.
Alright, so after googling this problem, I saw that apparently, one needs to use DoTexture. Which is really just this:
Quote:
return mul(float4(inTex.x,inTex.y,1,1),matTexture).xy;
Okay, sweet. So apparently, there's something in the first 2x2-block of that 4x4-matrix that gives us the texture, neat.
The problem is, though, it doesn't work. I'm using a slightly adapted version of the fx_mirrorfloor version, and in there (in the vertex shader), I have:
Code:
Out.Tex0 = mul(float4(inTex0.x,inTex0.y,1,1),matTexture).xy;
(I've also defined matTexture, don't worry about that)
And with that, I see no texture shifting. Neither do I see something with that:
Code:
Out.Tex0.x = mul(float4(inTex0.x,inTex0.y,1,1),matTexture).x; Out.Tex0.y = inTex0.y;
If I instead use, say, this:
Code:
Out.Tex0.x = inTex0.x + vecTime.w/16; Out.Tex0.y = inTex0.y;
I see the expected texture shifting.
But I need to have individual u,v-offsets.
It's very possible I just don't understand how matTexture is to be used.
So can anyone help me with this? When exactly is matTexture (re)calculated? How do I use it for shifting a texture?
Thanks!