mirror of
https://github.com/w23/xash3d-fwgs
synced 2025-01-18 23:00:01 +01:00
Add simple soft shadows by @LifeKILLED
This is a temporary solution.
This commit is contained in:
parent
e5658f59cd
commit
190a691c6d
@ -104,12 +104,18 @@ void computePointLights(vec3 P, vec3 N, uint cluster_index, vec3 throughput, vec
|
||||
if (dot(combined,combined) < color_culling_threshold)
|
||||
continue;
|
||||
|
||||
vec3 shadow_sample_offset = normalize(vec3(rand01(), rand01(), rand01()) - vec3(0.5, 0.5, 0.5));
|
||||
const float shadow_sample_radius = is_environment ? 1000. : 10.; // 10000 for some maps!
|
||||
const vec3 shadow_sample_dir = light_dir_norm * light_dist + shadow_sample_offset * shadow_sample_radius;
|
||||
|
||||
// TODO split environment and other lights
|
||||
if (is_environment) {
|
||||
if (shadowedSky(P, light_dir_norm))
|
||||
//if (shadowedSky(P, light_dir_norm))
|
||||
if (shadowedSky(P, normalize(shadow_sample_dir)))
|
||||
continue;
|
||||
} else {
|
||||
if (shadowed(P, light_dir_norm, light_dist + shadow_offset_fudge))
|
||||
//if (shadowed(P, light_dir_norm, light_dist + shadow_offset_fudge))
|
||||
if (shadowed(P, normalize(shadow_sample_dir), length(shadow_sample_dir) + shadow_offset_fudge))
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user