Artfaith Posted January 16, 2023 Share Posted January 16, 2023 (edited) Dear Community, Thank you very much for the magnificent project! Currently, I am trying to create a filter which is based on a shader ""Godrays" by alaingalvan", but the one which only lightens a certain area where "lights" exist on a transparent stage. The current version creates dark places ('0x000000') where the "lights" are not shown, but the darkness must not surpass the background ('0x333333' or '0xffffff' as in CSS), so it would look like a transparent filter in the result. This is the incorrect behavior since it creates black background where the "lights" are (it is correct that it affects the background): ~ Is it even possible using this filter/shader? Is it correct that the issue is in the color matrix ("float noise(in vec3 p)")? Would it be correct to somehow base a pixel color on the source and only increase its "gain" instead? I will highly appreciate any suggestion! Best and kind regards Edited January 24, 2023 by Artfaith Marked "Solved" Quote Link to comment Share on other sites More sharing options...
Artfaith Posted January 24, 2023 Author Share Posted January 24, 2023 (edited) The issue was in the alpha channel! How did I miss... Got the answer at StackOverflow by Eduardo Páez Rubio and am so grateful! The line 153 must be changed from: vec4 mist = vec4(noise, noise, noise, 1.0); noise = mix(noise, 0.0, 0.3); to: noise = mix(noise, 0.0, 0.3); vec4 mist = vec4(noise, noise, noise, noise); Also, the line seems must be swapped with 154. The working example: https://codepen.io/faither/pen/oNMqBab Edited January 24, 2023 by Artfaith Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.