1) The FONT Texture memory value is abnormally high 2) The UWA report Overdraw statistics and data reading question 3) The URP 4) UGUI is broken due to Different Material Instance 5) SplatAlpha compression confusion in Unity TerrainData


This is the 255th post of UWA technical knowledge sharing. Today, we continue to select a number of issues related to development and optimization for you. It is recommended that you read for 10 minutes.

UWA Q&A Community: Answer.uwa4d.com UWA QQ Group 2:793972859 (The group is full)

Font

Q: We found in our check that there is a very large Font Texture that has existed since we entered the game. What I can’t figure out is that it’s only 256*256, so why is there 61MB of usage?

Version: Unity 2019.4.3F1

A: We haven’t seen this issue in 2018, it’s supposed to be A Unity 2019 Bug, fixed in Unity 2019.4.21.





Reference Website:
https://unity3d.com/unity/whats-new/2019.4.21

Thanks to the Xuan@UWA Q&A community for your response

Rendering

Q: According to the UWA test report, the overall Overdraw of our game is relatively high. I would like to retest the Overdraw data on the Intranet. I would like to ask you some questions:

1. I useUnityOverdrawMonitorI tested the Overdraw of the whole scene in the Editor, and the result was smaller than the one in UWA. I also tested several of the same scenes, but the result was higher in UWA. The statistics of this tool were a little lower than the total number of fill in the UWA report.

2. What is the relationship between these data in the UWA report? The total number of fills, the average fill multiple and the maximum number of fills per pixel.

3. As for other tools, I putParticleEffectProfilerAfter getting the internal network, it can calculate the maximum number of single pixels of a single effect. It has tested several individual effects, and the Overdraw high reaches 4, 5, 6, and most of the effects are 2. The Overdraw high effects have been sorted out for the art to optimize.

PS: Since the company’s project is developed on the Intranet, the data of the project in the Editor cannot be captured. I will post a few screenshots of the report in UWA:



A: 1. If UnityOverdrawMonitor is under the open source tools: https://github.com/Nordeus/Unite2017/

Then, the statistics above are not accurate, because its underlying principle is to render the Shader by replacing the Shader with a translucent Shader, so as to calculate its Overdraw. This does not consider the depth occlusion, culling and other issues, so the calculated value is wrong. Sometimes it can even be unnecessarily misleading.

These values specify the visible: the uaw trust new features | GPU performance optimization, One Step!” Peak number of filled pixels in a single frame during the operation of a project.

The average number of filled pixels per frame during the project operation.

During the operation of the project, the peak number of times that the entire screen is filled in a single frame; The higher the multiple, the greater the pressure on the GPU.

In the process of running the project, the mean of the filling multiple of each frame is averaged; The higher the multiple, the greater the pressure on the GPU.

From the screenshot, we can see that the Overdraw pressure of your special effects is not small. We suggest you pay special attention to it.

This answer is provided by UWA

Rendering

Q: The simplest scene, which contains a Unity default sphere, uses a URP Lit Shader.

Shows normal in the editor:



After exporting the project to Android, the highlight part is very badly Mosaic:



The material has only the color set:



Has anyone encountered this problem before?

Unity version: 2021.1.9 F1 URP version: 11.0.0

A: Need to modify the URP source code.

In the Packages/[email protected] / ShaderLibrary/Common HLSL file line 1225:

// Normalize that account for vectors with zero length

real3 SafeNormalize(float3 inVec)
{
    real dp3 = max(FLT_MIN, dot(inVec, inVec));
    return inVec * rsqrt(dp3);
}

Where real needs to be changed to float:

// Normalize that account for vectors with zero length

float3 SafeNormalize(float3 inVec)
{
    float dp3 = max(FLT_MIN, dot(inVec, inVec));
    return inVec * rsqrt(dp3);
}

So there is a problem with the accuracy setting of the mobile platform.

Thanks to the WTF-082699@UWA Q&A community for providing the answer

UGUI

Q: As shown in the figure below, because Different Material Instance and batch are interrupted, they are indeed balls of the same Material. Could you tell me the reason?

A1: Is it possible that the material name is the same? You can open Debug mode to see if the Instance ID is the same.

Thanks to Fan Shiqing @uwa Q&A community for providing the answer

A2: Resolved, caused by template testing.

Thanks to the cwf@UWA Q&A community for providing the answer

Rendering

Q: The splatAlpha in Unity TerrainData is in an uncompressed format and takes up a lot of memory. Is there a good way to compress it?

A: I’m not sure if this image can be compressed under Unity’s native Terrain, it seems to be in principle (unless the image was generated in memory at runtime).

However, this image does not store color information, so it can be compressed poorly, such as with a Mosaic at the edges of the blend. We used T2M to convert it into a Mesh before, we compressed the mix map, the result was very poor, finally we used 16 bits in some acceptable blocks to reduce the memory by half, the problem blocks still used the original 32 bit image.

Thanks to Jia Weihao @uwa Answers Community for providing the answer

Cover image from the network


That’s all for today’s sharing. Life, of course, is long and knowledge is long. The questions you may see are just the tip of the iceberg in the long development cycle, and we have already prepared more technical topics for you to explore and share on the UWA Q&A website. Welcome you who love progress to join us. Maybe your method can solve others’ urgent need. And the “stone” of another mountain can attack your “jade”.

Website: www.uwa4d.com Official Technology Blog: blog.uwa4d.com Official Q&A Community: Answer.uwa4d.com Official Technology QQ Group: 793972859 (The original group is full)