Search Issue Tracker
By Design
Votes
0
Found in
6000.0.24f1
6000.1.0a1
6000.2.0a1
Issue ID
UUM-84728
Regression
No
The sampling result will have black artifacts when using URP Sample Buffer with UV value set to 1
How to reproduce:
1. Open the “TestFullScreenShader“ project
2. Open the “SampleScene Failed“ scene
3. Observe the top-right and bottom-right corners of the Game view
Expected result: Black areas appear
Actual result: No black areas
Reproducible with: 6000.1.0a1, 6000.0.24f1
Could not test with: 2021.3.45f1, 2022.3.51f1 (The custom render features cannot be applied)
Reproducible on: macOS 14.6.1 (Intel), Windows 10 (Reporters)
Not reproducible on: No other environments tested
Workaround 1: Clamp the URP Sample Buffer Node input Max (X and Y values) to 0.999
Workaround 2: Instead of the URP Sample Buffer use the Sampler State Node and Sample Texture 2D Node
Note: To see the second workaround navigate to the “SampleScene.unity“ which uses “Twirl Shader Graph“
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
- Crash on RaiseException when opening a specific project
- DownloadHandlerScript.CompleteContent is called twice when building for WebGL
- Scene view has Y coordinates of the Screen Position node flipped when some of the URP features are disabled
- Volumetric fog shader variants are missing from build when "Strict Shader Variant Matching" is disabled
- Unnecessary modifications clutter the Scene when using a RectTransform driven by a LayoutGroup in a Prefab
Resolution Note:
Edit: Since you reopened the bug:
This is still as designed. In your "failed" shader graph, you perform a sample buffer operation, which doesn't go through the texture unit on a GPU, and hence returns invalid values on the final pixel. You're right, that 1 is in the range [0, 1]. However, the texture coordinates are indices. So a texture coordinate of 1 is like sampling the nth index of a buffer of length n elements. The correct solution is to sample the n-1th index. I'd recommend that you either account for this in your UV coordinates, or just use the sample texture node instead, and let the GPU hardware take care of clamping for you.
Original comment:
Hey, as you observed, you’re getting a black value when you’re sampling outside the original texture, i.e. when your U or your V coordinate is outside the range [0, 1]. This is standard GPU behavior. The most proper fix for your effect is probably to never sample outside of screen bounds, i.e. you should probably do a small zoom in while doing the wobble effect, to make sure you never sample off-screen. So this is not a bug.
However, your sampler state clamp looks like the next best thing. You can read more about sampler state addressing modes here: https://learn.microsoft.com/en-us/windows/uwp/graphics-concepts/texture-addressing-modes