feat: vanilla fresnel - #2332
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a VanillaFresnel feature with runtime settings and UI, exposes settings to shaders, implements GGX microfacet specular helpers and a VANILLA_FRESNEL lighting path, updates material/env handling in Lighting.hlsl, and switches grass rendering to use roughness and F0 for specular/reflectance. ChangesVanilla Fresnel Feature
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/Features/VanillaFresnel.cpp (1)
66-74: ⚡ Quick winHonor the runtime toggles before setting the eye permutation bit.
UpdateEyePermutation()always does the eye-pass detection work, so the new eye-specific permutation split stays active even when Vanilla Fresnel or eye special handling is turned off. Please clear the bit and return early unless the feature is enabled throughglobals::features. As per coding guidelines, "Flag potential performance impacts on rendering performance when implementing graphics features and suggest user toggles for feature control" and "Access core systems and feature registry through globals::features and globals::d3d namespaces defined in src/Globals.h".🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/Features/VanillaFresnel.cpp` around lines 66 - 74, Update UpdateEyePermutation so it first checks the runtime feature toggle(s) in globals::features (e.g., the Vanilla Fresnel / eye-special-handling flags) and, if the feature is disabled, clear the IsEyeDescriptor bit on globals::state->permutationData.ExtraShaderDescriptor and return early; only call IsEyePass and set the IsEyeDescriptor bit when the feature toggle is enabled. This change touches UpdateEyePermutation, IsEyePass, IsEyeDescriptor and globals::state->permutationData.ExtraShaderDescriptor and should ensure the eye permutation split is only active when globals::features indicates it.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/Features/VanillaFresnel.cpp`:
- Around line 66-74: Update UpdateEyePermutation so it first checks the runtime
feature toggle(s) in globals::features (e.g., the Vanilla Fresnel /
eye-special-handling flags) and, if the feature is disabled, clear the
IsEyeDescriptor bit on globals::state->permutationData.ExtraShaderDescriptor and
return early; only call IsEyePass and set the IsEyeDescriptor bit when the
feature toggle is enabled. This change touches UpdateEyePermutation, IsEyePass,
IsEyeDescriptor and globals::state->permutationData.ExtraShaderDescriptor and
should ensure the eye permutation split is only active when globals::features
indicates it.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: b242c771-4297-4a35-850c-ced402f99412
📒 Files selected for processing (13)
features/Grass Lighting/Shaders/Features/GrassLighting.inipackage/Shaders/Common/LightingEval.hlslipackage/Shaders/Common/Permutation.hlslipackage/Shaders/Common/SharedData.hlslipackage/Shaders/Lighting.hlslpackage/Shaders/RunGrass.hlslsrc/Feature.cppsrc/FeatureBuffer.cppsrc/Features/VanillaFresnel.cppsrc/Features/VanillaFresnel.hsrc/Globals.cppsrc/Globals.hsrc/State.h
✅ Files skipped from review due to trivial changes (3)
- package/Shaders/Common/Permutation.hlsli
- features/Grass Lighting/Shaders/Features/GrassLighting.ini
- src/Globals.h
🚧 Files skipped from review as they are similar to previous changes (7)
- src/FeatureBuffer.cpp
- package/Shaders/Common/LightingEval.hlsli
- package/Shaders/RunGrass.hlsl
- src/Feature.cpp
- package/Shaders/Common/SharedData.hlsli
- src/Globals.cpp
- package/Shaders/Lighting.hlsl
|
do not merge yet |
This pull request introduces a new "Vanilla Fresnel" feature, providing advanced Fresnel and GGX-based physically-based rendering (PBR) specular reflection options, with extensive configurability and integration throughout the shader pipeline. The changes add new settings, update data structures, and modify lighting calculations in both general and grass-specific shaders to support these features. Additionally, the feature is integrated into the engine's feature management and configuration systems.
Major new feature: Vanilla Fresnel
VanillaFresnelfeature with configurable settings (GGX specular, dynamic cubemap conversion, eye handling, etc.), UI controls, and serialization support (src/Features/VanillaFresnel.cpp,features/Vanilla Fresnel/Shaders/Features/VanillaFresnel.ini). [1] [2]Shader pipeline and lighting model updates
SharedData::VanillaFresnelSettings), and updated the buffer to include these settings (package/Shaders/Common/SharedData.hlsli,src/FeatureBuffer.cpp). [1] [2] [3]package/Shaders/Lighting.hlsl,package/Shaders/Common/LightingEval.hlsli). [1] [2] [3] [4] [5] [6] [7]package/Shaders/Common/LightingEval.hlsli).Grass lighting improvements
features/Grass Lighting/Shaders/GrassLighting/GrassLighting.hlsli,package/Shaders/RunGrass.hlsl). [1] [2] [3] [4] [5] [6]Engine integration
src/Feature.cpp,src/FeatureBuffer.cpp). [1] [2] [3]These changes collectively enable a more physically-accurate and configurable specular reflection model, improving visual fidelity and user control over rendering behavior.
Summary by CodeRabbit
New Features
Bug Fixes / Behavior