Search Issue Tracker
By Design
Votes
0
Found in [Package]
9.0.0-preview.33
Issue ID
1259997
Regression
No
[HDRP] RenderTextures used as light cookie stop working in build
Reproduction steps:
1. Open attached project "LightCookie.zip" and scene "Directional RT Cookies"
2. Enter Play Mode
3. In Game View, observe "Plane", "Cube" and "Cube (debug)" GameObject
4. Exit Play Mode
5. Build and play project
6. In Build, observe "Plane", "Cube" and "Cube (debug)" GameObject
Expected result: Render texture cookie works the same as in Editor
Actual result: Render texture cookie constantly switches between two states
Reproducible with: 2019.4.7f1 (HDRP 7.4.1), 2020.1.1f1, 2020.2.0a20 (HDRP 9.0.0-preview.33)
Could not test with: 2018.4.26f1 (errors break project)
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
- Editor crashes when starting a new game session using Direct3D12 Graphics API
- Play on awake does not work with an audio random container when instantiating a game object
- Play on awake does not work with an audio random container when loading a scene
- Prefab components are not rendered correctly in the Inspector Window when "HideFlags.HideInInspector" is used
- The "Editor.CreateInspectorGUI" method is being called twice when the Console and the Inspector windows are in the same panel
Resolution Note:
The issue is in fact caused by a missing call to IncrementUpdateCount() on the render texture.
For performance reasons, cookie texture atlas isn't updated every frame for every textures (as most of them are static anyway). To tell the system that the content of a texture has changed, you need to call IncrementUpdateCount() on the render texture, the system can then check the updateCount property to see if it has changed.
However there is several things to note:
- A mistake in the code made the atlas wrongly update in the editor. We will fix this so that behavior stays consistent between build/editor.
- The documentation does not mention the need for IncrementUpdateCount so we will add a section to the light documentation to highlight that.
Additional note on the repro scene.
The script was creating a new RenderTexture each frame which is wrong because it will flood the atlas with a new texture every frame. I assume that this was some left overs from debugging tests but this should be removed for a correct behavior.