binaryeye wrote:This may be the wrong thread because I don't know if this shader actually works.
I'm trying to convert a CRT shader found on Shadertoy to LÖVE. It runs without errors, but I get a black screen. I don't know if this is because the shader isn't working or because my system doesn't support it. I'm not exactly sure what I should be passing to the iChannel variable (it seems to want an image, so I'm drawing to a buffer and passing that), nor what the first variable should be in iResolution, so those could also be problems.
I've attached a .love. If anyone could run it and let me know what happens, I'd appreciate it. There should be a white circle in the center of the screen. Thanks!
Funny, I spent a few hours getting that exact shader working the other day. We ended up not using it though because it makes things look too blurry and dark. If anyone finds a nice CRT shader PLEASE LET ME KNOW! <3
The shaders on retroarch look awesome, but I don't know how to convert them.
I attached a working version of the shader, (although it still splits the image in 3 sections)
farzher wrote:I attached a working version of the shader, (although it still splits the image in 3 sections)
Thanks for that. I would have never tried defining iResolution as a vec2.
I modified it to work full screen and you're right; it's generally too blurry and dark. It can be sharpened up but at the cost of losing the shadow mask effect, which is mainly what I'm after in a CRT shader.
I got curious about adding reflective water in my games (specifically for 2D platform or point-and-click adventure perspectives). I implemented such a mirror via ImageData manipulation and was aghast yet unsurprised at the performance hit. So I had my hand at writing my first shader.
Very simple and likely an eyesore to those of you with more experience creating shaders
vec4 effect( vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords )
{
// n represents where the source of the mirror pixels start.
// 1.0 mirrors from the very top of the screen.
// 0.5 mirrors from half-way up the screen.
number n = 0.5;
// Alter reflection with a slight blue tint
vec4 overlayColor = vec4(0.1, 0.3, 0.6, 1.0);
// Its a kind fo magic pink
vec4 texcolor = Texel(texture, texture_coords);
if (texcolor.r == 1.0 && texcolor.g == 0.0 && texcolor.b == 1.0)
{
// Mirror mirror on the wall
vec2 mirrorpoint = vec2(
texture_coords.x,
1.0 - (texture_coords.y * n)
);
return Texel(texture, mirrorpoint) * overlayColor;
}
else
{
return texcolor * color;
}
}
]]
GhostAction wrote:I am using the Mari0 CRT.frag shader for my project and for some reason I'm getting this result where the player is basically duplicated I guess: https://gyazo.com/ef7d97e62c1a6da9a5cd49e36fce8b0a
Anybody know whats going on?
All you need to do is clearing the canvas before drawing to it again:
It may be a little off-topic, but this thread has so many people sharing their shaders...
So, the question is: is there a way to somehow grab what was drawn so far and apply a shader to that?
I've tried using shine (and it worked ok) but failed to understand how to make it respect all my scale() and transform().