1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Batch of lightmapper fixes and minor improvements

- Fix objects with no material being considered as fully transparent by the lightmapper.
- Added "environment_min_light" property: gives artistic control over the shadow color.
- Fixed "Custom Color" environment mode, it was ignored before.
- Added "interior" property to BakedLightmapData: controls whether dynamic capture objects receive environment light or not.
- Automatically update dynamic capture objects when the capture data changes (also works for "energy" which used to require object movement to trigger the update).
- Added "use_in_baked_light" property to GridMap: controls whether the GridMap will be included in BakedLightmap bakes.
- Set "flush zero" and "denormal zero" mode for SSE2 instructions in the Embree raycaster. According to Embree docs it should give a performance improvement.
This commit is contained in:
JFonS
2021-03-11 13:34:57 +01:00
parent 0e0d73c011
commit e2c28675ef
24 changed files with 229 additions and 30 deletions

View File

@@ -1085,6 +1085,13 @@ void VisualServerScene::_update_instance(Instance *p_instance) {
VSG::storage->particles_set_emission_transform(p_instance->base, p_instance->transform);
}
if (p_instance->base_type == VS::INSTANCE_LIGHTMAP_CAPTURE) {
InstanceLightmapCaptureData *capture = static_cast<InstanceLightmapCaptureData *>(p_instance->base_data);
for (List<InstanceLightmapCaptureData::PairInfo>::Element *E = capture->geometries.front(); E; E = E->next()) {
_instance_queue_update(E->get().geometry, false, true);
}
}
if (p_instance->aabb.has_no_surface()) {
return;
}
@@ -1441,6 +1448,7 @@ void VisualServerScene::_update_instance_lightmap_captures(Instance *p_instance)
for (int i = 0; i < 12; i++)
new (&p_instance->lightmap_capture_data.ptrw()[i]) Color;
bool interior = true;
//this could use some sort of blending..
for (List<Instance *>::Element *E = geom->lightmap_captures.front(); E; E = E->next()) {
const PoolVector<RasterizerStorage::LightmapCaptureOctree> *octree = VSG::storage->lightmap_capture_get_octree_ptr(E->get()->base);
@@ -1456,6 +1464,7 @@ void VisualServerScene::_update_instance_lightmap_captures(Instance *p_instance)
Vector3 pos = to_cell_xform.xform(p_instance->transform.origin);
const float capture_energy = VSG::storage->lightmap_capture_get_energy(E->get()->base);
interior = interior && VSG::storage->lightmap_capture_is_interior(E->get()->base);
for (int i = 0; i < 12; i++) {
@@ -1467,6 +1476,7 @@ void VisualServerScene::_update_instance_lightmap_captures(Instance *p_instance)
p_instance->lightmap_capture_data.write[i] += capture;
}
}
p_instance->lightmap_capture_data.write[0].a = interior ? 0.0f : 1.0f;
}
bool VisualServerScene::_light_instance_update_shadow(Instance *p_instance, const Transform p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, RID p_shadow_atlas, Scenario *p_scenario) {