Distort maps U, and V explanation

For questions about using Classic.

Post » Thu Nov 12, 2009 9:41 pm

Can some one give me a definitive explanation of how U, and V work in a distort map?
There's nothing in the wiki, that I can find, and its kind of hard to figure out just by experimenting.
Also is there any difference as far as U, and V go in how they act to relative, and absolute?
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Fri Nov 13, 2009 1:18 am

In 3d apps, UV's are the texture coordinates, 0.0 - 1.0.

That probably didn't help at all :P
B
3
G
3
Posts: 42
Reputation: 959

Post » Fri Nov 13, 2009 4:36 am

The U and V values are pretty much equivalent to X and Y positions, but for texture coordinates. They stand for the point on the texture that associates with a vertex. In Construct these coordinates are actually numbered like screen coordinates rather than values from 0.0 - 1.0.

Here's an image showing an example of UV coordinates:

Since Construct's sprite meshes require displacement values, these wouldn't be the actual values. The real values, starting with the left square, would be 0, 0 all the way around; the right square, on the other hand, would -- going from the top-left corner around clockwise -- have these values:

1 - 0, 0
2 - 128, 0
3 - 128, 128
4 - 0, 128

Hopefully I explained all of this well enough and that I got the main idea across. Hope this helps. :)
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Fri Nov 13, 2009 4:46 am

Thanks linkman, thats great!
B
134
S
65
G
16
Posts: 1,766
Reputation: 19,190

Post » Fri Nov 13, 2009 7:20 pm

Thanks, that helps a lot. I think the thing that was screwing me up was the zeros, that and always confusing u and v. Then how each only represents one row/column.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Sat Nov 14, 2009 12:06 pm

Ok question.
Thus far everything starts with zero. Should U, and V in the above example start with zero and end with 127?
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Sat Nov 14, 2009 12:08 pm

I think it is the corner coordinates.

If you have one pixel texture, 0,0 would be top left corner and 1,1 would be bottom right.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Sat Nov 14, 2009 12:37 pm

Egad making a tileable texture using loops is going to be a nightmare!
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Sat Nov 14, 2009 8:32 pm

[quote="newt":279ipa66]Egad making a tileable texture using loops is going to be a nightmare![/quote:279ipa66]

what do you mean?
if you want to infinitely scroll a tileable texture using uv, I've done that and it wasn't hard at all.
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Sat Nov 14, 2009 10:39 pm

Well Im using a distort map set higher than 2 columns/rows, plus z heights. What Im wanting is more like 50.
The problem is arranging the quadrants within the loop, or I should say loops.

In a loop you first define the distort maps size.
50 in this case so 49 columns/rows.

That also gives me how many steps x, and y wise.
Within a nested loop its:

For x= 0 to 49
> for y= 0 to 49
>distort map set relative displacement at loopindex(x), loopindex(y)

The problem is for each x,y step I have to set u, and v to one of four quadrants 0,0| texture size,0 | 0,texture size | texture size,texture size.

So I either need to add two more loops or devise a way using private variables.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests