summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2019-10-31 19:54:21 -0300
committerJuan Linietsky <reduzio@gmail.com>2020-02-11 12:04:56 +0100
commitda0457fa29e1ea63f89b1e1d73e72c4dc80a9966 (patch)
tree995b5a34b8c1175b8b313262cf9b5cf2035c33ad /servers
parent971ce680f22f6bebbccb333c48b2d2983550e50d (diff)
Several fixes to GIProbes
Diffstat (limited to 'servers')
-rw-r--r--servers/visual/rasterizer_rd/rasterizer_scene_forward_rd.cpp9
-rw-r--r--servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp1
-rw-r--r--servers/visual/rasterizer_rd/shaders/scene_forward.glsl2
-rw-r--r--servers/visual/visual_server_scene.cpp5
4 files changed, 12 insertions, 5 deletions
diff --git a/servers/visual/rasterizer_rd/rasterizer_scene_forward_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_scene_forward_rd.cpp
index 279cb88660..d57c62b629 100644
--- a/servers/visual/rasterizer_rd/rasterizer_scene_forward_rd.cpp
+++ b/servers/visual/rasterizer_rd/rasterizer_scene_forward_rd.cpp
@@ -2363,11 +2363,14 @@ void RasterizerSceneForwardRD::_setup_render_pass_uniform_set(RID p_depth_buffer
RD::Uniform u;
u.binding = 6;
u.type = RD::UNIFORM_TYPE_TEXTURE;
+ RID texture;
if (p_shadow_atlas.is_valid()) {
- u.ids.push_back(shadow_atlas_get_texture(p_shadow_atlas));
- } else {
- u.ids.push_back(storage->texture_rd_get_default(RasterizerStorageRD::DEFAULT_RD_TEXTURE_WHITE));
+ texture = shadow_atlas_get_texture(p_shadow_atlas);
}
+ if (!texture.is_valid()) {
+ texture = storage->texture_rd_get_default(RasterizerStorageRD::DEFAULT_RD_TEXTURE_WHITE);
+ }
+ u.ids.push_back(texture);
uniforms.push_back(u);
}
diff --git a/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp
index b2e90c7f59..05624e5279 100644
--- a/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp
+++ b/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp
@@ -2334,6 +2334,7 @@ void RasterizerSceneRD::render_shadow(RID p_light, RID p_shadow_atlas, int p_pas
}
} else {
//render shadow
+
_render_shadow(render_fb, p_cull_result, p_cull_count, light_projection, light_transform, zfar, bias, normal_bias, using_dual_paraboloid, using_dual_paraboloid_flip);
//copy to atlas
diff --git a/servers/visual/rasterizer_rd/shaders/scene_forward.glsl b/servers/visual/rasterizer_rd/shaders/scene_forward.glsl
index 8c122e6fcb..f567970e4a 100644
--- a/servers/visual/rasterizer_rd/shaders/scene_forward.glsl
+++ b/servers/visual/rasterizer_rd/shaders/scene_forward.glsl
@@ -266,7 +266,7 @@ VERTEX_SHADER_CODE
#else
float z_ofs = scene_data.z_offset;
- z_ofs += (1.0 - abs(normal_interp.z)) * scene_data.z_slope_scale;
+ z_ofs += max(0.0,1.0 - abs(normalize(normal_interp).z)) * scene_data.z_slope_scale;
vertex_interp.z -= z_ofs;
#endif
diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp
index 1ce4f47d75..61e6755ee2 100644
--- a/servers/visual/visual_server_scene.cpp
+++ b/servers/visual/visual_server_scene.cpp
@@ -851,7 +851,7 @@ void VisualServerScene::instance_geometry_set_flag(RID p_instance, VS::InstanceF
Instance *instance = instance_owner.getornull(p_instance);
ERR_FAIL_COND(!instance);
- ERR_FAIL_COND(((1 << instance->base_type) & VS::INSTANCE_GEOMETRY_MASK));
+ //ERR_FAIL_COND(((1 << instance->base_type) & VS::INSTANCE_GEOMETRY_MASK));
switch (p_flags) {
@@ -2526,6 +2526,9 @@ void VisualServerScene::render_probes() {
for (List<InstanceGIProbeData::PairInfo>::Element *E = probe->dynamic_geometries.front(); E; E = E->next()) {
if (instance_cull_count < MAX_INSTANCE_CULL) {
Instance *ins = E->get().geometry;
+ if (!ins->visible) {
+ continue;
+ }
InstanceGeometryData *geom = (InstanceGeometryData *)ins->base_data;
if (geom->gi_probes_dirty) {