title: Keeping Texture2D object(s) for interpolation HLSL
body: <p>Recently someone added a module to OBS Studio which lets anyone incorporate their own shaders into OBS. I've never touched on writing shaders, but after reading some material, I get the gist, it's a function that returns a bit of memory representing the RGBA values of a specific pixel.</p>
  
  <p>Here's the issue, I'm too new to this, it looks to me like there's a few different high level shader languages? I have no clue which one OBS Studio is using, the author of <a href="https://github.com/nleseul/obs-shaderfilter" rel="nofollow noreferrer">https://github.com/nleseul/obs-shaderfilter</a> doesn't seem to know either. Any pointers to what syntax / what documentation would be of course greatly appreciated.</p>
  
  <p>What I'm aiming to do is a very dumbed down motion blur. Namely though my goal is that I'd like to keep a few frames in a buffer of some sort to work with, I figure that'd be a pretty useful thing to do for other effects...and that's where I'm stuck. Here's what I've got following from <a href="https://books.google.com/books?id=NG9Ly3GdnTwC&amp;printsec=frontcover" rel="nofollow noreferrer">Shaders for Game Programmers and Artists pg.87</a> adapted to work w/ the shader plugin*</p>
  
  <pre><code>uniform float4 blur_factor;
  texture2d previmage;
  //texture2d image; //this is the input data we're playing around with
  
  float4 mainImage(VertData v_in) : TARGET
  {   
      float4 originalFrame = image.Sample(textureSampler, v_in.uv);
      float4 oldFrame = previmage.Sample(textureSampler, v_in.uv);
  
      //this function's going pixel by pixel, I should be pushing
      //to the frame buffer here* or there should be some way of modifying
      //the frame buffer pixel by pixel, second option makes more sense to do
      if(v_in.uv.x == 1 &amp;&amp; v_in.uv.y == 1){
          //it couldn't have been this easy...it's never this easy
          //uncommenting the line below clearly causes a problem, I don't have a debugger for this
          //previmage = image;
          //this doesn't work either, wishful thinking
          //previmage = texture2d(image);
      }
      //this may not actually be the function to use for a motion blur but at the very least it's mixing two textures together so that I'd have a proof of concept working*
      return lerp(originalFrame,oldFrame,blur_factor);
  }
  </code></pre>