Search Issue Tracker

Fixed

Fixed in 2021.3.23f1, 2022.2.14f1, 2023.1.0b6, 2023.2.0a4

Votes

0

Found in

2021.3.6f1

2022.1.7f1

2022.2.0a17

2023.1.0a2

2023.2.0a1

Issue ID

UUM-7994

Regression

No

Blitting from RenderTexture.active to another RenderTexture with a shader sampling a texture at specific UV values causes visual artifacts

--

-

How to reproduce:
# Open the user-attached project (BlitBug.zip)
# In the “Project” panel open and edit the “TestShader” file
# Modify line 49 by changing {{float2(dx, 0)}} to {{float2(-dx, 0)}}
# In the Editor enter Play Mode
# Switch to the Scene view and observer the “Render Texture Preview“ Game Object

Expected result: the Game Object’s texture is a single solid color

Actual result: the Game Object’s texture has three dark lines going vertically and one diagonal line (when using Vulkan API there are flickering dark squares too)

Reproducible with: 2021.3.6f1, 2022.1.7f1, 2022.2.0a17, 2023.1.0a2

Could not test with: 2020.3.36f1 (due to shader compilation errors)

Reproducible on: Ubuntu 20.04 and Windows 10

Note: The issue is present on both OpenGLCore and Vulkan graphics APIs

Screenshot of the lines visible when using the OpenGLCore API:

!DemoScreenshot.png!

 
h2. Note after investigation:

 

This is an undefined behaviour to set source and destination texture to the same one according to the [documentation|https://docs.unity3d.com/ScriptReference/Graphics.Blit.html].

 

In the user's C# script:
{code:java}
_material.SetTexture(Shader.PropertyToID("_BaseMap"), RenderTexture.active);
Graphics.Blit(RenderTexture.active, camera.targetTexture, _material); {code}
_RenderTexture.active_ and _camera.targetTexture_ are actually the same texture. It's also used in the blit material as a shader property.

  1. Resolution Note (fix version 2021.3.23f1):

    Before the fix, no console message was provided about graphics glitching. After the fix, the console window presents a new warning for the user

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.