Issue with model lighting

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.
_mental_
 
 
Posts: 3784
Joined: Sun Aug 07, 2011 4:32 am

Issue with model lighting

Post by _mental_ »

Lighting of player's weapon model is a bit weird after indexbuffer merge. Here is the example at spawn point of Gene Tech.
Screenshot_Doom_20180525_120817.jpg
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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 48337
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Issue with model lighting

Post by Graf Zahl »

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

Re: Issue with model lighting

Post by dpJudas »

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

Re: Issue with model lighting

Post by Graf Zahl »

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

Re: Issue with model lighting

Post by dpJudas »

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

Re: Issue with model lighting

Post by Graf Zahl »

No, they are not. But I don't see how passing more info would help with the precision of position determination
dpJudas
 
 
Posts: 2890
Joined: Sat May 28, 2016 1:01 pm

Re: Issue with model lighting

Post by dpJudas »

Okay, forced the model light to always be attenuated.
_mental_
 
 
Posts: 3784
Joined: Sun Aug 07, 2011 4:32 am

Re: Issue with model lighting

Post by _mental_ »

It still doesn't look as good as before :(
weapon_model_comparison.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
Marisa the Magician
 
 
Posts: 3844
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia

Re: Issue with model lighting

Post by Marisa the Magician »

That may just be because of incorrect normals on the MD3. The model light fix did definitely have a noticeable effect on UE1 models.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 48337
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Issue with model lighting

Post by Graf Zahl »

So is this ok now?
_mental_
 
 
Posts: 3784
Joined: Sun Aug 07, 2011 4:32 am

Re: Issue with model lighting

Post by _mental_ »

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

Re: Issue with model lighting

Post by Graf Zahl »

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

Re: Issue with model lighting

Post by dpJudas »

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.

Return to “Closed Bugs [GZDoom]”