private void CreateTextures() { this.ReleaseTextures(); TextureUtility.RenderTextureDesc desc = new TextureUtility.RenderTextureDesc("[UWS] WaterSimulationArea - Simulation") { Width = this._Width, Height = this._Height, Format = WaterQualitySettings.Instance.Ripples.SimulationFormat, Filter = FilterMode.Bilinear, EnableRandomWrite = true }; for (int i = 0; i < 3; i++) { this._Buffers[i] = desc.CreateRenderTexture(); this._Buffers[i].name = "[UWS] WaterSimulationArea - Buffer[" + i + "]"; this._Buffers[i].Clear(Color.clear, false, true); } this.SendSimulationMatrix(this._Buffers[1]); TextureUtility.RenderTextureDesc desc2 = new TextureUtility.RenderTextureDesc("[UWS] WaterSimulationArea - Depth") { Width = this._DepthWidth, Height = this._DepthHeight, Depth = 24, Format = RenderTextureFormat.ARGBHalf, Filter = FilterMode.Point }; this._Depth = desc2.CreateRenderTexture(); this._PreviousDepth = desc2.CreateRenderTexture(); this._Depth.Clear(Color.clear, false, true); this._PreviousDepth.Clear(Color.clear, false, true); }
private void CreateRenderTexture() { TextureUtility.RenderTextureDesc desc = new TextureUtility.RenderTextureDesc("[UWS] WaterRaindropsIME - Raindrops") { Height = (int)((float)Screen.height * this.Resolution), Width = (int)((float)Screen.width * this.Resolution), Format = RenderTextureFormat.RFloat, Filter = FilterMode.Bilinear }; this._Target = desc.CreateRenderTexture(); this._Target.Clear(false, true); }
private void RenderStaticDepthTexture() { if (!this._EnableStaticCalculations) { if (this._StaticDepth != null) { this._StaticDepth.Release(); this._StaticDepth = null; } return; } if (this._DepthCamera.IsNullReference(this)) { return; } if (this._StaticDepth == null) { TextureUtility.RenderTextureDesc desc = new TextureUtility.RenderTextureDesc("[UWS] - Static Depth") { Width = this._StaticWidth, Height = this._StaticHeight, Depth = 24, Format = RenderTextureFormat.RFloat, Filter = FilterMode.Point }; this._StaticDepth = desc.CreateRenderTexture(); this._StaticDepth.Clear(Color.clear, false, true); } float y = this._DepthCamera.transform.localPosition.y; float nearClipPlane = this._DepthCamera.nearClipPlane; float farClipPlane = this._DepthCamera.farClipPlane; WaterSimulationArea.SetDepthCameraParameters(ref this._DepthCamera, 40f, 0f, 80f); this._DepthCamera.cullingMask = WaterQualitySettings.Instance.Ripples.StaticDepthMask; this._DepthCamera.targetTexture = this._StaticDepth; this._DepthCamera.SetReplacementShader(ShaderUtility.Instance.Get(ShaderList.Depth), string.Empty); this._DepthCamera.Render(); WaterSimulationArea.SetDepthCameraParameters(ref this._DepthCamera, y, nearClipPlane, farClipPlane); RipplesShader.SetStaticDepth(this._StaticDepth, this._RipplesMaterial); }