Attn. spotlights do not illuminate wall decals

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
Nash
 
 
Posts: 17434
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Attn. spotlights do not illuminate wall decals

Post by Nash »

Image

Thread title. Attenuated spotlights are not affecting decals.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Attn. spotlights do not illuminate wall decals

Post by Graf Zahl »

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.
dpJudas
 
 
Posts: 3037
Joined: Sat May 28, 2016 1:01 pm

Re: Attn. spotlights do not illuminate wall decals

Post by dpJudas »

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.
User avatar
Nash
 
 
Posts: 17434
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Attn. spotlights do not illuminate wall decals

Post by Nash »

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 all

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.
dpJudas
 
 
Posts: 3037
Joined: Sat May 28, 2016 1:01 pm

Re: Attn. spotlights do not illuminate wall decals

Post by dpJudas »

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

Code: Select all

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
 
 
Posts: 3037
Joined: Sat May 28, 2016 1:01 pm

Re: Attn. spotlights do not illuminate wall decals

Post by dpJudas »

Decided to just add the !self check. This should be working now.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Attn. spotlights do not illuminate wall decals

Post by Graf Zahl »

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.
dpJudas
 
 
Posts: 3037
Joined: Sat May 28, 2016 1:01 pm

Re: Attn. spotlights do not illuminate wall decals

Post by dpJudas »

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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Attn. spotlights do not illuminate wall decals

Post by Graf Zahl »

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
Caligari87
Admin
Posts: 6174
Joined: Thu Feb 26, 2004 3:02 pm
Preferred Pronouns: He/Him
Contact:

Re: Attn. spotlights do not illuminate wall decals

Post by Caligari87 »

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
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Attn. spotlights do not illuminate wall decals

Post by Graf Zahl »

Don't expect any quick results here. Decal lighting should be done properly. Currently it just uses sprite lighting which is insufficient.
User avatar
Armaetus
Posts: 1255
Joined: Fri Mar 13, 2009 3:55 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10 Home
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Location: New York State
Contact:

Re: Attn. spotlights do not illuminate wall decals

Post by Armaetus »

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
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Attn. spotlights do not illuminate wall decals

Post by Graf Zahl »

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
Nash
 
 
Posts: 17434
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Attn. spotlights do not illuminate wall decals

Post by Nash »

Can be closed because per pixel decal lighting was added!
Post Reply

Return to “Closed Bugs [GZDoom]”