From 96e2887945a6cbacece12bf983a50ef72abd9dd9 Mon Sep 17 00:00:00 2001 From: dedm0zaj Date: Thu, 17 Dec 2020 22:02:08 +0700 Subject: [PATCH] Lightness of dynamic objects from Energy Lightmap Capture Data --- servers/visual/visual_server_scene.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index afb3f41c754..0c268a928c2 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -1306,10 +1306,15 @@ 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); + for (int i = 0; i < 12; i++) { Vector3 dir = to_cell_xform.basis.xform(cone_traces[i]).normalized(); Color capture = _light_capture_voxel_cone_trace(octree_r.ptr(), pos, dir, cone_aperture, cell_subdiv); + capture.r *= capture_energy; + capture.g *= capture_energy; + capture.b *= capture_energy; p_instance->lightmap_capture_data.write[i] += capture; } }