Improve compatibility with GLES back-end
This commit is contained in:
@@ -33,9 +33,9 @@ vec3 srgb_to_linear(vec3 c) {
|
||||
vec3 linear_to_srgb(vec3 c) {
|
||||
const float t = 0.00313066844250063;
|
||||
return vec3(
|
||||
c.r <= t ? c.r * 12.92 : 1.055 * pow(c.r, 1 / 2.4) - 0.055,
|
||||
c.g <= t ? c.g * 12.92 : 1.055 * pow(c.g, 1 / 2.4) - 0.055,
|
||||
c.b <= t ? c.b * 12.92 : 1.055 * pow(c.b, 1 / 2.4) - 0.055
|
||||
c.r <= t ? c.r * 12.92 : 1.055 * pow(c.r, 1.0 / 2.4) - 0.055,
|
||||
c.g <= t ? c.g * 12.92 : 1.055 * pow(c.g, 1.0 / 2.4) - 0.055,
|
||||
c.b <= t ? c.b * 12.92 : 1.055 * pow(c.b, 1.0 / 2.4) - 0.055
|
||||
);
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ void main() {
|
||||
*/
|
||||
@Suppress("RUNTIME_ANNOTATION_NOT_SUPPORTED")
|
||||
@Description("Blend spectral")
|
||||
class BlendSpectral : Filter2to1(filterShaderFromCode(spectralBlendShader, "color-burn")) {
|
||||
class BlendSpectral : Filter2to1(filterShaderFromCode(spectralBlendShader, "blend-spectral")) {
|
||||
@BooleanParameter("source clip")
|
||||
var clip: Boolean by parameters
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.openrndr.extra.parameters.IntParameter
|
||||
import org.openrndr.shape.Rectangle
|
||||
|
||||
@Description("Lenses")
|
||||
class Lenses : Filter1to1(mppFilterShader(fx_lenses, "block-repeat")) {
|
||||
class Lenses : Filter1to1(mppFilterShader(fx_lenses, "lenses")) {
|
||||
@IntParameter("rows", 1, 64, order = 0)
|
||||
var rows: Int by parameters
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.*
|
||||
import org.openrndr.extensions.SingleScreenshot
|
||||
import org.openrndr.extra.fx.blur.*
|
||||
import org.openrndr.math.Polar
|
||||
import kotlin.math.sin
|
||||
|
||||
@@ -2,7 +2,6 @@ import org.openrndr.application
|
||||
import org.openrndr.draw.createEquivalent
|
||||
import org.openrndr.draw.loadImage
|
||||
import org.openrndr.extra.fx.dither.LumaHalftone
|
||||
import org.openrndr.math.mod_
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
|
||||
@@ -16,11 +16,6 @@ fun main() {
|
||||
checkers.size = 64.0
|
||||
checkers.apply(emptyArray(), image)
|
||||
|
||||
if (System.getProperty("takeScreenshot") == "true") {
|
||||
extend(SingleScreenshot()) {
|
||||
this.outputFile = System.getProperty("screenshotPath")
|
||||
}
|
||||
}
|
||||
extend {
|
||||
fd.blend = mouse.position.x/width
|
||||
fd.apply(image, distorted)
|
||||
|
||||
@@ -21,14 +21,14 @@ void main() {
|
||||
vec4 b = texture2D(tex1, v_texCoord0);
|
||||
#endif
|
||||
|
||||
vec3 na = a.a > 0 ? a.rgb/a.a : vec3(0.0);
|
||||
vec3 nb = b.a > 0 ? b.rgb/b.a : vec3(0.0);
|
||||
vec3 na = a.a > 0.0 ? a.rgb/a.a : vec3(0.0);
|
||||
vec3 nb = b.a > 0.0 ? b.rgb/b.a : vec3(0.0);
|
||||
|
||||
vec3 addColor = b.rgb;
|
||||
|
||||
vec4 result;
|
||||
if (clip) {
|
||||
result = vec4((na + addColor), 1) * a.a;
|
||||
result = vec4((na + addColor), 1.0) * a.a;
|
||||
} else {
|
||||
result = (1.0-a.a) * b + a.a * b.a * vec4(min(na + nb, vec3(1.0)), 1.0) + (1.0-b.a) * a;
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ void main() {
|
||||
vec3 nb = b.a == 0.0 ? vec3(0.0): b.rgb / b.a;
|
||||
|
||||
vec3 m = vec3(
|
||||
nb.r <= 0.5? 2*na.r * nb.r : 1.0 - 2.0*(1.0 - na.r)*(1.0 - nb.r),
|
||||
nb.g <= 0.5? 2*na.g * nb.g : 1.0 - 2.0*(1.0 - na.g)*(1.0 - nb.g),
|
||||
nb.b <= 0.5? 2*na.b * nb.b : 1.0 - 2.0*(1.0 - na.b)*(1.0 - nb.b)
|
||||
nb.r <= 0.5? 2.0*na.r * nb.r : 1.0 - 2.0*(1.0 - na.r)*(1.0 - nb.r),
|
||||
nb.g <= 0.5? 2.0*na.g * nb.g : 1.0 - 2.0*(1.0 - na.g)*(1.0 - nb.g),
|
||||
nb.b <= 0.5? 2.0*na.b * nb.b : 1.0 - 2.0*(1.0 - na.b)*(1.0 - nb.b)
|
||||
);
|
||||
|
||||
vec4 result;
|
||||
|
||||
@@ -21,14 +21,14 @@ void main() {
|
||||
vec4 b = texture2D(tex1, v_texCoord0);
|
||||
#endif
|
||||
|
||||
float alpha = min(1,max(0, b.a));
|
||||
float alpha = min(1.0, max(0.0, b.a));
|
||||
|
||||
vec4 result;
|
||||
if (!clip) {
|
||||
result = a * (1.0-alpha) + b;
|
||||
result = a * (1.0 - alpha) + b;
|
||||
result.a = clamp(o_color.a, 0.0, 1.0);
|
||||
} else {
|
||||
result = a * (1.0-alpha) + b * a.a;
|
||||
result = a * (1.0 - alpha) + b * a.a;
|
||||
}
|
||||
|
||||
#ifdef OR_GL_FRAGCOLOR
|
||||
|
||||
@@ -13,7 +13,7 @@ out vec4 o_color;
|
||||
#endif
|
||||
|
||||
vec3 demul(vec4 c) {
|
||||
if (c.a == 0) {
|
||||
if (c.a == 0.0) {
|
||||
return vec3(0.0);
|
||||
} else {
|
||||
return c.rgb / c.a;
|
||||
|
||||
@@ -21,8 +21,8 @@ void main() {
|
||||
vec4 b = texture2D(tex1, v_texCoord0);
|
||||
#endif
|
||||
|
||||
vec3 na = a.a > 0 ? a.rgb/a.a : vec3(0.0);
|
||||
vec3 nb = b.a > 0 ? b.rgb/b.a : vec3(0.0);
|
||||
vec3 na = a.a > 0.0 ? a.rgb/a.a : vec3(0.0);
|
||||
vec3 nb = b.a > 0.0 ? b.rgb/b.a : vec3(0.0);
|
||||
vec3 subColor = b.rgb;
|
||||
vec4 result;
|
||||
if (clip) {
|
||||
|
||||
@@ -20,7 +20,7 @@ void main() {
|
||||
float lw = exp( float(-(x*x)) / (2.0 * sigma * sigma) ) ;
|
||||
vec2 tc = v_texCoord0 + float(x) * blurDirection * s;// * spread;
|
||||
#ifndef OR_WEBGL2
|
||||
sum += textureLod(tex0, tc, sourceLevel) * lw;
|
||||
sum += textureLod(tex0, tc, float(sourceLevel)) * lw;
|
||||
#else
|
||||
sum += texture(tex0, tc);
|
||||
#endif
|
||||
|
||||
@@ -8,12 +8,12 @@ void main()
|
||||
{
|
||||
float centerWeight = 0.16210282163712664;
|
||||
vec2 diagonalOffsets = vec2(0.3842896354828526, 1.2048616327242379);
|
||||
vec4 offsets = vec4(-diagonalOffsets.xy, +diagonalOffsets.xy) / textureSize(tex0, 0).xyxy;
|
||||
vec4 offsets = vec4(-diagonalOffsets.xy, +diagonalOffsets.xy) / vec2(textureSize(tex0, 0)).xyxy;
|
||||
float diagonalWeight = 0.2085034734347498;
|
||||
|
||||
o_output = textureLod(tex0, v_texCoord0, 0) * centerWeight +
|
||||
textureLod(tex0, v_texCoord0 + offsets.xy, 0) * diagonalWeight +
|
||||
textureLod(tex0, v_texCoord0 + offsets.wx, 0) * diagonalWeight +
|
||||
textureLod(tex0, v_texCoord0 + offsets.zw, 0) * diagonalWeight +
|
||||
textureLod(tex0, v_texCoord0 + offsets.yz, 0) * diagonalWeight;
|
||||
o_output = textureLod(tex0, v_texCoord0, 0.0) * centerWeight +
|
||||
textureLod(tex0, v_texCoord0 + offsets.xy, 0.0) * diagonalWeight +
|
||||
textureLod(tex0, v_texCoord0 + offsets.wx, 0.0) * diagonalWeight +
|
||||
textureLod(tex0, v_texCoord0 + offsets.zw, 0.0) * diagonalWeight +
|
||||
textureLod(tex0, v_texCoord0 + offsets.yz, 0.0) * diagonalWeight;
|
||||
}
|
||||
@@ -20,55 +20,55 @@ uniform sampler2D tex4;
|
||||
uniform sampler2D tex5;
|
||||
|
||||
vec4 sampleBloom(vec2 pos, float shape) {
|
||||
vec4 sum = vec4(0);
|
||||
float total = 0;
|
||||
vec4 sum = vec4(0.0);
|
||||
float total = 0.0;
|
||||
|
||||
{
|
||||
float weight = pow(0.0, shape);
|
||||
vec2 rnd = vec2(nrand(3 + 0.0 + pos.xy + noiseSeed),
|
||||
nrand(5 + 0.0 + pos.yx - noiseSeed));
|
||||
rnd = (rnd * 2 - 1) / textureSize(tex0, 0);
|
||||
vec2 rnd = vec2(nrand(3.0 + 0.0 + pos.xy + noiseSeed),
|
||||
nrand(5.0 + 0.0 + pos.yx - noiseSeed));
|
||||
rnd = (rnd * 2.0 - 1.0) / vec2(textureSize(tex0, 0));
|
||||
sum += textureLod(tex0, pos + rnd * noiseGain, 0.0) * weight;
|
||||
total += weight;
|
||||
}
|
||||
{
|
||||
float weight = pow(1.0, shape);
|
||||
vec2 rnd = vec2(nrand(3 + 0.0 + pos.xy + noiseSeed),
|
||||
nrand(5 + 0.0 + pos.yx - noiseSeed));
|
||||
rnd = (rnd * 2 - 1) / textureSize(tex1, 0);
|
||||
vec2 rnd = vec2(nrand(3.0 + 0.0 + pos.xy + noiseSeed),
|
||||
nrand(5.0 + 0.0 + pos.yx - noiseSeed));
|
||||
rnd = (rnd * 2.0 - 1.0) / vec2(textureSize(tex0, 0));
|
||||
sum += textureLod(tex1, pos + rnd * noiseGain, 0.0) * weight;
|
||||
total += weight;
|
||||
}
|
||||
{
|
||||
float weight = pow(2.0, shape);
|
||||
vec2 rnd = vec2(nrand(3 + 0.0 + pos.xy + noiseSeed),
|
||||
nrand(5 + 0.0 + pos.yx - noiseSeed));
|
||||
rnd = (rnd * 2 - 1) / textureSize(tex2, 0);
|
||||
vec2 rnd = vec2(nrand(3.0 + 0.0 + pos.xy + noiseSeed),
|
||||
nrand(5.0 + 0.0 + pos.yx - noiseSeed));
|
||||
rnd = (rnd * 2.0 - 1.0) / vec2(textureSize(tex0, 0));
|
||||
sum += textureLod(tex2, pos + rnd * noiseGain, 0.0) * weight;
|
||||
total += weight;
|
||||
}
|
||||
|
||||
{
|
||||
float weight = pow(3.0, shape);
|
||||
vec2 rnd = vec2(nrand(3 + 0.0 + pos.xy + noiseSeed),
|
||||
nrand(5 + 0.0 + pos.yx - noiseSeed));
|
||||
rnd = (rnd * 3 - 1) / textureSize(tex3, 0);
|
||||
vec2 rnd = vec2(nrand(3.0 + 0.0 + pos.xy + noiseSeed),
|
||||
nrand(5.0 + 0.0 + pos.yx - noiseSeed));
|
||||
rnd = (rnd * 3.0 - 1.0) / vec2(textureSize(tex0, 0));
|
||||
sum += textureLod(tex3, pos + rnd * noiseGain, 0.0) * weight;
|
||||
total += weight;
|
||||
}
|
||||
{
|
||||
float weight = pow(4.0, shape);
|
||||
vec2 rnd = vec2(nrand(3 + 0.0 + pos.xy + noiseSeed),
|
||||
nrand(5 + 0.0 + pos.yx - noiseSeed));
|
||||
rnd = (rnd * 3 - 1) / textureSize(tex3, 0);
|
||||
vec2 rnd = vec2(nrand(3.0 + 0.0 + pos.xy + noiseSeed),
|
||||
nrand(5.0 + 0.0 + pos.yx - noiseSeed));
|
||||
rnd = (rnd * 3.0 - 1.0) / vec2(textureSize(tex0, 0));
|
||||
sum += textureLod(tex4, pos + rnd * noiseGain, 0.0) * weight;
|
||||
total += weight;
|
||||
}
|
||||
{
|
||||
float weight = pow(5.0, shape);
|
||||
vec2 rnd = vec2(nrand(3 + 0.0 + pos.xy + noiseSeed),
|
||||
nrand(5 + 0.0 + pos.yx - noiseSeed));
|
||||
rnd = (rnd * 3 - 1) / textureSize(tex3, 0);
|
||||
vec2 rnd = vec2(nrand(3.0 + 0.0 + pos.xy + noiseSeed),
|
||||
nrand(5.0 + 0.0 + pos.yx - noiseSeed));
|
||||
rnd = (rnd * 3.0 - 1.0) / vec2(textureSize(tex0, 0));
|
||||
sum += textureLod(tex5, pos + rnd * noiseGain, 0.0) * weight;
|
||||
total += weight;
|
||||
}
|
||||
|
||||
@@ -10,17 +10,17 @@ uniform float gain;
|
||||
out vec4 o_color;
|
||||
void main() {
|
||||
|
||||
vec2 s = textureSize(tex0, 0).xy;
|
||||
vec2 s = vec2(textureSize(tex0, 0).xy);
|
||||
s = vec2(1.0/s.x, 1.0/s.y);
|
||||
|
||||
int w = window;
|
||||
|
||||
vec4 sum = vec4(0,0,0,0);
|
||||
float weight = 0;
|
||||
vec4 sum = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
float weight = 0.0;
|
||||
for (int y = -w; y<= w; ++y) {
|
||||
for (int x = -w; x<= w; ++x) {
|
||||
float lw = exp(-(x*x+y*y) / (2 * sigma * sigma));
|
||||
sum+=texture(tex0, v_texCoord0 + vec2(x,y) * s * spread) * lw;
|
||||
float lw = exp(-float(x*x+y*y) / (2.0 * sigma * sigma));
|
||||
sum+=texture(tex0, v_texCoord0 + vec2(x, y) * s * spread) * lw;
|
||||
weight+=lw;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ uniform int levels;
|
||||
out vec4 o_output;
|
||||
void main() {
|
||||
vec4 c = texture(tex0, v_texCoord0);
|
||||
vec2 step = 1.0 / textureSize(tex0, 0);
|
||||
vec2 step = 1.0 / vec2(textureSize(tex0, 0));
|
||||
float w = 0.0;
|
||||
vec3 s = vec3(0.0);
|
||||
for (int v = -window; v <= window; ++v) {
|
||||
@@ -14,7 +14,7 @@ void main() {
|
||||
if (c.a != 0.0) {
|
||||
c.rgb /= c.a;
|
||||
}
|
||||
vec3 q = min(floor(c.rgb * float(levels))/float(levels-1.0), vec3(1.0));
|
||||
vec3 q = min(floor(c.rgb * float(levels))/float(levels-1), vec3(1.0));
|
||||
s += q;
|
||||
w += 1.0;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ void main() {
|
||||
}
|
||||
c.rgb *= 255.0;
|
||||
float y = 0.0 + 0.299 * c.r + 0.587 * c.g + 0.114 * c.b;
|
||||
float cb = 128 - (0.168736 * c.r) - (0.331264 * c.g) + (0.5 * c.b);
|
||||
float cr = 128 + (0.5 * c.r) - 0.418688 * c.g - 0.081312 * c.b;
|
||||
float cb = 128.0 - (0.168736 * c.r) - (0.331264 * c.g) + (0.5 * c.b);
|
||||
float cr = 128.0 + (0.5 * c.r) - 0.418688 * c.g - 0.081312 * c.b;
|
||||
o_color = vec4(y/255.0, cb/255.0, cr/255.0, 1.0) * c.a;
|
||||
}
|
||||
@@ -4,7 +4,7 @@ uniform sampler2D tex0;
|
||||
|
||||
out vec4 o_color;
|
||||
void main() {
|
||||
vec2 ts = textureSize(tex0, 0);
|
||||
vec2 ts = vec2(textureSize(tex0, 0));
|
||||
vec4 c = texture(tex0, v_texCoord0);
|
||||
|
||||
if (c.a != 0.0) {
|
||||
|
||||
@@ -22,7 +22,7 @@ void main() {
|
||||
|
||||
float ar = targetSize.y / targetSize.x;
|
||||
|
||||
vec4 nb = b.a > 0? b/b.a : vec4(0.0);
|
||||
vec4 nb = b.a > 0.0? b/b.a : vec4(0.0);
|
||||
|
||||
vec2 offset = (nb.rg - vec2(offset))*vec2(gain) * nb.a;
|
||||
offset = rm * offset * vec2(1.0, ar);
|
||||
|
||||
@@ -34,11 +34,11 @@ uniform float blend;
|
||||
out vec4 o_color;
|
||||
|
||||
float getRot(vec2 pos, vec2 b) {
|
||||
vec2 Res = textureSize(tex0, 0);
|
||||
vec2 Res = vec2(textureSize(tex0, 0));
|
||||
vec2 p = b;
|
||||
float rot = 0.0;
|
||||
for (int i = 0; i < RotNum; i++) {
|
||||
rot += dot(texture(tex0, fract((pos + p) / Res.xy)).xy -vec2(0.5), p.yx * vec2(1, -1));
|
||||
rot += dot(texture(tex0, fract((pos + p) / Res.xy)).xy -vec2(0.5), p.yx * vec2(1.0, -1.0));
|
||||
p = m * p;
|
||||
}
|
||||
return rot / float(RotNum)/dot(b, b);
|
||||
@@ -46,10 +46,10 @@ float getRot(vec2 pos, vec2 b) {
|
||||
|
||||
void main() {
|
||||
vec2 pos = v_texCoord0 * targetSize;
|
||||
vec2 Res = textureSize(tex0, 0);
|
||||
vec2 Res = vec2(textureSize(tex0, 0));
|
||||
|
||||
vec2 b = vec2(cos(ang * random), sin(ang * random));
|
||||
vec2 v = vec2(0);
|
||||
vec2 v = vec2(0.0);
|
||||
float bbMax = 0.5 * Res.y;
|
||||
bbMax *= bbMax;
|
||||
for (int l = 0; l < 20; l++) {
|
||||
|
||||
@@ -18,7 +18,7 @@ void main() {
|
||||
float ca = cos(radians(rotation));
|
||||
float sa = sin(radians(rotation));
|
||||
|
||||
vec2 ts = textureSize(tex0, 0);
|
||||
vec2 ts = vec2(textureSize(tex0, 0));
|
||||
mat2 rm = mat2(1.0, 0.0, 0.0, ts.x / ts.y) * mat2(vec2(ca, sa), vec2(-sa, ca)) * mat2(1.0, 0.0, 0.0, ts.y / ts.x);
|
||||
vec2 ruv = (uv - blockCenter);
|
||||
vec2 luv;
|
||||
|
||||
@@ -11,11 +11,11 @@ uniform float rotation;
|
||||
out vec4 o_color;
|
||||
void main() {
|
||||
vec2 origin = vec2((xOrigin+1.0)/2.0, (yOrigin+1.0)/2.0);
|
||||
vec2 ts = textureSize(tex0, 0);
|
||||
vec2 ts = vec2(textureSize(tex0, 0));
|
||||
float r = ts.x/ts.y;
|
||||
vec2 offset = vec2(1.0, r) * vec2(xOffset, yOffset);
|
||||
vec2 uv = v_texCoord0 - vec2(origin);
|
||||
float rad = (rotation/180) * 3.1415926535;
|
||||
float rad = (rotation / 180.0) * 3.1415926535;
|
||||
vec2 cs0 = vec2(cos(rad), -sin(rad));
|
||||
vec2 cs1 = vec2(sin(rad), cos(rad));
|
||||
mat2 rotStep = mat2(cs0, cs1);
|
||||
@@ -24,7 +24,7 @@ void main() {
|
||||
vec4 c = texture(tex0, v_texCoord0);
|
||||
for (int i = 1; i <= repeats; ++i) {
|
||||
//vec2 s = (uv * (1.0 + zoom) * i) + vec2(0.5);
|
||||
vec2 s = (rot * uv * pow(1.0 + zoom,i*1.0) )+ vec2(origin) + vec2(offset) * i;
|
||||
vec2 s = (rot * uv * pow(1.0 + zoom, float(i) * 1.0))+ vec2(origin) + vec2(offset) * float(i);
|
||||
float f = s.x >= 0.0 && s.y > 0.0 && s.x < 1.0 && s.y < 1.0? 1.0 : 0.0;
|
||||
vec4 sc = texture(tex0, s) * f;
|
||||
|
||||
@@ -34,7 +34,5 @@ void main() {
|
||||
}
|
||||
rot *= rotStep;
|
||||
}
|
||||
|
||||
|
||||
o_color = c;
|
||||
}
|
||||
|
||||
@@ -35,19 +35,19 @@ void main() {
|
||||
o_output = vec4(0.0);
|
||||
for (int k = 0; k < 10; ++k ) {
|
||||
vec2 duv = v_texCoord0;
|
||||
duv.y += smoothstep(pow(cos(time+k*dk+v_texCoord0.y*1.0),10.0)*0.1+0.1, 0.0, v_texCoord0.x)*deformAmplitude * cos((time+k*dk)*deformFrequency);
|
||||
duv.y += smoothstep(pow(1.0-cos(time+k*dk+v_texCoord0.y*1.0),10.0)*0.1+0.1, 0.9, v_texCoord0.x)*deformAmplitude * cos((time+k*dk)*deformFrequency);
|
||||
duv.y += smoothstep(pow(cos(time+float(k)*dk+v_texCoord0.y*1.0),10.0)*0.1+0.1, 0.0, v_texCoord0.x)*deformAmplitude * cos((time+float(k)*dk)*deformFrequency);
|
||||
duv.y += smoothstep(pow(1.0-cos(time+float(k)*dk+v_texCoord0.y*1.0),10.0)*0.1+0.1, 0.9, v_texCoord0.x)*deformAmplitude * cos((time+float(k)*dk)*deformFrequency);
|
||||
duv.y += sin(v_texCoord0.x*3.1415926535)*0.0;
|
||||
float bc = floor(hash22(vec2(time+k*dk, (time+k*dk)*0.1)).x*20.0);
|
||||
float bc = floor(hash22(vec2(time+float(k)*dk, (time+float(k)*dk)*0.1)).x*20.0);
|
||||
|
||||
float gb3 = floor(duv.y*bc)/bc;
|
||||
|
||||
vec2 v = hash22(duv.xy*0.003+time+k*dk);
|
||||
vec2 v2 = hash22(duv.xy*0.03+time+k*dk);
|
||||
vec2 v2b = hash22(duv.yx*0.03+time+k*dk);
|
||||
float stretch = (cos(time+k*dk)*0.001+0.002)*0.3+0.001;
|
||||
vec2 h = hash22(duv.yy*stretch+time+k*dk);
|
||||
float gap = smoothstep(gapLow, gapHigh, cos(gb3*(gapFrequency+duv.y*gapFrequency + (time+k*dk)*gapFrequency) +duv.x*gapFrequency)) * (cos(gb3)*0.5+0.5);
|
||||
vec2 v = hash22(duv.xy*0.003+time+float(k)*dk);
|
||||
vec2 v2 = hash22(duv.xy*0.03+time+float(k)*dk);
|
||||
vec2 v2b = hash22(duv.yx*0.03+time+float(k)*dk);
|
||||
float stretch = (cos(time+float(k)*dk)*0.001+0.002)*0.3+0.001;
|
||||
vec2 h = hash22(duv.yy*stretch+time+float(k)*dk);
|
||||
float gap = smoothstep(gapLow, gapHigh, cos(gb3*(gapFrequency+duv.y*gapFrequency + (time+float(k)*dk)*gapFrequency) +duv.x*gapFrequency)) * (cos(gb3)*0.5+0.5);
|
||||
|
||||
float r = smoothstep(noiseLow, noiseHigh, h.x*gap*v2.x)*1.0;
|
||||
float g = smoothstep(noiseLow, noiseHigh, h.x*gap*v2.y)*1.0;
|
||||
|
||||
@@ -30,8 +30,8 @@ vec4 getVideo(vec2 uv, float amplitude, float seconds) {
|
||||
float iTime = seconds;
|
||||
vec2 look = mod(uv, vec2(1.0));
|
||||
float window = 1.0/(1.0 + 20.0*(look.y-mod(iTime*vfreq, 1.0))*(look.y-mod(iTime*vfreq, 1.)));
|
||||
look.x = look.x + sin(look.y*pfreq + poffset * 3.1415)/50 *(1.+cos(iTime*hfreq))*window*amplitude;
|
||||
look.y = mod(look.y, 1.);
|
||||
look.x = look.x + sin(look.y*pfreq + poffset * 3.1415)/50.0 *(1.0+cos(iTime*hfreq))*window*amplitude;
|
||||
look.y = mod(look.y, 1.0);
|
||||
|
||||
vec4 video = texture(tex0, look);
|
||||
return video;
|
||||
@@ -48,11 +48,11 @@ void main() {
|
||||
float ds = scrollOffset1 - scrollOffset0;
|
||||
if (aa > 0.0 || ds > 0.0) {
|
||||
for (int i = 1; i < 16; ++i) {
|
||||
vec4 lc = getVideo(v_texCoord0 + vec2(0.0, scrollOffset0+ds*i), aa, time-i/(16*60.0));
|
||||
vec4 lc = getVideo(v_texCoord0 + vec2(0.0, scrollOffset0+ds*float(i)), aa, time-float(i)/(16.0*60.0));
|
||||
if (!linearInput) {
|
||||
lc.rgb = pow(lc.rgb, vec3(2.2));
|
||||
}
|
||||
c += lc * (3.0/16.0) * aberrationColor(i/16.0);
|
||||
c += lc * (3.0/16.0) * aberrationColor(float(i)/16.0);
|
||||
}
|
||||
o_output = c;
|
||||
} else {
|
||||
@@ -63,6 +63,6 @@ void main() {
|
||||
o_output = lc;
|
||||
}
|
||||
if (!linearOutput) {
|
||||
o_output.rgb = pow(o_output.rgb, vec3(1/2.2));
|
||||
o_output.rgb = pow(o_output.rgb, vec3(1.0/2.2));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,22 +7,22 @@ uniform int pattern;
|
||||
uniform int levels;
|
||||
|
||||
float mask1(int levels, float l, int x, int y, int c) {
|
||||
float mask = ((x ^ y * 149) * 1234& 511)/511.0;
|
||||
return floor(levels * l + mask)/levels;
|
||||
float mask = float((x ^ y * 149) * 1234& 511)/511.0;
|
||||
return floor(float(levels) * l + mask)/float(levels);
|
||||
}
|
||||
|
||||
float mask2(int levels, float l, int x, int y, int c) {
|
||||
float mask = (((x+c*17) ^ y * 149) * 1234 & 511)/511.0;
|
||||
return floor(levels * l + mask)/levels;
|
||||
float mask = float(((x+c*17) ^ y * 149) * 1234 & 511)/511.0;
|
||||
return floor(float(levels) * l + mask)/float(levels);
|
||||
}
|
||||
float mask3(int levels, float l, int x, int y, int c) {
|
||||
float mask = ((x + y * 237) * 119 & 255)/255.0;
|
||||
return floor(levels * l + mask)/levels;
|
||||
float mask = float((x + y * 237) * 119 & 255)/255.0;
|
||||
return floor(float(levels) * float(l) + mask)/float(levels);
|
||||
}
|
||||
|
||||
float mask4(int levels, float l, int x, int y, int c) {
|
||||
float mask = (((x+c*67) + y * 236) * 119 & 255)/255.0;
|
||||
return floor(levels * l + mask)/levels;
|
||||
float mask = float(((x+c*67) + y * 236) * 119 & 255)/255.0;
|
||||
return floor(float(levels) * float(l) + mask)/float(levels);
|
||||
}
|
||||
|
||||
out vec4 o_color;
|
||||
@@ -31,7 +31,7 @@ void main() {
|
||||
if (c.a > 0.0) {
|
||||
c.rgb/=c.a;
|
||||
}
|
||||
ivec2 ic = ivec2(v_texCoord0 * textureSize(tex0, 0));
|
||||
ivec2 ic = ivec2(v_texCoord0 * vec2(textureSize(tex0, 0)));
|
||||
|
||||
vec4 rgba = vec4(0.0);
|
||||
if (pattern == 0) {
|
||||
|
||||
@@ -23,7 +23,7 @@ vec3 cmyki2rgb(in vec4 c)
|
||||
return c.rgb * c.a;
|
||||
}
|
||||
vec3 u(vec4 c) {
|
||||
if (c.a == 0) {
|
||||
if (c.a == 0.0) {
|
||||
return vec3(0.0);
|
||||
} else {
|
||||
return c.rgb/c.a;
|
||||
@@ -46,7 +46,7 @@ vec4 cmyki2rgba(in vec4 cmyk){
|
||||
|
||||
vec2 px2uv(in vec2 px)
|
||||
{
|
||||
return vec2(px / textureSize(tex0, 0));
|
||||
return vec2(px / vec2(textureSize(tex0, 0)));
|
||||
}
|
||||
|
||||
vec2 grid(in vec2 px)
|
||||
@@ -63,7 +63,7 @@ vec4 halftone(in vec2 fc,in mat2 m)
|
||||
{
|
||||
vec2 smp = (grid(m*fc) + 0.5*scale) * m;
|
||||
float s = min(length(fc-smp) / (dotSize*0.5*scale), 1.0);
|
||||
vec3 texc = texture(tex0, px2uv(smp+textureSize(tex0, 0)/2.0)).rgb;
|
||||
vec3 texc = texture(tex0, px2uv(smp+vec2(textureSize(tex0, 0))/2.0)).rgb;
|
||||
vec4 c = rgb2cmyki(texc);
|
||||
return c+s;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ mat2 rotm(in float r)
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 fc = v_texCoord0 * textureSize(tex0, 0) - textureSize(tex0, 0)/2.0;
|
||||
vec2 fc = v_texCoord0 * vec2(textureSize(tex0, 0)) - vec2(textureSize(tex0, 0))/2.0;
|
||||
|
||||
mat2 mc = rotm(rotation + radians(15.0));
|
||||
mat2 mm = rotm(rotation + radians(75.0));
|
||||
|
||||
@@ -16,7 +16,7 @@ float cosine_sample(vec2 uv){
|
||||
float ca = cos(radians(rotation));
|
||||
float sa = sin(radians(rotation));
|
||||
|
||||
vec2 ts = textureSize(tex0, 0);
|
||||
vec2 ts = vec2(textureSize(tex0, 0));
|
||||
mat2 rm = mat2(1.0, 0.0, 0.0, ts.x/ts.y) * mat2(vec2(ca, sa), vec2(-sa, ca)) * mat2(1.0, 0.0, 0.0, ts.y/ts.x);
|
||||
|
||||
vec2 cuv = (rm * (uv - vec2(0.5))) + vec2(0.5);
|
||||
@@ -28,7 +28,7 @@ float cosine_sample(vec2 uv){
|
||||
}
|
||||
float l = dot(vec3(1.0/3.0), c.rgb);
|
||||
if (invert) {
|
||||
l = 1 - l;
|
||||
l = 1.0 - l;
|
||||
}
|
||||
|
||||
float t = 0.0;
|
||||
@@ -38,14 +38,14 @@ float cosine_sample(vec2 uv){
|
||||
|
||||
float cosine_halftone(vec2 uv) {
|
||||
int w = 3;
|
||||
vec2 step = 1.0 / textureSize(tex0, 0);
|
||||
step /= (2*w);
|
||||
vec2 step = 1.0 / vec2(textureSize(tex0, 0));
|
||||
step /= (2.0*float(w));
|
||||
float weight = 0.0;
|
||||
float sum = 0.0;
|
||||
for (int v = -w; v <= w; ++v) {
|
||||
for (int u = -w; u <= w; ++u) {
|
||||
sum += cosine_sample(uv + step * vec2(u, v));
|
||||
weight+=1;
|
||||
weight+=1.0;
|
||||
}
|
||||
}
|
||||
return sum / weight;
|
||||
@@ -56,7 +56,7 @@ void main() {
|
||||
vec4 c = texture(tex0, v_texCoord0);
|
||||
float t = cosine_halftone(v_texCoord0);
|
||||
if (invert) {
|
||||
t = 1 - t;
|
||||
t = 1.0 - t;
|
||||
}
|
||||
o_color = vec4(t, t, t, 1.0) * c.a;
|
||||
}
|
||||
@@ -15,8 +15,7 @@ uniform vec4 foregroundColor;
|
||||
uniform float backgroundOpacity;
|
||||
uniform float foregroundOpacity;
|
||||
|
||||
vec2 iResolution = textureSize(tex0, 0);
|
||||
vec2 fragCoord = v_texCoord0 * iResolution;
|
||||
vec2 iResolution;
|
||||
|
||||
float getAve(vec2 uv){
|
||||
vec3 rgb = texture(tex0, uv).rgb;
|
||||
@@ -104,6 +103,8 @@ float cannyEdge(vec2 fragCoord, float mn, float mx){
|
||||
}
|
||||
|
||||
void main(){
|
||||
iResolution = vec2(textureSize(tex0, 0));
|
||||
vec2 fragCoord = v_texCoord0 * iResolution;
|
||||
float edge = cannyEdge(fragCoord, threshold0, threshold1);
|
||||
o_output = mix(foregroundColor * foregroundOpacity, backgroundColor * backgroundOpacity, 1.-edge);
|
||||
}
|
||||
@@ -17,13 +17,13 @@ float calc_contour(vec2 uv) {
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 step = 1.0 / textureSize(tex0, 0);
|
||||
vec2 step = 1.0 / vec2(textureSize(tex0, 0));
|
||||
float contour = 0.0;
|
||||
float weight = 0.0;
|
||||
|
||||
for (int i = -window; i <= window; ++i) {
|
||||
for (int j = -window; j <= window; ++j) {
|
||||
contour += calc_contour(v_texCoord0 + step/(window+1.0) * vec2(i, j));
|
||||
contour += calc_contour(v_texCoord0 + step/(float(window)+1.0) * vec2(float(i), float(j)));
|
||||
weight += 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ float luma(vec4 color){
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 step = 1.0 / textureSize(tex0, 0);
|
||||
vec2 step = 1.0 / vec2(textureSize(tex0, 0));
|
||||
|
||||
float tl = luma(texture(tex0, v_texCoord0 + vec2(-step.x, step.y)));
|
||||
float l = luma(texture(tex0, v_texCoord0 + vec2(-step.x, 0)));
|
||||
@@ -39,7 +39,7 @@ void main() {
|
||||
|
||||
float x = tl + 2.0 * l + bl - tr - 2.0 * r - br;
|
||||
float y = -tl - 2.0 * t - tr + bl + 2.0 * b + br;
|
||||
float intensity = sqrt((x*x) + (y*y)) / sqrt(2);
|
||||
float intensity = sqrt(x*x + y*y) / sqrt(2.0);
|
||||
vec4 color = mix(vec4(backgroundColor.rgb, backgroundOpacity), vec4(edgeColor.rgb, edgeOpacity), intensity);
|
||||
|
||||
vec4 a = texture(tex0, v_texCoord0);
|
||||
|
||||
@@ -21,7 +21,7 @@ void main() {
|
||||
|
||||
vec2 cell = (uv / size);
|
||||
ivec2 cellIndex = ivec2(floor(cell));
|
||||
vec2 cellUV = cell - cellIndex;
|
||||
vec2 cellUV = cell - vec2(cellIndex);
|
||||
|
||||
int c = (cellIndex.x + cellIndex.y) % 2;
|
||||
vec2 w = fwidth(cell);
|
||||
|
||||
@@ -7,6 +7,6 @@ out vec4 o_color;
|
||||
void main() {
|
||||
vec4 a = texture(tex0, v_texCoord0-shift);
|
||||
vec4 b = texture(tex1, v_texCoord0);
|
||||
float alpha = min(1,max(0, b.a));
|
||||
float alpha = min(1.0,max(0.0, b.a));
|
||||
o_color = a * (1.0-alpha) + b;
|
||||
}
|
||||
@@ -10,16 +10,16 @@ uniform float spread;
|
||||
uniform vec4 color;
|
||||
out vec4 o_color;
|
||||
void main() {
|
||||
vec2 s = textureSize(tex0, 0).xy;
|
||||
vec2 s = vec2(textureSize(tex0, 0)).xy;
|
||||
s = vec2(1.0/s.x, 1.0/s.y);
|
||||
|
||||
int w = window;
|
||||
|
||||
vec4 sum = vec4(0, 0, 0, 0);
|
||||
float weight = 0;
|
||||
float weight = 0.0;
|
||||
for (int x = -w; x<= w; ++x) {
|
||||
float lw = 1.0;
|
||||
sum += texture(tex0, v_texCoord0 + x * blurDirection * s * spread);
|
||||
sum += texture(tex0, v_texCoord0 + float(x) * blurDirection * s * spread);
|
||||
weight += lw;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,6 @@ vec3 ACESFilm(vec3 x) {
|
||||
void main() {
|
||||
vec3 texColor = texture(tex0,v_texCoord0).rgb;
|
||||
vec3 color = ACESFilm(texColor * exposureBias);
|
||||
vec3 retColor = pow(color, vec3(1/2.2));
|
||||
o_output = vec4(retColor, 1);
|
||||
vec3 retColor = pow(color, vec3(1.0/2.2));
|
||||
o_output = vec4(retColor, 1.0);
|
||||
}
|
||||
@@ -28,6 +28,6 @@ vec3 reinhard_extended_luminance(vec3 v, float max_white_l) {
|
||||
void main() {
|
||||
vec3 texColor = texture(tex0,v_texCoord0).rgb;
|
||||
vec3 color = reinhard_extended_luminance(texColor * exposureBias, maxLuminance);
|
||||
vec3 retColor = pow(color, vec3(1/2.2));
|
||||
vec3 retColor = pow(color, vec3(1.0/2.2));
|
||||
o_output = vec4(retColor, 1);
|
||||
}
|
||||
@@ -22,6 +22,6 @@ void main() {
|
||||
vec3 whiteScale = 1.0f/Uncharted2Tonemap(vec3(W));
|
||||
vec3 color = curr*whiteScale;
|
||||
|
||||
vec3 retColor = pow(color, vec3(1/2.2));
|
||||
vec3 retColor = pow(color, vec3(1.0/2.2));
|
||||
o_output = vec4(retColor, 1);
|
||||
}
|
||||
Reference in New Issue
Block a user