mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-10 05:41:51 +09:00
shader updates
This commit is contained in:
@@ -9,7 +9,7 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
*
|
||||
* Created by minjaesong on 2021-12-13.
|
||||
*/
|
||||
class FlippingSpriteBatch(size: Int = 1000) : SpriteBatch(size, if (App.isAppleM) MacosGL32Shaders.createSpriteBatchShader() else null) {
|
||||
class FlippingSpriteBatch(size: Int = 1000) : SpriteBatch(size, MacosGL32Shaders.createSpriteBatchShader()) {
|
||||
|
||||
/**
|
||||
* This function draws the flipped version of the image by giving flipped uv-coord to the SpriteBatch
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
#version 130
|
||||
#version 150
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
uniform sampler2D u_texture; // world texture, has alpha value that is meaningful
|
||||
in vec4 v_color;
|
||||
in vec2 v_texCoords;
|
||||
|
||||
uniform sampler2D u_texture; // world texture, has alpha value that is meaningful
|
||||
uniform sampler2D tex1; // lightmap texture
|
||||
uniform vec2 tex1Offset;
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
vec4 colorTex0 = texture2D(u_texture, v_texCoords); // world texture
|
||||
@@ -16,5 +17,5 @@ void main() {
|
||||
|
||||
colorTex1 = vec4(colorTex1.www, 1.0);
|
||||
|
||||
gl_FragColor = colorTex0 * colorTex1;
|
||||
fragColor = colorTex0 * colorTex1;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#version 130
|
||||
#version 150
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
in vec4 v_color;
|
||||
in vec2 v_texCoords;
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
int bayer[36] = int[](
|
||||
@@ -19,6 +19,7 @@ float bayerSize = 6.0;
|
||||
float bayerDivider = 256;
|
||||
|
||||
vec2 boolean = vec2(0.0, 1.0);
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
vec4 inColor = v_color * (texture2D(u_texture, v_texCoords));
|
||||
@@ -29,6 +30,6 @@ void main() {
|
||||
|
||||
vec4 selvec = vec4(0.0, 0.0, 0.0, (alpha > bayerThreshold) ? 1.0 : 0.0);
|
||||
|
||||
gl_FragColor = inColor * boolean.yyyx + selvec;
|
||||
gl_FragColor = inColor;
|
||||
fragColor = inColor * boolean.yyyx + selvec;
|
||||
fragColor = inColor;
|
||||
}
|
||||
@@ -1,9 +1,12 @@
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
#version 150
|
||||
|
||||
in vec4 v_color;
|
||||
in vec2 v_texCoords;
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
vec2 boolean = vec2(0.0, 1.0);
|
||||
out vec4 fragColor;
|
||||
|
||||
void main(void) {
|
||||
gl_FragColor = texture2D(u_texture, v_texCoords).aaaa * boolean.yyyx + boolean.xxxy;
|
||||
fragColor = texture2D(u_texture, v_texCoords).aaaa * boolean.yyyx + boolean.xxxy;
|
||||
}
|
||||
@@ -1,18 +1,19 @@
|
||||
#version 130
|
||||
#version 150
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
in vec4 v_color;
|
||||
in vec2 v_texCoords;
|
||||
uniform sampler2D u_texture; // world texture, has alpha value that is meaningful
|
||||
|
||||
uniform sampler2D tex1; // glow texture, SHOULD contain alpha of all 1.0
|
||||
out vec4 fragColor;
|
||||
|
||||
void main(void) {
|
||||
vec4 colorTex0 = texture2D(u_texture, v_texCoords); // lightmap (RGB) pre-mixed
|
||||
vec4 colorTex1 = texture2D(tex1, v_texCoords); // lightmap (A) pre-mixed
|
||||
|
||||
gl_FragColor = vec4(max(colorTex0.rgb, colorTex1.rgb), colorTex0.a);
|
||||
fragColor = vec4(max(colorTex0.rgb, colorTex1.rgb), colorTex0.a);
|
||||
}
|
||||
@@ -1,11 +1,13 @@
|
||||
attribute vec4 a_position;
|
||||
attribute vec4 a_color;
|
||||
attribute vec2 a_texCoord0;
|
||||
#version 150
|
||||
|
||||
in vec4 a_position;
|
||||
in vec4 a_color;
|
||||
in vec2 a_texCoord0;
|
||||
|
||||
uniform mat4 u_projTrans; // camera.combined
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
out vec4 v_color;
|
||||
out vec2 v_texCoords;
|
||||
|
||||
void main() {
|
||||
v_color = a_color;
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
#version 150
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
in vec4 v_color;
|
||||
in vec2 v_texCoords;
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
|
||||
|
||||
uniform vec2 iResolution;
|
||||
uniform float flip;
|
||||
uniform vec2 direction;
|
||||
out vec4 fragColor;
|
||||
|
||||
vec4 blur(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) {
|
||||
vec4 color = vec4(0.0);
|
||||
@@ -31,5 +32,5 @@ void main() {
|
||||
uv.y = 1.0 - uv.y;
|
||||
}
|
||||
|
||||
gl_FragColor = blur(u_texture, uv, iResolution.xy, direction);
|
||||
fragColor = blur(u_texture, uv, iResolution.xy, direction);
|
||||
}
|
||||
@@ -1,11 +1,13 @@
|
||||
attribute vec4 a_position;
|
||||
attribute vec4 a_color;
|
||||
attribute vec2 a_texCoord0;
|
||||
#version 150
|
||||
|
||||
in vec4 a_position;
|
||||
in vec4 a_color;
|
||||
in vec2 a_texCoord0;
|
||||
|
||||
uniform mat4 u_projTrans;
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
out vec4 v_color;
|
||||
out vec2 v_texCoords;
|
||||
|
||||
void main() {
|
||||
v_color = a_color;
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
#version 150
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
uniform sampler2D u_texture;
|
||||
in vec4 v_color;
|
||||
in vec2 v_texCoords;
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
uniform vec2 iResolution;
|
||||
uniform float flip;
|
||||
uniform vec2 direction;
|
||||
out vec4 fragColor;
|
||||
|
||||
vec4 blur(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) {
|
||||
vec4 color = vec4(0.0);
|
||||
@@ -33,5 +35,5 @@ void main() {
|
||||
uv.y = 1.0 - uv.y;
|
||||
}
|
||||
|
||||
gl_FragColor = blur(u_texture, uv, iResolution.xy, direction);
|
||||
fragColor = blur(u_texture, uv, iResolution.xy, direction);
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
#version 130
|
||||
#version 150
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
in vec4 v_color;
|
||||
in vec2 v_texCoords;
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
// recommended value: n / vec2(fbo_width, fbo_height) where n is something like {0.5, 1, 2, 4, ... }
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#version 130
|
||||
#version 150
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
in vec4 v_color;
|
||||
in vec2 v_texCoords;
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
// recommended value: n / vec2(fbo_width, fbo_height) where n is something like {0.5, 1, 2, 4, ... }
|
||||
@@ -16,6 +16,8 @@ vec2 doubley = vec2(0.0, 2.0);
|
||||
vec2 twister = vec2(1.0, -1.0);
|
||||
vec2 boolean = vec2(1.0, 0.0);
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
vec4 sum = texture2D(u_texture, v_texCoords) +
|
||||
texture2D(u_texture, v_texCoords + halfpixel) +
|
||||
@@ -27,5 +29,5 @@ void main() {
|
||||
texture2D(u_texture, v_texCoords + halfpixel * boolean.yx) +
|
||||
texture2D(u_texture, v_texCoords - halfpixel * boolean.yx) ;
|
||||
|
||||
gl_FragColor = sum / 9.0;
|
||||
fragColor = sum / 9.0;
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
#version 130
|
||||
#version 150
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
in vec4 v_color;
|
||||
in vec2 v_texCoords;
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
uniform vec2 resolution;
|
||||
@@ -17,6 +17,7 @@ vec3 scanline_darkening = vec3(0.66, 0.66, 0.66);
|
||||
uniform float alternative_scanline = 0.0; // 1.0: true
|
||||
|
||||
uniform float blur_blend = 0.5;
|
||||
out vec4 fragColor;
|
||||
|
||||
void main(void) {
|
||||
vec4 color = texture2D(u_texture, v_texCoords).rgba;
|
||||
@@ -40,6 +41,6 @@ void main(void) {
|
||||
out_color = out_color * scanline_darkening;
|
||||
}
|
||||
|
||||
gl_FragColor = vec4(out_color, 1);
|
||||
//gl_FragColor = texture2D(u_texture, v_texCoords);
|
||||
fragColor = vec4(out_color, 1);
|
||||
//fragColor = texture2D(u_texture, v_texCoords);
|
||||
}
|
||||
@@ -1,14 +1,17 @@
|
||||
attribute vec4 a_position;
|
||||
attribute vec4 a_color;
|
||||
attribute vec2 a_texCoord0;
|
||||
#version 150
|
||||
|
||||
in vec4 a_position;
|
||||
in vec4 a_color;
|
||||
in vec2 a_texCoord0;
|
||||
|
||||
uniform mat4 u_projTrans;
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
out vec4 v_color;
|
||||
out vec2 v_texCoords;
|
||||
|
||||
void main() {
|
||||
v_color = a_color;
|
||||
v_color.a = v_color.a * (255.0/254.0);
|
||||
v_texCoords = a_texCoord0;
|
||||
gl_Position = u_projTrans * a_position;
|
||||
}
|
||||
@@ -1,17 +1,18 @@
|
||||
#version 130
|
||||
#version 150
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
in vec4 v_color;
|
||||
in vec2 v_texCoords;
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
vec2 boolean = vec2(0.0, 1.0);
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
vec4 inColor = v_color * (texture2D(u_texture, v_texCoords));
|
||||
|
||||
vec4 divided = inColor / pow(inColor.aaaa, vec4(2.0));
|
||||
gl_FragColor = divided * boolean.yyyx + inColor * boolean.xxxy;
|
||||
fragColor = divided * boolean.yyyx + inColor * boolean.xxxy;
|
||||
}
|
||||
@@ -1,16 +1,17 @@
|
||||
#version 130
|
||||
#version 150
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
in vec4 v_color;
|
||||
in vec2 v_texCoords;
|
||||
uniform sampler2D u_texture;
|
||||
out vec4 fragColor;
|
||||
|
||||
void main(void) {
|
||||
vec4 inColor = texture2D(u_texture, v_texCoords);
|
||||
ivec4 bytes = ivec4(255.0 * inColor);
|
||||
ivec4 mask = ivec4(0x55);
|
||||
gl_FragColor = (bytes ^ mask) / 255.0;
|
||||
fragColor = (bytes ^ mask) / 255.0;
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
#version 130
|
||||
#version 150
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
in vec4 v_color;
|
||||
in vec2 v_texCoords;
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
uniform sampler2D u_pattern;
|
||||
|
||||
@@ -18,6 +19,7 @@ uniform float parallax_size = 1.0/3.0; // 0: no parallax
|
||||
// inverted zoom; this value must set to (1f/zoom)
|
||||
uniform float zoomInv = 1.0;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
float quant = 255.0; // 64 steps -> 63.0; 256 steps -> 255.0
|
||||
vec4 quantiser = vec4(quant);
|
||||
@@ -50,7 +52,7 @@ void main(void) {
|
||||
vec4 inColor = v_color * mix(newBottom, newTop, scale);
|
||||
vec4 selvec = getDitherredDot(inColor);
|
||||
|
||||
gl_FragColor = selvec;
|
||||
fragColor = selvec;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
#version 150
|
||||
in vec4 v_color;
|
||||
in vec2 v_texCoords;
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
vec2 boolean = vec2(0.0, 1.0);
|
||||
vec4 desaturate = vec4(0.2126, 0.7152, 0.0722, 0.0);
|
||||
out vec4 fragColor;
|
||||
|
||||
void main(void) {
|
||||
vec4 incolour = texture2D(u_texture, v_texCoords);
|
||||
float lum = dot(incolour * desaturate, boolean.yyyx) * 0.5 + 0.5;
|
||||
|
||||
gl_FragColor = v_color * (vec4(lum) * boolean.yyyx + incolour * boolean.xxxy);
|
||||
fragColor = v_color * (vec4(lum) * boolean.yyyx + incolour * boolean.xxxy);
|
||||
}
|
||||
@@ -3,7 +3,9 @@
|
||||
in vec4 a_position;
|
||||
in vec4 a_color;
|
||||
in vec2 a_texCoord0;
|
||||
|
||||
uniform mat4 u_projTrans;
|
||||
|
||||
out vec4 v_color;
|
||||
out vec2 v_texCoords;
|
||||
|
||||
@@ -11,5 +13,5 @@ void main() {
|
||||
v_color = a_color;
|
||||
v_color.a = v_color.a * (255.0/254.0);
|
||||
v_texCoords = a_texCoord0;
|
||||
gl_Position = u_projTrans * a_position;
|
||||
}
|
||||
gl_Position = u_projTrans * a_position;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#version 130
|
||||
#version 150
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
uniform sampler2D u_texture;
|
||||
in vec4 v_color;
|
||||
in vec2 v_texCoords;
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
// "steps" of R, G and B. Must be integer && equal or greater than 2
|
||||
uniform float rcount = 8.0;
|
||||
@@ -15,6 +15,8 @@ uniform float gcount = 8.0;
|
||||
uniform float bcount = 8.0;
|
||||
uniform float acount = 1.0;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
//int bayer[14 * 14] = int[](131,187,8,78,50,18,134,89,155,102,29,95,184,73,22,86,113,171,142,105,34,166,9,60,151,128,40,110,168,137,45,28,64,188,82,54,124,189,80,13,156,56,7,61,186,121,154,6,108,177,24,100,38,176,93,123,83,148,96,17,88,133,44,145,69,161,139,72,30,181,115,27,163,47,178,65,164,14,120,48,5,127,153,52,190,58,126,81,116,21,106,77,173,92,191,63,99,12,76,144,4,185,37,149,192,39,135,23,117,31,170,132,35,172,103,66,129,79,3,97,57,159,70,141,53,94,114,20,49,158,19,146,169,122,183,11,104,180,2,165,152,87,182,118,91,42,67,25,84,147,43,85,125,68,16,136,71,10,193,112,160,138,51,111,162,26,194,46,174,107,41,143,33,74,1,101,195,15,75,140,109,90,32,62,157,98,167,119,179,59,36,130,175,55,0,150);
|
||||
//float bayerSize = 14.0;
|
||||
int bayer[4 * 4] = int[](0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5);
|
||||
@@ -57,5 +59,5 @@ void main(void) {
|
||||
|
||||
vec4 outColor = nearestColour(inColor + spread * (bayer[int(entry.y) * int(bayerSize) + int(entry.x)] / bayerDivider - 0.5));
|
||||
|
||||
gl_FragColor = outColor;
|
||||
fragColor = outColor;
|
||||
}
|
||||
@@ -1,15 +1,17 @@
|
||||
#version 130
|
||||
#version 150
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
in vec4 v_color;
|
||||
in vec2 v_texCoords;
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
// recommended value: n / vec2(fbo_width, fbo_height) where n is something like {0.5, 1, 2, 4, ... }
|
||||
// that, or simply 0.5, depending on how your uv coord works
|
||||
uniform vec2 halfpixel = vec2(0.0, 0.0);
|
||||
out vec4 fragColor;
|
||||
|
||||
vec2 twister = vec2(1.0, -1.0);
|
||||
|
||||
@@ -19,7 +21,7 @@ void main() {
|
||||
sum += texture2D(u_texture, v_texCoords + halfpixel);
|
||||
sum += texture2D(u_texture, v_texCoords - halfpixel * twister);
|
||||
sum += texture2D(u_texture, v_texCoords + halfpixel * twister);
|
||||
gl_FragColor = sum / 8.0;
|
||||
fragColor = sum / 8.0;
|
||||
|
||||
// gl_FragColor = texture2D(u_texture, v_texCoords);
|
||||
}
|
||||
@@ -1,15 +1,17 @@
|
||||
#version 130
|
||||
#version 150
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
in vec4 v_color;
|
||||
in vec2 v_texCoords;
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
// recommended value: n / vec2(fbo_width, fbo_height) where n is something like {0.5, 1, 2, 4, ... }
|
||||
// that, or simply 0.5, depending on how your uv coord works
|
||||
uniform vec2 halfpixel = vec2(0.0, 0.0);
|
||||
out vec4 fragColor;
|
||||
|
||||
vec2 doublex = vec2(2.0, 0.0);
|
||||
vec2 doubley = vec2(0.0, 2.0);
|
||||
@@ -24,7 +26,7 @@ void main() {
|
||||
sum += texture2D(u_texture, v_texCoords + halfpixel * twister) * 2.0;
|
||||
sum += texture2D(u_texture, v_texCoords - halfpixel * doubley);
|
||||
sum += texture2D(u_texture, v_texCoords - halfpixel) * 2.0;
|
||||
gl_FragColor = sum / 12.0;
|
||||
fragColor = sum / 12.0;
|
||||
|
||||
// gl_FragColor = texture2D(u_texture, v_texCoords);
|
||||
// fragColor = texture2D(u_texture, v_texCoords);
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
#version 130
|
||||
#version 150
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
in vec4 v_color;
|
||||
in vec2 v_texCoords;
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
uniform float rcount = 64.0;
|
||||
@@ -17,6 +17,8 @@ uniform vec2 circleCentrePoint;
|
||||
uniform vec2 colorCentrePoint;
|
||||
uniform float circleSize;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
vec2 screenCoord = gl_FragCoord.xy;
|
||||
|
||||
@@ -27,13 +29,13 @@ void main() {
|
||||
|
||||
|
||||
if (distToCircleCentre <= circleSizeSqr) {
|
||||
gl_FragColor = vec4(0.993, 0.993, 0.993, 1.0);
|
||||
fragColor = vec4(0.993, 0.993, 0.993, 1.0);
|
||||
}
|
||||
else if (distToCircleCentre <= circleSizeSqr + 200) { // dunno why it's 200; 2000 makes 10px feather
|
||||
gl_FragColor = vec4(0.993, 0.993, 0.993, 1 - (distToCircleCentre - circleSizeSqr) / 200);
|
||||
fragColor = vec4(0.993, 0.993, 0.993, 1 - (distToCircleCentre - circleSizeSqr) / 200);
|
||||
}
|
||||
else {
|
||||
gl_FragColor = vec4(0,0,0,1);
|
||||
fragColor = vec4(0,0,0,1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
#version 130
|
||||
#version 150
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
in vec4 v_color;
|
||||
in vec2 v_texCoords;
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main(void) {
|
||||
gl_FragColor = vec4(texture2D(u_texture, v_texCoords).rgb, 1.0);
|
||||
fragColor = vec4(texture2D(u_texture, v_texCoords).rgb, 1.0);
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
* http://momentsingraphics.de/BlueNoise.html
|
||||
*/
|
||||
|
||||
#version 130
|
||||
#version 150
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
@@ -17,8 +17,9 @@ vec4 gammaOut(vec4 col) {
|
||||
return pow(col, vec4(1.0 / 2.2));
|
||||
}
|
||||
|
||||
varying vec4 v_color; // unused!
|
||||
varying vec2 v_texCoords;
|
||||
in vec4 v_color; // unused!
|
||||
in vec2 v_texCoords;
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
uniform sampler2D u_pattern;
|
||||
uniform ivec2 rnd = ivec2(0,0);
|
||||
@@ -30,6 +31,8 @@ uniform mat4 swizzler = mat4(
|
||||
);
|
||||
uniform float quant = 255.0; // 64 steps -> 63.0; 256 steps -> 255.0
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
vec2 boolean = vec2(0.0, 1.0);
|
||||
vec4 matrixNormaliser = vec4(0.5 / 256.0);
|
||||
|
||||
@@ -78,8 +81,8 @@ void main(void) {
|
||||
vec4 selvec = getDitherredDot(graded);
|
||||
vec4 outcol = selvec * boolean.yyyx + boolean.xxxy; // use quantised RGB but not the A
|
||||
|
||||
gl_FragColor = outcol;
|
||||
fragColor = outcol;
|
||||
// ivec4 bytes = ivec4(255.0 * outcol);
|
||||
// ivec4 mask = ivec4(0x55);
|
||||
// gl_FragColor = (bytes ^ mask) / 255.0;
|
||||
// fragColor = (bytes ^ mask) / 255.0;
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
* http://momentsingraphics.de/BlueNoise.html
|
||||
*/
|
||||
|
||||
#version 130
|
||||
#version 150
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
@@ -17,8 +17,9 @@ vec4 gammaOut(vec4 col) {
|
||||
return pow(col, vec4(1.0 / 2.2));
|
||||
}
|
||||
|
||||
varying vec4 v_color; // unused!
|
||||
varying vec2 v_texCoords;
|
||||
in vec4 v_color; // unused!
|
||||
in vec2 v_texCoords;
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
uniform sampler2D u_pattern;
|
||||
uniform ivec2 rnd = ivec2(0,0);
|
||||
@@ -44,6 +45,8 @@ mat4 ycocg_to_rgb = mat4(
|
||||
|
||||
uniform vec4 vibrancy = vec4(1.0);//vec4(1.0, 1.4, 1.2, 1.0);
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main(void) {
|
||||
// convert input RGB into YCoCg
|
||||
vec4 incolour = texture2D(u_texture, v_texCoords);
|
||||
@@ -57,5 +60,5 @@ void main(void) {
|
||||
|
||||
// Dither the output
|
||||
vec4 graded = ycocg_to_rgb * newColour;
|
||||
gl_FragColor = graded * boolean.yyyx + boolean.xxxy; // use quantised RGB but not the A
|
||||
fragColor = graded * boolean.yyyx + boolean.xxxy; // use quantised RGB but not the A
|
||||
}
|
||||
@@ -1,16 +1,20 @@
|
||||
#version 150
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
in vec4 v_color;
|
||||
in vec2 v_texCoords;
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
uniform mat4 u_projTrans;
|
||||
|
||||
void main() {
|
||||
vec3 color = texture2D(u_texture, v_texCoords).rgb;
|
||||
float gray = (3.0 * color.r + 4.0 * color.g + color.b) / 8.0;
|
||||
vec3 grayscale = vec3(gray);
|
||||
out vec4 fragColor;
|
||||
|
||||
gl_FragColor = vec4(grayscale, 1.0);
|
||||
void main() {
|
||||
vec3 color = texture2D(u_texture, v_texCoords).rgb;
|
||||
float gray = (3.0 * color.r + 4.0 * color.g + color.b) / 8.0;
|
||||
vec3 grayscale = vec3(gray);
|
||||
|
||||
fragColor = vec4(grayscale, 1.0);
|
||||
}
|
||||
@@ -1,14 +1,17 @@
|
||||
attribute vec4 a_position;
|
||||
attribute vec4 a_color;
|
||||
attribute vec2 a_texCoord0;
|
||||
#version 150
|
||||
|
||||
in vec4 a_position;
|
||||
in vec4 a_color;
|
||||
in vec2 a_texCoord0;
|
||||
|
||||
uniform mat4 u_projTrans;
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
out vec4 v_color;
|
||||
out vec2 v_texCoords;
|
||||
|
||||
void main() {
|
||||
v_color = a_color;
|
||||
v_color.a = v_color.a * (255.0/254.0);
|
||||
v_texCoords = a_texCoord0;
|
||||
gl_Position = u_projTrans * a_position;
|
||||
}
|
||||
@@ -1,9 +1,12 @@
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
#version 150
|
||||
in vec4 v_color;
|
||||
in vec2 v_texCoords;
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main(void) {
|
||||
vec4 color = texture2D(u_texture, vec2(v_texCoords.x, 1.0 - v_texCoords.y));
|
||||
vec4 alphamul = vec4(1.0, 1.0, 1.0, 0.5 * (1.0 - v_texCoords.y));
|
||||
gl_FragColor = color * alphamul;
|
||||
fragColor = color * alphamul;
|
||||
}
|
||||
@@ -1,9 +1,12 @@
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
#version 150
|
||||
in vec4 v_color;
|
||||
in vec2 v_texCoords;
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
vec2 boolean = vec2(0.0, 1.0);
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main(void) {
|
||||
gl_FragColor = texture2D(u_texture, v_texCoords).rgba * boolean.yyyx + boolean.xxxy;
|
||||
fragColor = texture2D(u_texture, v_texCoords).rgba * boolean.yyyx + boolean.xxxy;
|
||||
}
|
||||
@@ -1,21 +1,24 @@
|
||||
#version 130
|
||||
#version 150
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
in vec4 v_color;
|
||||
in vec2 v_texCoords;
|
||||
|
||||
uniform sampler2D u_texture; // world texture, has alpha value that is meaningful
|
||||
|
||||
uniform sampler2D tex1; // lightmap texture
|
||||
uniform vec2 tex1Offset;
|
||||
uniform vec2 tex1Resolution;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
vec4 colorTex0 = texture2D(u_texture, v_texCoords + vec2(0.5, 0.5)); // world texture
|
||||
vec4 colorTex1 = texture2D(tex1, v_texCoords); // lightmap (RGBA)
|
||||
|
||||
colorTex1 = vec4(colorTex1.xyz, 1.0);
|
||||
|
||||
gl_FragColor = colorTex0 * colorTex1;
|
||||
fragColor = colorTex0 * colorTex1;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
#version 130
|
||||
#version 150
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
uniform sampler2D u_texture;
|
||||
in vec4 v_color;
|
||||
in vec2 v_texCoords;
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
uniform vec3 topColor;
|
||||
uniform vec3 bottomColor;
|
||||
uniform float parallax = 0.0; // +1.0: all top col, -1.0: all bototm col, 0.0: normal grad
|
||||
uniform float parallax_size = 1.0/3.0; // 0: no parallax
|
||||
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main(void) {
|
||||
float scale = v_texCoords.y * (1.0 - parallax_size) + (parallax_size / 2.0) + (parallax * parallax_size / 2.0);
|
||||
@@ -23,7 +23,7 @@ void main(void) {
|
||||
float inG = mix(bottomColor.g, topColor.g, scale);
|
||||
float inB = mix(bottomColor.b, topColor.b, scale);
|
||||
|
||||
gl_FragColor = vec4(inR, inG, inB, 1.0);
|
||||
fragColor = vec4(inR, inG, inB, 1.0);
|
||||
}
|
||||
/*
|
||||
UV mapping coord.y
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
*/
|
||||
|
||||
#version 130
|
||||
#version 150
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
@@ -10,8 +10,9 @@ precision mediump float;
|
||||
//layout(origin_upper_left) in vec4 gl_FragCoord; // commented; requires #version 150 or later
|
||||
// gl_FragCoord is origin to bottom-left
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
in vec4 v_color;
|
||||
in vec2 v_texCoords;
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
|
||||
@@ -41,6 +42,8 @@ uniform float mulBlendIntensity = 1.0; // used my MUL-blending drawings; works a
|
||||
|
||||
const vec2 bc = vec2(1.0, 0.0); //binary constant
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
ivec2 getTileXY(int tileNumber) {
|
||||
return ivec2(tileNumber % int(tilesInAtlas.x), tileNumber / int(tilesInAtlas.x));
|
||||
}
|
||||
@@ -106,6 +109,6 @@ void main() {
|
||||
|
||||
vec4 finalColor =mix(finalTile, finalBreakage, finalBreakage.a) * bc.xxxy + (finalTile * bc.yyyx);
|
||||
|
||||
gl_FragColor = mix(colourFilter, colourFilter * finalColor, mulBlendIntensity);
|
||||
fragColor = mix(colourFilter, colourFilter * finalColor, mulBlendIntensity);
|
||||
|
||||
}
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
|
||||
*/
|
||||
|
||||
#version 130
|
||||
#version 150
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
in vec4 v_color;
|
||||
in vec2 v_texCoords;
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
|
||||
@@ -38,6 +39,8 @@ uniform float mulBlendIntensity = 1.0; // used my MUL-blending drawings; works a
|
||||
|
||||
const vec2 bc = vec2(1.0, 0.0); //binary constant
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
// man the traditional bayer crosshatch pattern looks really good on tiles...
|
||||
int bayer[16] = int[](
|
||||
0,8,2,10,
|
||||
@@ -118,5 +121,5 @@ void main() {
|
||||
vec2 entry = mod(gl_FragCoord.xy, vec2(bayerSize, bayerSize));
|
||||
float bayerThreshold = float(bayer[int(entry.y) * int(bayerSize) + int(entry.x)]) / bayerDivider;
|
||||
|
||||
gl_FragColor = undithered * bc.xxxy + vec4((undithered.a > bayerThreshold) ? 1.0 : 0.0) * bc.yyyx;
|
||||
fragColor = undithered * bc.xxxy + vec4((undithered.a > bayerThreshold) ? 1.0 : 0.0) * bc.yyyx;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
#version 150
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
in vec4 v_color;
|
||||
in vec2 v_texCoords;
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
mat4 rgb_to_ycocg = mat4(
|
||||
0.25, 1.0, -0.5, 0.0,
|
||||
0.5, 0.0, 1.0, 0.0,
|
||||
@@ -29,5 +32,5 @@ void main() {
|
||||
|
||||
vec4 scalar = vec4(1.0, 2.0, 2.0, 1.0);
|
||||
|
||||
gl_FragColor = ycocg_to_rgb * (yog * scalar);
|
||||
fragColor = ycocg_to_rgb * (yog * scalar);
|
||||
}
|
||||
Reference in New Issue
Block a user