More experimental shaders

This commit is contained in:
Joshua Barretto 2023-05-31 17:07:22 +01:00
parent c36e3693be
commit b2051767ff
4 changed files with 21 additions and 0 deletions

View File

@ -95,6 +95,10 @@ void main() {
tgt_color = vec4(mat_colors[mat.a % 5u], 1); tgt_color = vec4(mat_colors[mat.a % 5u], 1);
return; return;
#endif #endif
#ifdef EXPERIMENTAL_VIEWDEPTH
tgt_color = vec4(vec3(pow(clamp(depth_at(uv) / 524288.0, 0, 1), 0.3)), 1);
return;
#endif
#ifdef EXPERIMENTAL_BAREMINIMUM #ifdef EXPERIMENTAL_BAREMINIMUM
tgt_color = vec4(color.rgb, 1); tgt_color = vec4(color.rgb, 1);

View File

@ -27,6 +27,13 @@ float hash_two(uvec2 q) {
return float(n) * (1.0 / float(0xffffffffU)); return float(n) * (1.0 / float(0xffffffffU));
} }
float hash_three(uvec3 q) {
q *= uvec3(M1, M2, M3);
uint n = q.x ^ q.y ^ q.z;
n = n * (n ^ (n >> 15));
return float(n) * (1.0 / float(0xffffffffU));
}
float hash_fast(uvec3 q) { float hash_fast(uvec3 q) {
q *= uvec3(M1, M2, M3); q *= uvec3(M1, M2, M3);

View File

@ -314,5 +314,11 @@ void main() {
#endif #endif
#endif #endif
#ifdef EXPERIMENTAL_NEWSPAPER
float nz = hash_three(uvec3(uvec2(uv * screen_res.xy), tick.x * dot(fract(uv * 10) + 5, vec2(1)) * 0.3));
nz = (nz > 0.5) ? (pow(nz * 2 - 1, 1.5) * 0.5 + 0.5) : (pow(nz * 2, 1/1.5) * 0.5);
final_color.rgb = vec3(step(nz, length(final_color.rgb))) * mix(vec3(1, 0.5, 0.3), normalize(final_color.rgb), 0.05);
#endif
tgt_color = vec4(final_color.rgb, 1); tgt_color = vec4(final_color.rgb, 1);
} }

View File

@ -515,6 +515,8 @@ pub enum ExperimentalShader {
ViewNormals, ViewNormals,
/// Show gbuffer materials. /// Show gbuffer materials.
ViewMaterials, ViewMaterials,
/// Show gbuffer depth.
ViewDepth,
/// Rather than fading out screen-space reflections at view space borders, /// Rather than fading out screen-space reflections at view space borders,
/// smear screen space to cover the reflection vector. /// smear screen space to cover the reflection vector.
SmearReflections, SmearReflections,
@ -526,4 +528,6 @@ pub enum ExperimentalShader {
/// Prefer using physically-based values for various rendering parameters, /// Prefer using physically-based values for various rendering parameters,
/// where possible. /// where possible.
Photorealistic, Photorealistic,
/// A dithered newspaper effect.
Newspaper,
} }