10 public static void RenderDistortion(Material material, RenderTexture source, RenderTexture destination,
float angle, Vector2 center, Vector2 radius)
12 bool invertY = source.texelSize.y < 0.0f;
15 center.y = 1.0f - center.y;
19 Matrix4x4 rotationMatrix = Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(0, 0, angle), Vector3.one);
21 material.SetMatrix(
"_RotationMatrix", rotationMatrix);
22 material.SetVector(
"_CenterRadius",
new Vector4(center.x, center.y, radius.x, radius.y));
23 material.SetFloat(
"_Angle", angle*Mathf.Deg2Rad);
25 Graphics.Blit(source, destination, material);
29 [Obsolete(
"Use Graphics.Blit(source,dest) instead")]
30 public static void Blit(RenderTexture source, RenderTexture dest)
32 Graphics.Blit(source, dest);
36 [Obsolete(
"Use Graphics.Blit(source, destination, material) instead")]
37 public static void BlitWithMaterial(Material material, RenderTexture source, RenderTexture dest)
39 Graphics.Blit(source, dest, material);
A Utility class for performing various image based rendering tasks.
static void RenderDistortion(Material material, RenderTexture source, RenderTexture destination, float angle, Vector2 center, Vector2 radius)
static void Blit(RenderTexture source, RenderTexture dest)
static void BlitWithMaterial(Material material, RenderTexture source, RenderTexture dest)