Attn. spotlights do not illuminate wall decals

Is there something that doesn't work right in the latest GZDoom? Post about it here.

Moderator: Developers

Forum rules
Please construct and post a simple demo whenever possible for all bug reports. Please provide links to everything.

If you can include a wad demonstrating the problem, please do so. Bug reports that include fully-constructed demos have a much better chance of being investigated in a timely manner than those that don't.

Attn. spotlights do not illuminate wall decals

Postby Nash » Wed Feb 07, 2018 1:27 pm

Image

Thread title. Attenuated spotlights are not affecting decals.
User avatar
Nash
Nash Muhandes
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia

Re: Attn. spotlights do not illuminate wall decals

Postby Graf Zahl » Thu Feb 08, 2018 2:20 am

Decals are lit like sprites by dynamic lights. I think it'd be better to light them like walls - but that may make some older systems choke. Fortunately this should be doable by reusing the wall's light lists so it wouldn't put more drag on the CPU side where it'd really hurt.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Attn. spotlights do not illuminate wall decals

Postby dpJudas » Thu Feb 08, 2018 4:31 am

Nash, did you use Gutawer's flashlight mod to get that screenshot? Back when I did the initial spotlight support the decals blinked whenever you moved. Once stopped, there'd be 50% chance it showed the right light and 50% chance it would be black like on the screenshot.

At the time I concluded it was probably a general bug not directly caused by the spotlights as it was also happening when the flashlight was a normal point light. The sprite light calculate code does take spot lights into account and it worked just fine when I tested it on things in e1m1 - I'm not entirely sure what makes decals so different.
dpJudas
 
 
 
Joined: 28 May 2016

Re: Attn. spotlights do not illuminate wall decals

Postby Nash » Thu Feb 08, 2018 5:39 am

dpJudas wrote:Nash, did you use Gutawer's flashlight mod to get that screenshot


No, it's my own implementation. But I guess there's only so many ways you can attach a spotlight to a player so I guess you could say it's similar.

Code: Select allExpand view
class LADLightSource DynamicLight
{
    
// <snip>

    
override void BeginPlay(void)
    {
        
Super.BeginPlay();

        
// initialize dynamic light stuff
        
args[0] = def_r;
        
args[1] = def_g;
        
args[2] = def_b;
        
args[3] = def_intensity;
        
bAttenuate bool(def_atten);
        
bDontLightSelf bool(def_dontlightself);
        
bSpot bool(def_spot);
        if (
bSpot)
        {
            
SpotInnerAngle def_spotinnerangle;
            
SpotOuterAngle def_spotouterangle;
        }
    }
}
 


The light is then SetOrigin'd inside my player pawn's Tick().

Moving or not doesn't blink the spotlight - it stays black permanently.
User avatar
Nash
Nash Muhandes
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia

Re: Attn. spotlights do not illuminate wall decals

Postby dpJudas » Fri Feb 09, 2018 5:53 pm

I've found the general source of the problem here. gl_SetDynSpriteLight does the following check:

Code: Select allExpand view
if (light->visibletoplayer &&
    !(light->flags2&MF2_DORMANT) &&
    (!(light->lightflags&LF_DONTLIGHTSELF) || light->target != self) &&
    !(light->lightflags&LF_DONTLIGHTACTORS))

If any of those four conditions are false, then the light does not apply to the sprite/decal. The problem is that light->target is null, self is always null for decals and the DONTLIGHTSELF flag is set for this light. That makes the third clause always false.

What is the correct fix for this? add "|| self == nullptr" to the third check?
dpJudas
 
 
 
Joined: 28 May 2016

Re: Attn. spotlights do not illuminate wall decals

Postby dpJudas » Fri Feb 09, 2018 6:08 pm

Decided to just add the !self check. This should be working now.
dpJudas
 
 
 
Joined: 28 May 2016

Re: Attn. spotlights do not illuminate wall decals

Postby Graf Zahl » Fri Feb 09, 2018 6:22 pm

The proper fix here should be, as I already said, to change decal lighting to use the wall's light list. As long as that isn't done, that self check is indeed the correct thing to do.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Attn. spotlights do not illuminate wall decals

Postby dpJudas » Fri Feb 09, 2018 6:51 pm

I don't really disagree with you on that. It is just that I assume there was a reason you didn't make it use the light list in the first place - i.e. something needs to be fixed and/or adjusted for that to become a possibility. So I went for at least fixing the blackness bug.
dpJudas
 
 
 
Joined: 28 May 2016

Re: Attn. spotlights do not illuminate wall decals

Postby Graf Zahl » Sat Feb 10, 2018 4:51 am

dpJudas wrote:I don't really disagree with you on that. It is just that I assume there was a reason you didn't make it use the light list in the first place


Surely there is. When this code was written, there was no shader based lighting and using a light texture to illuminate sprites is not particularly well doable...
It just was never changed because with point lights it never became a serious issue.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Attn. spotlights do not illuminate wall decals

Postby Caligari87 » Wed Jun 13, 2018 7:59 am

bumping because I got a fresh report of this problem on DarkDoomZ, but I'm pretty sure it's not my mod.

Glaice wrote:I have noticed that with blood decals from custom gore mods don't always play nice, they sometimes show up as black and sometimes normally.

Screenshot example. GZDoom 3.4.0 64 bit used with a ATI Sapphire RX 480 8 GB video card under Windows 7 64 bit.


Image

8-)
User avatar
Caligari87
I'm just here for the community
 
 
 
Joined: 26 Feb 2004
Location: Salt Lake City, Utah, USA
Discord: Caligari87#3089

Re: Attn. spotlights do not illuminate wall decals

Postby Graf Zahl » Wed Jun 13, 2018 8:02 am

Don't expect any quick results here. Decal lighting should be done properly. Currently it just uses sprite lighting which is insufficient.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Attn. spotlights do not illuminate wall decals

Postby Glaice » Wed Jun 13, 2018 12:40 pm

In my situation, the blood isn't always black but sometimes flickers between normal and black when moving my perspective around, sometimes not at all.
User avatar
Glaice
Maps of Chaos/RDND/DVV Overseer
 
Joined: 13 Mar 2009
Location: North Babylon, NY
Discord: 8512

Re: Attn. spotlights do not illuminate wall decals

Postby Graf Zahl » Wed Jun 13, 2018 1:00 pm

Ok. But like I said, the decal lighting is rather crappy right now and needs some serious improvement, not just a hacky patch to make this case work.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany


Return to Bugs

Who is online

Users browsing this forum: No registered users and 0 guests