I have a shader in shader toy which looks like this: Code (CSharp): //Image void mainImage( out vec4 fragColor, in vec2 fragCoord ) { vec2 uv = fragCoord/iResolution.xy; uv = 2.0 * (uv - .5); if (iFrame > 0) { vec3 fin = texture(iChannel0, vec2(0, 0)).xyz; uv = fin.z * uv; uv = uv + fin.xy; } vec2 c; c.x = 0.3; c.y = 0.5; float R = 3.0, L, ITERS = 100.0; for(float i = 0.0; i < ITERS; i++) { float buffer = uv.x; uv.x = uv.x * uv.x - uv.y * uv.y; uv.y = 2.0 * buffer * uv.y; uv.x = uv.x + c.x; uv.y = uv.y + c.y; if (sqrt(uv.x * uv.x + uv.y * uv.y) > R) break; L += 1.0; } fragColor = vec4(L/ITERS, 0.0, 0.0, 1.0); } // buffer A bool readKey(int value) { float keyVal = texture(iChannel0, vec2((float(value)+0.5)/256.0, 0.25)).x; return (keyVal > 0.5) ? true: false; } void mainImage( out vec4 fragColor, in vec2 fragCoord ) { float zoom = 2.0; vec2 uv = fragCoord / iResolution.xy; uv = zoom * uv; if (iFrame > 0) { vec3 fin = texture(iChannel1, vec2(0, 0)).xyz; uv = fin.xy; zoom = fin.z; } if (readKey(65)) uv.x -= 0.025 * zoom; if (readKey(68)) uv.x += 0.025 * zoom; if (readKey(87)) uv.y += 0.025 * zoom; if (readKey(83)) uv.y -= 0.025 * zoom; if (readKey(69)) zoom = zoom - 0.025 * zoom; if (readKey(81)) zoom = zoom + 0.025 * zoom; fragColor = vec4(uv.x, uv.y, zoom, 1.0); } I transcribed the image portion to glsl which works, which looks like: Code (CSharp): Shader "Shaders/Julia" { Properties{ _MainTex ("MainTex", 2D) = "white" {} _Iterations ("Iterations", int) = 0 _Zoom ("Zoom", float) = 2.0 } SubShader { Tags { "RenderType" = "Transparent" "Queue" = "Transparent" } Pass { ZWrite Off Blend SrcAlpha OneMinusSrcAlpha CGPROGRAM #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" struct VertexInput { fixed4 vertex : POSITION; fixed2 uv:TEXCOORD0; fixed4 tangent : TANGENT; fixed3 normal : NORMAL; //VertexInput }; struct VertexOutput { fixed4 pos : SV_POSITION; fixed2 uv:TEXCOORD0; //VertexOutput }; //Variables sampler2D _MainTex; int _Iterations; float _Zoom; VertexOutput vert (VertexInput v) { VertexOutput o; o.pos = UnityObjectToClipPos (v.vertex); o.uv = v.uv; //VertexFactory return o; } fixed4 frag(VertexOutput i) : SV_Target { fixed2 uv = i.uv/1; uv = 2.0 * (uv - .5); fixed2 c; c.x = 0.3; c.y = 0.5; float R = 3.0, L, ITERS = _Iterations * 10; for(float i = 0.0; i < ITERS; i++) { float buffer = uv.x; uv.x = uv.x * uv.x - uv.y * uv.y; uv.y = 2.0 * buffer * uv.y; uv.x = uv.x + c.x; uv.y = uv.y + c.y; if (sqrt(uv.x * uv.x + uv.y * uv.y) > R) break; L += 1.0; } return fixed4(L/ITERS, 0.0, 0.0, 1.0); } ENDCG } } } I was hoping to get the same effect with zooming / panning around the shader as I have in shader toy, but I am not sure how to use a buffer along with the image shader in hlsl / Unity. Is there a way to move around the shader similar to how i'm doing with the wasd keys, then zoom inward/outward with the qe keys? Here is the direct link to the shader toy if you would like to see what I mean: https://www.shadertoy.com/view/4lKBRR. Thank you.
Instead of doing this I just made an attribute that was of float4. Passed in the x/y position and z/w scale. Assigned it when reading in the fragCoord (uv) by doing _Area.xy + (uv manipulation for shader) * _Area.wz where _Area is that float4. Does not answer the question but I suppose I do not need multiple buffers to achieve what I was trying to do.