Hi everyone,
I’m trying to render my scene to a file, but I the result has some color-bleeding which I presume is from antialiasing.
I need the green and red objects to render as pure plain color, with no antialiasing.
I have been searching for info on the web, and I have tried (unsuccessfully) the following:
*Disabling antialiasing in project
*Disabling HDR in the camera
*Setting the Render texture and 2D texture format to Point
*Disabling mipmaps
*Setting render texture antialiasing to 1
Changing the format to RGBA32 in both textures gives better results, but still some color bleeding
This is the code Im using for rendering:
void RenderCamera(string name)
{
RenderTexture thumbnail = new RenderTexture(_camera.pixelWidth, _camera.pixelHeight, 24);
thumbnail.autoGenerateMips = false;
thumbnail.filterMode = FilterMode.Point;
thumbnail.antiAliasing = 1;
thumbnail.Create();
_camera.targetTexture = thumbnail;
Texture2D thumb_tex = new Texture2D(_camera.pixelWidth, _camera.pixelHeight, TextureFormat.RGB24, false);
thumb_tex.filterMode = FilterMode.Point;
_camera.Render();
RenderTexture.active = thumbnail;
thumb_tex.ReadPixels(_camera.pixelRect, 0, 0);
thumb_tex.Apply();
byte[] png = thumb_tex.EncodeToPNG();
File.WriteAllBytes(Application.dataPath + "/../LabelRenders/" + name + ".png", png);
_camera.targetTexture = null;
RenderTexture.active = null;
}


