Search Issue Tracker

Duplicate

Votes

4

Found in

2018.3.0b9

Issue ID

1098759

Regression

No

Optimize Mesh Data Player setting can drastically increase build times

Graphics - General

-

-

Priority: 4Not yet prioritized for a release

-

Severity: 2Core functionality majorly impacted

When the Optimize Mesh Data player setting is turned on. A game build can spend a larger than normal amount of time compiling shaders. Event when the shaders are already compiled.

CalculateUsedVertexComponentsSnippetPart in Shader.cpp is run for every shader pass in every material that is on every mesh in the build. This data is also not cached so when there is a large level with many meshes and materials the build times become really slow. It's more prevalent when using HD render pipeline because the shaders have many more variants.

Steps to reproduce - sorry, I trying zipping the project but it was still bigger than the 48 Mb limit from Fogbugz...

- Create a project using the HDRP Template.
- On the SampleScene created, create an empty gameobject, name it root, and move the following under it:
- volume settings
- Workshop set
- Props
- Reflection Probe Main
- Post-Process Volume
- Reflection Probe behind the wall
- Light Probe Group
- Reflection Probe Behind the Frame
- Select the root game object and duplicate/move the duplicated object to create 8 copies total of them (I spaced them in a 4 x 2 pattern - see attached image)
- Open the build Settings dialog (File/Build Settings). Click on the "Player settings..." button and make sure the setting for "Other settings/Optimization/Optimize Mesh Data" is OFF.
- Click on the Build button. Specify a directory. Start measuring time on the moment you click on the "Select Folder" button.
- When the build is done, the file manager will pop up: stop measuring time then.
- This first round can be ignored as the build will take longer as it is caching a ton of stuff.
- Now press the Build button again. Specify a directory. Start measuring time on the moment you click on the "Select Folder" button.
- When the build is done, the file manager will pop up: stop measuring time then. This took 1:57.99 on my machine
- Now turn ON the "Player settings...Other settings/Optimization/Optimize Mesh Data"
- Now press the Build button again. Specify a directory. Start measuring time on the moment you click on the "Select Folder" button.
- When the build is done, the file manager will pop up: stop measuring time then. This took 3:57.5 on my machine

On bigger projects (like the ones that the Spotlight team deals with) this time is much much greater.

Comments (2)

  1. Ace39ee16e8e7251c3378918bce641c6?d=mm

    SpiderJones

    Apr 09, 2019 20:57

    Build times took 20 minutes, after unchecking OPTIMIZE MESH DATA build time now takes less than a minute.

    I was having the same issue described here -> https://forum.unity.com/threads/compiling-shader-variants-taking-ages.527724/

    I had this issue with 2018.3.11f1 and 2018.3.12f1 when building for iOS.

  2. 3ec61fa5998895c788de307b53cfdc4c?d=mm

    Jayeson

    Mar 05, 2019 22:49

    I have reproduced this on 2018.1.0f2, 2018.3.0f2 and 2019.2.0a4.

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.