public override void PreProcess(RenderTexture source, RenderTexture destination) { if (material == null) { CreateMaterial(); } if (material != null)// && mGlowEnable) { if (EarlyOutIfNotSupported(source, destination)) { return; } TimeX += Time.deltaTime; if (TimeX > 100) { TimeX = 0; } RenderTexture Camera2tex = RenderTexturePool.Get(Screen.width, Screen.height, 24); if (Camera2 != null) { Camera2.targetTexture = Camera2tex; material.SetTexture("_MainTex2", Camera2tex); } material.SetFloat("_TimeX", TimeX); material.SetFloat("_Value", BlendFX); material.SetFloat("_Value2", SwitchCameraToCamera2); material.SetVector("_ScreenResolution", new Vector4(Screen.width, Screen.height, 0.0f, 0.0f)); Graphics.Blit(source, destination, material); RenderTexturePool.Release(Camera2tex); } }
void OnRenderImage(RenderTexture source, RenderTexture destination) { RenderTexture buffer0 = RenderTexturePool.Get(Screen.width, Screen.height); Graphics.Blit(source, buffer0); foreach (var p in peblist) { if (!p.IsApply) { continue; } if (!p.IsInitialized) { p.OnEnable(); continue; } RenderTexture buffer1 = RenderTexturePool.Get(Screen.width, Screen.height); p.PreProcess(buffer0, buffer1); RenderTexturePool.Release(buffer0); buffer0 = buffer1; } Graphics.Blit(buffer0, destination); RenderTexturePool.Release(buffer0); }
public override void PreProcess(RenderTexture source, RenderTexture destination) { if (material == null) { CreateMaterial(); } if (material != null)// && mGlowEnable) { RenderTexture m_rtFade = RenderTexturePool.Get(Screen.width, Screen.height, 0); if (EarlyOutIfNotSupported(source, destination)) { return; } if (m_isRenderFadeTexture) { material.SetTexture("_FadeoutTexture", m_rtFade); material.SetFloat("_FadeoutFactor", m_currentFadeFactor); Graphics.Blit(source, destination, material); } else { Graphics.Blit(source, m_rtFade); Graphics.Blit(source, destination); m_isRenderFadeTexture = true; } RenderTexturePool.Release(m_rtFade); } }
public override void PreProcess(RenderTexture source, RenderTexture destination) { if (material == null) { CreateMaterial(); } if (material != null) { if (EarlyOutIfNotSupported(source, destination)) { return; } RenderTexture tempRtA = RenderTexturePool.Get(Screen.width / 4, Screen.height / 4, 0, RenderTextureFormat.ARGB32); RenderTexture tempRtB = RenderTexturePool.Get(Screen.width / 4, Screen.height / 4, 0, RenderTextureFormat.ARGB32); material.SetVector(strParameter, new Vector4(blurSize, 0.0f, Threshhold, Intensity)); Graphics.Blit(source, tempRtA, material, 1); for (int i = 0; i < blurIterations; ++i) { material.SetVector(strParameter, new Vector4(blurSize + i, 0.0f, Threshhold, Intensity)); Graphics.Blit(tempRtA, tempRtB, material, 2); Graphics.Blit(tempRtB, tempRtA, material, 3); } material.SetTexture(strBloom, tempRtA); Graphics.Blit(source, destination, material, 0); RenderTexturePool.Release(tempRtA); RenderTexturePool.Release(tempRtB); } }
public override void PreProcess(RenderTexture source, RenderTexture destination) { /*RenderTexture*/ solidSilhouette = RenderTexturePool.Get(Screen.width, Screen.height); Graphics.SetRenderTarget(solidSilhouette); Graphics.ExecuteCommandBuffer(m_RenderCommand); int width = (int)(Screen.width * sample); int height = (int)(Screen.height * sample); RenderTexture mBlurSilhouette = RenderTexturePool.Get(width, height); Graphics.Blit(solidSilhouette, mBlurSilhouette); for (int i = 0; i < iteration; ++i) { RenderTexture blurTemp = RenderTexturePool.Get(width, height); float offset = spread * i + 0.5f; blurMaterial.SetVector("_Offset", new Vector4(offset / width, offset / height)); Graphics.Blit(mBlurSilhouette, blurTemp, blurMaterial); RenderTexturePool.Release(mBlurSilhouette); mBlurSilhouette = blurTemp; } material.SetTexture("_StencilMap", solidSilhouette); material.SetTexture("_BlurMap", mBlurSilhouette); material.SetFloat("_Intensity", intensity); Graphics.Blit(source, destination, material); RenderTexturePool.Release(mBlurSilhouette); RenderTexturePool.Release(solidSilhouette); }
void OnRenderImage(RenderTexture source, RenderTexture destination) { RenderTexture buffer0 = RenderTexturePool.Get(Screen.width, Screen.height); Graphics.Blit(source, buffer0); for (int i = 0; i < peblist.Count; i++) { if (!peblist[i].IsApply) { continue; } //if (peblist[i].InValidQuality()) continue; RenderTexture buffer1 = RenderTexturePool.Get(Screen.width, Screen.height); peblist[i].PreProcess(buffer0, buffer1); RenderTexturePool.Release(buffer0); buffer0 = buffer1; } Graphics.Blit(buffer0, destination); RenderTexturePool.Release(buffer0); }