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 / My first shader app

Author
Message
puzzler2018
User Banned
Posted: 10th Aug 2018 18:35
Gotta start from somewhere



Shall introduce more as time goes on

puzzler2018
User Banned
Posted: 10th Aug 2018 18:48
2nd one



fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 10th Aug 2018 18:50
A good start
fubar
puzzler2018
User Banned
Posted: 10th Aug 2018 18:54
Wow Jeeze - im on a roll

Move your mouse around


puzzler2018
User Banned
Posted: 10th Aug 2018 18:58
Hi

Is that vec4( 0.0 , 0.0 , 0.0, 1.0) made up of perhaps x, y, z, zoom between 0.0 and 1

at all?
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 10th Aug 2018 19:08
yep and there is also the "clamp" command that can restrict to a range ie color = clamp(color,0.0,1.0);")

Good to see your working on shaders
fubar
puzzler2018
User Banned
Posted: 10th Aug 2018 20:03
Here is an interesting book for beginners - this is where got the stepping stones from

https://thebookofshaders.com/

It can only lead to more interesting things
puzzler2018
User Banned
Posted: 10th Aug 2018 20:16
Sorry folks - im having a whale of a time

Shader Simplex Noise anyone



Im going to call it a night and work more on these tomorrow
GarBenjamin
AGK Developer
7
Years of Service
User Offline
Joined: 30th Nov 2016
Location: USA
Posted: 10th Aug 2018 20:16 Edited at: 10th Aug 2018 20:17
Haven't had a chance to check out any of your examples yet (stuck at work) but this is something I am very interested in as well and hope to explore very soon! I did some work on it a few months or so ago and it was fun.

You might find this interesting... Shadertoy
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)
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 10th Aug 2018 20:24
The noise generation I think has potential for smoke on a planeobject if the colors went from shades of white to full transparency
fubar
puzzler2018
User Banned
Posted: 10th Aug 2018 20:32 Edited at: 10th Aug 2018 20:35
Yeah that sounds good and coding train youtuber as done something similar with simplex noise - like with 2D fire at the bottom of the screen - transparency going via the noise map where there is black it fades.

also moving clouds, thats coming next but probably tomorrow


if cant beat em - join em! as the ole saying goes

EDIT - im starting to feel thats how AppGameKit works generally - all converted to shader code and sent to the shader to do the graphics
puzzler2018
User Banned
Posted: 10th Aug 2018 20:50
I just couldnt wait



Enjoy folks
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 10th Aug 2018 21:00
Hahahahaha your as bad as me when you get an idea you have to try it

I love shaders they have great potential for allot of things and really are the fastest way to do most stuff
but with that said complex shaders or too many dont work so well with the mobile platform. As mobiles
currently dont have video chips that take advantage of shader code. I found with my Night Driver app
the shader that does the 3d works well with mobile. but when i added the simple shader that really just
added taillights to the car and i combined that with the shader that did the 3D, the frame rate went out
the window on my mobile even tho they use different objects totally. And both shaders give great frame
rates by themselves on my crappy mobile lol
fubar
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 10th Aug 2018 21:15 Edited at: 10th Aug 2018 21:16
I had the same problem with a terrain splatmap shader on mobile. FPS dropped to 17. Yikes. I haven't tried the one Jack posted., but will soon.
puzzler2018
User Banned
Posted: 10th Aug 2018 21:15
Doesnt work well on mobiles - oh poo

They are great though must admit - I dont think Minecraft would ever get onto the mobile market - it has now but didnt start that way

This wont stop me from developing knowledge on shaders though
puzzler2018
User Banned
Posted: 10th Aug 2018 23:33
Ohhh I wonder if I could pass type variable constructor via the constant by name (say a 16x16x16 set of cube vertices array construction) and allow the shader to construct those objects and texture.

Or am I too imagining things too impossible slightly

I will have a bash this weekend


fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 11th Aug 2018 05:43
My TWO CENTS

