Attn. spotlights do not illuminate wall decals
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.
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.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49073
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Attn. spotlights do not illuminate wall decals
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.
Re: Attn. spotlights do not illuminate wall decals
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.
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
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.dpJudas wrote:Nash, did you use Gutawer's flashlight mod to get that screenshot
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;
}
}
}
Moving or not doesn't blink the spotlight - it stays black permanently.
Re: Attn. spotlights do not illuminate wall decals
I've found the general source of the problem here. gl_SetDynSpriteLight does the following check:
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?
Code: Select all
if (light->visibletoplayer &&
!(light->flags2&MF2_DORMANT) &&
(!(light->lightflags&LF_DONTLIGHTSELF) || light->target != self) &&
!(light->lightflags&LF_DONTLIGHTACTORS))
What is the correct fix for this? add "|| self == nullptr" to the third check?
Re: Attn. spotlights do not illuminate wall decals
Decided to just add the !self check. This should be working now.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49073
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Attn. spotlights do not illuminate wall decals
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
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.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49073
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Attn. spotlights do not illuminate wall decals
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...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
It just was never changed because with point lights it never became a serious issue.
- 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
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.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49073
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Attn. spotlights do not illuminate wall decals
Don't expect any quick results here. Decal lighting should be done properly. Currently it just uses sprite lighting which is insufficient.
- 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
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.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49073
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Attn. spotlights do not illuminate wall decals
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
Can be closed because per pixel decal lighting was added!