Search Issue Tracker
By Design
By Design in 2023.1.X
Votes
0
Found in
2022.3.11f1
2023.1.16f1
Issue ID
UUM-53197
Regression
Yes
Script causes Console error "Reading pixels out of bounds of the current active render texture" when entering the Play mode on a HDRP project
Reproduction steps:
1. Open the attached "PROJECTFILE" project
2. Open the "Assets/OutdoorsScene.unity" scene
3. Enter the Play mode
Expected result: No errors in the Console
Actual result: Console error “Reading pixels out of bounds of the current active render texture” can be seen
Reproducible with: 2022.1.0a1, 2022.3.11f1, 2023.1.16f1, 2023.2.0a11
Not reproducible with: 2021.3.31f1, 2023.3.0a10
Fixed in: 2023.2.0a12
Reproducible on: macOS Ventura 13.6 (M1 Max), Windows 10
Not reproducible on: No other environment tested
Note:
-Couldn’t reproduce the issue with Built-in or URP, reproduced with HDRP
-The Console error on Windows is “[d3d11] attempting to ReadPixels outside of RenderTexture bounds! Reading (0, 0, 1611, 711) from (1, 1)"
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- VFX Graph Documentation dropdown button does nothing when clicked on the right side
- Required SpriteMask class (ID 331) is stripped when "Strip Engine Code" is enabled
- “Maximized serialized file backup not found” error is thrown when minimizing a window in a newly opened project
- Build stack trace contains invalid lines when building with IL2CPP using scripts with delegates containing generic types in the signature
- Entities Systems window has a “Show Full Player Loop” dropdown which does nothing when clicked after enabling “Show Full Player Loop”
Resolution Note:
It seems that what the user wants to do is readback the result of the camera rendering by using ReadPixels.
However, as the documentation states, ReadPixels will read pixels from the currently active render target. We cannot guarantee what the current render target will be in the EndCameraRendering callback, especially in the editor when a lot of things happen outside of render pipeline rendering.
Because of that, it is recommended that users set explicitly the current render target (with the camera output texture in this case) before calling ReadPixels and not rely on an undefined behavior.
Resolution Note (2023.1.X):
It seems that what the user wants to do is readback the result of the camera rendering by using ReadPixels.
However, as the documentation states, ReadPixels will read pixels from the currently active render target. We cannot guarantee what the current render target will be in the EndCameraRendering callback, especially in the editor when a lot of things happen outside of render pipeline rendering.
Because of that, it is recommended that users set explicitly the current render target (with the camera output texture in this case) before calling ReadPixels and not rely on an undefined behavior.