Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/06/23 11:29
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
7 registered members (fairtrader, Quad, miwok, Martin_HH, AndrewAMD, alibaba, dpn), 581 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Tell me about matTexture #405659
08/04/12 15:31
08/04/12 15:31
Joined: Jul 2002
Posts: 3,208
Germany
Error014 Offline OP
Expert
Error014  Offline OP
Expert

Joined: Jul 2002
Posts: 3,208
Germany
Hello, everyone!

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!


Perhaps this post will get me points for originality at least.

Check out Dungeon Deities! It's amazing and will make you happy, successful and almost certainly more attractive! It might be true!
Re: Tell me about matTexture [Re: Error014] #405661
08/04/12 16:20
08/04/12 16:20
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
When I think about it the only senseful approach for (a) matTexture is the following:
1 0 u 0
0 1 0 v
0 0 1 0
0 0 0 1
When you take the vector (Tex.x,Tex.y,1,1) and multiply the matrix above from left, you'd get the result (Tex.x + u, Tex.y + v,1,1). But when I check matTexture[0][2] or matTexture[2][0], I always get 0. So I assume it's a bug, matTexture isn't calculated anymore.


"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: Tell me about matTexture [Re: Superku] #405669
08/04/12 18:40
08/04/12 18:40
Joined: Jul 2002
Posts: 3,208
Germany
Error014 Offline OP
Expert
Error014  Offline OP
Expert

Joined: Jul 2002
Posts: 3,208
Germany
Ah, thank you. Good to know it's not a failure on my part, then. laugh

And yeah, that matrix makes a lot of sense. I should have stared a bit longer at the vector (tex.x,tex.y,1,1) to figure that out.


Have you tried it with the new 8.40-version? Since I'm still rockin' the ol' 8.30.5-version.
I'm just asking so we can provide that bit in a Bug-Hunt-thread. laugh


Perhaps this post will get me points for originality at least.

Check out Dungeon Deities! It's amazing and will make you happy, successful and almost certainly more attractive! It might be true!
Re: Tell me about matTexture [Re: Error014] #405672
08/04/12 20:16
08/04/12 20:16
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Yep, it's the 8.40 public beta. wink


"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: Tell me about matTexture [Re: Superku] #405678
08/04/12 20:58
08/04/12 20:58
Joined: Jul 2002
Posts: 3,208
Germany
Error014 Offline OP
Expert
Error014  Offline OP
Expert

Joined: Jul 2002
Posts: 3,208
Germany
Thanks for the help! I've posted a bug report on this issue.


Perhaps this post will get me points for originality at least.

Check out Dungeon Deities! It's amazing and will make you happy, successful and almost certainly more attractive! It might be true!

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