czm_antialias

czm_antialias

Procedural anti-aliasing by blurring two colors that meet at a sharp edge.

Parameters:
Name Type Argument Default Description
color1 vec4 The color on one side of the edge.
color2 vec4 The color on the other side of the edge.
currentcolor vec4 The current color, either color1 or color2.
dist float The distance to the edge in texture coordinates.
fuzzFactor float <optional>
0.1 Controls the blurriness between the two colors.
Returns:
vec4 The anti-aliased color.
Example
// GLSL declarations
vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist, float fuzzFactor);
vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist);

// get the color for a material that has a sharp edge at the line y = 0.5 in texture space
float dist = abs(textureCoordinates.t - 0.5);
vec4 currentColor = mix(bottomColor, topColor, step(0.5, textureCoordinates.t));
vec4 color = czm_antialias(bottomColor, topColor, currentColor, dist, 0.1);
Source: