Created
February 18, 2021 21:39
-
-
Save mminer/816ff2b8a9599a9dd342e553d189e03f to your computer and use it in GitHub Desktop.
Unity function to vertically flip a render texture.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Vertically flips a render texture in-place. | |
/// </summary> | |
/// <param name="target">Render texture to flip.</param> | |
public static void VerticallyFlipRenderTexture(RenderTexture target) | |
{ | |
var temp = RenderTexture.GetTemporary(target.descriptor); | |
Graphics.Blit(target, temp, new Vector2(1, -1), new Vector2(0, 1)); | |
Graphics.Blit(temp, target); | |
RenderTexture.ReleaseTemporary(temp); | |
} |
very hepful thank you
Thank you!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Incredibly helpful, thank you.