-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Share your shaders! #22
Comments
the shaderprecision highp float;
varying vec2 v_texcoord;
uniform sampler2D tex;
uniform float time;
void warpco(inout vec2 tc) {
tc -= 0.5;
tc *= length(tc) * 2.0;
tc += 0.5;
}
float rand1d(float seed) {
return sin(seed*1454.0);
}
float rand2d(vec2 co)
{
return fract(sin(dot(co.xy, vec2(12.9898,78.233))) * 43758.5453);
}
vec3 rgb(in vec2 tc, float freq, float amp, inout vec4 centre) {
vec2 off = vec2(1.0/800.0, 0.0) * sin(tc.t * freq + time) * amp;
vec2 off2 = vec2(1.0/800.0, 0.0) * sin(tc.t * freq - time * 1.5) * amp;
centre = texture2D(tex, tc);
return vec3(texture2D(tex, tc-off).r, centre.g, texture2D(tex, tc+off2).b);
}
void main() {
// vec2 px = 1.0 / textureSize(tex, 0).st;
vec2 tc = v_texcoord;
warpco(tc);
tc = mix(v_texcoord, tc, sin(time * 2.0)*0.07);
tc.x += rand2d(floor(tc * 20.0 + floor(time * 2.5))) * 0.01;
tc.x += rand1d(floor(tc.x * 40.0)) * 0.005 * rand1d(time * 0.001);
tc.y += sin(tc.x + time) * 0.02;
vec4 centre;
vec3 bent = rgb(tc, 100.0, 5.0, centre);
vec3 col = mix(centre.rgb, bent, sin(time));
gl_FragColor = vec4(col, centre.a);
// gl_FragColor = vec4(texture2D(tex, v_texcoord));
} edit: pasted the code directly here since the discord link doesn't last forever |
https://github.com/sigma-957/hyprland-shaders/blob/main/crt.frag |
There's a blue light filter and vibrance, both of which are included in https://github.com/loqusion/hyprshade. |
I personally think we should have a dedicated place for this, with screenshots and everything. A GitHub issue isn't gonna cut it is it? What do you think? |
the issue is to collect them, not to store them. as per the purpose of this repository, they will be store in this awesome-hyprland repository with links. |
Yeah, I'll create something for them ;) |
I think we should at least store copies of them, in case the original sources get deleted. |
Ofc |
simple blur shader#version 330 core
precision mediump float;
varying vec2 v_texcoord;
uniform sampler2D tex;
uniform int blurRadius = 1;
void main() {
if (blurRadius <= 0) {
gl_FragColor = texture(tex, v_texcoord);
return;
}
vec2 invTextureSize = 1.0f / textureSize(tex, 0);
float invBlurRadius = 1.0f / float(blurRadius);
float samples = 0.0f;
vec4 colorSum = vec4(0.0f);
for (int x = -blurRadius; x <= blurRadius; ++x) {
for (int y = -blurRadius; y <= blurRadius; ++y) {
vec2 offset = vec2(x, y) * invTextureSize;
float strength = 1 - (length(offset) * invBlurRadius);
samples += strength;
vec2 coords = v_texcoord + offset;
colorSum += texture(tex, coords) * strength;
}
}
colorSum /= samples;
gl_FragColor = colorSum;
} |
What does this blur exactly, the whole screen? |
yeah, no need for it though, just thought it'd be cool to make |
also bloom shader#version 330 core
precision mediump float;
varying vec2 v_texcoord;
uniform sampler2D tex;
uniform int bloomRadius = 10;
uniform float bloomIntensity = 0.7f;
uniform float bloomThreshold = 0.4f;
void main() {
vec4 color = texture(tex, v_texcoord);
vec4 bloomThreshold4 = vec4(bloomThreshold);
bloomThreshold4.w = 0.0f;
vec2 invTextureSize = 1.0f / textureSize(tex, 0);
float invBloomRadius = bloomRadius == 0 ? 1.0f : 1.0f / float(bloomRadius);
float invBloomThreshold = 1.0f / (1.0f - bloomThreshold);
float samples = 0.0f;
vec4 colorSum = vec4(0.0f);
for (int x = -bloomRadius; x <= bloomRadius; ++x) {
for (int y = -bloomRadius; y <= bloomRadius; ++y) {
vec2 offset = vec2(x, y) * invTextureSize;
vec2 coords = v_texcoord + offset;
vec4 color = texture(tex, coords);
color = max(color - bloomThreshold, vec4(0.0f));
float strength = 1 - (length(offset) * invBloomRadius);
samples += strength;
strength *= max(max(color.x, color.y), color.z) * invBloomThreshold;
strength *= bloomIntensity;
colorSum += color * strength;
}
}
colorSum /= samples;
gl_FragColor = min(color + colorSum, 1.0f);
} |
Can you also post screenshots along with the shader ? |
i don't know how to with nvidia |
https://github.com/hyprland-community/awesome-hyprland#screenshotting |
sorry, I should've added more detail, screenshotting works fine but the shaders aren't applied to the screenshot |
Ohhh didn't know sorry. |
monochromatic shaderprecision mediump float;
varying vec2 v_texcoord;
uniform sampler2D tex;
void main() {
vec4 pixColor = texture2D(tex, v_texcoord);
float lum = dot(pixColor.rgb, vec3(0.299, 0.587, 0.114)); // BT.601
// float lum = dot(pixColor.rgb, vec3(0.2126, 0.7152, 0.0722)); // BT.709
// float lum = dot(pixColor.rgb, vec3(0.2627, 0.6780, 0.0593)); // BT.2100
// Check https://en.wikipedia.org/wiki/Grayscale for more information about which one to choose
vec4 outCol = vec4(vec3(lum), pixColor.a);
gl_FragColor = outCol;
} |
Sick |
Don't know if you're still accepting shaders since there is a pull request, but someone said I should put this here: It's another crt shader, but it's different from the one posted earlier It's a modified version of this |
sick ill add it |
I asked him to post it in here cause it doesn't use I think you should add some sort of note which shaders might need damage_tracking to be turned off when you add it. |
Oh is that so? |
Shaders are pretty powerful, you can force colorschemes on your entire display, make modern LCD look like a 80s CRT, and other stuff I'm not even thinking of. So let's add a section for them. Problem is I have 1 shader, and having just one is pointless, so if you have any shaders or know someone who does please share shaders in the replies!
The text was updated successfully, but these errors were encountered: