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 / Useful Community Shaders Project

Author
Message
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 13th Feb 2017 00:37 Edited at: 15th Jul 2017 01:30
SetObjectShaderConstantByName()
Oh wow how could I miss this command

I once made my own solution for that problem with drawobject()
Would love to know how Paul solved it !?

Thanks MikeMax
And I guess...yes there should be SetObjectMeshShaderConstantByName() and SetSpriteShaderConstantByName() then

For your problem...lets see
Hm there is no command for drawing the mesh or setting it invisible
Maybe you create a temporary mesh/object with your shader which you draw over the other object/mesh right before you render the scene

Using AGKv2 Tier1
MadBit
VIP Member
Gold Codemaster
15
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 13th Feb 2017 08:49 Edited at: 13th Feb 2017 08:50
MikeMax wrote: "2. Fog activation make the shader to throw an error with the agk_CameraPos declaration (previously declared ? i don't see where)"

I have already answered this question here (some posts above).

MikeMax wrote: "1. with animated models, when the normal shader is applied, animations no longer works "

This is a similar problem to the fog. The animation is realized with a shader. If you use your own shader, then you override the automatically generated code.
A solution would be to write your own code for the bone animation. Or intigrate the existing code in the normalmapping shader.

Here is the standard code that agk generate.


I hope it helps.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
Pixie-Particle-Engine
hoyoyo80
8
Years of Service
User Offline
Joined: 11th May 2016
Location:
Posted: 18th Feb 2017 07:09
Really hope to get a 3d shadow system(free or paid)
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 18th Feb 2017 10:38
Quote: "Really hope to get a 3d shadow system(free or paid)
"


Yes, it's a real need for me too !

The janbo's 3D shadow shader is a great good start but unstable and unusable actually in a "real" 3D environment for the moment.

