-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GLTF Shaders are using too much space in ram #586
Comments
string[] tmp_ShaderNames =
{
"glTF-pbrMetallicRoughness",
"glTF-pbrMetallicRoughness-Opaque",
"glTF-pbrSpecularGlossiness",
"glTF-pbrSpecularGlossiness-Opaque",
"glTF-pbrSpecularGlossiness-Blend",
"glTF-unlit",
"glTF-pbrMetallicRoughness-Blend",
};
foreach (string tmp_ShaderName in tmp_ShaderNames)
{
var tmp_Shader = Shader.Find($"Shader Graphs/{tmp_ShaderName}");
if (tmp_Shader)
Resources.UnloadAsset(tmp_Shader);
} Try this code this release the shaders. |
Still prevalent on our iOS built with Unity6 and glTFast 6.8. If you only have 2GB available, having nearly half of it just for those shaders is too much! |
Thanks for providing those insights. Without doing further investigation I suspect the problem is the sheer mass of shader variants as a result of including all of them. Unfortunately there's no generic quick fix, but I can think of solutions:
Question regarding point 2: Would you be willing to accept a regression in render performance if this memory issue would be resolved by it? |
In our case, we would be perfectly fine with the approach in point 2. Since we're using it as a more generic GLTF viewer and don’t always know in advance what assets we’ll be working with, it’s not feasible for us to manually reduce shader variants. A solution like dynamic branching would be a great fit for our needs. |
Thanks for the feedback, duly noted. I'll consider it in the planning process. In case someone jumps ahead and crafts that solution, feel free to share and make a contribution. |
#703 might be a solution for this problem. |
Hello, i have a project where i need to import glb files in runtime. I need all shader variants (at least that is what i think) so i included those in the build. I took a memory snapshot using Unity Memory Profiler, this snapshot belongs to a standalone build. I am not sure if this is a bug, is there anything i can do to decrease this ram usage?
The text was updated successfully, but these errors were encountered: