-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blend Normal with Alpha #6
Comments
Indeed! I would love for all of the blend modes to take the alpha of the textures into account! |
This works for transparent images and any blend mode:
|
@felixturner Awesome, thank you for writing this up! I'll be putting it into use shortly :-) |
Hello! I thought I'd share my approach. I made it comparing to Photopea as a reference. I realized what Photopea does (and I'm assuming Photoshop does too, I don't have access to the software right now) is basically layer the blend texture over the base texture wherever the base texture is transparent. I'll use darken as an example: vec4 blendDarken(vec4 base, vec4 blend, float opacity){
blend.a *= opacity;
vec4 blended = vec4(blendDarken(base.rgb, blend.rgb, opacity), 1.0);
vec4 over = blend+(base*(1.0-blend.a));
return mix(blended, over, 1.0-base.a);
} Edit: This method assumes the function will be receiving values with premultiplied alpha |
Is it possible to use the Normal Blend.. but if the blend texture has parts that are alpha 0.0
show the basetexture below?
Just like putting a image that has transparent parts ON TOP of a base image. But the opacity of both images is 100%. so you are able to see both at the same time.
The text was updated successfully, but these errors were encountered: