involved technology: C#、Unity shader、OnGUI()、compute shader
This project is a tool for showing the overdraw rate both in Unity Editor and in running Game. it was implemented during my internship in Kingsoft. i was mainly responsible for the display of the overdraw-related indicators of each camera during the debugging of the mobile game, so as to detect and troubleshoot the overdraw problem in the mobile game.
In order to detect where the overdraw rate is relatively high, I developed this tool. This tool can display the overdraw rate when running in the unity editor, and it can also display the overdraw rate when the game is running on the Android platform. by using this tool, you can find out Where is the performance bottleneck of the game.
Perform a high-precision sampling for each camera below the scene, and use the replacement shader to normalize the sampling texture and save it as a Render Texture.
Use the Compute shader to use the Parallel reduction algorithm to calculate the number of times each pixel is drawn which is using the parallel computing, and pass it back to C# for the statistics of Overdraw. compute shader is used to add up all the pixels in the overdrawTexture and store the information into this component.
Use OnGUI() function to count the peak value of single frame fillrate multiple, single frame fillrate multiple, GPU actual fillrate multiple, GPU fillrate multiple peaks and actual fillrate multiple, and output the display.
Each term:
the peak value of single frame fillrate multiple = the peak value of single frame fillrate/ frame rendering camera resolution
single frame fillrate multiple = single frame fillrate/ frame rendering camera resolutions
GPU actual fillrate multiple = The total number of fills in this frame /screen resolution to which this frame is projected; The higher the value, the greater the overdraw rate.
GPU fillrate multiple peaks = the peak of GPU actual fillrate multiple
actual fillrate multiple = Add the actual GPU fillrates multiples of all cameras. and also shows the maximum of actual fillrates.
Comments