Skip to content

Instantly share code, notes, and snippets.

@Volcanoscar
Volcanoscar / gaussianBloom.frag
Created January 19, 2017 08:47 — forked from LRitesh/gaussianBloom.frag
Gaussian Bloom
uniform sampler2D renderedTexture;
uniform bool bloom;
uniform float bloomIntensity;
uniform float windowWidth;
uniform float windowHeight;
varying vec4 texCoord;
void main()
@Volcanoscar
Volcanoscar / NearlyNearestNeighborFiltering.glsl
Created January 19, 2017 08:47 — forked from slembcke/NearlyNearestNeighborFiltering.glsl
Anti-aliased Nearest Neighbor Filtering.
uniform sampler2D texture;
uniform vec2 textureSize;
varying vec2 uv;
void main(){
vec2 puv = uv*textureSize;
vec2 hfw = fwidth(puv)/2.0;
vec2 fl = floor(puv - 0.5) + 0.5;
@Volcanoscar
Volcanoscar / fog.frag
Created January 19, 2017 08:37 — forked from rgngl/fog.frag
fog shader
uniform float u_fogMaxDist;
uniform float u_fogMinDist;
uniform vec4 u_fogColor;
varying vec4 v_eyePos;
float computeLinearFogFactor()
{
float factor;
// XOR'd carpets
#ifdef GL_ES
precision mediump float;
#endif
uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;
#ifdef GL_ES
precision mediump float;
#endif
// burl figure
// - trick, use far less iterations!
uniform vec2 resolution;
uniform float time;
@Volcanoscar
Volcanoscar / Contour_Default.glsl
Created January 19, 2017 08:34 — forked from wipe2238/Contour_Default.glsl
Cheap critters contours
//
// Cheap critters contours
// Wipe/cirn0
//
#version 110
#ifdef VERTEX_SHADER
uniform mat4 ProjectionMatrix;
@Volcanoscar
Volcanoscar / BlobShader.fsh
Created January 19, 2017 08:32 — forked from voyce/BlobShader.fsh
Blob fragment shader
#define MAX_BALLS 10
precision mediump float;
varying lowp vec2 v_texCoord;
uniform float u_width;
uniform int numballs;
uniform vec3 balls[MAX_BALLS]; //.xy is position .z is radius
float energyField(in vec2 p, in float iso)
@Volcanoscar
Volcanoscar / greyscale.frag
Created January 19, 2017 08:28 — forked from wiseoldduck/greyscale.frag
A simple glsl color -> greyscale shader, using luminosity method
// fragment shader
//
// RGBA color to RGBA greyscale
//
// smooth transition based on u_colorFactor: 0.0 = original, 1.0 = greyscale
//
// http://www.johndcook.com/blog/2009/08/24/algorithms-convert-color-grayscale/
// "The luminosity method is a more sophisticated version of the average method.
// It also averages the values, but it forms a weighted average to account for human perception.
// We’re more sensitive to green than other colors, so green is weighted most heavily. The formula
uniform sampler2D tex;
float M_2PI = 6.283185307179586;
float SQRT2 = 1.4142135623730951;
void main()
{
float x = (gl_TexCoord[0].x - 0.5);
float y = (gl_TexCoord[0].y - 0.5);
float r = sqrt(x*x+y*y);
#define R 1.1
float wave(in vec2 uv, in vec2 center, in float radius) {
vec2 s = uv - center;
float r = length(s);
float h = sin(r * 50.0 + float(iFrame) / 10.0) * 0.1 * (radius - r);
if(r >= radius)
return 0.0;
else
return h;