Black Mesa

Black Mesa

231 ratings
Newlight Directionality Fix
2
2
2
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
2.954 MB
13 Feb @ 6:56pm
1 Change Note ( view )

Subscribe to download
Newlight Directionality Fix

Description
Update: Soon this mod will be rendered obsolete by an upcoming patch as the half-lambert calculations will have been fixed. However, many materials will still benefit from this parameter, and other now fixed parameters. Stay tuned for an upcoming sequel post patch.

Update 3: This patch is now released


This mod edits EVERY model material in the game! If you have other mods, there will be conflicts if it edits any default materials!


This mod adds a hidden unused parameter to every models material that can in some cases extensively improves dynamic lighting and shadows on models that use phong shading without any additional performance costs. Without this newly added parameter, newlights will shine on a phong shaded model from BOTH directions of a newlight, creating unexpected and ugly results! You will mainly see differences in Xen, especially in areas with lots of models, and where newlights have shadows disabled.

Technical Explanation
Sources standard model lighting comes with a hacky way of boosting ambient lighting on characters and props. This is called half-lambertian lighting. The light is wrapped around the edges of a model which gives the lighting a softer appearance, prevents overly harsh shadows from normal maps. This was implemented as an easy and performant way to improve the appearance of lighting, at a cost of realism.
Consequentially, newlights also had half-lambertian lighting implemented. However, it is currently left in a broken state. The result is that meshes with $phong or $halflambert get lit from ALL sides perpendicular to newlights, including ones with opposing normals. Shadows help to mask this bug, but it still appears glaringly incorrect.
As it turns out however, the aforementioned command existed, which disables halflambert for newlights, but not regular lights!

A small album showcasing the issue with comparison to Blenders realtime renderer https://imgur.com/a/5iy2Nhf

Limitations and Caveats
  • As explained, this will only affect models that use $halflambert, which mostly means things with specularity/phong.
  • Some areas may not quite be lit the same as they may have depended on the bug. Notably areas entirely lit by newlights may seemingly lack ambient lighting and have overly dark shadows.
  • Xen plant lights for instance have shadows on the bulbs as they did not use illumtextures.
  • I used an automated process to mass add the parameter, as such some materials will actually be more desirable with the effect off, notably plants, and anything that uses nocull.

For Modders
To implement this fix in your own mods, add this parameter anywhere within your models VMTs. You only need to add this if you are using $phong or $halflambert. This parameter does not need to be added to lightmappedgeneric or similar as it doesn't use either. If you are a mapper, be sure to supplement your newlights with regular lights for better ambient lighting.
"$halflambert_gbuffer_off" "1"

Mod folder is Steam\steamapps\workshop\content\362890



This commands existence was brought to my attention by Rimas and this fix will be included in the chapter 5 release of Black Mesa: Blue Shift!
36 Comments
Jofoyo  [author] 17 May @ 11:00pm 
No idea. Only if BMCE replaces default materials. In any case it's alright to skip this mod atm until I can make a bigger update since the biggest problem was fixed by the Necro Patch.
tuesday 17 May @ 10:54pm 
does this conflict with BMCE?
Mort_Brain 19 Apr @ 9:04am 
@Jofoyo Thank you very much for response! Now I see it's really a matter of art direction.
Jofoyo  [author] 18 Apr @ 11:21am 
In anycase, "directionality" is restored regardless of if you use this mod or not. Just this mod introduces hard shading on everything, whereas default everything will be softly shaded. Technically this mod makes things more "realistic" but. Neither option is ideal.
Jofoyo  [author] 18 Apr @ 11:18am 
I'm aware. The patch fixes the halflambert problem but really it's a matter of art direction now. Lambert doesn't look good on everything but does look good on somethings. I may make a new mod eventually but idk, it's a bigger undertaking now.
Mort_Brain 18 Apr @ 8:37am 
@Jofoyo Well you see, Black Mesa was update as of 16th April, and patch notes say that it fixes isses with 'new lighting' as well as your mod does, but it's not so precisely in technical spects as you do, so I am wonering if devs fixed everything themselves or it's in the same state as when you wrote your last comment? Thanks in advance and big thank you for you work to the community, I appreciate time and effort you put into this free addon.
LordAinzalot 17 Apr @ 8:13pm 
hey! loving this one since it came out. can it be, it causes issues with new update? legs blood of headcrabs on zombies looks white now
Jofoyo  [author] 16 Apr @ 7:18pm 
Read my last comment below. Same applies.
Mort_Brain 16 Apr @ 7:14pm 
So does these days update make this addon absolutely obsolete afteral?
smilokmusic 29 Mar @ 11:49am 
Great ! How do you know it is installed/enabled ? (I subscribed)
And is unsubscribe deactivating it ?