Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed issue with history buffers when using multiple AOVs (case 1323684).
- Fixed camera preview with multi selection (case 1324126).
- Fixed a NaN generating in Area light code.
- Fix potential NaN on apply distortion pass.

### Changed
- Changed Window/Render Pipeline/HD Render Pipeline Wizard to Window/Rendering/HDRP Wizard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,15 @@ Shader "Hidden/HDRP/ApplyDistortion"
float mip = (_ColorPyramidLodCount - 1) * saturate(distortionBlur) * _RoughDistortion;

uint mipCeiled = ceil(mip);
float texelsToClamp = (1u << mipCeiled);

float2 uv = ClampAndScaleUV(distordedUV, _Size.zw, texelsToClamp);
int2 mipSize = int2(_Size.xy) >> mipCeiled;
// Clamp to the max size that is safe on the lowest mip. Note we recompute the full size this way to account for the
// rounding that can happen to sizes (and that _RTHandleScale won't represent correctly as we descend the mip chain)
float2 maxCoord = (mipSize << mipCeiled) * _Size.zw;
// Take of the half pixel for bilinear
maxCoord -= 0.5 * rcp(mipSize);

float2 uv = min(distordedUV, maxCoord) * _RTHandleScale.xy;
float4 sampled = SAMPLE_TEXTURE2D_X_LOD(_ColorPyramidTexture, s_trilinear_clamp_sampler, uv, mip);
return sampled;
}
Expand Down