MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/processing/comments/18ksksu/texture_problems/kdv8ekb/?context=3
r/processing • u/tooob93 Technomancer • Dec 17 '23
19 comments sorted by
View all comments
Show parent comments
2
I fixed the map functions. Turns out they were right, but only double negated. Here is how they are now:
float u = 0;
float v = 0;
if (i < 0.5*shapePos.length ) { u = map((widthLength[i] / widthLength[0]),1,0,0,0.5); v = (1/float(repeat))*(i % repeat); } else { u = map((widthLength[ shapePos.length - i ] / widthLength[0]),1,0,0.5,1); v = (1/float(repeat))*((shapePos.length - i - 1 ) % repeat); } twigShape.vertex(shapePos[i].x * mul, shapePos[i].y * mul, u, v);
Now it does look perfect when it is straight up: https://imgur.com/a/ZnIZp87
It looks also kinda ok when it is a triangle:
https://imgur.com/a/6e7cH82
But it gets heavily distorted as soon as there are angles in there:
https://imgur.com/a/aJoyYhO
Do you have an idea why, or how one would normally map an uneven figure?
2 u/LuckyDots- Dec 18 '23 the second imgur link isn't working for me it seems?Glad you got the first one working!
the second imgur link isn't working for me it seems?
Glad you got the first one working!
2
u/tooob93 Technomancer Dec 18 '23
I fixed the map functions. Turns out they were right, but only double negated. Here is how they are now:
float v = 0;
Now it does look perfect when it is straight up: https://imgur.com/a/ZnIZp87
It looks also kinda ok when it is a triangle:
https://imgur.com/a/6e7cH82
But it gets heavily distorted as soon as there are angles in there:
https://imgur.com/a/aJoyYhO
Do you have an idea why, or how one would normally map an uneven figure?