And we need multiple pass shaders system to combine multiple shaders only when necessary (or an AppGameKit system to compile this "all-in-one shader" at project compilation according to object/mesh options (Bones animation + fog + 3D Shadow casting + normal/spec mapping + lightmapping... it's just an example of a real need !) .
--------------------------------
Join us on dedicated AppGameKit WeeKChat :
https://week.chat/room/AppGameKit
hoyoyo80
8
Years of Service
User Offline
Joined: 11th May 2016
Location:
Posted: 19th Feb 2017 04:56
+1. I dont mind if the community is selling plugin those features. But if it is support officially, agk features advertisement will look great
haliop_New
User Banned
Posted: 19th Feb 2017 17:00
yeah I think AppGameKit should at least include the default tested on all platform shaders.
so we get a head start and adjust and create extras but the default is a must.
GolWofael
8
Years of Service
User Offline
Joined: 15th Mar 2016
Location:
Posted: 1st Mar 2017 09:10
@Ched80
Thanks for your DOF shader ....
But could you put a small 3d example please ... sorry .. I'm very noob
Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 3rd Mar 2017 06:36
@GolWofael the shader is really a simple tilt shift shader applying blur to the full screen, but increasing the magnitude of the blur the further away from the middle of the screen (in the y axis) the pixel is.

It's not a true DOF shader.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 7th Mar 2017 04:51
i just noticed this in the documentation;
https://www.appgamekit.com/documentation/guides/13_shaders.htm
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 24th Mar 2017 06:55
2d realistic snow shader with example code:
(shader will be created by the code)


[/url]
PSY
Developer
8
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 24th Mar 2017 15:15
Woah,

nice snow shader.

Man, I really need to learn how these shaders work
PSY LABS Games
Coders don't die, they just gosub without return
Richard_6
7
Years of Service
User Offline
Joined: 3rd Feb 2017
Location:
Posted: 25th Mar 2017 04:56
Really niice!!
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 29th Mar 2017 17:11
Anyone wanting to learn shaders, I have found a great online book which has links to editors etc:

http://thebookofshaders.com/

Might be useful
The Amiga and Amos were great!
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 1st Apr 2017 22:32 Edited at: 1st Apr 2017 22:40
Text string, Image Buffer, Sprite Effect:

With different settings in the shader, you can get a lot of variations

// This one builds a starfield:
const float maskStr = 0.0125; // 0.0 - 1.0
const float vignetteStr = 0.0002; // 0.0 - 1.0
const float crtBend = 20.8;
const float crtOverscan = 0.21; // 0.0 - 1.0

Image:

Download:
https://forum.thegamecreators.com/attachment/79074

[/url]

Attachments

Login to view attachments
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 1st Apr 2017 23:51 Edited at: 1st Apr 2017 23:52
CRT Shader

Can also be modified in the .ps shader...

Image:


Download:
https://forum.thegamecreators.com/attachment/79076

[/url]

Attachments

Login to view attachments
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 5th Apr 2017 07:14 Edited at: 5th Apr 2017 07:17
Lensflare

Position of the sun can be set in screen coordinates.

Image:


Download:
https://forum.thegamecreators.com/attachment/79115

Can become handy sometimes.

[/url]

Attachments

Login to view attachments
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 5th Apr 2017 12:14
Looks nice Jack!
Using AppGameKit V2 Tier 1
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 26th Apr 2017 02:28 Edited at: 12th Apr 2018 22:19
Excellent Shaders Jack

And I believe baxslash 2d for the additive code

I modified the Lensflare and snow shaders by jack and added an additive blend of the background image rather than just use the noise this created
a background that could have a sun scroll down in the background adding a colour blend to the background sprite. Great for what I wanted a sunset
in 2d without the use of a quad image. I didn't change all that much to baxslashes awesome lensflare but now it does what I wanted and I have
commented the changes.

The summer.png that I use can be any 2d background image

The following allows you to switch between sun(lensflare) or snow
fubar
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 22nd May 2017 10:32 Edited at: 12th Apr 2018 22:20
Ive been playing around with Blendmans texture blending code as I was hoping with modifications the gl_FragColor could be used to output a morphed texture
I believe averages the color between texture0 and texture1
so I end up with an image 50percent texture0 and 50 percent texture1.(correct me if I'm wrong but that's what I think I'm seeing)
my question is how could I add and averaging factor in the following so that it might morph 10percent if chosen 20percent or even 100 percent and totally replace
with the second texture

test code


shaders
fubar
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 22nd May 2017 11:28
you could alter this line
Quote: "WriteLine(file,"gl_FragColor = (texture2D(texture0, uvVarying) + texture2D(texture1, uvVarying))/2.0;")"

This is where it's sets the 50% blend between each pixel colour.
Signature removed by mod because it's larger than 600x120... please resize and try again.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 22nd May 2017 12:00 Edited at: 12th Apr 2018 22:21
ive changed the line
Quote: "Quote: "WriteLine(file,"gl_FragColor = (texture2D(texture0, uvVarying) + texture2D(texture1, uvVarying))/2.0;")""

to
gl_FragColor = (texture2D(texture0, uvVarying) + (2.0*.5*texture2D(texture1, uvVarying)))/2.0;

where .5 is a percentage that seemed to work

the main problem I was having was setting the variable from the program but I fixed that thanks
with the following which converts one texture to another gradually on an object
fubar
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 22nd May 2017 12:42
Why I'm sure you don't need to multiply it by 2, then divide by 2 at the end?
Signature removed by mod because it's larger than 600x120... please resize and try again.
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 22nd May 2017 12:58 Edited at: 15th Jul 2017 01:31
There is much going on with VR right now and I through I released my "Lens Correction shaders/Tiny VR Lib" month ago...I realized, I did not
So here it is:

Demo
You can use the magnet of the card board to switch the width of the lenses center.
VR Test v2

Image

Using AGKv2 Tier1

Attachments

Login to view attachments
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 22nd May 2017 22:44 Edited at: 22nd May 2017 23:31
janbo

Thanks for your contribution. I have a question on your VR shader.
How would I adjust it so it would completely fill the screen top to bottom and left to right
in it's half of the screen?
The coffee is lovely dark and deep,and I have code to write before I sleep.
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 22nd May 2017 23:59
remove it ? :p
--------------------------------
Join us on dedicated AppGameKit WeeKChat :
https://week.chat/room/AppGameKit
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 23rd May 2017 00:34
I mean like this screen shot from Google cardboard app.
The coffee is lovely dark and deep,and I have code to write before I sleep.

Attachments

Login to view attachments
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 23rd May 2017 01:25 Edited at: 23rd May 2017 01:25
This low lens correction is strange ... This headset has no lenses ? :p

for my FreeFly VR (which have the big FOV of 120°) i need this correction :

--------------------------------
Join us on dedicated AppGameKit WeeKChat :
https://week.chat/room/AppGameKit

Attachments

Login to view attachments
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 23rd May 2017 16:03 Edited at: 15th Jul 2017 01:31
Stab in the Dark software

I think it's a different technique they use...or the lens curvature is so small that you could ignore it ^^
I think they are doing the correction on vertex level.
It's faster because you don't have to process every pixel on screen like I do, even if you have to add some vertices's to your models to make a good illusion.
I think its on vertex level because if you hold an ruler at an edge of the hill model, you can see that it is straight... that's why you don't notice the lens correction.
So it's not a perfect solution like the per fragment one, but in some cases a much faster one...ofc. you need a game art that fits well to that kind dependence...
Mobile VR apps tend to make it kind of polygon style with only face colors and no textures and so on.

[Edit]
You could probably zoom out, apply the shader and then take a smaller area from the resulting render image which you then stretch to fit the borders.
You need to increase the resolution of the render image so it fits the device resolution after the procedure...
I only tested my lib on my Honor 8 with a cheap copy the of Google cardboard, but it works perfectly and I can't see the borders nor I get ill...
[Edit]

Using AGKv2 Tier1
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 24th May 2017 03:17 Edited at: 24th May 2017 03:18
I changed this line in your shader to this value and just set the center to 0.0



It seems to be working well for my tzumi Dream Vision head set with my LG Stylo 3.
The screen resolution on the LG Stylo 3 is 1280 x 720.
Are the other shaders in your demo deprecated as part of the development process?
The coffee is lovely dark and deep,and I have code to write before I sleep.

Attachments

Login to view attachments
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 24th May 2017 15:15 Edited at: 15th Jul 2017 01:31
Well,
Now you have nearly no lens correction.
You could probably remove the shader...
I have read that the lens of your Dream Vision does have a focal length of 42mm and the Cardboard lenses have 45mm, so you should have a higher curvature...
You should increase the alpha variable instead.

Quote: "Are the other shaders in your demo deprecated as part of the development process?"

sort of ...you can probably make them all work again... as they was working once ...

Using AGKv2 Tier1
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 28th May 2017 22:06
Quote: "I have read that the lens of your Dream Vision does have a focal length of 42mm and the Cardboard lenses have 45mm, so you should have a higher curvature...
You should increase the alpha variable instead."


You are correct, I still need the barrel distortion to compensate for the lenses.
0.2 seems to be correct for my lenses. I found that if I change this line in the shader
it keeps the barrel distortion but creates a larger image to fill the screen so I can not see
the edges in the viewer. I changed the 1.0 - alpha to 1.18 - alpha. Do you think this is correct
or have I made a mistake again?


The coffee is lovely dark and deep,and I have code to write before I sleep.
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 29th May 2017 12:19 Edited at: 15th Jul 2017 01:31
@Stab in the Dark software
No you are right that should work, but the center will get shifted and you might want to increase the render target size.
Actually its a pretty good finding

You can use the "BarrelDistortion#" value in the "VR_Init" function to increase the render target..just set it to 1.18 then
[Edit]I updated my demo above[/Edit]

Using AGKv2 Tier1
Xaron
10
Years of Service
User Offline
Joined: 3rd May 2014
Location: Germany
Posted: 30th May 2017 13:00 Edited at: 30th May 2017 13:01
Hey there, I just looked at this 2D Normal Map Shader:
https://forum.thegamecreators.com/thread/212611

But using the latest AGKv2 version it looks like:

Attachments

Login to view attachments
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 30th May 2017 16:39 Edited at: 15th Jul 2017 01:31
@Xaron
Hm try this

Using AGKv2 Tier1

Attachments

Login to view attachments
Xaron
10
Years of Service
User Offline
Joined: 3rd May 2014
Location: Germany
Posted: 31st May 2017 07:30 Edited at: 31st May 2017 07:31
Thanks, it has the same issue. Maybe it's because of my system then? I have quite an unusual graphics card, the NVidia Quadro K600.
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 31st May 2017 12:18 Edited at: 15th Jul 2017 01:31
Even if its an unusual graphics card, the Quadro series is for rendering heavy stuff and I doubt that NVIDIA didn't got it right.
If you are a bit familiar with glsl you could remove/shrink the shader to it's bare-bones step by step and see if it gets any better and where it fails.

You can even see the vertices of the sprite...very unusual stuff...maybe it's the card though
What happens if you have no lights ?

Using AGKv2 Tier1
Xaron
10
Years of Service
User Offline
Joined: 3rd May 2014
Location: Germany
Posted: 31st May 2017 12:20 Edited at: 31st May 2017 12:22
Yeah I will try to strip it down. I have a bit of shader knowledge so it should be possible. Let's see. I'll try it on my other PCs as well but I guess it's a problem with the specific one here.

edit: Will try with no lights...
edit2: That's without lights:

Attachments

Login to view attachments
Xaron
10
Years of Service
User Offline
Joined: 3rd May 2014
Location: Germany
Posted: 31st May 2017 12:40
Ok fixed it. In your main shader there was the following:


So you use a not initialized variable called Light. This might work on many platforms but obviously mine is NOT initialized correctly with 0,0,0. Doing that fixed it:


Cheers!

Attachments

Login to view attachments
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 31st May 2017 12:59 Edited at: 15th Jul 2017 01:31
@Xaron
Haha, I was about to say that you should try to initialize the Light variable, don't know why I did not
But I'm glad the problem is out of the way.
So why is it working for me...in other words: why is the Light variable zero and not pointing into nowhere ?

Using AGKv2 Tier1
Xaron
10
Years of Service
User Offline
Joined: 3rd May 2014
Location: Germany
Posted: 31st May 2017 13:06
Well that's the "magic" of different compilers on different systems. You see even C++ does quite funny things with not initialized variables on some systems but not all of them. It's just not clearly defined so always dangerous.
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 16th Jun 2017 22:00 Edited at: 16th Jun 2017 22:04
2d Shader Primitives

Allows you to render 2d primitives without media.

This is a small lib to provide rendered, 2d primitives, even including a border.
You can also apply two images for the border/ fill aswell as a simple color.
You can also set the fill to transparent to only use the borders. It renders images in any size,
so it also should be pixel perfect.




Greetings, Jack

[/url]

Attachments

Login to view attachments
GarBenjamin
AGK Developer
7
Years of Service
User Offline
Joined: 30th Nov 2016
Location: USA
Posted: 16th Jun 2017 23:32
@Jack Thanks for sharing this. These actually work right "out of the box" so to speak. Awesome!
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)
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 17th Jun 2017 00:15
Thanks GarBenjamin,

there should be a better way to render the images, my current method brings some sync flickers as the images are rendered in the first frames with it.
I would be glad if you could create something based on this lib and post the image in your post

[/url]
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 17th Jun 2017 10:50
@janbo: I have interest in normal mapping. I don't know if normal mapping is mobile friendly
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 18th Jun 2017 18:55 Edited at: 15th Jul 2017 01:31
@ george++
Every intense calculation isn't mobile friendly but it is very much possible
I plan on releasing a 3D shader pack of useful game shaders and create one or more demos around it.
I can/will add my normal-mapping shader but I don't know when I can release it.
If you need some special shaders you can post your ideas ofc please.
Preview


But first I have another free shader for you guys.
I saw this thread today and here is my solution for it.

Masked Progressbar
Note that you can create any silhouette, it just depends on your mask.
You set the color with SetSpriteColor()
Preview

Demo (not the best demo code of mine but it shows what you need)
Link

Using AGKv2 Tier1

Attachments

Login to view attachments
hoyoyo80
8
Years of Service
User Offline
Joined: 11th May 2016
Location:
Posted: 18th Jun 2017 21:04
Hi all, can i humbly request for outline(normally black) in 3d object? Thanks
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 18th Jun 2017 21:28 Edited at: 15th Jul 2017 01:31
Like that one which often comes with a Toon shaders or like that in Borderlands ?
Just Added to my list

Also if Paul doesn't provide the possibility to pass tangents and bi-tangents to the shader attributes to create faster normal mapping for example
I may create a little lib for that also

Using AGKv2 Tier1
hoyoyo80
8
Years of Service
User Offline
Joined: 11th May 2016
Location:
Posted: 18th Jun 2017 23:59
Like the toon shader outline..yes.
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 19th Jun 2017 17:47 Edited at: 15th Jul 2017 01:31
Did you try this:
paste it above your sync()
This works best for convex objects


If you need something more advanced like glowing outline or something like in left 4 dead I might add it to the pack

Using AGKv2 Tier1
hoyoyo80
8
Years of Service
User Offline
Joined: 11th May 2016
Location:
Posted: 19th Jun 2017 21:15
Wow..maybe something like that.Is this like the toon shader effect? i try this first and report back. Thanks

Login to post a reply

Server time is: 2024-11-21 23:20:24
Your offset time is: 2024-11-21 23:20:24