View Issue Details

IDProjectCategoryView StatusLast Update
0004292The Dark ModCodingpublic01.12.2016 21:08
ReporterSpooks Assigned Tonbohr1more  
PrioritynormalSeveritynormalReproducibilityalways
Status resolvedResolutionfixed 
PlatformALLOSALLOS VersionALL
Product VersionTDM 2.04 
Target VersionTDM 2.05Fixed in VersionTDM 2.05 
Summary0004292: "nospecular" light entity argument does not work
DescriptionIn the example map I've provided you have 3 lights and 2 bobbing boxes, each textured with a custom material that has an extra shiny specular for demonstration purposes.

The red light skips specular.
The green light skips diffuse.
The blue light skips specular, diffuse and casts no shadows.

In practice, the lights skip neither specular, nor diffuse, no matter the combination or the scene complexity. (diffuse and bump have been moved to another tracker).
Steps To ReproduceMake a light, check off disable specular in Light Properties, put next to a surface and observe in game. Always reproducible on my system.
Additional InformationThis is happening when compiling from DR 2.0.3 x64 on Windows 7. Toggling enhanced ambient or the advanced interaction on/off does not change the results of my tests. This map does not have an ambient_world light and putting one in shouldn't change the results. The lights do not have a custom texture set.
TagsNo tags attached.

Relationships

related to 0004367 assignednbohr1more nodiffuse and nobump Light Entity args do not work 
related to 0003684 new Investigate GPL Renderer Improvements 

Activities

Spooks

Spooks

04.03.2016 23:12

reporter  

specular.zip (63,536 bytes)
Spooks

Spooks

10.04.2016 11:19

reporter   ~0008072

Bump. This got moved from the DR section. Has anyone tried the test map? I want to establish whether or not this is reproducible. If it is, there's several places where these spawnargs may be failing: the engine does not respect them, something in the material isn't set right, or it's shader-side.
SteveL

SteveL

11.04.2016 19:22

developer   ~0008089

Your .map file has the correct "nospecular" etc spawnargs set, so this is a TDM problem not a DR problem.

I'm surprised no-one has reported this before, but I guess these spawnargs are little used in real maps. Even ambient lights have some specular in our lighting model.
Spooks

Spooks

12.04.2016 22:39

reporter   ~0008097

Ah, it's nice I'm not just going crazy. Use case scenarios for lights without specular would be where you want an ambient look, but also want to use light_center to point your light in a direction. Lights with the AmbientLight keyword don't have directionality through light_center, not to mention they don't cast shadows. This is how I came across this bug.

A nodiffuse light could be used to fake Fresnel highlights I suppose, but it's hard to figure out without testing it first and seeing how it looks.
nbohr1more

nbohr1more

24.08.2016 21:46

developer   ~0008281

Last edited: 25.08.2016 05:51

View 2 revisions

As I recall, there is a minimal hardcoded specular level in the light shader but the engine shouldn't be passing the specular texture if nospecular is set.

