fix: terrain variation broken parallax shadows & incorrect mipmapping.#1124
Conversation
WalkthroughThe update alters the fallback texture sampling method in the terrain variation shader. Specifically, it changes the sampling from Changes
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
🔇 Additional comments (2)
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Pull Request Overview
Hotfix for terrain variation parallax shadows and correct texture sampling when the tiling fix is disabled.
- Re-enables parallax shadow calculations under the EMAT pipeline with the appropriate shadow and parallax flags.
- Switches to
SampleGradfor stochastic terrain variation sampling when tiling fix is turned off.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| package/Shaders/Lighting.hlsl | Added an #if defined(EMAT) block to restore parallax shadow calculations for various material modes. |
| features/Terrain Variation/Shaders/TerrainVariation/TerrainVariation.hlsli | Changed fallback sampling from SampleLevel to SampleGrad when tiling fix is disabled. |
Comments suppressed due to low confidence (2)
features/Terrain Variation/Shaders/TerrainVariation/TerrainVariation.hlsli:70
- The variables
dxanddyare not declared or passed intoStochasticEffect. Add them to the function signature or compute derivatives inside before callingSampleGrad.
return tex.SampleGrad(samp, uv, dx, dy);
package/Shaders/Lighting.hlsl:2541
- The variable
mipLevelsis likely incorrect here—other calls usemipLevel(singular). This mismatch can cause unintended behavior or compilation errors.
parallaxShadow = ExtendedMaterials::GetParallaxSoftShadowMultiplierTerrain(input, uv, mipLevels, lightDirectionTS, sh0, parallaxShadowQuality, screenNoise, displacementParams, sharedOffset, dx, dy, viewDistance);
Hotfix for two issues introduced by original terrain variation merge.
These will carry through to the rewrite, but are important to get in so other dev builds don't have these issues.
No failed shaders, fixed shadow issues in interiors for parallax shadows.
Summary by CodeRabbit