Unity uses RenderTexture to display black screen, ghosting, and jagged solutions

1. Black screen, abnormal display problems

Solution:
Script new a texture map instead of serialized dragged RenderTexture.

			//宽、高、深度值、RenderTexture格式
            RenderTexture render = new RenderTexture(1080, 1080, 32, UnityEngine.Experimental.Rendering.DefaultFormat.LDR);
            characterCamera.targetTexture = render;

2. Ghosting and background display abnormalities

Solution:
Just set the Clear Flags of Camera to Solid Color mode.

3. Severe sawtooth

Solution:
Just adjust the antiAliasing anti-aliasing parameters of RenderTexture.
The antialiasing value must be one of (1, 2, 4 or 8), indicating the number of samples per pixel.
I chose to use 4, and the jaggies are not so obvious on the mobile side.

render.antiAliasing = 4;

Guess you like

Origin blog.csdn.net/qq_39162826/article/details/129692493