Skip to content

]Fixed CustomPassUtils scaling issues when used with RTHandles allocated from a RenderTexture. #4140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 21, 2021
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
3 changes: 3 additions & 0 deletions com.unity.render-pipelines.core/Runtime/Textures/RTHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ public void Release()
/// <returns>Input size scaled by the RTHandle scale factor.</returns>
public Vector2Int GetScaledSize(Vector2Int refSize)
{
if (!useScaling)
return refSize;

if (scaleFunc != null)
{
return scaleFunc(refSize);
Expand Down
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 @@ -154,6 +154,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed GBuffer clear option in FrameSettings not working
- Fixed usage of Panini Projection with floating point HDRP and Post Processing color buffers.
- Fixed a NaN generating in Area light code.
- Fixed CustomPassUtils scaling issues when used with RTHandles allocated from a RenderTexture.

### 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 @@ -569,7 +569,11 @@ internal static void SetRenderTargetWithScaleBias(in CustomPassContext ctx, Mate
{
// viewport with RT handle scale and scale factor:
Rect viewport = new Rect();
Vector2 destSize = viewport.size = destination.GetScaledSize(destination.rtHandleProperties.currentViewportSize);
if (destination.useScaling)
viewport.size = destination.GetScaledSize(destination.rtHandleProperties.currentViewportSize);
else
viewport.size = new Vector2Int(destination.rt.width, destination.rt.height);
Vector2 destSize = viewport.size;
viewport.position = new Vector2(viewport.size.x * destScaleBias.z, viewport.size.y * destScaleBias.w);
viewport.size *= new Vector2(destScaleBias.x, destScaleBias.y);

Expand Down