Skip to content

feat: vanilla fresnel - #243

Merged
alandtse merged 4 commits into
devfrom
feat/vanilla-fresnel-2332
Jul 5, 2026
Merged

feat: vanilla fresnel#243
alandtse merged 4 commits into
devfrom
feat/vanilla-fresnel-2332

Conversation

@alandtse

@alandtse alandtse commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Summary

Integrates upstream community-shaders#2332
(Vanilla Fresnel by @jiayev) ahead of its upstream merge, structured for
easy reconciliation at the next upstream sync.

New core feature: environmental reflections for vanilla and complex
materials, optional Phong-to-GGX specular conversion (incl. grass), and
optional dynamic-cubemap conversion of static cubemaps.

Commit structure (reconciliation plan)

  • feat: vanilla fresnel (upstream #2332): pure squash of the upstream
    PR head (506488a). The only local edits are trivial conflict
    resolutions in the feature registration lists against fork-only
    features (Feature.cpp include, FeatureBuffer.cpp pack order,
    Globals.cpp includes).
  • feat(vr): enable Vanilla Fresnel in VR: the sole fork deviation, a
    SupportsVR() = true override.

Deviation list for the future upstream sync

When upstream squash-merges community-shaders#2332 and it arrives via the next tag sync,
the content should mostly auto-resolve as identical. Fork deviations to
re-apply (in the sync's fix(sync) commit) if conflicted:

  1. SupportsVR() override in src/Features/VanillaFresnel.h (+ the
    fork comment above it).
  2. Registration-list orderings around fork-only features.

VR review

  • All new shader terms (GGX specular, EnvBRDF, F0/roughness derivation,
    grass path) derive from the per-eye viewDirection/context.viewDir;
    no screen-space or camera-global state, so no #if defined(VR) needed.
  • The IsEye bit rides the existing permutationData.ExtraShaderDescriptor
    path (same pattern as SubsurfaceScattering's IsBeastRace, VR-proven).
  • The C++ hook is a vtable write (write_vfunc<0x6> on
    VTABLE_BSLightingShader[0]) with no address-library dependency; six
    existing features hook the identical slot.
  • Interaction partners (DynamicCubemaps, GrassLighting) already support VR.

Notes

  • The always-on VANILLA_FRESNEL define invalidates the shader disk
    cache: users get a full cold recompile on first launch.
  • CORE marker file is present, so the AIO bundle includes its shaders.

Testing

🤖 Generated with Claude Code

https://claude.ai/code/session_0183vd8arYzymdQi94eqpctT

alandtse and others added 2 commits July 4, 2026 23:02
Squash of upstream PR community-shaders#2332
(jiayev, head 506488a) applied to origin/dev. Pure upstream content;
the only local edits are trivial conflict resolutions in the feature
registration lists (Feature.cpp include, FeatureBuffer.cpp pack order,
Globals.cpp includes) against fork-only features.

Adds the Vanilla Fresnel core feature: environmental reflections for
vanilla and complex materials, optional GGX specular conversion and
dynamic cubemap conversion. New always-on VANILLA_FRESNEL shader
define invalidates the shader disk cache (full cold recompile).

Co-Authored-By: Jiaye <l936249247@hotmail.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0183vd8arYzymdQi94eqpctT
Fork adaptation on top of the upstream community-shaders#2332 squash. All feature
shader terms derive from the per-eye viewDirection/context.viewDir,
the IsEye descriptor uses the existing permutationData path shared
with VR, and the SetupGeometry hook is a vtable write with no
address-library dependency, so no VR divergence is required beyond
the SupportsVR flag.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0183vd8arYzymdQi94eqpctT
Copilot AI review requested due to automatic review settings July 5, 2026 06:03
@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@alandtse, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 3 seconds

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 993ef410-9bb8-4cf3-9c84-34ec35483b8c

📥 Commits

Reviewing files that changed from the base of the PR and between d8cbfd5 and a66f708.

📒 Files selected for processing (17)
  • features/Grass Lighting/Shaders/Features/GrassLighting.ini
  • features/Grass Lighting/Shaders/GrassLighting/GrassLighting.hlsli
  • features/Vanilla Fresnel/CORE
  • features/Vanilla Fresnel/Shaders/Features/VanillaFresnel.ini
  • package/SKSE/Plugins/CommunityShaders/Translations/en.json
  • package/Shaders/Common/LightingEval.hlsli
  • package/Shaders/Common/Permutation.hlsli
  • package/Shaders/Common/SharedData.hlsli
  • package/Shaders/Lighting.hlsl
  • package/Shaders/RunGrass.hlsl
  • src/Feature.cpp
  • src/FeatureBuffer.cpp
  • src/Features/VanillaFresnel.cpp
  • src/Features/VanillaFresnel.h
  • src/Globals.cpp
  • src/Globals.h
  • src/State.h
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/vanilla-fresnel-2332

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

No actionable suggestions for changed features.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Integrates upstream “Vanilla Fresnel” to add environment-reflection/Fresnel behavior to vanilla + complex materials, with optional Phong→GGX specular conversion (including grass) and optional dynamic-cubemap conversion, plus a VR enablement override and required shader/permutation plumbing.

Changes:

  • Added a new core feature (VANILLA_FRESNEL) with settings, registration, and a lighting shader hook that tags eye materials via a new permutation bit.
  • Extended shared feature constant-buffer packing and shader SharedData to carry Vanilla Fresnel settings.
  • Updated lighting/grass shaders to support GGX specular paths, EnvBRDF-based reflectance, and eye-material special handling.

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/State.h Adds IsEye to extra shader descriptor flags for new eye-material permutation.
src/Globals.h Declares global vanillaFresnel feature instance.
src/Globals.cpp Defines/initializes global vanillaFresnel feature instance and includes header.
src/Features/VanillaFresnel.h Introduces the new core feature interface + settings struct.
src/Features/VanillaFresnel.cpp Implements settings serialization, UI, and a BSLightingShader vfunc hook to set IsEye.
src/FeatureBuffer.cpp Adds Vanilla Fresnel settings to packed feature constant buffer (b6).
src/Feature.cpp Registers Vanilla Fresnel in the feature list.
package/Shaders/RunGrass.hlsl Updates grass deferred outputs and lighting/specular paths to support Fresnel/GGX options.
package/Shaders/Lighting.hlsl Adds Fresnel-derived F0/roughness logic, eye handling, and cubemap conversion behavior in lighting.
package/Shaders/Common/SharedData.hlsli Adds VanillaFresnelSettings to the shared feature cbuffer layout.
package/Shaders/Common/Permutation.hlsli Adds IsEye bit to match C++ permutation descriptors.
package/Shaders/Common/LightingEval.hlsli Adds microfacet (GGX) specular evaluation path gated by Vanilla Fresnel settings.
features/Vanilla Fresnel/Shaders/Features/VanillaFresnel.ini Adds the feature shader INI metadata/version.
features/Vanilla Fresnel/CORE Marks feature as CORE so AIO bundles include its shaders.
features/Grass Lighting/Shaders/GrassLighting/GrassLighting.hlsli Extends grass specular helper to optionally use GGX/Fresnel inputs.
features/Grass Lighting/Shaders/Features/GrassLighting.ini Bumps Grass Lighting shader feature version to reflect shader changes.

Comment thread features/Grass Lighting/Shaders/GrassLighting/GrassLighting.hlsli
Comment thread src/Features/VanillaFresnel.cpp
Comment thread src/Features/VanillaFresnel.cpp
Comment thread src/Features/VanillaFresnel.h
Comment thread src/Features/VanillaFresnel.h Outdated
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

✅ A pre-release build is available for this PR:
Download

alandtse and others added 2 commits July 5, 2026 11:08
Copilot review on #243: the upstream squash's new feature file
hardcoded English UI strings and a raw category literal instead of
this fork's T()/FeatureCategories conventions (upstream has no i18n
system, so it never could have used them), and the packed Settings
struct lacked the STATIC_ASSERT_ALIGNAS_16 check every other
b6-buffer feature carries. Fixed to match the exact pattern in
ExtendedMaterials/DynamicCubemaps.

Two other Copilot findings were checked and NOT changed:

- GrassLighting.hlsli's Vis_SmithJointApprox(roughness, NdotL, NdotV)
  looks argument-swapped against the function's (roughness, NdotV,
  NdotL) signature, but the approximation's Vis_SmithV+Vis_SmithL sum
  is symmetric in the two angles by construction; verified numerically
  that output is bit-identical either order. No bug.
- DrawSettings() force-disables EnableDynamicCubemapsConversion when
  EnableGGX is off. This looked like an artificial UI restriction
  (the shader's indirect-specular path consumes the cubemap-derived
  F0/Roughness independent of EnableGGX), but jiayev's upstream
  history has a standalone commit titled "forbid cubemap conversion
  when not ggx" (498fa7d) deliberately adding this exact coupling.
  Confirmed intentional; left as upstream authored it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WFzp29R2ZAM2Xa93jk8TG7
CI check "Verify en.json is in sync with source" failed after the
fork-standards commit added T() calls to VanillaFresnel.h/.cpp; en.json
is generated (tools/extract-i18n.py --write) and must never be
hand-edited. Regenerated, adding only the 17 new
feature.vanilla_fresnel.* keys.
@alandtse alandtse changed the title feat: vanilla fresnel (upstream #2332) feat: vanilla fresnel Jul 5, 2026
@alandtse
alandtse merged commit 8e7ce4a into dev Jul 5, 2026
24 checks passed
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