View Issue Details

IDProjectCategoryView StatusLast Update
0005529The Dark ModTexturespublic04.01.2022 07:01
ReporterDragofer Assigned Toduzenko  
PrioritynormalSeveritynormalReproducibilityalways
Status resolvedResolutionfixed 
Product VersionTDM 2.08 
Target VersionTDM 2.10Fixed in VersionTDM 2.10 
Summary0005529: Projected lights can't use appropriate falloff images
DescriptionIt does not appear to be possible to assign gradient falloff images to projected lights in TDM without major rendering bugs, mainly the light shining forwards and backwards and getting cut off depending on how the player's view is angled. This gets more severe the wider the beam is in relation to the length.

This means that all projected lights in TDM use circular falloff images. This is also bad, since the light beam will have a constant light intensity until it abruptly cuts off to black at the end of its reach.

Several assets depend on projection lights working correctly, most importantly the security camera.
Steps To ReproduceI've attached:
- a test FM with a rotating spotlight. The player starts in the intended light cone and is rotated so that he can also see the backwards light projection on the far side of the room.
- a screenshot of the starting view in the test FM
- a .jpg of the falloff image. The original .tga can be found in the FM's lights folder.
Additional Information- I encountered this problem for the first time in 2016.
- I believe the falloff image is rotated correctly, since all 3 other rotations cause the light to reach far longer than it should.
TagsNo tags attached.

Relationships

related to 0005815 resolvedstgatilov Projected lights behavior has changed since 2.08 
related to 0005860 resolvedstgatilov Texture broken by 2.10: lights/cloudscroll 
child of 0005528 resolvedDragofer Improvements to security cameras 

Activities

Dragofer

Dragofer

09.02.2021 12:29

developer  

test_proj.pk4 (131,034 bytes)
falloff.jpg (252,110 bytes)   
falloff.jpg (252,110 bytes)   
falloff_gradient04.jpg (1,940 bytes)   
falloff_gradient04.jpg (1,940 bytes)   
nbohr1more

nbohr1more

09.02.2021 13:11

developer   ~0013670

The material def for the light is using the biground1 texture, was that intentional?

lights/spotlight_security_camera
{

    lightFalloffImage makeintensity( lights/falloff_gradient04 )
    {
        forceHighQuality
        map lights/biground1
        colored
        zeroClamp
        red ((.02 * sintable [(time * ( 1 + Parm3 ) ) ]) +1.68) * Parm0
        green ((.02 * sintable [(time * ( 1 + Parm3 ) ) ]) +1.68) * Parm1
        blue ((.02 * sintable [(time * ( 1 + Parm3 ) ) ]) +1.68) * Parm2
    }

}


Shouldn't it be using your custom projection image? :


lights/spotlight_security_camera
{

    lightFalloffImage makeintensity( lights/falloff_gradient04 )
    {
        forceHighQuality
        map lights/spotlight_security_camera
        colored
        zeroClamp
        red ((.02 * sintable [(time * ( 1 + Parm3 ) ) ]) +1.68) * Parm0
        green ((.02 * sintable [(time * ( 1 + Parm3 ) ) ]) +1.68) * Parm1
        blue ((.02 * sintable [(time * ( 1 + Parm3 ) ) ]) +1.68) * Parm2
    }

}
Dragofer

Dragofer

09.02.2021 14:59

developer   ~0013671

Ah yeah, I didn't mean to include my custom projection image in the .pk4. The problem is the same with either projection image.
Dragofer

Dragofer

15.02.2021 09:09

developer   ~0013684

Relevant post on code for projection lights by stgatilov here:
https://forums.thedarkmod.com/index.php?/topic/20768-security-cameras/&do=findComment&comment=456655
Judith

Judith

04.03.2021 23:15

reporter   ~0013761

I experimented with projection textures long time ago, so my memory might fail me, isn't the falloff image wrong? The falloff gradient should be billinear, so the light materials works for both omni and projected lights, as in the classic example: https://wiki.thedarkmod.com/index.php?title=File:LT_Projectedlight.png
Dragofer

