Quantcast
Channel: Questions in topic: "post processing"
Viewing all articles
Browse latest Browse all 713

How to draw texture on top of everything?

$
0
0
Hello, I found this [really nice shader][1] for drawing screen transitions/wipes ***behind*** the UI. What I want to do is draw it **on top** of everything- even the UI. I tried WaitForEndOfFrame() but that hides the UI because it's getting the current render texture in OnRenderImage()- before the UI is drawn. So my question is: how do you grab the render texture of the camera after the UI and everything has been drawn, send that to the shader for lerping in an alpha transition, then Gaphics.blit it to the current RT? This is my current attempt: void OnGUI() { StartCoroutine(RenderOnTop()); } IEnumerator RenderOnTop() { while(true) { RenderTexture currentRT = RenderTexture.active; RenderTexture.active = cam.targetTexture; cam.Render(); material.SetColor("_MaskColor", maskColor); material.SetFloat("_MaskValue", maskValue); material.SetFloat("_MaskSpread", maskSpread); material.SetTexture("_MainTex", currentRT); material.SetTexture("_MaskTex", maskTexture); yield return new WaitForEndOfFrame(); Graphics.Blit(currentRT, null, material); } } Thanks P.S. Would UI masks be a more efficient solution? [1]: https://www.youtube.com/watch?v=dwjvkv4y0NE

Viewing all articles
Browse latest Browse all 713

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>