Attn. spotlights do not illuminate wall decals

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 a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Attn. spotlights do not illuminate wall decals

Re: Attn. spotlights do not illuminate wall decals

by Nash » Sat Jun 06, 2020 10:25 am

Can be closed because per pixel decal lighting was added!

Re: Attn. spotlights do not illuminate wall decals

by Graf Zahl » Wed Jun 13, 2018 12: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.

Re: Attn. spotlights do not illuminate wall decals

by Armaetus » Wed Jun 13, 2018 11:40 am

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.

Re: Attn. spotlights do not illuminate wall decals

by Graf Zahl » Wed Jun 13, 2018 7:02 am

Don't expect any quick results here. Decal lighting should be done properly. Currently it just uses sprite lighting which is insufficient.

Re: Attn. spotlights do not illuminate wall decals

by Caligari87 » Wed Jun 13, 2018 6: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-)

Re: Attn. spotlights do not illuminate wall decals

by Graf Zahl » Sat Feb 10, 2018 3: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.

Re: Attn. spotlights do not illuminate wall decals

by dpJudas » Fri Feb 09, 2018 5: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.

Re: Attn. spotlights do not illuminate wall decals

by Graf Zahl » Fri Feb 09, 2018 5: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.

Re: Attn. spotlights do not illuminate wall decals

by dpJudas » Fri Feb 09, 2018 5:08 pm

Decided to just add the !self check. This should be working now.

Re: Attn. spotlights do not illuminate wall decals

by dpJudas » Fri Feb 09, 2018 4:53 pm

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?

Re: Attn. spotlights do not illuminate wall decals

by Nash » Thu Feb 08, 2018 4: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 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.

Re: Attn. spotlights do not illuminate wall decals

by dpJudas » Thu Feb 08, 2018 3: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.

Re: Attn. spotlights do not illuminate wall decals

by Graf Zahl » Thu Feb 08, 2018 1: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.

Attn. spotlights do not illuminate wall decals

by Nash » Wed Feb 07, 2018 12:27 pm

Image

Thread title. Attenuated spotlights are not affecting decals.

Top