private void OnGUI() { GUILayout.BeginVertical("Box"); GUILayout.BeginHorizontal(); GUILayout.Label("Filter Type : " + _filterType.ToString() + "\nBlur Frequency: " + _blurFreq.ToString()); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("GAUSSIAN")) { _filterType = FilterType.GAUSSIAN; } if (GUILayout.Button("KAWASE")) { _filterType = FilterType.KAWASE; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("NORMAL")) { _blurFreq = BlurFrequency.NORMAL; } if (GUILayout.Button("STATIC")) { _blurFreq = BlurFrequency.STATIC; } if (GUILayout.Button("HALF FREQUENCY")) { _blurFreq = BlurFrequency.HALF; } if (GUILayout.Button("EVERY FOURTH FRAME")) { _blurFreq = BlurFrequency.EVERY_FOURTH_FRAME; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("TOGGLE BLUR MAP")) { _toggleBlur = !_toggleBlur; _glassMaterial.SetTexture("_BlurMap", (_toggleBlur ? BlurTexture : null)); } if (GUILayout.Button("TOGGLE DISTORTION MAP")) { _toggleDist = !_toggleDist; _glassMaterial.SetTexture("_NormalMap", (_toggleDist ? DistortionTexture : null)); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); }
void Start() { _camera = GetComponent <Camera>(); _camera.depthTextureMode = DepthTextureMode.Depth; _camera.clearFlags = CameraClearFlags.Skybox; InitBlurTextures(); _blurFreq = BlurFrequency.NORMAL; _filterType = FilterType.GAUSSIAN; _glassMaterial = GameObject.Find("Quad").GetComponent <Renderer>().sharedMaterial; _toggleDist = false; _toggleBlur = true; }