2022-01-25 17:34:33 +00:00
#version 420 core
2022-02-15 16:45:18 +00:00
#include <constants.glsl>
#define LIGHTING_TYPE LIGHTING_TYPE_REFLECTION
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_GLOSSY
#if (FLUID_MODE == FLUID_MODE_CHEAP)
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
#elif (FLUID_MODE == FLUID_MODE_SHINY)
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
#endif
#define LIGHTING_DISTRIBUTION_SCHEME LIGHTING_DISTRIBUTION_SCHEME_MICROFACET
#define LIGHTING_DISTRIBUTION LIGHTING_DISTRIBUTION_BECKMANN
#define HAS_SHADOW_MAPS
#include <globals.glsl>
2022-01-25 17:34:33 +00:00
layout(location = 0) in vec3 f_pos;
layout(location = 0) out vec4 tgt_color;
2022-02-15 16:45:18 +00:00
#include <sky.glsl>
#include <light.glsl>
#include <lod.glsl>
const float FADE_DIST = 32.0;
2022-01-25 17:34:33 +00:00
void main() {
2022-02-15 16:45:18 +00:00
vec3 trail_color = vec3(.55, .92, 1.0);
2022-02-16 19:41:34 +00:00
float trail_alpha = 0.05;
2022-02-15 16:45:18 +00:00
// Controls how much light affects alpha variation. TODO: Maybe a better name?
2022-03-02 05:54:20 +00:00
float light_variable = 0.075;
2022-02-15 16:45:18 +00:00
// Make less faint at day (relative to night) by adding light to alpha. Probably hacky but looks fine.
2022-03-03 03:44:31 +00:00
// TODO: Trails should also eventually account for shadows, nearby lights, attenuation of sunlight in water, and block based lighting. Note: many of these will require alternative methods that don't require a normal.
2022-03-02 05:54:20 +00:00
trail_alpha += get_sun_brightness() * light_variable;
2022-02-15 16:45:18 +00:00
tgt_color = vec4(trail_color, trail_alpha);
2022-01-25 17:34:33 +00:00
}