How to release a RenderTexture with antialiasing in Unity?

306 Views Asked by At

I'm struggling with multisampling. I allocated a RenderTexture with the property 'antiAliasing' which could not be released totally and I don't know why.

I had found a way to allocate a RenderTexture which can be released as follows.

//allocate a temporary RenderTarget
multisampleRT = RenderTexture.GetTemporary(Camera.pixelWidth, Camera.pixelHeight, 32, RenderTextureFormat.Depth, RenderTextureReadWrite.Default, multisampleCount);
//release a temporary RenderTarget
RenderTexture.ReleaseTemporary(multisampleRT);

But this way is followed by a default resolve pass which will affect my later operation. Then I tried another properties 'bindTextureMS'.

multisampleRT.bindTextureMS = true;

However, this causes the memory explosion again.

Above all, I'll appreciate a resolution that:

  1. Allocate and release RenderTarget correctly.
  2. Allocate RenderTarget with RenderTextureFromat not GraphicsFormat.(I must use this.)
  3. Allocate RenderTarget without resloved by default.

Thanks a lot:)

0

There are 0 best solutions below