View Issue Details

IDProjectCategoryView StatusLast Update
0004379The Dark ModCodingpublic06.10.2016 01:08
Reporternbohr1more Assigned Tonbohr1more  
PrioritynormalSeverityfeatureReproducibilityhave not tried
Status resolvedResolutionfixed 
PlatformALL 
Product VersionTDM 2.04 
Target VersionTDM 2.05Fixed in VersionTDM 2.05 
Summary0004379: Investigate RenderView culling for the lightgem
DescriptionCurrently the lightgem renders the entire scene geometry except for particles and lights marked with "ai_see" "0".

See if culling all lights whose radius doesn't overlap the player yields better lightgem performance.

Also investigate culling all noshadows surfaces except the lightgem surface itself.
Additional InformationFrom lg_weak:

if (distance > light->m_MaxLightRadius)
        {
            DM_LOG(LC_LIGHT, LT_DEBUG)LOGSTRING("%s is outside distance: %f/%f\r", light->name.c_str(), light->m_MaxLightRadius, distance);
            if(h == -1)
                h = i;
            continue;
}

From ai_see:

if ( !args->GetBool( "ai_see", "1") ) // SteveL 0004128
    {
        renderLight->suppressLightInViewID = DARKMOD_LG_VIEWID;
    }


Discussion:

http://forums.thedarkmod.com/topic/18346-lightgem-optimization/

Bugs with related code areas:

0004128
0003970
0003584
TagsNo tags attached.

Activities

nbohr1more

nbohr1more

22.09.2016 15:17

developer   ~0008337

Initial steps:

1) Cull light-list of all ai_see lights to reduce the radius checks
2) Radius check lights to the player
3) Mark out-of-range lights for suppression

Note: lg_weak appears to use spherical checking, see if changes from 3584 can be used instead.
nbohr1more

nbohr1more

29.09.2016 18:58

developer   ~0008358

Cutting off all lights that are not "viewInsideLight" doesn't improve performance.

Next test is to cull all noshadows surfaces except for the lightgem.

Changes will be done in interaction.cpp and RenderWorld_portal.cpp
nbohr1more

nbohr1more

30.09.2016 06:08

developer   ~0008359

tdm_misc.mtr

models/props/misc/lightgem_surface //the actual diamond used for rendershot
{
    noShadows
    diffusemap _white
    islightgemsurf //nbohr1more



Entity.cpp 828

// nbohr1more lightgem culling
renderEntity->islightgem = args->GetBool( "islightgem" );

Lightgem.cpp 150 and 181

m_LightgemSurface.GetEntity()->GetRenderEntity()->islightgem = true;

Material.h 550 and 670
// nbohr1more: lightgem culling
    bool Islightgemsurf( void ) const { return islightgemsurf; }

bool islightgemsurf; // nbohr1more: lightgem culling

Material.cpp 100 and 1855

islightgemsurf = false; //nbohr1more: lightgem culling

// nbohr1more: lightgem culling
        else if ( !token.Icmp( "islightgemsurf" ) ) {
            islightgemsurf = true;
            continue;
        }

RenderWorld.h 142

bool islightgem; //nbohr1more lightgem culling


RenderWorld_portals.cpp 615

if ( !r_skipSuppress.GetBool() ) {
            if ( (!entity->parms.islightgem) && (entity->parms.noShadow) && (tr.viewDef->renderView.viewID == -1)){
                continue;
            }

interaction.cpp 900 and 1045

if ((!HasShadows() ) && ( !shader->Islightgemsurf() ) && (tr.viewDef->renderView.viewID == -1)) {
            continue;
            }

if ((!HasShadows() ) && ( !entityDef->parms.islightgem ) && (tr.viewDef->renderView.viewID == -1)) {
            return;
            }
nbohr1more

nbohr1more

01.10.2016 04:04

developer   ~0008360

Binary at 14602

Src rev 6627
nbohr1more

nbohr1more

03.10.2016 04:46

developer   ~0008361

Last edited: 03.10.2016 04:48

Further revision:

RenderWorld_portal.cpp 658 and 675:

#define INSIDE_LIGHT_FRUSTUM_SLOP 32

if ( ( light->frustum[i].Distance( tr.viewDef->renderView.vieworg ) > INSIDE_LIGHT_FRUSTUM_SLOP ) && (tr.viewDef->renderView.viewID == -1) )
            {
            continue;
            }

Src rev 6630

nbohr1more

nbohr1more

06.10.2016 01:07

developer   ~0008366

Conclusion: No huge (real-world) gains but reducing the lightgem process time allows you to set tdm_lg_interleave_min lower while tdm_lg_interleave = 2 and tdm_lg_split = 1.

It should allow low-end players to have a much better experience.

High-end folks haven't chimed-in on whether this also allows them to increase image quality options but it seems that it should help there too.

Issue History

Date Modified Username Field Change
22.09.2016 15:07 nbohr1more New Issue
22.09.2016 15:07 nbohr1more Status new => assigned
22.09.2016 15:07 nbohr1more Assigned To => nbohr1more
22.09.2016 15:17 nbohr1more Note Added: 0008337
29.09.2016 18:58 nbohr1more Note Added: 0008358
30.09.2016 06:08 nbohr1more Note Added: 0008359
01.10.2016 04:04 nbohr1more Note Added: 0008360
01.10.2016 04:05 nbohr1more Status assigned => feedback
03.10.2016 04:46 nbohr1more Note Added: 0008361
03.10.2016 04:46 nbohr1more Status feedback => assigned
03.10.2016 04:48 nbohr1more Note Edited: 0008361
03.10.2016 04:49 nbohr1more Status assigned => feedback
06.10.2016 01:07 nbohr1more Note Added: 0008366
06.10.2016 01:07 nbohr1more Status feedback => assigned
06.10.2016 01:08 nbohr1more Status assigned => resolved
06.10.2016 01:08 nbohr1more Resolution open => fixed
06.10.2016 01:08 nbohr1more Fixed in Version => TDM 2.05