Hi there, I am trying to reproduce Blit (src, dest). But my test code fails: Code (CSharp): Shader shader = Shader.Find ("Hidden/BlitCopy"); Material material = new Material (shader); commandBuffer.Blit (src, dest, material, 0); What I am doing wrong? ============================================= Another question should I use my own quad in order to use "Hidden/BlitCopy"? Ex.: Code (CSharp): Shader shader = Shader.Find ("Hidden/BlitCopy"); Material material = new Material (shader); commandBuffer.SetGlobalTexture ("_MainTex", src); commandBuffer.SetRenderTarget (dest); commandBuffer.DrawMesh (quad, Matrix4x4.identity, material, 0, 0); ============================================= Just everyone know the shader source Ill put this here: Code (CSharp): Shader "Hidden/BlitCopy" { Properties { _MainTex ("Texture", any) = "" {} } SubShader { Pass { ZTest Always Cull Off ZWrite Off CGPROGRAM #pragma vertex vert #pragma fragment frag #pragma target 2.0 #include "UnityCG.cginc" sampler2D _MainTex; uniform float4 _MainTex_ST; struct appdata_t { float4 vertex : POSITION; float2 texcoord : TEXCOORD0; }; struct v2f { float4 vertex : SV_POSITION; float2 texcoord : TEXCOORD0; }; v2f vert (appdata_t v) { v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.texcoord = TRANSFORM_TEX(v.texcoord.xy, _MainTex); return o; } fixed4 frag (v2f i) : SV_Target { return tex2D(_MainTex, i.texcoord); } ENDCG } } Fallback Off }
UPDATE: Well hello Aaron again Found his post with the same issue at: https://forum.unity3d.com/threads/c...er-blit-with-internal_blitcopy-shader.432699/ Thanks to his workaround I found the solution to force _MainTex being declared: Code (CSharp): Shader shader = Shader.Find ("Hidden/BlitCopy"); Material material = new Material (shader); commandBuffer.SetGlobalTexture ("_MainTex", src); commandBuffer.Blit (src, dest, material, 0); This IS the bug, as long as the Unity's documentation states the Blit source will be declared in _MainTex, which is not in this case. =========================================== Now the question is how can I do this with the "quad" ?