[SOLVED] Canvas and shader issue
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Canvas and shader issue
Shaders use transparent pixels internally. You can return transparent pixels from shader by setting their alpha values (4th color component) to something smaller than 1.
Re: Canvas and shader issue
Yeah, remember the last line I recommended? return vec4(c, 0., 0., 1.);
Using vec4(c, 0., 0., c) should give you as much opacity as intensity, which will probably work. Note however that it's not fully transparent near the borders where the shader is still being applied, so you may want to use some formula that makes it zero earlier, for example: return vec4(c, 0., 0., 1.1*c-0.1); or 1.2*c-0.2 or you can play with it until it's satisfactory. The first component could even be 1.0, letting blending do the work.
Using vec4(c, 0., 0., c) should give you as much opacity as intensity, which will probably work. Note however that it's not fully transparent near the borders where the shader is still being applied, so you may want to use some formula that makes it zero earlier, for example: return vec4(c, 0., 0., 1.1*c-0.1); or 1.2*c-0.2 or you can play with it until it's satisfactory. The first component could even be 1.0, letting blending do the work.
Re: Canvas and shader issue
Alright, thank you very much to you all, everything works fine now !
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Majestic-12 [Bot] and 2 guests