2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations
2015-03-03
09:28 AM
- last edited on
2023-08-01
01:36 PM
by
Doreena Deng
void main() { float mask = texture( tex, fragTexCoord).r; vec4 res = vec4(1.0,1.0,1.0, 1.0); if(mask > 0.0) //test failed, outside of mask res = vec4(0.0,0.0,0.0, 0.0); //smoothing if there is an edge nearby //0 or 1 otherwise res.w = smoothstep(0.0, 1.0, -1.0 * mask); finalColor = res; }However if the mask is drawn too big, its edges appear blurry, because smoothstep afflicts too many fragments. This could be solved by multiplying the mask by some value, however it would stop smoothing if is the mask was drawn too small.
2015-03-03 02:51 PM
bobbell wrote:I think this belongs in the Developer Forum.
Not sure if this would be the correct placement of this thread, but seen the question asked before in here.
2015-03-05 12:16 AM