Shaders are the very last draw stage before going to your screen. I don't think you can construct an object but you can modify its vertices but
to do this you would have to keep calling the shader with the new vertices locations as it will not modify the object.

As for Minecraft I still believe it is within possibilities for a mobile version depending on the size of the meshes of blocks and the number of them
just the creation time would be rather slow but pre-generating it before hand and then loading could make it quite feasible for mobile. Mobiles
might be behind the CPU technology of modern pcs but they still have CPUs with some punch

fubar
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 11th Aug 2018 06:20 Edited at: 11th Aug 2018 06:50
Great work Puzzler!
Do you write your shaders in AppGameKit? Its nice for sharing concepts in the AppGameKit board as its only one codefile.
I can recommend notepad++ with a GLSL Syntax Highlight extention, way easier to work with.
There are also some node based shader tools, that are also quite nice to use!

You can actually create geometry in a shader, but then you would not have any collision or other management over it in AGK.
I would not recommend it, unless you want to pass all AppGameKit input into the shader and do the whole game inside one shader code.
This is an amazing experiment for a Demo as it will definitly perform well, but for regular work it's a pure horror.


A while ago I build a terrible Skybox Render Shader, in order to create skies like in Terragen or Vue. But I was not able to output a Cubebox Image,
so I drew the geometry of a box in the pixel shader, which is a lot slower in a pixel shader and actually a really bad method.
There where great problems with performance, but the sky got rendered.


The sky is animated and is procedually rendered at each frame.
Then pasted on a virtual box and rendered out by giving the camera angle to the shader.

[/url]

Attachments

Login to view attachments
puzzler2018
User Banned
Posted: 11th Aug 2018 09:58 Edited at: 11th Aug 2018 10:14
Wow thanks guys and interesting read of which will take into consideration

The Shader code is inbuilt into the apps by calling createVSShaderFile() and createPSshaderFile(), this just creates the code by adding lines to a file which corresponds to which shader file working on


Skies..




Cellular Noise - Move mouse for this one



And another - move your mouse about


puzzler2018
User Banned
Posted: 11th Aug 2018 11:08 Edited at: 11th Aug 2018 11:29
Lightning bolt anyone?



PS - dont mind the "water" comments - i was trying to do water and gave up lol

EDIT

Or maybe an outrun road on high



puzzler2018
User Banned
Posted: 11th Aug 2018 11:42 Edited at: 11th Aug 2018 11:46
Cool vortex




Maybe TRON Reinvented


puzzler2018
User Banned
Posted: 11th Aug 2018 12:11 Edited at: 11th Aug 2018 12:18
More clouds anyone



This should keep you going for a day or 3


I see what you mean Jack - this beast runs at 10FPS - Ouch!!



A nice efect one here



Enjoy folks!
puzzler2018
User Banned
Posted: 11th Aug 2018 12:31 Edited at: 11th Aug 2018 13:00
Terrain anyone




Concrete world




Ocean





Enjoy
smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 11th Aug 2018 14:27
the ocean one is very nice
life's one big game
spec= 4ghz, 16gb ram, AMD R9 2700 gpu
puzzler2018
User Banned
Posted: 11th Aug 2018 14:48 Edited at: 11th Aug 2018 14:56
Thanks - but then dont thank me too much - we can get the ideas from

ShaderToy - I found that this is very slow at loading and browsing around and also quiet difficult to convert to GLSL to the version AppGameKit uses


and

http://glslsandbox.com/ - I found this absolutely perfect for the correct GLSL version which AppGameKit uses - Please please forgive me on one particular shader someone created - I didnt expect that myself - you will know as soon as you see it (enough said)


Hope they give you inspirational ideas on how shaders work and construct our own - now that you have seen the language a fair bit here


Worlds of shaders is your oyster now!!
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 11th Aug 2018 14:56
You should write a app where users click buttons for a shader they want and its generated for agk
Could be usefull for lazy people

