veloren/assets/voxygen/shaders/trail-frag.glsl

44 lines
1.1 KiB
Plaintext
Raw Normal View History

#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>
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;
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-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);
}