Dragofer

30.10.2021 09:19

developer   ~0014455

Last edited: 30.10.2021 09:22

Thanks for the suggestion to use bilinear falloff images for this projected light. Unfortunately it doesn't look like this is the way forward, here are the results:

Gradient1 is dark in the middle. In the screenshot you can see the light cone has a dark stripe near the beginning, and it shines far further than expected along the side walls, while the far away end wall is dark as expected. It also shines forwards and backwards (not shown in this screenshot).

Gradient2 is bright in the middle. In the screenshot you can see it has the same problem as other falloff images already used in TDM for projected lights: high light intensity until it abruptly cuts to black when the light's range ends.
gradient1.jpg (2,420 bytes)   
gradient1.jpg (2,420 bytes)   
gradient1_problem.jpg (285,294 bytes)
gradient2.jpg (2,314 bytes)   
gradient2.jpg (2,314 bytes)   
gradient2_problem.jpg (258,971 bytes)   
gradient2_problem.jpg (258,971 bytes)   
duzenko

duzenko

30.10.2021 15:17

developer   ~0014457

Committed fix for shining backwards to svn (new backend)
stgatilov

stgatilov

21.11.2021 06:41

administrator   ~0014557

Added a more comprehensive fix in svn rev 9646.
Aside from forbidding "antiworld" (w < 0), also forbid U, V, T getting out of [0..1] interval.
duzenko

duzenko

19.12.2021 05:18

developer   ~0014599

@Dragofer
Is this resolved now?
Dragofer

Dragofer

19.12.2021 12:37

developer   ~0014600

Excellent: the security camera's projected light now fades out naturally near the end of its range and no longer shines backwards. Thanks very much for this.

Setting to resolved.

Issue History

Date Modified Username Field Change
09.02.2021 12:29 Dragofer New Issue
09.02.2021 12:29 Dragofer File Added: test_proj.pk4
09.02.2021 12:29 Dragofer File Added: falloff.jpg
09.02.2021 12:29 Dragofer File Added: falloff_gradient04.jpg
09.02.2021 12:30 Dragofer Relationship added child of 0005528
09.02.2021 12:35 Dragofer Description Updated
09.02.2021 12:36 Dragofer Description Updated
09.02.2021 13:11 nbohr1more Note Added: 0013670
09.02.2021 14:59 Dragofer Note Added: 0013671
15.02.2021 09:09 Dragofer Note Added: 0013684
04.03.2021 23:15 Judith Note Added: 0013761
30.10.2021 09:19 Dragofer Note Added: 0014455
30.10.2021 09:19 Dragofer File Added: gradient1.jpg
30.10.2021 09:19 Dragofer File Added: gradient1_problem.jpg
30.10.2021 09:19 Dragofer File Added: gradient2.jpg
30.10.2021 09:19 Dragofer File Added: gradient2_problem.jpg
30.10.2021 09:21 Dragofer Note Edited: 0014455
30.10.2021 09:21 Dragofer Note Edited: 0014455
30.10.2021 09:21 Dragofer Note Edited: 0014455
30.10.2021 09:22 Dragofer Note Edited: 0014455
30.10.2021 15:17 duzenko Note Added: 0014457
01.11.2021 13:05 nbohr1more Assigned To => duzenko
01.11.2021 13:05 nbohr1more Status new => feedback
21.11.2021 06:40 stgatilov Relationship added related to 0005815
21.11.2021 06:41 stgatilov Note Added: 0014557
19.12.2021 05:18 duzenko Note Added: 0014599
19.12.2021 12:37 Dragofer Status feedback => resolved
19.12.2021 12:37 Dragofer Resolution open => fixed
19.12.2021 12:37 Dragofer Fixed in Version => TDM 2.10
19.12.2021 12:37 Dragofer Note Added: 0014600
04.01.2022 07:01 stgatilov Relationship added related to 0005860