overte/libraries/render-utils/src/glowLine.slf
2016-11-18 17:42:55 -08:00

33 lines
910 B
Text

<@include gpu/Config.slh@>
<$VERSION_HEADER$>
// Generated on <$_SCRIBE_DATE$>
//
// Created by Bradley Austin Davis on 2016/07/05
// Copyright 2013-2016 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
layout(location = 0) in vec4 inColor;
out vec4 _fragColor;
void main(void) {
// The incoming value actually ranges from -1 to 1, so modify it
// so that it goes from 0 -> 1 -> 0 with the solid alpha being at
// the center of the line
float alpha = 1.0 - abs(inColor.a);
// Convert from a linear alpha curve to a sharp peaked one
alpha = pow(alpha, 10);
// Drop everything where the curve falls off to nearly nothing
if (alpha <= 0.05) {
discard;
}
// Emit the color
_fragColor = vec4(inColor.rgb, alpha);
return;
}