private float GetBlurNormalizer(LensFlareBlurSamples blurSamples) { float normMult = 0.0f; if (blurSamples == LensFlareBlurSamples.Off) { normMult = 1.0f; } else if (blurSamples == LensFlareBlurSamples.x4) { normMult = 1.0f / 4.0f; } else if (blurSamples == LensFlareBlurSamples.x8) { normMult = 1.0f / 8.0f; } return(normMult); }
private float GetBlurNormalizer(LensFlareBlurSamples blurSamples) { float result = 0f; if (blurSamples == LensFlareBlurSamples.Off) { result = 1f; } else if (blurSamples == LensFlareBlurSamples.x4) { result = 0.25f; } else if (blurSamples == LensFlareBlurSamples.x8) { result = 0.125f; } return(result); }
public void HexagonalBlur(RenderTexture lensFlareTex, LensFlareBlurSamples blurSamples) { if (blurSamples == LensFlareBlurSamples.Off) { return; } int blurPass1ID = blurSamples == LensFlareBlurSamples.x4 ? 0 : 1; int blurPass2ID = blurSamples == LensFlareBlurSamples.x4 ? 2 : 3; RenderTexture blurTarget0 = RenderTexture.GetTemporary(lensFlareTex.width, lensFlareTex.height, 0, lensFlareTex.format, RenderTextureReadWrite.Linear); RenderTexture blurTarget1 = RenderTexture.GetTemporary(lensFlareTex.width, lensFlareTex.height, 0, lensFlareTex.format, RenderTextureReadWrite.Linear); lensFlareTex.filterMode = FilterMode.Bilinear; blurTarget0.filterMode = FilterMode.Bilinear; blurTarget1.filterMode = FilterMode.Bilinear; targetBuffers[0] = blurTarget0.colorBuffer; targetBuffers[1] = blurTarget1.colorBuffer; Graphics.SetRenderTarget(targetBuffers, blurTarget0.depthBuffer); m_lensFlareMat.SetTexture("_MainTex", lensFlareTex); ScionGraphics.Blit(m_lensFlareMat, blurPass1ID); m_lensFlareMat.SetTexture("_BlurTexture1", blurTarget1); Graphics.Blit(blurTarget0, lensFlareTex, m_lensFlareMat, blurPass2ID); //Graphics.Blit(blurTarget0, lensFlareTex); //ScionPostProcessBase.ActiveDebug.RegisterTextureForVisualization(blurTarget0, false); RenderTexture.ReleaseTemporary(blurTarget0); RenderTexture.ReleaseTemporary(blurTarget1); // uniform sampler2D _BlurTexture1; // // // First blur pass. // // texture0 - output of CalculateCoCSize // BlurOutput BlurPass1(v2f i) // // texture0 - SV_Target0 from BlurPass1 // // texture1 - SV_Target1 from BlurPass1 // float4 BlurPass2(v2f i) : SV_Target0 }
public void HexagonalBlur(RenderTexture lensFlareTex, LensFlareBlurSamples blurSamples) { if (blurSamples == LensFlareBlurSamples.Off) return; int blurPass1ID = blurSamples == LensFlareBlurSamples.x4 ? 0 : 1; int blurPass2ID = blurSamples == LensFlareBlurSamples.x4 ? 2 : 3; RenderTexture blurTarget0 = RenderTexture.GetTemporary(lensFlareTex.width, lensFlareTex.height, 0, lensFlareTex.format, RenderTextureReadWrite.Linear); RenderTexture blurTarget1 = RenderTexture.GetTemporary(lensFlareTex.width, lensFlareTex.height, 0, lensFlareTex.format, RenderTextureReadWrite.Linear); lensFlareTex.filterMode = FilterMode.Bilinear; blurTarget0.filterMode = FilterMode.Bilinear; blurTarget1.filterMode = FilterMode.Bilinear; targetBuffers[0] = blurTarget0.colorBuffer; targetBuffers[1] = blurTarget1.colorBuffer; Graphics.SetRenderTarget(targetBuffers, blurTarget0.depthBuffer); m_lensFlareMat.SetTexture("_MainTex", lensFlareTex); ScionGraphics.Blit(m_lensFlareMat, blurPass1ID); m_lensFlareMat.SetTexture("_BlurTexture1", blurTarget1); Graphics.Blit(blurTarget0, lensFlareTex, m_lensFlareMat, blurPass2ID); //Graphics.Blit(blurTarget0, lensFlareTex); //ScionPostProcessBase.ActiveDebug.RegisterTextureForVisualization(blurTarget0, false); RenderTexture.ReleaseTemporary(blurTarget0); RenderTexture.ReleaseTemporary(blurTarget1); // uniform sampler2D _BlurTexture1; // // // First blur pass. // // texture0 - output of CalculateCoCSize // BlurOutput BlurPass1(v2f i) // // texture0 - SV_Target0 from BlurPass1 // // texture1 - SV_Target1 from BlurPass1 // float4 BlurPass2(v2f i) : SV_Target0 }
public void HexagonalBlur(RenderTexture lensFlareTex, LensFlareBlurSamples blurSamples) { if (blurSamples == LensFlareBlurSamples.Off) { return; } int passNr = (blurSamples != LensFlareBlurSamples.x4) ? 1 : 0; int pass = (blurSamples != LensFlareBlurSamples.x4) ? 3 : 2; RenderTexture temporary = RenderTexture.GetTemporary(lensFlareTex.width, lensFlareTex.height, 0, lensFlareTex.format, RenderTextureReadWrite.Linear); RenderTexture temporary2 = RenderTexture.GetTemporary(lensFlareTex.width, lensFlareTex.height, 0, lensFlareTex.format, RenderTextureReadWrite.Linear); lensFlareTex.filterMode = FilterMode.Bilinear; temporary.filterMode = FilterMode.Bilinear; temporary2.filterMode = FilterMode.Bilinear; this.targetBuffers[0] = temporary.colorBuffer; this.targetBuffers[1] = temporary2.colorBuffer; Graphics.SetRenderTarget(this.targetBuffers, temporary.depthBuffer); this.m_lensFlareMat.SetTexture("_MainTex", lensFlareTex); ScionGraphics.Blit(this.m_lensFlareMat, passNr); this.m_lensFlareMat.SetTexture("_BlurTexture1", temporary2); Graphics.Blit(temporary, lensFlareTex, this.m_lensFlareMat, pass); RenderTexture.ReleaseTemporary(temporary); RenderTexture.ReleaseTemporary(temporary2); }
private float GetBlurNormalizer(LensFlareBlurSamples blurSamples) { float normMult = 0.0f; if (blurSamples == LensFlareBlurSamples.Off) normMult = 1.0f; else if (blurSamples == LensFlareBlurSamples.x4) normMult = 1.0f / 4.0f; else if (blurSamples == LensFlareBlurSamples.x8) normMult = 1.0f / 8.0f; return normMult; }