// Use this for initialization void Start() { _Correction = new OffscreenProcessor(); _Correction.ShaderName = "Image/DistortionCorrection"; _Correction.TargetFormat = RenderTextureFormat.ARGB32; _SrcBlitter = new OffscreenProcessor(); _SrcBlitter.ShaderName = "Image/Blitter"; _SrcBlitter.TargetFormat = RenderTextureFormat.Default; _SrcBlitter.TargetFormat = RenderTextureFormat.ARGB32; _GazeBlitterCircle = Shader.Find("Image/GazeBlit_Circle"); _GazeBlitterRect = Shader.Find("Image/GazeBlit_Rect"); _GazeBlitter = new OffscreenProcessor(); _GazeBlitter.ShaderName = "Image/Blitter"; _GazeBlitter.TargetFormat = RenderTextureFormat.Default; _GazeBlitter.TargetFormat = RenderTextureFormat.ARGB32; _SceneBlitter = new OffscreenProcessor(); _SceneBlitter.ShaderName = "Image/Blitter"; _SceneBlitter.TargetFormat = RenderTextureFormat.Default; _SceneBlitter.TargetFormat = RenderTextureFormat.ARGB32; _CombinedTexture = new RenderTexture((int)1, (int)1, 16, RenderTextureFormat.ARGB32); _blurGenerator = new BlurImageGenerator(); _blurGenerator.DownScaler = 0; _blurGenerator.Iterations = 1; CamSource.GetBaseTexture().OnFrameBlitted += OnFrameGrabbed; _GazeTexture = new Texture[0]; }
// Postprocess the image void OnRenderImage(RenderTexture source, RenderTexture destination) { if (_blurGenerator == null) { _blurGenerator = new BlurImageGenerator(); } _blurGenerator.Iterations = Iterations; _blurGenerator.DownScaler = Downscale; BluredTexture = _blurGenerator.GenerateBlur(source, ref _blurTex); Graphics.Blit(BluredTexture, destination); }