Beispiel #1
0
    public void RenderDepth()
    {
        if (_GenerateDepth)
        {
            Profiler.BeginSample("FogVolume Depth");
            //Gimme scene depth
            // ThisCamera.cullingMask = ~(1 << LayerMask.NameToLayer("FogVolume"));//hide FogVolume
            ThisCamera.cullingMask = SceneCamera.cullingMask;//Render the same than scene camera

            Get_RT_Depth(ref RT_Depth, new int2(screenX, screenY), "RT_Depth");

            _CameraRender.targetTexture = RT_Depth;
            _CameraRender.CameraShader  = depthShader;
            _CameraRender.Render();

            Shader.SetGlobalTexture("RT_Depth", _CameraRender.targetTexture);
            _CameraRender.CameraShader = null;

            Profiler.EndSample();
        }
        else
        {
            Shader.SetGlobalTexture("RT_Depth", nullTex);
        }
    }
Beispiel #2
0
    public void ConvolveFogVolume()
    {
        if (UniformFogCameraGO == null)
        {
            CreateUniformFogCamera();
        }

        int2 resolution = new int2(screenX, screenY);

        GetRT(ref RT_FogVolumeConvolution, resolution, "RT_FogVolumeConvolution");
        _CameraRender.targetTexture = RT_FogVolumeConvolution;
        _CameraRender.Render();
        Shader.SetGlobalTexture("RT_FogVolumeConvolution", RT_FogVolumeConvolution);
    }