Added ChannelMixer

This commit is contained in:
Misaki
2024-12-26 19:48:31 +09:00
parent 2a455513bc
commit b00b63cfb4
30 changed files with 284 additions and 61 deletions

View File

@@ -0,0 +1,20 @@
using System.IO;
using UnityEngine;
using UnityEngine.Experimental.Rendering;
namespace Misaki.ArtToolEditor
{
internal static class TextureHelpers
{
internal static void ExportRenderTextureToPNG(RenderTexture targetRT, string textureFullPath)
{
var exportTexture = new Texture2D(targetRT.width, targetRT.height, targetRT.graphicsFormat, TextureCreationFlags.None);
exportTexture.ReadPixels(new Rect(0, 0, targetRT.width, targetRT.height), 0, 0);
exportTexture.Apply();
var bytes = exportTexture.EncodeToPNG();
File.WriteAllBytes(textureFullPath, bytes);
UnityEngine.Object.DestroyImmediate(exportTexture);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 44fc0bf1b58d77b47ac2af048b958418