Tiled distormaps...(solved)... pretty much

For questions about using Classic.

Post » Tue Nov 17, 2009 12:56 am

Either my understanding of how U, and V work, or how to implement a tiled texture on a distort map, using either a loop, or array is wrong.

In the cap here:
[url:1gr138tp]http://dl.dropbox.com/u/666516/perlintiledsprite.cap[/url:1gr138tp]
perlin noise plug here:
[url:1gr138tp]http://www.box.net/shared/3y6ogomhbi[/url:1gr138tp]

I've tried to set the u and v coords with the thinking they are either one of two, then the rows are even or odd.
In a distort map set 4 columns/ rows it would start like this:
0,0 |1,0 |0,0 |1,0 for the first row
then
0,1 |1,1 |0,1 |1,1 for the second.
And then making a bigger map should be fairly straight forward following the formula:
(y is even or odd, then a variable is either 1 or 2)

Well apparently not, in the cap I've tried it in a loop, and an array with limited success, but it's far from being right.
If any one would like to take a look at it and see if they can figure out what I'm doing wrong I'd appreciate it.

Keep in mind you need the perlin plug to open the cap.
[url:1gr138tp]http://www.scirra.com/phpBB3/viewtopic.php?f=2&t=4836&st=0&sk=t&sd=a&hilit=perlin[/url:1gr138tp]
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Tue Nov 17, 2009 8:52 am

Ok figured out something I was doing wrong. Instead of doing is even, or is odd on just y, I should have had it set to x, and y.

I've also had an epiphany. You could actually have several textures all on one sprite, then set u, and v based on the noise that was generated. Although the math for that is a bit much for my feeble mind.
But imagine an almost infinitely scaleable map, with as many textures as you please. Land, trees, water, all in semi 3d, and all taking the ram of just the one sprite!
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Fri Nov 20, 2009 10:19 am

Funny how looking at other people's code can confuse the hell out of you.

You've given me some ideas, and how I would go about achieving what you have, but I'll be buggered if I can understand how yours works, lol.

Cool though.
B
2
S
2
G
5
Posts: 108
Reputation: 1,866

Post » Sat Nov 21, 2009 11:20 pm

[quote="newt":23caqjbt]Land, trees, water, all in semi 3d, and all taking the ram of just the one sprite![/quote:23caqjbt]
Which would be about the same ram of multiple sprites, minus power-of-two padding.

:s yeah.
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Tue Dec 08, 2009 6:58 pm

Here is a cap of what I have been able to figure out. It tiles, but not perfectly.
[url:hsged4ui]http://dl.dropbox.com/u/666516/dtm.cap[/url:hsged4ui]

I think I've figured out about as much as I can with what little experience I have.
I still would like to be able to get this to tile like the bg object.
Dunno perhaps there's a bug with distort maps?

Any way, if any one wants to give a go at figuring it out it would be much appreciated.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Wed Dec 09, 2009 12:09 am

[quote="Construct 0.99.6 changelog":3rpgjr57]- [CHANGE] Sprite: distort maps now tile the texture when distorting outside the texture area. Allows for sprites to be used as rotating or animated tiled backgrounds.[/quote:3rpgjr57]
Does this do what you want?
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Wed Dec 09, 2009 4:40 am

Actually..., wait whut?
What about 0,0?

The thing is I'm trying to set z heights over many rows/columns.
So will it automatically set the first vertex then?
mmmkay off to experiment, thanks.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Wed Dec 09, 2009 4:27 pm

0,0 is already using texture co-ordinate 0,0 - the top left of the image is still at the top left!

If you want more control over the Z heights, you'll need more columns and rows in the mesh, and you'd have to loop to set the U/V of each cell. lerp might help there.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Wed Dec 09, 2009 11:40 pm

I tried lerp a bit, and it seems to be working much better, Im not sure If I have it set up exactly right but It does seem to be getting there.

for x, and y loops
set u and v to lerp(0, maxtilesize, loopindex(x, and y)*0.1

That gives me a decent showing, but Im unsure of using loopindex, as the percentage.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Wed Dec 22, 2010 10:58 pm

Update:
Epiphany, crushed. :(

[quote="newt":13bbsu72]Ok figured out something I was doing wrong. Instead of doing is even, or is odd on just y, I should have had it set to x, and y.

I've also had an epiphany. You could actually have several textures all on one sprite, then set u, and v based on the noise that was generated. Although the math for that is a bit much for my feeble mind.
But imagine an almost infinitely scaleable map, with as many textures as you please. Land, trees, water, all in semi 3d, and all taking the ram of just the one sprite![/quote:13bbsu72]

Seems you cant use multiple textures, its always going to use the whole texture.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests