Skip to content
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

There are hundreds of "NametagBackgroundMaterial" in the material list when viewed with the inspector. #177

Closed
Aitolda opened this issue Jun 11, 2023 · 5 comments · Fixed by #179
Assignees
Labels
bug Something isn't working

Comments

@Aitolda
Copy link
Contributor

Aitolda commented Jun 11, 2023

This COULD be contributing to slowdowns as the inspector appears to shows hundreds of materials being used, despite just a handful in the scene. Needs further investigation on a locally run client.

0ff6e2952293e02f5dc0d45afe0546b9 1

Worth noting there quite a few "skybox" materials appearing as well.

@Aitolda Aitolda added the bug Something isn't working label Jun 11, 2023
@Gigabyte5671
Copy link
Member

We may not be correctly destroying old materials when their parent meshes are removed from the scene. How many of these duplicate materials are there when you first open the app?

@Gigabyte5671 Gigabyte5671 self-assigned this Jun 11, 2023
@Aitolda
Copy link
Contributor Author

Aitolda commented Jun 18, 2023

We may not be correctly destroying old materials when their parent meshes are removed from the scene. How many of these duplicate materials are there when you first open the app?

There's no way to shift-select and get a count, but it's likely hundreds and immediately.

@Gigabyte5671
Copy link
Member

Gigabyte5671 commented Jun 23, 2023

Yikes, that's not fantastic. Roughly how many chairs (or other interactive meshes) are there in the world?

I think it's the case that we're creating a new instance of the NametagBackgroundMaterial for every nametag/label in the scene. This is necessary for player nametags since the display name is in the texture itself. However, for generic labels on chairs (etc) we could memoize and reuse the materials. I'll have a look into this as soon as I can.

@Aitolda
Copy link
Contributor Author

Aitolda commented Jun 25, 2023

Yikes, that's not fantastic. Roughly how many chairs (or other interactive meshes) are there in the world?

I think it's the case that we're creating a new instance of the NametagBackgroundMaterial for every nametag/label in the scene. This is necessary for player nametags since the display name is in the texture itself. However, for generic labels on chairs (etc) we could memoize and reuse the materials. I'll have a look into this as soon as I can.

Looking at the blend file with anything called "animate_" its 282. However it's worth noting the sit icon/image actually doesn't seem to appear in this world for whatever reason.

EDIT: Looking closer that might actually be the scale of the objects causing this (0.02). At some point we might want to decouple the scale of the sit/icon from the object scale. I can't foresee a situation where that would be beneficial.

@Aitolda
Copy link
Contributor Author

Aitolda commented Jun 27, 2023

Winner winner, chicken dinner! (That fixes it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants