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
- Mono Windows Builds don't produce full log callstacks when generating logs
- AssetBundles fail to load when running in Built Players for Mobile Devices
- UI elements with text gets bigger and grey when Player window is moved to another screen with different resolution
- System name accepts multiline text but crops it on confirmation, duplicates input, and shrinks the field when empty
- UI element scale and position are wrong in project build when DRS is changed with HDR and Software Dynamic Resolution enabled
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.