Skip to content

Commit

Permalink
Premultiplied alpha to fix colors for globe translucency
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleyse committed Mar 4, 2021
1 parent e07921d commit 0351120
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Source/Scene/Vector3DTileClampedPolylines.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ function getRenderState(mask3DTiles) {
cull: {
enabled: true, // prevent double-draw. Geometry is "inverted" (reversed winding order) so we're drawing backfaces.
},
blending: BlendingState.ALPHA_BLEND,
blending: BlendingState.PRE_MULTIPLIED_ALPHA_BLEND,
depthMask: false,
stencilTest: {
enabled: mask3DTiles,
Expand Down
3 changes: 3 additions & 0 deletions Source/Shaders/Vector3DTileClampedPolylinesFS.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,8 @@ void main()
}
gl_FragColor = u_highlightColor;

// Premultiply alpha. Required for classification primitives on translucent globe.
gl_FragColor.rgb *= gl_FragColor.a;

czm_writeDepthClamp();
}

0 comments on commit 0351120

Please sign in to comment.