[Closed] Issue with model lighting

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Issue with model lighting

Postby _mental_ » Fri May 25, 2018 3:34 am

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.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: Issue with model lighting

Postby Graf Zahl » Fri May 25, 2018 3:48 am

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

Re: Issue with model lighting

Postby dpJudas » Fri May 25, 2018 5:50 am

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.
dpJudas
 
 
 
Joined: 28 May 2016

Re: Issue with model lighting

Postby Graf Zahl » Fri May 25, 2018 5:59 am

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

Re: Issue with model lighting

Postby dpJudas » Fri May 25, 2018 8:00 am

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.
dpJudas
 
 
 
Joined: 28 May 2016

Re: Issue with model lighting

Postby Graf Zahl » Fri May 25, 2018 8:08 am

No, they are not. But I don't see how passing more info would help with the precision of position determination
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Issue with model lighting

Postby dpJudas » Fri May 25, 2018 11:25 am

Okay, forced the model light to always be attenuated.
dpJudas
 
 
 
Joined: 28 May 2016

Re: Issue with model lighting

Postby _mental_ » Sat May 26, 2018 1:51 am

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.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: Issue with model lighting

Postby Marisa Kirisame » Sat May 26, 2018 4:35 am

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
Marisa Kirisame
ZScript Crimester
 
 
 
Joined: 08 Feb 2008
Location: Vigo, Galicia
Discord: 霧雨魔理沙#1666
Twitch ID: MarisaDOOM
Github ID: OrdinaryMagician
Operating System: Other Linux 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Issue with model lighting

Postby Graf Zahl » Sat Jun 02, 2018 12:57 am

So is this ok now?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Issue with model lighting

Postby _mental_ » Sat Jun 02, 2018 1:36 am

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.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: Issue with model lighting

Postby Graf Zahl » Sat Jun 02, 2018 1:59 am

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

Re: Issue with model lighting

Postby dpJudas » Sat Jun 02, 2018 3:03 am

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.
dpJudas
 
 
 
Joined: 28 May 2016


Return to Closed Bugs

Who is online

Users browsing this forum: No registered users and 0 guests