summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorKiri Jolly <expiredpopsicle@gmail.com>2020-04-28 17:13:36 -0700
committerKiri Jolly <expiredpopsicle@gmail.com>2020-04-29 19:24:43 -0700
commit459cab99f47a3c761129abdc94f2325aaa23e129 (patch)
treebb183e7810248259efd09b91e35edea5c59a3dd3 /servers
parent92d4a0cbd231508221b0e977ae9a0e9d4207e328 (diff)
Fixed unbounded dual-paraboloid shadow map culling.
Dual paraboloid shadowmaps were ending up with infinitely large volumes of area behind the hemisphere un-culled. This change just adds a back plane to the convex shape used for the culling volume.
Diffstat (limited to 'servers')
-rw-r--r--servers/rendering/rendering_server_scene.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/servers/rendering/rendering_server_scene.cpp b/servers/rendering/rendering_server_scene.cpp
index 337eb5995f..2c3c2730d5 100644
--- a/servers/rendering/rendering_server_scene.cpp
+++ b/servers/rendering/rendering_server_scene.cpp
@@ -1850,12 +1850,13 @@ bool RenderingServerScene::_light_instance_update_shadow(Instance *p_instance, c
real_t z = i == 0 ? -1 : 1;
Vector<Plane> planes;
- planes.resize(5);
+ planes.resize(6);
planes.write[0] = light_transform.xform(Plane(Vector3(0, 0, z), radius));
planes.write[1] = light_transform.xform(Plane(Vector3(1, 0, z).normalized(), radius));
planes.write[2] = light_transform.xform(Plane(Vector3(-1, 0, z).normalized(), radius));
planes.write[3] = light_transform.xform(Plane(Vector3(0, 1, z).normalized(), radius));
planes.write[4] = light_transform.xform(Plane(Vector3(0, -1, z).normalized(), radius));
+ planes.write[5] = light_transform.xform(Plane(Vector3(0, 0, -z), 0));
int cull_count = p_scenario->octree.cull_convex(planes, instance_shadow_cull_result, MAX_INSTANCE_CULL, RS::INSTANCE_GEOMETRY_MASK);
Plane near_plane(light_transform.origin, light_transform.basis.get_axis(2) * z);