Search Issue Tracker

By Design

Votes

2

Found in

2021.3.46f1

2022.3.53f1

6000.0.27f1

6000.1.0a5

Issue ID

UUM-87456

Regression

No

Rendering into RenderTexture is affected by Camera transforms when using DrawMeshNow

--

-

Reproduction steps:
1. Open the attached “DrawMeshDebug.zip” project
2. Open the “Scene” Scene
3. Enter the Play mode
4. Observe the Game view
5. Now Build and Run the Project (File > Build and Run)
6. Observe the Player

Expected result: Game view matches the Player, a red static square is visible while the Camera is moving
Actual result: In the Player, the red texture is drawn based on Camera position

Reproducible with: 2021.3.46f1, 2022.3.53f1, 6000.0.27f1, 6000.1.0a5

Reproducible on: Windows 11
Not reproducible on: no other environment tested

Note:
- Only reproduces in the Player

  1. Resolution Note:

    DrawMeshNow happens outside the usual render loop. At the point in time when it is executed, no camera is actively being rendered. As a result, camera-related data, like the projection matrix, should be treated as uninitialized data, and not be used by the shader. No guarantees are given to what camera-related shader properties are set to, and any value incidentally set should not be relied upon. The behavior of these properties can change at any point in time.

    The repro project also uses GL.LoadProjectionMatrix. This function is not intended to be used together with DrawMeshNow, and only affects subsequent GL.xxx calls like GL.Begin / GL.End. Note that the use of the entire GL class is discouraged, and usually not very performant.

    The recommendation to resolve the issue is to use a custom shader that does not access camera matrices for the DrawMeshNow call

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.