mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'zesterer/tiny-fixes' into 'master'
Remove colour banding See merge request veloren/veloren!3153
This commit is contained in:
commit
25543b45c5
@ -43,6 +43,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Added arthropods
|
||||
- A 'point light glow' effect, making lanterns and other point lights more visually pronounced
|
||||
- Generate random name for site2 sites
|
||||
- Shader dithering to remove banding from scenes with large colour gradients
|
||||
|
||||
### Changed
|
||||
|
||||
|
@ -10,9 +10,9 @@ float hash(vec4 p) {
|
||||
return (fract(p.x * p.y * (1.0 - p.z) * p.w * (p.x + p.y + p.z + p.w)) - 0.5) * 2.0;
|
||||
}
|
||||
|
||||
#define M1 1597334677U //1719413*929
|
||||
#define M2 3812015801U //140473*2467*11
|
||||
#define M3 2741598923U
|
||||
#define M1 2047667443U
|
||||
#define M2 3883706873U
|
||||
#define M3 3961281721U
|
||||
|
||||
float hash_one(uint q) {
|
||||
uint n = ((M3 * q) ^ M2) * M1;
|
||||
@ -20,6 +20,13 @@ float hash_one(uint q) {
|
||||
return float(n) * (1.0 / float(0xffffffffU));
|
||||
}
|
||||
|
||||
float hash_two(uvec2 q) {
|
||||
q *= uvec2(M1, M2);
|
||||
uint n = q.x ^ q.y;
|
||||
n = n * (n ^ (n >> 15));
|
||||
return float(n) * (1.0 / float(0xffffffffU));
|
||||
}
|
||||
|
||||
float hash_fast(uvec3 q) {
|
||||
q *= uvec3(M1, M2, M3);
|
||||
|
||||
|
@ -197,14 +197,14 @@ void main() {
|
||||
// return;
|
||||
// }
|
||||
|
||||
vec2 sample_uv = uv;
|
||||
#ifdef EXPERIMENTAL_UNDERWARPER
|
||||
vec2 uv = uv;
|
||||
if (medium.x == MEDIUM_WATER) {
|
||||
uv += sin(uv.yx * 40 + tick.xx * 1.0) * 0.003;
|
||||
sample_uv += sin(uv.yx * 40 + tick.xx * 1.0) * 0.003;
|
||||
}
|
||||
#endif
|
||||
|
||||
vec4 aa_color = aa_apply(t_src_color, s_src_color, uv * screen_res.xy, screen_res.xy);
|
||||
vec4 aa_color = aa_apply(t_src_color, s_src_color, sample_uv * screen_res.xy, screen_res.xy);
|
||||
|
||||
#ifdef EXPERIMENTAL_SOBEL
|
||||
vec3 s[8];
|
||||
@ -282,5 +282,9 @@ void main() {
|
||||
}
|
||||
#endif
|
||||
|
||||
// Add a small amount of very cheap dithering noise to remove banding from gradients
|
||||
// TODO: Instead of 256, detect the colour resolution of the display
|
||||
final_color.rgb = max(vec3(0), final_color.rgb - hash_two(uvec2(uv * screen_res.xy)) / 256.0);
|
||||
|
||||
tgt_color = vec4(final_color.rgb, 1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user