Edit in GitHubLog an issue

lib-alpha.glsl


Public Functions: alphaKill

Copied to your clipboard
import lib-sampler.glsl
import lib-random.glsl

Opacity map, provided by the engine.

Copied to your clipboard
//: param auto channel_opacity
uniform SamplerSparse opacity_tex;

Alpha test threshold.

Copied to your clipboard
//: param custom {
//: "default": 0.33,
//: "label": "Alpha threshold",
//: "min": 0.0,
//: "max": 1.0,
//: "group": "Common Parameters"
//: }
uniform float alpha_threshold;

Alpha test dithering.

Copied to your clipboard
//: param custom {
//: "default": false,
//: "label": "Alpha dithering",
//: "group": "Common Parameters"
//: }
uniform bool alpha_dither;

Emulate alpha test : discard current fragment if its opacity is below a user defined threshold. Should be called AFTER texture sampling calls: it can break derivatives

Copied to your clipboard
void alphaKill(float alpha)
{
float threshold = alpha_dither ? getBlueNoiseThresholdTemporal() : alpha_threshold;
if (alpha < threshold) discard;
}
void alphaKill(SparseCoord coord)
{
alphaKill(getOpacity(opacity_tex, coord));
}
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.