mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Minor shader fixes.
This commit is contained in:
parent
746a10e8d0
commit
22ddbad3eb
@ -21,8 +21,8 @@ const float EXTRA_NEG_Z = 65536.0;
|
|||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
f_pos = vec3((uvec3(v_pos_norm) >> uvec3(0, 6, 12)) & uvec3(0x3Fu, 0x3Fu, 0x1FFFFu)) - vec3(0, 0, EXTRA_NEG_Z) + model_offs;
|
f_pos = vec3((uvec3(v_pos_norm) >> uvec3(0, 6, 12)) & uvec3(0x3Fu, 0x3Fu, 0x1FFFFu)) - vec3(0, 0, EXTRA_NEG_Z) + model_offs;
|
||||||
f_pos.z -= 250.0 * (1.0 - min(1.0001 - 0.02 / pow(tick.x - load_time, 10.0), 1.0));
|
// f_pos.z -= 250.0 * (1.0 - min(1.0001 - 0.02 / pow(tick.x - load_time, 10.0), 1.0));
|
||||||
f_pos.z -= min(32.0, 25.0 * pow(distance(focus_pos.xy, f_pos.xy) / view_distance.x, 20.0));
|
// f_pos.z -= min(32.0, 25.0 * pow(distance(focus_pos.xy, f_pos.xy) / view_distance.x, 20.0));
|
||||||
|
|
||||||
// Small waves
|
// Small waves
|
||||||
f_pos.xy += 0.01; // Avoid z-fighting
|
f_pos.xy += 0.01; // Avoid z-fighting
|
||||||
|
@ -291,11 +291,11 @@ vec3 light_reflection_factor(vec3 norm, vec3 dir, vec3 light_dir, vec3 k_d, vec3
|
|||||||
}
|
}
|
||||||
|
|
||||||
vec3 light_reflection_factor(vec3 norm, vec3 dir, vec3 light_dir, vec3 k_d, vec3 k_s, float alpha, float voxel_lighting) {
|
vec3 light_reflection_factor(vec3 norm, vec3 dir, vec3 light_dir, vec3 k_d, vec3 k_s, float alpha, float voxel_lighting) {
|
||||||
if (voxel_lighting < 1.0) {
|
//if (voxel_lighting < 1.0) {
|
||||||
return FresnelBlend_Voxel_f(norm, dir, light_dir, k_d/* * max(dot(norm, -light_dir), 0.0)*/, k_s, alpha, voxel_lighting);
|
return FresnelBlend_Voxel_f(norm, dir, light_dir, k_d/* * max(dot(norm, -light_dir), 0.0)*/, k_s, alpha, voxel_lighting);
|
||||||
} else {
|
//} else {
|
||||||
return FresnelBlend_f(norm, dir, light_dir, k_d/* * max(dot(norm, -light_dir), 0.0)*/, k_s, alpha);
|
// return FresnelBlend_f(norm, dir, light_dir, k_d/* * max(dot(norm, -light_dir), 0.0)*/, k_s, alpha);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
float rel_luminance(vec3 rgb)
|
float rel_luminance(vec3 rgb)
|
||||||
|
@ -51,7 +51,7 @@ void main() {
|
|||||||
const float R_s2s1 = pow((1.0 - 1.3325) / (1.0 + 1.3325), 2);
|
const float R_s2s1 = pow((1.0 - 1.3325) / (1.0 + 1.3325), 2);
|
||||||
const float R_s1s2 = pow((1.3325 - 1.0) / (1.3325 + 1.0), 2);
|
const float R_s1s2 = pow((1.3325 - 1.0) / (1.3325 + 1.0), 2);
|
||||||
// float faces_fluid = faces_fluid && f_pos.z <= floor(f_alt);
|
// float faces_fluid = faces_fluid && f_pos.z <= floor(f_alt);
|
||||||
float fluid_alt = max(ceil(f_pos.z), floor(f_alt));
|
float fluid_alt = max(f_pos.z + 1, floor(f_alt));
|
||||||
float R_s = /*(f_pos.z < f_alt)*/faces_fluid /*&& f_pos.z <= fluid_alt*/ ? mix(R_s2s1 * R_s1s0, R_s1s0, medium.x) : mix(R_s2s0, R_s1s2 * R_s2s0, medium.x);
|
float R_s = /*(f_pos.z < f_alt)*/faces_fluid /*&& f_pos.z <= fluid_alt*/ ? mix(R_s2s1 * R_s1s0, R_s1s0, medium.x) : mix(R_s2s0, R_s1s2 * R_s2s0, medium.x);
|
||||||
|
|
||||||
// vec3 surf_color = /*srgb_to_linear*/(f_col);
|
// vec3 surf_color = /*srgb_to_linear*/(f_col);
|
||||||
|
Loading…
Reference in New Issue
Block a user