mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 19:59:28 +02:00
Fix star point smoothing... sort of
This commit is contained in:
parent
59b69be251
commit
2221c839c3
2 changed files with 24 additions and 5 deletions
|
@ -11,8 +11,24 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
in vec4 varColor;
|
in vec4 varColor;
|
||||||
|
in float varSize;
|
||||||
|
|
||||||
out vec4 outFragColor;
|
out vec4 outFragColor;
|
||||||
|
|
||||||
|
const float EDGE_SIZE = 0.25;
|
||||||
|
const float ALPHA_BOUNDARY = 1.0 - EDGE_SIZE;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
outFragColor = varColor; //vec4(varColor, 1.0);
|
vec2 coord = gl_PointCoord * vec2(2.0) - vec2(1.0);
|
||||||
|
coord = coord * coord;
|
||||||
|
|
||||||
|
float l = coord.x + coord.y;
|
||||||
|
if (l > 1.0) {
|
||||||
|
discard;
|
||||||
|
}
|
||||||
|
|
||||||
|
outFragColor = varColor;
|
||||||
|
if (l >= ALPHA_BOUNDARY) {
|
||||||
|
outFragColor.a = smoothstep(1.0, ALPHA_BOUNDARY, l);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,12 @@
|
||||||
|
|
||||||
<$declareStandardTransform()$>
|
<$declareStandardTransform()$>
|
||||||
|
|
||||||
out vec3 varPosition;
|
// TODO we need to get the viewport resolution and FOV passed to us so we can modify the point size
|
||||||
out vec4 varColor;
|
// and effectively producing a points that take up a constant angular size regardless of the display resolution
|
||||||
|
// or projection matrix
|
||||||
|
|
||||||
|
out vec4 varColor;
|
||||||
|
out float varSize;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
varColor = inColor.rgba;
|
varColor = inColor.rgba;
|
||||||
|
@ -29,6 +32,6 @@ void main(void) {
|
||||||
TransformCamera cam = getTransformCamera();
|
TransformCamera cam = getTransformCamera();
|
||||||
TransformObject obj = getTransformObject();
|
TransformObject obj = getTransformObject();
|
||||||
<$transformModelToClipPos(cam, obj, inPosition, gl_Position)$>
|
<$transformModelToClipPos(cam, obj, inPosition, gl_Position)$>
|
||||||
varPosition = inPosition.xyz;
|
varSize = inColor.a;
|
||||||
gl_PointSize = inColor.a;
|
gl_PointSize = varSize;
|
||||||
}
|
}
|
Loading…
Reference in a new issue