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 / determining the position of a sprite with a glsl shader help

Author
Message
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 2nd Jun 2023 01:48 Edited at: 2nd Jun 2023 02:24
The following code adds shader positioning as world coordinates relative to the screen

What i require help with is the shader code changed so as its on relative to the sprite, whenever i feel i get close it just shows a white sprite
it may need a vs shader aswell im not really sure

this is the ps shader now edited and working as desired a few minor mods to come i needed to work with uvvarying better for those interested


the code i use to test it


fubarpk
https://fubarpk.itch.io/
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 2nd Jun 2023 03:34

an example of what it looks like for a banner without the animation

it looks much better ofcourse which a sprite that fills out a square area better leaving the edges for the effect


fubarpk
https://fubarpk.itch.io/
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 2nd Jun 2023 04:28
That is pretty cool, thank you
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 2nd Jun 2023 05:15
Your welcome

to make the shader more useful i made it so as you could use with animated sprites
to do so you will now need to add SetShaderConstantByName(sh,"center",0.5,0.5,0,0)
when you are setting up you sprite the 0.5 values are required to be just that for non animated sprites
for animated sprites it will be some value less ie a percentage of 0.5 depending on your
number of frames. it may not work with an odd number of frames but worked for my testing
purposes


fubarpk
https://fubarpk.itch.io/
nonom
6
Years of Service
User Offline
Joined: 12th Nov 2017
Location: Picking mushrooms
Posted: 2nd Jun 2023 19:51
Awesome, let me try
http://www.nyan.cat/index.php?cat=pirate
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 3rd Jun 2023 03:25
Nice work fubes. You are becomming quite the shader guru!
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 4th Jun 2023 07:37
Your welcome Game_Code_here
Thankyou Blink

Ive been trying to improve the effect so as its more just flames around the sprites edge /banner etc
and ive come up with the below solution. The problem is with it is that the edge is the same pixel several times (outlinesize)
when i need it to be the offset one. like in the previous and above results but only in the outlined area.
I hope someone can see this like janbo and point me in the right direction



the way i use those modifications is as follows

if anyoneone can help so as it doesnt repeat the same colour outline size times that would be really helpfull thankyou in advance
fubarpk
https://fubarpk.itch.io/

Login to post a reply

Server time is: 2024-03-28 14:01:02
Your offset time is: 2024-03-28 14:01:02