Help with a shader.
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Help with a shader.
Yea. I've been playing with Love off and on since 6.x days. I like that GLSL shader support was added, but it's way over my head. All I'm trying to do is make a vignette shader that I can use, but I can not wrap my head around it. I've tried looking at code for porting on GLSL Sandbox, but still no luck. Anyone willing to walk me through creating a vignette shader?
Re: Help with a shader.
I believe It's a simple task: all you got to do is to:
(in shader of course)
If you got stuck, let me know, I may do it again in pseudocode
(in shader of course)
- Find the distance from the current position to the center of the screen (distance(vec2, vec2) function makes it piss easy)
- Maybe tweak it a bit (divide by something like 2)
- return vec4(1.-dist, 1.-dist, 1.-dist, 1.)
If you got stuck, let me know, I may do it again in pseudocode
Re: Help with a shader.
if it doesnt work then you should be able to do vec4(1.0) - vec4(vec3(dist), 0.0)richapple wrote:I believe It's a simple task: all you got to do is to:
(in shader of course)
The last step was not very elegant but I am not sure if return vec4(1.)-vec3(dist) works. It should, haven't checked
- Find the distance from the current position to the center of the screen (distance(vec2, vec2) function makes it piss easy)
- Maybe tweak it a bit (divide by something like 2)
- return vec4(1.-dist, 1.-dist, 1.-dist, 1.)
If you got stuck, let me know, I may do it again in pseudocode
Re: Help with a shader.
What is the best way to implement this in a way that i can still see my game under the vignette? As i currently understand shaders in love2d.. there is no way. The shader would cover over everything right?
Re: Help with a shader.
i haven't tried doing things with shaders that affect the whole screen, so i'm not sure if it's possible to do that directly or if you;d have to draw everything onto a canvas and pass that to the shader insteaddncwalk99 wrote:What is the best way to implement this in a way that i can still see my game under the vignette? As i currently understand shaders in love2d.. there is no way. The shader would cover over everything right?
but basically, inside the shader you'd simply multiply the fragment color with the result of the vignette (which should be normalized)
EDIT: actually, you could instead just use a screen-size quad for the vignette, and draw that over everything else (in this case, a vignette fragment would be 0, 0, 0 with the alpha being controlled by the vignette output)
Who is online
Users browsing this forum: Bing [Bot], Google [Bot], Semrush [Bot] and 2 guests