You have started with the base for it

You havent found a good shader to pixelate 3d objects as the trick i used will not work in my game ...
puzzler2018
User Banned
Posted: 11th Aug 2018 15:02
Thats an interesting concept to build shaders through automation via click of a buttons - hmmm interesting but not for this side of Xmas - i have minecraft to tackle before move onto anything else.

But thought to share some tips here to get you all started - cause I would love an ocean or sky shader or both in minecraft if FPS doesnt bolt down to 0

Ive seen your pixelated app and quiet ingenuous method.


Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 11th Aug 2018 15:07
I try to find simplicity but it dosent Always work
Due to the fact that you nead to use the draw object command so will some that are far away be drawn over Close objects with that method.
Its how agk renders 3d.

I made a large shader thread years ago when agk where pretty new with alot of shaders but i have forgotten alot right now.

Maybe i will have a go at it or there is a easier way
Icerion
5
Years of Service
User Offline
Joined: 3rd Aug 2018
Location:
Posted: 11th Aug 2018 15:43
Please add an RGBA splatmap to Terrain code! I think that would be very beneficial!

Thanks again & excellent Shaders thus far! Keep up the great work!
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 11th Aug 2018 15:49 Edited at: 11th Aug 2018 15:50
I love them all
from lightning bolts to oceans just wow
except I get an error with outrun
fubar
puzzler2018
User Banned
Posted: 11th Aug 2018 15:54
I just thought to share this one too



Go on - you know you want to
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 11th Aug 2018 16:46
The last one could make a great intro for minecraft
fubar
puzzler2018
User Banned
Posted: 11th Aug 2018 17:46 Edited at: 11th Aug 2018 17:47
I dont think we should use any of these to be honest - they are other peoples hard work and the minecraft one came from Marcus Perrson (Notch) himself



So using these shaders use at your own descretion, like if send your apps out to the public for example

Im just giving you ideas on how shaders capabilities and more of the GLSL language so can tweak or create our own from scratch once got the basic understanding of the language
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 11th Aug 2018 17:55 Edited at: 11th Aug 2018 18:19
Supernova

fubar
puzzler2018
User Banned
Posted: 11th Aug 2018 18:03
Thats really impressive well done
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 11th Aug 2018 18:06 Edited at: 11th Aug 2018 18:19
Thanks but I just converted it to AGK

Too extensive to be anything but a end of game shader tho
fubar
puzzler2018
User Banned
Posted: 11th Aug 2018 22:52 Edited at: 11th Aug 2018 22:54
I really dont want to upset anyone here - like Janbo and others that may feel uncomfortable with the works here.. Janbo is and always will be indeed top notch with shaders programming

I just like to share my experiences what I find out there

Please visit on Janbo's works at https://forum.thegamecreators.com/thread/220091?page=5#msg2620570
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 11th Aug 2018 23:53
Agreed janbo is indeed the king on these forums of shaders and I think santman isn't far behind

I had a go at converting a different lightning shader as I thought that could be handy all sorts of weather ones
could be very handy for both 3D and 2D. There is a nice 2D sun effect and rain on the community shaders page
but there is so much more to weather that could be accomplished.

And 2D shaders arent to bad to convert to 3D
fubar
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 12th Aug 2018 08:16
Everything is fine, thats how i started too.
I just converted a few shaders from the webs to AGK.
At that time cliff pioneered the shader work here.
Just don't give up if it gets harder.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 12th Aug 2018 14:00 Edited at: 12th Aug 2018 14:09
Heres a 2D Pixelate Shader




you could change SetShaderConstantByName(2,"pixels",1024/5,768/5,0,0) //the bigger the numbers the more pixels
to this SetShaderConstantByName(2,"pixels",1024/timer(),768/timer(),0,0) //the bigger the numbers the more pixels
for effect

fubar

Login to post a reply

Server time is: 2024-03-28 20:23:49
Your offset time is: 2024-03-28 20:23:49