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.

Newcomers AppGameKit Corner / Shaders in AGK2 BASIC Current Version Simple Examples

Author
Message
GarBenjamin
User Offline
Joined: 30th Nov 2016
Location: USA
Posted: 16th Jun 2017 20:30 Edited at: 16th Jun 2017 21:16
Hello! I recently decided to get back to some more game dev or at least experiments.

I have an interest in learning shaders and have searched all around the forum and found things scattered here and there as well a big Shaders thread that has a lot of complex stuff and the ones I tested do not seem to work anymore.

Just wondering could someone create 5 simple AGK2 BASIC shader examples and post here?

Something like...

* Outlining a sprite with a glow that we change color in AGK2 code

* A fire FX that causes a sprite to appear like it is on fire (fire kind of over it, around it and through it)

* Same two shaders as above only examples are for 3D objects

* Fullscreen shader for posterization or scan lines or a plasma or whatever


It would be great to see ultra simple examples that JUST WORK "out of the box". Then we (those wanting to get into it and have a small amount of time) have a starting point and can start playing around.

Thank you!
TI/994a (BASIC) -> C64 (BASIC/PASCAL/ASM/Others) -> Amiga (AMOS/BLITZ/ASM/C/Gamesmith) -> DOS (C/C++/Allegro) -> Windows (C++/C#/Monkey X/GL Basic/Unity/Others)
GarBenjamin
User Offline
Joined: 30th Nov 2016
Location: USA
Posted: 17th Jun 2017 03:31 Edited at: 17th Jun 2017 03:34
Aha! I had to greatly simplify. Started with the Default Sprite Shader that is described in the AGK2 Shader documentation.
Then just played around with it. Guesswork mainly. Now I get it. I think. Pretty straightforward it seems. This Pixel / Fragment shader is actually called on a pixel-by-pixel basis. Which makes sense now that I think about it. lol

Anyway, I made a simple shader to change the color and then one to apply a tint. Just ultra basic stuff so far. I guess what I will do is after I have made a collection of tiny shaders growing in complexity I will post them in here to help others get a jump start.

Eventually, I should be at a point where I can figure out how to do edge detection (which should just be determining when the Alpha becomes 0 for a sprite image) and then be able to do a glow.
TI/994a (BASIC) -> C64 (BASIC/PASCAL/ASM/Others) -> Amiga (AMOS/BLITZ/ASM/C/Gamesmith) -> DOS (C/C++/Allegro) -> Windows (C++/C#/Monkey X/GL Basic/Unity/Others)
blink0k
4
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 17th Jun 2017 04:28
nz0
AGK Developer
10
Years of Service
User Offline
Joined: 13th Jun 2007
Location: UK
Posted: 17th Jun 2017 22:41
A great start for learning basic shader techniques is this tutorial on ShaderToy.

Use this tutorial to understand exactly what's going on and what exactly a shader is.
GarBenjamin
User Offline
Joined: 30th Nov 2016
Location: USA
Posted: 19th Jun 2017 02:09 Edited at: 19th Jun 2017 02:09
@nz0 that is a fantastic tutorial. I was familiar with ShaderToy but have never seen this tutorial before. This is exactly the kind of tutorial I like the best. Hands on code-oriented tutorial so I can play around. Makes it very easy to learn.
TI/994a (BASIC) -> C64 (BASIC/PASCAL/ASM/Others) -> Amiga (AMOS/BLITZ/ASM/C/Gamesmith) -> DOS (C/C++/Allegro) -> Windows (C++/C#/Monkey X/GL Basic/Unity/Others)

Login to post a reply

Server time is: 2017-06-23 02:41:19
Your offset time is: 2017-06-23 02:41:19