One thing I notice is that UpdateLightDef (in RenderWorld.cpp ) doesn't have any nospecular criteria whereas it has other attribute criteria:

    if ( light ) {
        // if the shape of the light stays the same, we don't need to dump
        // any of our derived data, because shader parms are calculated every frame
        if ( rlight->axis == light->parms.axis && rlight->end == light->parms.end &&
             rlight->lightCenter == light->parms.lightCenter && rlight->lightRadius == light->parms.lightRadius &&
             rlight->noShadows == light->parms.noShadows && rlight->origin == light->parms.origin &&
             rlight->parallel == light->parms.parallel && rlight->pointLight == light->parms.pointLight &&
             rlight->right == light->parms.right && rlight->start == light->parms.start &&
             rlight->target == light->parms.target && rlight->up == light->parms.up &&
             rlight->shader == light->lightShader && rlight->prelightModel == light->parms.prelightModel ) {
            justUpdate = true;
        } else {
            // if we are updating shadows, the prelight model is no longer valid
            light->lightHasMoved = true;
R_FreeLightDefDerivedData( light );


Edit: Adding noSpecular to the above has no effect on this bug...

nbohr1more

nbohr1more

24.08.2016 22:06

developer   ~0008282

Last edited: 25.08.2016 02:32

View 2 revisions

tr_render.cpp

    // Serp - This check is more expensive than just making extra calls, I am not sure if the calls might result in
    // things which should not be lit, being lit. Welp, we'll see.

Reverting this does not cure the issue.

nbohr1more

nbohr1more

25.08.2016 05:55

developer   ~0008283

Last edited: 25.08.2016 21:45

View 2 revisions

That's all I can think of before looking into branches for the ARB bind.

program.env[1] is already being used in the shader to determine whether substitute specular should be created...

so I would need to create another new program.env variable if I were to go that route.

nbohr1more

nbohr1more

31.08.2016 05:07

developer   ~0008288

Fix for nospecular in tr_render.cpp:

case SL_SPECULAR: {
                    // ignore stage that fails the condition
                    if ( !surfaceRegs[ surfaceStage->conditionRegister ] ) {
                        break;
                    }
                    // nbohr1more: 0004292 nospecular and nodiffuse fix
                    else if ( backEnd.vLight->lightDef->parms.noSpecular ) {
                        break;
                    }
                    else if ( inter.specularImage ) {
                        RB_SubmittInteraction( &inter, DrawInteraction );
                    }
                    R_SetDrawInteraction( surfaceStage, surfaceRegs, &inter.specularImage,
                                            inter.specularMatrix, inter.specularColor.ToFloatPtr() );
                    inter.specularColor[0] *= lightColor[0];
                    inter.specularColor[1] *= lightColor[1];
                    inter.specularColor[2] *= lightColor[2];
                    inter.specularColor[3] *= lightColor[3];
                    inter.vertexColor = surfaceStage->vertexColor;
                    break;
                }


nodiffuse and nobump will be much larger tasks.
nbohr1more

nbohr1more

31.08.2016 05:30

developer   ~0008289

Src revision 6616

Binary 14584

Issue History

Date Modified Username Field Change
04.03.2016 23:12 Spooks New Issue
04.03.2016 23:12 Spooks File Added: specular.zip
05.03.2016 10:54 Spooks Additional Information Updated View Revisions
09.03.2016 06:01 greebo Project DarkRadiant => The Dark Mod
09.03.2016 06:01 greebo Category Shader System => General
10.04.2016 11:19 Spooks Note Added: 0008072
11.04.2016 19:22 SteveL Note Added: 0008089
12.04.2016 22:39 Spooks Note Added: 0008097
24.08.2016 21:46 nbohr1more Note Added: 0008281
24.08.2016 22:06 nbohr1more Note Added: 0008282
24.08.2016 22:16 nbohr1more Assigned To => nbohr1more
24.08.2016 22:16 nbohr1more Reproducibility N/A => always
24.08.2016 22:16 nbohr1more Status new => assigned
24.08.2016 22:16 nbohr1more Category General => Coding
24.08.2016 22:16 nbohr1more OS Windows => ALL
24.08.2016 22:16 nbohr1more OS Version 7 =>
24.08.2016 22:16 nbohr1more Product Version 2.0.3 => TDM 2.04
24.08.2016 22:16 nbohr1more Target Version => TDM 2.05
25.08.2016 02:32 nbohr1more Note Edited: 0008282 View Revisions
25.08.2016 05:51 nbohr1more Note Edited: 0008281 View Revisions
25.08.2016 05:55 nbohr1more Note Added: 0008283
25.08.2016 21:45 nbohr1more Note Edited: 0008283 View Revisions
31.08.2016 05:07 nbohr1more Note Added: 0008288
31.08.2016 05:12 nbohr1more Relationship added related to 0004367
31.08.2016 05:13 nbohr1more Summary "nodiffuse" and "nospecular" light arguments do not work => "nospecular" light argument does not work
31.08.2016 05:30 nbohr1more Note Added: 0008289
31.08.2016 05:32 nbohr1more Status assigned => resolved
31.08.2016 05:32 nbohr1more Resolution open => fixed
31.08.2016 05:32 nbohr1more OS Version => ALL
31.08.2016 05:32 nbohr1more Platform => ALL
31.08.2016 05:32 nbohr1more Description Updated View Revisions
31.08.2016 05:32 nbohr1more Steps to Reproduce Updated View Revisions
31.08.2016 05:33 nbohr1more Summary "nospecular" light argument does not work => "nospecular" light entity argument does not work
18.09.2016 05:47 nbohr1more Fixed in Version => TDM 2.05
01.12.2016 21:08 nbohr1more Relationship added related to 0003684