mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Addressed review comments, minor fixes
This commit is contained in:
parent
0067825187
commit
0bdc66b10a
@ -39,13 +39,13 @@ uniform texture2D t_src_depth;
|
||||
layout(set = 2, binding = 3)
|
||||
uniform sampler s_src_depth;
|
||||
|
||||
layout(location = 0) in vec2 uv;
|
||||
|
||||
layout (std140, set = 2, binding = 4)
|
||||
uniform u_locals {
|
||||
mat4 all_mat_inv;
|
||||
};
|
||||
|
||||
layout(location = 0) in vec2 uv;
|
||||
|
||||
layout(set = 2, binding = 5)
|
||||
uniform utexture2D t_src_mat;
|
||||
|
||||
@ -149,7 +149,7 @@ void main() {
|
||||
|
||||
#if (FLUID_MODE >= FLUID_MODE_MEDIUM || REFLECTION_MODE >= REFLECTION_MODE_MEDIUM)
|
||||
if (mat.a != MAT_SKY) {
|
||||
vec3 surf_norm = vec3(texelFetch(usampler2D(t_src_mat, s_src_depth), clamp(ivec2(uv * mat_sz), ivec2(0), ivec2(mat_sz) - 1), 0).xyz) / 127.0 - 1.0;
|
||||
vec3 surf_norm = vec3(mat.xyz) / 127.0 - 1.0;
|
||||
vec3 refl_dir = reflect(dir, surf_norm);
|
||||
|
||||
vec4 clip = (all_mat * vec4(cam_pos.xyz + refl_dir, 1.0));
|
||||
@ -292,7 +292,8 @@ void main() {
|
||||
vec3 wpos = cam_pos.xyz + dir * wpos_dist;
|
||||
|
||||
if (wpos_dist > dist) { break; }
|
||||
if (length((fract(wall_pos.xz) - 0.5)) < 0.1 + pow(max(0.0, wpos_dist - (dist - 0.25)) / 0.25, 4.0) * 0.2) {
|
||||
vec2 wall_pos_half = fract(wall_pos.xz) - 0.5;
|
||||
if (dot(wall_pos_half, wall_pos_half) < 0.01 + pow(max(0.0, wpos_dist - (dist - 0.25)) / 0.25, 4.0) * 0.2) {
|
||||
float density = rain_density * rain_occlusion_at(wpos);
|
||||
if (fract(hash_two(uvec2(wall_pos.xz) + 1000u)) >= density) { continue; }
|
||||
|
||||
|
@ -27,13 +27,12 @@ uniform texture2D t_col_light;
|
||||
layout(set = 2, binding = 1)
|
||||
uniform sampler s_col_light;
|
||||
|
||||
layout (location = 0)
|
||||
out vec4 tgt_color;
|
||||
layout(location = 0) out vec4 tgt_color;
|
||||
layout(location = 1) out uvec4 tgt_mat;
|
||||
|
||||
void main() {
|
||||
vec3 cam_to_frag = normalize(f_pos - cam_pos.xyz);
|
||||
vec3 view_dir = -cam_to_frag;
|
||||
float point_shadow = shadow_at(f_pos, f_norm);
|
||||
|
||||
#if (SHADOW_MODE == SHADOW_MODE_CHEAP || SHADOW_MODE == SHADOW_MODE_MAP || FLUID_MODE == FLUID_MODE_SHINY)
|
||||
float f_alt = alt_at(f_pos.xy);
|
||||
@ -49,8 +48,8 @@ void main() {
|
||||
#endif
|
||||
float moon_shade_frac = 1.0;
|
||||
|
||||
DirectionalLight sun_info = get_sun_info(sun_dir, point_shadow * sun_shade_frac, f_pos);
|
||||
DirectionalLight moon_info = get_moon_info(moon_dir, point_shadow * moon_shade_frac);
|
||||
DirectionalLight sun_info = get_sun_info(sun_dir, sun_shade_frac, f_pos);
|
||||
DirectionalLight moon_info = get_moon_info(moon_dir, moon_shade_frac);
|
||||
|
||||
vec3 surf_color = f_color.xyz;
|
||||
float alpha = 1.0;
|
||||
@ -74,8 +73,13 @@ void main() {
|
||||
max_light += get_sun_diffuse2(sun_info, moon_info, f_norm, view_dir, f_pos, mu, cam_attenuation, fluid_alt, k_a, k_d, k_s, alpha, f_norm, 1.0, emitted_light, reflected_light);
|
||||
|
||||
max_light += lights_at(f_pos, f_norm, view_dir, mu, cam_attenuation, fluid_alt, k_a, k_d, k_s, alpha, f_norm, 1.0, emitted_light, reflected_light);
|
||||
|
||||
float point_shadow = shadow_at(f_pos, f_norm);
|
||||
reflected_light *= point_shadow;
|
||||
emitted_light *= point_shadow;
|
||||
|
||||
surf_color = illuminate(max_light, view_dir, surf_color * emitted_light, surf_color * reflected_light * 1.0);
|
||||
|
||||
tgt_color = vec4(surf_color, 1.0);
|
||||
//tgt_color = vec4(f_norm, 1.0);
|
||||
tgt_color = vec4(surf_color, f_color.a);
|
||||
tgt_mat = uvec4(uvec3((f_norm + 1.0) * 127.0), MAT_FIGURE);
|
||||
}
|
||||
|
@ -160,9 +160,8 @@ void main() {
|
||||
// float shade_frac = /*1.0;*/sun_shade_frac + moon_shade_frac;
|
||||
|
||||
// DirectionalLight sun_info = get_sun_info(sun_dir, sun_shade_frac, light_pos);
|
||||
float point_shadow = shadow_at(f_pos, f_norm);
|
||||
DirectionalLight sun_info = get_sun_info(sun_dir, point_shadow * sun_shade_frac, /*sun_pos*/f_pos);
|
||||
DirectionalLight moon_info = get_moon_info(moon_dir, point_shadow * moon_shade_frac/*, light_pos*/);
|
||||
DirectionalLight sun_info = get_sun_info(sun_dir, sun_shade_frac, /*sun_pos*/f_pos);
|
||||
DirectionalLight moon_info = get_moon_info(moon_dir, moon_shade_frac/*, light_pos*/);
|
||||
|
||||
vec3 surf_color;
|
||||
// If the figure is large enough to be 'terrain-like', we apply a noise effect to it
|
||||
@ -259,6 +258,8 @@ void main() {
|
||||
|
||||
reflected_light *= ao;
|
||||
emitted_light *= ao;
|
||||
|
||||
float point_shadow = shadow_at(f_pos, f_norm);
|
||||
reflected_light *= point_shadow;
|
||||
emitted_light *= point_shadow;
|
||||
/* reflected_light *= cloud_shadow(f_pos); */
|
||||
|
@ -132,9 +132,8 @@ void main() {
|
||||
// float shade_frac = /*1.0;*/sun_shade_frac + moon_shade_frac;
|
||||
|
||||
// DirectionalLight sun_info = get_sun_info(sun_dir, sun_shade_frac, light_pos);
|
||||
float point_shadow = shadow_at(f_pos, f_norm);
|
||||
DirectionalLight sun_info = get_sun_info(sun_dir, point_shadow * sun_shade_frac, /*sun_pos*/f_pos);
|
||||
DirectionalLight moon_info = get_moon_info(moon_dir, point_shadow * moon_shade_frac/*, light_pos*/);
|
||||
DirectionalLight sun_info = get_sun_info(sun_dir, sun_shade_frac, /*sun_pos*/f_pos);
|
||||
DirectionalLight moon_info = get_moon_info(moon_dir, moon_shade_frac/*, light_pos*/);
|
||||
|
||||
float fluid_alt = f_pos.z;//max(ceil(f_pos.z), floor(f_alt));// f_alt;//max(f_alt - f_pos.z, 0.0);
|
||||
|
||||
@ -191,6 +190,11 @@ void main() {
|
||||
|
||||
// Global illumination when underground (silly)
|
||||
emitted_light += (1.0 - not_underground) * 0.05;
|
||||
|
||||
float point_shadow = shadow_at(f_pos, f_norm);
|
||||
reflected_light *= point_shadow;
|
||||
emitted_light *= point_shadow;
|
||||
|
||||
// reflected_light *= f_light * point_shadow * shade_frac;
|
||||
// emitted_light *= f_light * point_shadow * max(shade_frac, MIN_SHADOW);
|
||||
// max_light *= f_light * point_shadow * shade_frac;
|
||||
|
@ -286,9 +286,8 @@ void main() {
|
||||
reflect_color *= not_underground;
|
||||
|
||||
// DirectionalLight sun_info = get_sun_info(sun_dir, sun_shade_frac, light_pos);
|
||||
float point_shadow = shadow_at(f_pos, f_norm);
|
||||
DirectionalLight sun_info = get_sun_info(sun_dir, point_shadow * sun_shade_frac, /*sun_pos*/f_pos);
|
||||
DirectionalLight moon_info = get_moon_info(moon_dir, point_shadow * moon_shade_frac/*, light_pos*/);
|
||||
DirectionalLight sun_info = get_sun_info(sun_dir, sun_shade_frac, /*sun_pos*/f_pos);
|
||||
DirectionalLight moon_info = get_moon_info(moon_dir, moon_shade_frac/*, light_pos*/);
|
||||
|
||||
// Hack to determine water depth: color goes down with distance through water, so
|
||||
// we assume water color absorption from this point a to some other point b is the distance
|
||||
@ -346,6 +345,9 @@ void main() {
|
||||
|
||||
// Global illumination when underground (silly)
|
||||
emitted_light += (1.0 - not_underground) * 0.05;
|
||||
|
||||
float point_shadow = shadow_at(f_pos, f_norm);
|
||||
reflected_light *= point_shadow;
|
||||
// Apply cloud layer to sky
|
||||
// reflected_light *= /*water_color_direct * */reflect_color * f_light * point_shadow * shade_frac;
|
||||
// emitted_light *= /*water_color_direct*//*ambient_attenuation * */f_light * point_shadow * max(shade_frac, MIN_SHADOW);
|
||||
@ -365,7 +367,7 @@ void main() {
|
||||
|
||||
max_light += lights_at(f_pos, cam_norm, view_dir, mu, cam_attenuation, fluid_alt, k_a, /*k_d*//*vec3(0.0)*/k_d, /*vec3(0.0)*/k_s, alpha, f_norm, 1.0, emitted_light, /*diffuse_light*/reflected_light);
|
||||
|
||||
float reflected_light_point = length(reflected_light);///*length*/(diffuse_light_point.r) + f_light * point_shadow;
|
||||
//float reflected_light_point = length(reflected_light);///*length*/(diffuse_light_point.r) + f_light * point_shadow;
|
||||
// TODO: See if we can be smarter about this using point light distances.
|
||||
// reflected_light += k_d * (diffuse_light_point/* + f_light * point_shadow * shade_frac*/) + /*water_color_ambient*/specular_light_point;
|
||||
|
||||
|
@ -57,9 +57,8 @@ void main() {
|
||||
#endif
|
||||
float moon_shade_frac = 1.0;
|
||||
|
||||
float point_shadow = shadow_at(f_pos, f_norm);
|
||||
DirectionalLight sun_info = get_sun_info(sun_dir, point_shadow * sun_shade_frac, f_pos);
|
||||
DirectionalLight moon_info = get_moon_info(moon_dir, point_shadow * moon_shade_frac);
|
||||
DirectionalLight sun_info = get_sun_info(sun_dir, sun_shade_frac, f_pos);
|
||||
DirectionalLight moon_info = get_moon_info(moon_dir, moon_shade_frac);
|
||||
|
||||
vec3 surf_color = f_col.rgb;
|
||||
float alpha = 1.0;
|
||||
@ -99,8 +98,9 @@ void main() {
|
||||
|
||||
max_light += lights_at(f_pos, f_norm, view_dir, mu, cam_attenuation, fluid_alt, k_a, k_d, k_s, alpha, f_norm, 1.0, emitted_light, reflected_light);
|
||||
|
||||
emitted_light *= point_shadow;
|
||||
float point_shadow = shadow_at(f_pos, f_norm);
|
||||
reflected_light *= point_shadow;
|
||||
emitted_light *= point_shadow;
|
||||
|
||||
// Allow particles to glow at night
|
||||
// TODO: Not this
|
||||
|
@ -66,9 +66,8 @@ void main() {
|
||||
#endif
|
||||
float moon_shade_frac = 1.0;
|
||||
|
||||
float point_shadow = shadow_at(f_pos, f_norm);
|
||||
DirectionalLight sun_info = get_sun_info(sun_dir, point_shadow * sun_shade_frac, f_pos);
|
||||
DirectionalLight moon_info = get_moon_info(moon_dir, point_shadow * moon_shade_frac);
|
||||
DirectionalLight sun_info = get_sun_info(sun_dir, sun_shade_frac, f_pos);
|
||||
DirectionalLight moon_info = get_moon_info(moon_dir, moon_shade_frac);
|
||||
|
||||
vec3 surf_color = f_col;
|
||||
float alpha = 1.0;
|
||||
@ -118,10 +117,12 @@ void main() {
|
||||
emitted_light += glow * cam_attenuation;
|
||||
|
||||
float ao = f_ao;
|
||||
emitted_light *= ao;
|
||||
reflected_light *= ao;
|
||||
emitted_light *= point_shadow;
|
||||
emitted_light *= ao;
|
||||
|
||||
float point_shadow = shadow_at(f_pos, f_norm);
|
||||
reflected_light *= point_shadow;
|
||||
emitted_light *= point_shadow;
|
||||
|
||||
surf_color = illuminate(max_light, view_dir, surf_color * emitted_light, surf_color * reflected_light);
|
||||
|
||||
|
@ -321,9 +321,8 @@ void main() {
|
||||
// float shade_frac = /*1.0;*/sun_shade_frac + moon_shade_frac;
|
||||
|
||||
// DirectionalLight sun_info = get_sun_info(sun_dir, sun_shade_frac, light_pos);
|
||||
float point_shadow = shadow_at(f_pos, f_norm);
|
||||
DirectionalLight sun_info = get_sun_info(sun_dir, point_shadow * sun_shade_frac, /*sun_pos*/f_pos);
|
||||
DirectionalLight moon_info = get_moon_info(moon_dir, point_shadow * moon_shade_frac/*, light_pos*/);
|
||||
DirectionalLight sun_info = get_sun_info(sun_dir, sun_shade_frac, /*sun_pos*/f_pos);
|
||||
DirectionalLight moon_info = get_moon_info(moon_dir, moon_shade_frac/*, light_pos*/);
|
||||
|
||||
#ifdef EXPERIMENTAL_DIRECTIONALSHADOWMAPTEXELGRID
|
||||
float offset_scale = 0.5;
|
||||
@ -402,9 +401,12 @@ void main() {
|
||||
|
||||
max_light += lights_at(f_pos, f_norm, view_dir, mu, cam_attenuation, fluid_alt, k_a, k_d, k_s, alpha, f_norm, 1.0, emitted_light, reflected_light);
|
||||
|
||||
reflected_light *= 0.4 + f_ao * 0.6;
|
||||
emitted_light *= point_shadow;
|
||||
emitted_light *= mix(1.0, f_ao, 0.5);
|
||||
reflected_light *= mix(1.0, f_ao, 0.5);
|
||||
|
||||
float point_shadow = shadow_at(f_pos, f_norm);
|
||||
reflected_light *= point_shadow;
|
||||
emitted_light *= point_shadow;
|
||||
|
||||
#ifndef EXPERIMENTAL_NOCAUSTICS
|
||||
#if (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
|
Loading…
Reference in New Issue
Block a user