Tremulous Forum

Media => Mapping Center => Topic started by: seeeker on July 16, 2008, 06:24:10 pm

Title: tcMod transform
Post by: seeeker on July 16, 2008, 06:24:10 pm
Can anyone please help me understand what exactly does it do?

Quote
tcMod transform m00 m01 m10 m11 t0 t1
Transforms each texture coordinate as follows:
S' = s * m00 + t * m10 + t0
T' = s * m01 + t * m11 + t1
This is for use by programmers.

Ive seen it being used on several places.

=/

thanks
Title: Re: tcMod transform
Post by: Lava Croft on July 16, 2008, 08:03:14 pm
All shaders I can find that use tcMod transform are related to liquids. I suggest you just try to use Google to steal a shader from somewhere and see what it does.
Title: Re: tcMod transform
Post by: Bissig on July 17, 2008, 03:14:44 am
Can anyone please help me understand what exactly does it do?

Quote
tcMod transform m00 m01 m10 m11 t0 t1
Transforms each texture coordinate as follows:
S' = s * m00 + t * m10 + t0
T' = s * m01 + t * m11 + t1
This is for use by programmers.

Ive seen it being used on several places.

=/

thanks

That's vector math. Get a book ;-)
Title: Re: tcMod transform
Post by: Taiyo.uk on July 17, 2008, 07:38:23 pm
Matrix math.
Title: Re: tcMod transform
Post by: CreatureofHell on July 17, 2008, 08:17:31 pm
granger math
Title: Re: tcMod transform
Post by: Bissig on July 18, 2008, 01:04:00 am
Matrix math.

[no offence]
Ok, smart man, what are those t0 and t1s then? Vectors and Matrices often come in one package. 8-)
Title: Re: tcMod transform
Post by: gimhael on July 18, 2008, 06:56:24 am
the only thing that makes this different from the textbook formula for an affine transformation of a vector is that the components are named s and t instead of e.g. x0 and x1. Rename them and you'll see that

y0 = x0 * m00 + x1 * m10 + t0
y1 = x0 * m01 + x1 * m11 + t1

is exactly the same as

y = x * m + t.

Title: Re: tcMod transform
Post by: Taiyo.uk on July 18, 2008, 12:07:02 pm
Matrix math.

[no offence]
Ok, smart man, what are those t0 and t1s then? Vectors and Matrices often come in one package. 8-)

[no offense]
Ok, smart man, I'm going to sit on my high chair and insist that the so-called vector (t0, t1) you speak of is in fact a [1,2] matrix, and that all so-called scalars are just [1,1] matrices. So there. thpppppppt!
Title: Re: tcMod transform
Post by: Lava Croft on July 18, 2008, 03:29:32 pm
seeeker, do please update us (actually, just me is fine too) about what the hell it does.
Title: Re: tcMod transform
Post by: Bissig on July 18, 2008, 04:59:53 pm
the only thing that makes this different from the textbook formula for an affine transformation of a vector is that the components are named s and t instead of e.g. x0 and x1. Rename them and you'll see that

y0 = x0 * m00 + x1 * m10 + t0
y1 = x0 * m01 + x1 * m11 + t1

is exactly the same as

y = x * m + t.

Thanks for shining a light into those dark memories that never shall rise again (vector math) 8-)

@Taiyo.uk

Hahahaha, twas funny ;_)
Title: Re: tcMod transform
Post by: gimhael on July 19, 2008, 06:53:33 am
"What it does" depends on the concrete values of all those little ms and ts, but usually this is used to change from one coordinate system to another. (maybe tc=transform coordinates ?)

You will find lots of examples for this kind of transformation in any linear algebra or computer graphics book. If you intend to read and understand the code of 3d computer games, you should learn the basics of Vector / Matrix maths. It's not as difficult as it may look in the beginning.

@Taiko: don't forget that the 2x2 matrices form a 4-dimensional vector space, so all your precious matrices are by definition vectors.   ;D