-
-
Notifications
You must be signed in to change notification settings - Fork 35.6k
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
Premultiplied alpha on materials #8245
Changes from 2 commits
9236121
47c1f47
001aab6
ce91ae9
b39d8c8
64a1eb9
0bdcff2
7009dbf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifdef PREMULTIPLIED_ALPHA | ||
|
||
// Get get normal blending with premultipled, use with CustomBlending, OneFactor, OneMinusSrcAlphaFactor, AddEquation. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comment not required, now. |
||
gl_FragColor.rgb *= gl_FragColor.a; | ||
|
||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,5 +30,6 @@ void main() { | |
gl_FragColor = linearToOutputTexel( vec4( outgoingLight, diffuseColor.a ) ); | ||
|
||
#include <fog_fragment> | ||
#include <premultiplied_alpha_fragment> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider |
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -491,6 +491,8 @@ THREE.WebGLProgram = ( function () { | |
parameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '', | ||
parameters.pointLightShadows > 0 ? '#define POINT_LIGHT_SHADOWS' : '', | ||
|
||
parameters.premultipliedAlpha ? "#define PREMULTIPLIED_ALPHA" : '', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to add |
||
|
||
parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '', | ||
parameters.logarithmicDepthBuffer && renderer.extensions.get( 'EXT_frag_depth' ) ? '#define USE_LOGDEPTHBUF_EXT' : '', | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#ifdef PREMULTIPLIED_ALPHA_BLENDING
#endif
We do not want this to be confused with
renderer.premultipliedAlpha
.