Posted: 4th Jun 2015 13:24
Hi guys,

I'm not much of a shader guy I'll be the first to admit. If I can color a 3d object with a solid color then I'm jumping for joy! The aim of this thread is to collect into one thread any shaders AppGameKit enthusiasts have come up with so we can all learn how to use them and have a resource stockpile.

Please donate your shaders today. If enough come in I'll spring for a prize or two around Christmas time!
Posted: 4th Jun 2015 14:12
I don't take credit for these shaders - I just tweaked them a little to work in AppGameKit, but even that can be tricky when you're new to shaders (like me!). Still, some amazing shaders here:

Flames
Clouds
Swirl
Mountains

Posted: 4th Jun 2015 15:37
Additive blend for transparent sprites:
+ Code Snippet
#ifdef GL_ES
	#ifdef GL_FRAGMENT_PRECISION_HIGH   
		precision highp float;
	#else
		precision mediump float;
	#endif
#endif

uniform sampler2D texture0;
varying vec4 colorVarying;
varying vec2 uvVarying;

void main()
{
	gl_FragColor = texture2D(texture0, uvVarying) * colorVarying * colorVarying.a;
}

2D Retro Lighting
2D Lighting
Posterise
Multiply
Posted: 6th Jun 2015 17:55
Dynamic shadows
http://forum.thegamecreators.com/?m=forum_view&t=212525&b=41
Posted: 6th Jun 2015 19:32
Cool - I like shaders

Here are the shaders I had to do with:
[Fullscreen] FXAA Shader
[Fullscreen] Barrel Distortion
[Fullscreen] Lens Correction shader for VR
[Fullscreen] Shockwave

[2D] Normalmapping
[2D] Burning Sprite
[2D] Soft [size=xsmall]Shadows[/size]
[2D] Side-scroller Water
[2D] Top-down Water
[2D] Smoke
[2D] Masked Progress bar
[2D] Scan Line
[2D] Voronoi Tesselation
[2D] Metaballs

[3D] Water
[3D] Fake Glass
[3D] Shadow
[3D] Depth of Field
[3D] Flat Shading
[3D] World Bending(log-rolling)

[3D] AppShaderKit
Posted: 8th Jun 2015 22:24
This is a good idea for a thread so here's my contribution:

3D light shader
3D toon shaders
Posted: 9th Jun 2015 2:21
This is looking to be a great thread.
Would you be able to list the shaders on the top post to make it easier to search through as the thread grows?
Posted: 11th Jun 2015 21:56
A few 3D shaders for Ambient/Directional/Point lighting..
http://skywaygame.com/progress/shaderpack
Posted: 12th Jun 2015 18:09
Jammy's fractals: http://forum.thegamecreators.com/?m=forum_view&t=214653&b=41
Posted: 17th Jun 2015 0:13
Anybody have a good 3d water shader they would like to share?
Posted: 16th Oct 2015 17:35
unlock
Posted: 16th Oct 2015 20:56
Simple ripple effect courtesy lilpissywilly and I. (attached)
Posted: 17th Oct 2015 8:43
3D Water ripple shader with light distortion (and one without light distortion, project and shaders attached)

Posted: 17th Oct 2015 8:51
I have a general shader question for Paul (or anyone who feels they can answer):

I have a 2d shader with 24 pointlights among other things. I made one version where the shader iterates through the pointlight calculations to a number set in AppGameKit, let's say 8. And I made another version where I literally typed out 8 point light shader calculations in the shader, and the second one is much faster. I think I used a For loop in the iteration version. Any idea why that's much slower?
Posted: 17th Oct 2015 16:56
Regarding the ripple shader, and similar effects, bearing in mind I know nothing about shaders. Would it be possible to apply a shader like this as a momentary effect to the screen. For example, an explosion occurs and the effect hits the screen at high speed, for 0.5 seconds?
Posted: 17th Oct 2015 19:53
Quite easily, yes. You would set a flag check in the shader that you would set to 0 and 1 from within AGK.

I'll make an example


Edit: project attached water ripple with toggle
Posted: 17th Oct 2015 20:42
@Batvink:
Take a look at the swirl shader. This will show you how you can implement a positional element of the shader that would allow you to place your explosion ripples. Combine this with the amplitude ripples and a render image and I think you could create some nice special effects!
Posted: 19th Oct 2015 11:31
Thanks both of you. One of my projects has just risen up through the rank of priorities!

[EDIT] CJB, your link is a dead end
Posted: 19th Oct 2015 11:44
CJB, your link is a dead end

Fixed.

It's the swirl shader from the 2nd post on this thread. You position the effect region with the mouse, but could quite as easily position an effect with your explosion coordinates
Posted: 3rd Nov 2015 2:24
2d fisheye shader, works with this code:
+ Code Snippet
// Project: Image FOV 
// Created: 2015-11-03

// set window properties
SetWindowTitle( "Image FOV" )
SetWindowSize( 1280, 720, 0 )

// set display properties
SetVirtualResolution( 1920,1080 )
SetOrientationAllowed( 0, 0, 1, 0 )


fovshader=LoadspriteShader("fish.ps" ) 

img=LoadImage("img.png")
spr=CreateSprite(img)
spr2=CreateSprite(img)
SetSpritePosition(spr2,540,0)

SetSpriteShader(spr,fovshader)

do
  // setShaderConstantByName(fovshader, "time", timer(), 0, 0, 0) 


    Print( ScreenFPS() )
    Sync()
loop




fisheye.ps
+ Code Snippet
uniform sampler2D tex0;
varying vec4 uvVarying;
const float PI = 3.1415926535;
 
void main()
{
  float aperture = 178.0;
  float apertureHalf = 0.5 * aperture * (PI / 180.0);
  float maxFactor = sin(apertureHalf);
  
  vec2 uv;
  vec2 xy = 2.0 * uvVarying.xy - 1.0;
  float d = length(xy);
  if (d < (2.0-maxFactor))
  {
    d = length(xy * maxFactor);
    float z = sqrt(1.0 - d * d);
    float r = atan(d, z) / PI;
    float phi = atan(xy.y, xy.x);
    
    uv.x = r * cos(phi) + 0.5;
    uv.y = r * sin(phi) + 0.5;
  }
  else
  {
    uv = uvVarying.xy;
  }
  vec4 c = texture2D(tex0, uv);
  gl_FragColor = c;
}