Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Searching for some UV calculations

Author
Message
haliop_New
User Banned
Posted: 24th Oct 2014 18:43
searched google it didnt gave me alot maybe im searching for the wrong thing

i want to change my sprite UV in order to create a real time flag like effect..

any ideas ?
unlikely
12
Years of Service
User Offline
Joined: 5th Mar 2012
Location: Ohio, USA
Posted: 24th Oct 2014 18:56
You can control a sprite's UV coords using SetSpriteUV() or SetSpriteUVOffset(). If you use the SetImageWrapU() and SetImageWrapV() commands, you can control the clamping or wrapping behavior of the coordinates on a per image basis. I think you should be able to achieve what you're looking for.
Markus
Valued Member
19
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 24th Oct 2014 21:39 Edited at: 24th Oct 2014 21:44
uv is same as xy,
u can input a running value in sin or cos
angle=angle+1
if angle>360 then angle=angle-360
newvalue = sin(angle) * value
this make a sin wave.

this uv for a sqare image
left top is 0,0
right top is 1,0
right bottom is 1,1
left bottom is 0,1

a single sprite have only 4 points, think SpriteUV did not work.

AGK 108 (B)19 + AppGameKit V2 Alpha .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini
Markus
Valued Member
19
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 24th Oct 2014 21:46 Edited at: 24th Oct 2014 21:46
this here is based on more sprites, maybe u can use.


AGK 108 (B)19 + AppGameKit V2 Alpha .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini
unlikely
12
Years of Service
User Offline
Joined: 5th Mar 2012
Location: Ohio, USA
Posted: 25th Oct 2014 00:21
Okay, I see what you're looking for haliop. An actual 3d flag like effect. I was assuming you were just trying to scroll a flag texture to make it appear like it's "waving".
Markus
Valued Member
19
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 25th Oct 2014 00:36
a pre rendered animation should also work but take much of memory and
loading time.

AGK 108 (B)19 + AppGameKit V2 Alpha .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini
haliop_New
User Banned
Posted: 25th Oct 2014 09:05
thank you markus but that is not what im after cause you actually create and regenerate new sprites on the fly which i think is a waste of system usage..
i found the Grass tutorial presented here in the forum , but i cant really figure out what to do with the UV , you said Sin for wave right? maybe a bit more explanation about that if you can will be very helpfull.
Markus
Valued Member
19
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 25th Oct 2014 12:57
i know olny to do effect in 3d with moving the vertieces.
i had unsterstand you want make a flag that moving in wind / breeze.

Quote: "create and regenerate new sprites on the fly "

not, this "do wave" only change the position.
instead of 1 sprites - i used more smaller sprites.

AGK 108 (B)19 + AppGameKit V2 Alpha .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini
haliop_New
User Banned
Posted: 25th Oct 2014 19:20
ahh ok you create 100 sprites at startup then only moving them but then again using 100 sprites is too much , so still i think if i could manipulate the UV choords like this example it will be best efficient cause what if i want to present 10 flags or flag like items on one screen at the same time.. then you aiming at high sprite usage which is kinda of problem as i already present thousands of sprites ...
haliop_New
User Banned
Posted: 25th Oct 2014 19:26
you know what i think i'll use it for now , i reduced it to 5 sprites and still it looks neat , thank you markus.

btw what should i change if i want it to wave sideways rather then upwards?
Markus
Valued Member
19
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 25th Oct 2014 19:53
the make wave cut from left to right,
and do wave setspriteposition(s[y],y+sin(w#)*4.0,cos(w#))
the look there i had use y, from left to right its x

AGK 108 (B)19 + AppGameKit V2 Alpha .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini
fog
20
Years of Service
User Offline
Joined: 5th Oct 2003
Location: Newcastle, England
Posted: 25th Oct 2014 22:45
Provided you're using V2 then a single sprite and a simple shader would be the easiest and most efficient way to do it.

haliop_New
User Banned
Posted: 26th Oct 2014 06:46
markus i tried that exactly but it went weird

fog please explain, i know very little about shaders
so you are suggesting i'll add a shader to that sprite which sounds even better then UV calcs and since the game is aimed for windows thinking that most pc's have a decent gpu capabilities it might be the best solution.

Login to post a reply

Server time is: 2024-03-29 00:39:57
Your offset time is: 2024-03-29 00:39:57