Skip to content

Add configurable N-L blending for dynamic lights#312

Merged
GooberRF merged 4 commits into
masterfrom
ndotl
Mar 26, 2026
Merged

Add configurable N-L blending for dynamic lights#312
GooberRF merged 4 commits into
masterfrom
ndotl

Conversation

@GooberRF

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new D3D11-only configuration knob to blend whether dynamic lights on lightmapped surfaces use Lambertian N·L (dot(normal, lightDir)) vs. “stock” distance-only attenuation, wiring the value from console/config → D3D11 constant buffer → pixel shader.

Changes:

  • Added dynamic_light_ndotl to the D3D11 render-mode constant buffer and populated it from g_alpine_game_config.
  • Implemented r_dynamiclightndotl console command plus config load/save (DynamicLightNdotL).
  • Updated standard_ps.hlsl to lerp between no-N·L (1.0) and full N·L for the non-dynamic-lit/lightmap path.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
resources/shaders/standard_ps.hlsl Uses new constant-buffer value to blend N·L contribution for dynamic lights on the lightmap/non-dynamic-lit path.
game_patch/object/obj_light.cpp Registers new r_dynamiclightndotl console command to edit/print the setting.
game_patch/misc/alpine_settings.h Adds dynamic_light_ndotl setting with clamped setter.
game_patch/misc/alpine_settings.cpp Persists the setting via DynamicLightNdotL load/save.
game_patch/graphics/d3d11/gr_d3d11_context.{h,cpp} Extends RenderModeBuffer tracking + CPU-side constant-buffer struct, and uploads the new value.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread resources/shaders/standard_ps.hlsl Outdated
Comment thread game_patch/object/obj_light.cpp
Comment thread game_patch/misc/alpine_settings.h
GooberRF and others added 2 commits March 26, 2026 19:06
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@GooberRF GooberRF marked this pull request as ready for review March 26, 2026 21:39
@GooberRF GooberRF merged commit 6aefa30 into master Mar 26, 2026
4 checks passed
@GooberRF GooberRF deleted the ndotl branch March 26, 2026 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants