View Issue Details

IDProjectCategoryView StatusLast Update
0005309DarkRadiantRendererpublic25.06.2021 04:50
Reporterorbweaver Assigned Toorbweaver  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version2.8.0 
Target Version2.10.0Fixed in Version2.10.0 
Summary0005309: Creating a model entity creates a "phantom light" near the world origin
Description1. Create a textured floor brush at the world origin (with upper surface at Z=0, and X and Y dimensions extending a reasonable distance).
2. Choose Create Entity and add a simple entity (e.g. atdm:moveable_barrel_01). The location of the entity does not matter.
3. Enter lighting preview mode.

Observe that the floor brush is now lit with a light which does not exist in the map and cannot be selected or edited. The light persists for the session, but is gone if the map is reloaded in a new session.

Hypothesis: this is something to do with the entity preview widget, maybe? A light is needed to show the preview and perhaps this light is remaining in the internal scene after the widget has closed.
TagsNo tags attached.

Activities

orbweaver

orbweaver

11.08.2020 20:14

developer   ~0012727

Confirmed that the phantom light is caused by the model preview.

In ModelPreview::setupSceneGraph() we create a local scene graph with a light node, but LightNode::onInsertIntoScene() always inserts the new node into the GlobalRenderSystem (since there is no other render system to insert it into).

Since the ModelPreview is persistent (for performance reasons we don't create a new dialog for each EntityClassChooser operation, but maintain a single dialog which is hidden and shown on demand), the LightNode is never destroyed and the singleton GlobalRenderSystem maintains the light for the rest of the session.

This could be worked around by adding extra function calls to create and destroy this light node (or manually attach/detach it from the render system) each time the model preview is shown, but it really highlights the limitations of this global light list. A better long term solution is to remove the global light list and have lights submitted from the active scenegraph using RenderableCollector.
orbweaver

orbweaver

18.08.2020 20:02

developer   ~0012744

Another manifestation of the same bug: toggling any filter, even without the model preview visible (or ever having been shown), also creates the phantom light! The call trace is as follows:

    frame #0: 0x00005555559f0c3d darkradiant`render::OpenGLRenderSystem::attachLight(this=0x000055555655f630, light=0x000055555791c1c0) at OpenGLRenderSystem.cpp:405
    frame 0000001: 0x000055555582f160 darkradiant`entity::LightNode::onInsertIntoScene(this=0x000055555791c1c0, root=0x000055555780d180) at LightNode.cpp:92
    frame 0000002: 0x0000555555a04945 darkradiant`scene::SceneGraph::insert(this=0x0000555557890560, node=std::__shared_ptr<scene::INode, 4>::element_type @ 0x000055555791d7a8) at SceneGraph.cpp:126
    frame 0000003: 0x00007ffff51dde95 libscenegraph-2.8.1.so`scene::InstanceSubgraphWalker::pre(this=0x00007fffffffc9a0, node=std::__shared_ptr<scene::INode, 4>::element_type @ 0x000055555791d7a8) at InstanceWalkers.cpp:17
    frame 0000004: 0x00007ffff51efb6a libscenegraph-2.8.1.so`scene::Node::traverse(this=0x000055555791c1c0, visitor=0x00007fffffffc9a0) at Node.cpp:234
    frame 0000005: 0x00007ffff51efe8f libscenegraph-2.8.1.so`scene::Node::onChildAdded(this=0x000055555780d180, child=std::__shared_ptr<scene::INode, 4>::element_type @ 0x000055555791d7a8) at Node.cpp:276
    frame 0000006: 0x00007ffff51e082f libscenegraph-2.8.1.so`scene::TraversableNodeSet::append(this=0x000055555780d1b0, node=std::__shared_ptr<scene::INode, 4>::element_type @ 0x000055555791d7a8) at TraversableNodeSet.cpp:116
    frame 0000007: 0x00007ffff51ef743 libscenegraph-2.8.1.so`scene::Node::addChildNode(this=0x000055555780d180, node=std::__shared_ptr<scene::INode, 4>::element_type @ 0x000055555791d7a8) at Node.cpp:175
    frame #8: 0x00007ffff4ecaca1 libwxutil-2.8.1.so`wxutil::ModelPreview::setupSceneGraph(this=0x00005555574a63e0) at ModelPreview.cpp:110
    frame 0000009: 0x00007ffff4ef2425 libwxutil-2.8.1.so`wxutil::RenderPreview::getScene(this=0x00005555574a63e0) at RenderPreview.cpp:263
  * frame 0000010: 0x00007ffff4ef1e8e libwxutil-2.8.1.so`wxutil::RenderPreview::filtersChanged(this=0x00005555574a63e0) at RenderPreview.cpp:171

The simple act of calling filtersChanged(), which happens in response to any filter being activated or deactivated, re-initialises the lighting in the preview scene and attaches the preview light to the shader system. The end result is that lighting can visibly change in response to toggling a filter.
orbweaver

orbweaver

02.12.2020 21:15

developer   ~0013080

As of commit 4309d9e9f421c84361d3968f583b1936dffb61f5 the lighting system has been refactored so that lights are not inserted straight into the render backend, but instead collected by traversing the scene with the frontend. This fixes the phantom light problem.
greebo

greebo

03.12.2020 15:31

administrator   ~0013085

Just merged your master branch into mine

Related Changesets

DarkRadiant: master 05532549

28.10.2020 21:05

orbweaver


Details Diff
Patches now use addLitRenderable() for rendering

Just like brushes, patches are using the new method instead of the old light
list approach. This means that patches no longer show the phantom light
described in 0005309.
Affected Issues
0005309
mod - radiant/patch/Patch.cpp Diff File
mod - radiant/patch/Patch.h Diff File
mod - radiant/patch/PatchNode.cpp Diff File
mod - radiant/patch/PatchNode.h Diff File

Issue History

Date Modified Username Field Change
26.07.2020 20:28 orbweaver New Issue
26.07.2020 20:28 orbweaver Status new => assigned
26.07.2020 20:28 orbweaver Assigned To => orbweaver
11.08.2020 20:14 orbweaver Note Added: 0012727
18.08.2020 20:02 orbweaver Note Added: 0012744
02.12.2020 21:15 orbweaver Fixed in Version => 2.9.2
02.12.2020 21:15 orbweaver Target Version => 2.9.2
02.12.2020 21:15 orbweaver Status assigned => resolved
02.12.2020 21:15 orbweaver Resolution open => fixed
02.12.2020 21:15 orbweaver Note Added: 0013080
03.12.2020 15:31 greebo Note Added: 0013085
03.12.2020 16:19 orbweaver Changeset attached => DarkRadiant master 05532549
13.12.2020 06:22 greebo Fixed in Version 2.9.2 => 2.10.0
13.12.2020 06:22 greebo Target Version 2.9.2 => 2.10.0
25.06.2021 04:50 greebo Status resolved => closed