# Distort maps U, and V explanation

For questions about using Classic.

### » 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?
B
175
S
50
G
199
Posts: 8,625
Reputation: 124,026

### » 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
B
3
S
1
G
3
Posts: 42
Reputation: 1,109

### » 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
114
S
41
G
20
Posts: 1,586
Reputation: 19,161

### » Fri Nov 13, 2009 4:46 am

Thanks linkman, thats great!
B
166
S
80
G
22
Posts: 1,811
Reputation: 24,699

### » 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.
B
175
S
50
G
199
Posts: 8,625
Reputation: 124,026

### » 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?
B
175
S
50
G
199
Posts: 8,625
Reputation: 124,026

### » 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
13
Posts: 1,910
Reputation: 13,685

### » Sat Nov 14, 2009 12:37 pm

Egad making a tileable texture using loops is going to be a nightmare!
B
175
S
50
G
199
Posts: 8,625
Reputation: 124,026

### » 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

### » 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.
B
175
S
50
G
199
Posts: 8,625
Reputation: 124,026

Next

Return to Help & Support using Construct Classic

### Who is online

Users browsing this forum: No registered users and 3 guests