You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-13 13:31:48 +00:00
Fix SDFGI bug after previous optimization.
Was causing arctifacts, should be good now.
This commit is contained in:
@@ -244,6 +244,9 @@ void main() {
|
|||||||
|
|
||||||
vec4 light;
|
vec4 light;
|
||||||
if (hit) {
|
if (hit) {
|
||||||
|
//avoid reading different texture from different threads
|
||||||
|
for (uint j = params.cascade; j < params.max_cascades; j++) {
|
||||||
|
if (j == hit_cascade) {
|
||||||
const float EPSILON = 0.001;
|
const float EPSILON = 0.001;
|
||||||
vec3 hit_normal = normalize(vec3(
|
vec3 hit_normal = normalize(vec3(
|
||||||
texture(sampler3D(sdf_cascades[hit_cascade], linear_sampler), uvw + vec3(EPSILON, 0.0, 0.0)).r - texture(sampler3D(sdf_cascades[hit_cascade], linear_sampler), uvw - vec3(EPSILON, 0.0, 0.0)).r,
|
texture(sampler3D(sdf_cascades[hit_cascade], linear_sampler), uvw + vec3(EPSILON, 0.0, 0.0)).r - texture(sampler3D(sdf_cascades[hit_cascade], linear_sampler), uvw - vec3(EPSILON, 0.0, 0.0)).r,
|
||||||
@@ -258,6 +261,9 @@ void main() {
|
|||||||
//one liner magic
|
//one liner magic
|
||||||
light.rgb = hit_light * (dot(max(vec3(0.0), (hit_normal * hit_aniso0)), vec3(1.0)) + dot(max(vec3(0.0), (-hit_normal * hit_aniso1)), vec3(1.0)));
|
light.rgb = hit_light * (dot(max(vec3(0.0), (hit_normal * hit_aniso0)), vec3(1.0)) + dot(max(vec3(0.0), (-hit_normal * hit_aniso1)), vec3(1.0)));
|
||||||
light.a = 1.0;
|
light.a = 1.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} else if (params.sky_mode == SKY_MODE_SKY) {
|
} else if (params.sky_mode == SKY_MODE_SKY) {
|
||||||
#ifdef USE_CUBEMAP_ARRAY
|
#ifdef USE_CUBEMAP_ARRAY
|
||||||
light.rgb = textureLod(samplerCubeArray(sky_irradiance, linear_sampler_mipmaps), vec4(ray_dir, 0.0), 2.0).rgb; //use second mipmap because we dont usually throw a lot of rays, so this compensates
|
light.rgb = textureLod(samplerCubeArray(sky_irradiance, linear_sampler_mipmaps), vec4(ray_dir, 0.0), 2.0).rgb; //use second mipmap because we dont usually throw a lot of rays, so this compensates
|
||||||
|
|||||||
Reference in New Issue
Block a user