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

45 lines
1.4 KiB
Plaintext
Raw Normal View History

2023-10-28 15:53:35 +00:00
#version 440 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
2022-10-23 19:03:21 +00:00
#if (FLUID_MODE == FLUID_MODE_LOW)
2022-02-15 16:45:18 +00:00
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
2022-09-23 14:04:47 +00:00
#elif (FLUID_MODE >= FLUID_MODE_MEDIUM)
2022-02-15 16:45:18 +00:00
#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-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);
}