umasteeringgroup / UMA

Unity Multipurpose Avatar
MIT License
739 stars 168 forks source link

I suggest If the same model without any reciple , Can it be optimized to only use 3 RenderTexture instead of 3 RenderTexture per model ,used for monsters in the game ? #384

Closed FzuLiWei closed 6 months ago

FzuLiWei commented 2 years ago

Hello Jaimi:

I read UMA Code , I have know the texturemerge solution .A amazing solution . It create 3 RenderTexture to setmaterial . Of course ,if more channel ,more rendertexture.

I suggest If the same model without any reciple , Can it be optimized to only use 3 RenderTexture instead of 3 RenderTexture per model ,used for monsters in the game ?

It can further optimize memory usage, since memory usage is capped if a large number of characters are used .

10

Thank you again for the solution provided by UMA.

Jaimi commented 2 years ago

There isn't a way to currently cache and reuse the render textures. But, there are several ways to address this - The first way is to build a prefab using the prefab maker. That will basically "hardcode" a character, and you can then reuse it as many times as you like without duplication. Then second way is to use type "TintedTexture" in some of the channels. This only works when the material type is set to "no atlas". Then the texture from the overlay is used directly instead of layered/composited (the Color property on the material is set to the first color on the overlay). If you make no changes to the normal map or metallic maps, for example, you can do this. The third way is to skip using the texture merge for some materials - and "hard code" the material to specific textures. The fourth way is to use the UMASimpleLOD to rebuild the textures on the fly based on distance to the camera.

All of these can be combined based on what you need.

FzuLiWei commented 2 years ago

Thanks

FzuLiWei commented 2 years ago

hello , In this code TextureMerge.cs. 2022 04 28_李炜

see unity doc , origin of coordinates is on the left bottom. why is not GL.LoadPixelMatrix(0, width, 0, height); I cannot understand it.

2022 04 28_李炜1

FzuLiWei commented 2 years ago

I think I already know why. Because unity Rect is base on left top is zero. 2022 04 28_李炜11

I get it.

123

Jaimi commented 6 months ago

This is because the parameter names were specified, so the order does not matter (the compiler figures it out).