Example #1
0
        private void BlurTapPass(RenderTexture prefilteredSource, RenderTexture tiledData, RenderTexture neighbourhoodData,
                                 RenderTexture exclusionMask, RenderTexture depthCenterAverage, RenderTexture presortTexture,
                                 DepthOfFieldSamples qualityLevel, out RenderTexture tapsTexture, out RenderTexture alphaTexture)
        {
            m_DoFMat.SetTexture("_TiledData", tiledData);
            m_DoFMat.SetTexture("_TiledNeighbourhoodData", neighbourhoodData);
            m_DoFMat.SetTexture("_HalfResSourceDepthTexture", prefilteredSource);             //Actually the prefiltered half res
            m_DoFMat.SetTexture("_PresortTexture", presortTexture);

            if (exclusionMask != null)
            {
                m_DoFMat.SetTexture("_ExclusionMask", exclusionMask);
            }
            if (depthCenterAverage != null)
            {
                m_DoFMat.SetTexture("_AvgCenterDepth", depthCenterAverage);
            }
            prefilteredSource.filterMode = FilterMode.Point;

            tapsTexture            = RenderTexture.GetTemporary(prefilteredSource.width, prefilteredSource.height, 0, prefilteredSource.format);
            tapsTexture.filterMode = FilterMode.Point;
            tapsTexture.wrapMode   = TextureWrapMode.Clamp;

            alphaTexture            = RenderTexture.GetTemporary(prefilteredSource.width, prefilteredSource.height, 0, RenderTextureFormat.R8);
            alphaTexture.filterMode = FilterMode.Point;
            alphaTexture.wrapMode   = TextureWrapMode.Clamp;

            renderBuffers[0] = tapsTexture.colorBuffer;
            renderBuffers[1] = alphaTexture.colorBuffer;
            Graphics.SetRenderTarget(renderBuffers, tapsTexture.depthBuffer);

            if (qualityLevel == DepthOfFieldSamples.Normal_25)
            {
                ScionGraphics.Blit(m_DoFMat, 12);
            }
            if (qualityLevel == DepthOfFieldSamples.High_49)
            {
                ScionGraphics.Blit(m_DoFMat, 5);
            }
        }
Example #2
0
		private void BlurTapPass(RenderTexture prefilteredSource, RenderTexture tiledData, RenderTexture neighbourhoodData, 
		                         RenderTexture exclusionMask, RenderTexture depthCenterAverage, RenderTexture presortTexture, 
		                         DepthOfFieldSamples qualityLevel, out RenderTexture tapsTexture, out RenderTexture alphaTexture)
		{
			m_DoFMat.SetTexture("_TiledData", tiledData);
			m_DoFMat.SetTexture("_TiledNeighbourhoodData", neighbourhoodData);
			m_DoFMat.SetTexture("_HalfResSourceDepthTexture", prefilteredSource); //Actually the prefiltered half res
			m_DoFMat.SetTexture("_PresortTexture", presortTexture); 

			if (exclusionMask != null) 		m_DoFMat.SetTexture("_ExclusionMask", exclusionMask); 
			if (depthCenterAverage != null) m_DoFMat.SetTexture("_AvgCenterDepth", depthCenterAverage); 
			prefilteredSource.filterMode = FilterMode.Point;

			tapsTexture = RenderTexture.GetTemporary(prefilteredSource.width, prefilteredSource.height, 0, prefilteredSource.format);
			tapsTexture.filterMode = FilterMode.Point;
			tapsTexture.wrapMode = TextureWrapMode.Clamp;
			
			alphaTexture = RenderTexture.GetTemporary(prefilteredSource.width, prefilteredSource.height, 0, RenderTextureFormat.R8);
			alphaTexture.filterMode = FilterMode.Point;
			alphaTexture.wrapMode = TextureWrapMode.Clamp;

			renderBuffers[0] = tapsTexture.colorBuffer;
			renderBuffers[1] = alphaTexture.colorBuffer;
			Graphics.SetRenderTarget(renderBuffers, tapsTexture.depthBuffer);

			if (qualityLevel == DepthOfFieldSamples.Normal_25) ScionGraphics.Blit(m_DoFMat, 12);
			if (qualityLevel == DepthOfFieldSamples.High_49) ScionGraphics.Blit(m_DoFMat, 5);
		}