Issue with model lighting
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.
-
-
- Posts: 3808
- Joined: Sun Aug 07, 2011 4:32 am
Issue with model lighting
Lighting of player's weapon model is a bit weird after indexbuffer merge. Here is the example at spawn point of Gene Tech.
It appeared to be caused by this line. Removing it is mostly equivalent to using the old version of this shader.
The screenshot is from Windows PC with NVIDIA hardware using OpenGL 4.6 but the problem affects all render paths involving shaders.
It appeared to be caused by this line. Removing it is mostly equivalent to using the old version of this shader.
The screenshot is from Windows PC with NVIDIA hardware using OpenGL 4.6 but the problem affects all render paths involving shaders.
You do not have the required permissions to view the files attached to this post.
-
- Lead GZDoom+Raze Developer
- Posts: 48879
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Issue with model lighting
That line didn't work out as intended. It was supposed to cull backface lighting. But for models that obviously does not work that well.
I cannot check right now, but the way I see it, for models all lights need to act as if they were attenuated, even if not set like that. Otherwise it just won't look that great. Better let's wait for dpJudas to respond.
I cannot check right now, but the way I see it, for models all lights need to act as if they were attenuated, even if not set like that. Otherwise it just won't look that great. Better let's wait for dpJudas to respond.
-
-
- Posts: 2987
- Joined: Sat May 28, 2016 1:01 pm
Re: Issue with model lighting
I suspect the problem is broken normals in the Gene Tech models. I'll try confirm that when I get home. If it is broken normals, then we need some code detecting that during md3 loading and then generate some plain face normals.
I agree that always attenuated will look much better, but I wonder if it will look bad on old maps that used gigantic dynamic lights. For Gene Tech, that mod could really need a patch that converted all its lights to attenuated - it would look much better that way.
I agree that always attenuated will look much better, but I wonder if it will look bad on old maps that used gigantic dynamic lights. For Gene Tech, that mod could really need a patch that converted all its lights to attenuated - it would look much better that way.
-
- Lead GZDoom+Raze Developer
- Posts: 48879
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Issue with model lighting
I mean "always attenuated" on models only, because their look depends on the shadows this creates. For map lighting it was already nixed for obvious reasons and I won't change anything about that.
I don't really think that the model normals are broken here - the effect looks like with my backside check there's a hard edge between pixels facing the light and pixels facing away from the light.
Simply put, that check does not work.
I only added it because it would be needed to use sector light lists to handle two-sided intra-sector walls because for those some sort of backside culling is needed if we want to create combined draw lists. On the other hand: Frozen Time is pretty much the only map out there which would benefit from that because this type of bridge architecture has fallen out of favor these days.
I don't really think that the model normals are broken here - the effect looks like with my backside check there's a hard edge between pixels facing the light and pixels facing away from the light.
Simply put, that check does not work.
I only added it because it would be needed to use sector light lists to handle two-sided intra-sector walls because for those some sort of backside culling is needed if we want to create combined draw lists. On the other hand: Frozen Time is pretty much the only map out there which would benefit from that because this type of bridge architecture has fallen out of favor these days.
-
-
- Posts: 2987
- Joined: Sat May 28, 2016 1:01 pm
Re: Issue with model lighting
We currently have two unused floats per light (lightspot2.z and lightspot2.w) if it helps to add some more information to the lights for when to do this extra check. I think the light lights for models are currently not shared with anything else.
-
- Lead GZDoom+Raze Developer
- Posts: 48879
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Issue with model lighting
No, they are not. But I don't see how passing more info would help with the precision of position determination
-
-
- Posts: 2987
- Joined: Sat May 28, 2016 1:01 pm
Re: Issue with model lighting
Okay, forced the model light to always be attenuated.
-
-
- Posts: 3808
- Joined: Sun Aug 07, 2011 4:32 am
Re: Issue with model lighting
It still doesn't look as good as before 

You do not have the required permissions to view the files attached to this post.
-
- Posts: 3886
- Joined: Fri Feb 08, 2008 9:15 am
- Preferred Pronouns: She/Her
- Operating System Version (Optional): (btw I use) Arch
- Graphics Processor: nVidia with Vulkan support
- Location: Vigo, Galicia
-
- Lead GZDoom+Raze Developer
- Posts: 48879
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Issue with model lighting
So is this ok now?
-
-
- Posts: 3808
- Joined: Sun Aug 07, 2011 4:32 am
Re: Issue with model lighting
Now it's better than in OP but still it's worse than before all related changes.
See picture from my previous post. Model lighting is still the same as in the right part of the image.
See picture from my previous post. Model lighting is still the same as in the right part of the image.
-
- Lead GZDoom+Raze Developer
- Posts: 48879
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Issue with model lighting
Having model lighting unattenuated is not a working solution.
If these models' normals are broken they need to be fixed somehow, but that cannot mean it's fine to amputate the lighting.
If these models' normals are broken they need to be fixed somehow, but that cannot mean it's fine to amputate the lighting.
-
-
- Posts: 2987
- Joined: Sat May 28, 2016 1:01 pm
Re: Issue with model lighting
I analyzed the normals of Gene Tech the other day and they are well-formed, but it might be that they are all effectively face normals. The normals on Marisa's redeemer are smoothed. Unsmoothed normals could match _mental_'s screenshot.