Example #1
0
 RTHandle IndirectDiffuseHistoryBufferAllocatorFunction(string viewName, int frameIndex, RTHandleSystem rtHandleSystem)
 {
     return(rtHandleSystem.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, dimension: TextureXR.dimension,
                                 enableRandomWrite: true, useMipMap: false, autoGenerateMips: false,
                                 name: string.Format("IndirectDiffuseHistoryBuffer{0}", frameIndex)));
 }
Example #2
0
 static RTHandle PathTracingHistoryBufferAllocatorFunction(string viewName, int frameIndex, RTHandleSystem rtHandleSystem)
 {
     return(rtHandleSystem.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.R32G32B32A32_SFloat, dimension: TextureXR.dimension,
                                 enableRandomWrite: true, useMipMap: false, autoGenerateMips: false,
                                 name: string.Format("PathTracingHistoryBuffer{0}", frameIndex)));
 }
 static RTHandle AreaAnalyticHistoryBufferAllocatorFunction(string viewName, int frameIndex, RTHandleSystem rtHandleSystem)
 {
     return(rtHandleSystem.Alloc(Vector2.one, slices: 4 * TextureXR.slices, dimension: TextureDimension.Tex2DArray, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R16_SFloat,
                                 enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: string.Format("AreaShadowHistoryBuffer{0}", frameIndex)));
 }
 // Allocation of the second history buffer
 static RTHandle VolumetricClouds1HistoryBufferAllocatorFunction(string viewName, int frameIndex, RTHandleSystem rtHandleSystem)
 {
     return(rtHandleSystem.Alloc(Vector2.one * 0.5f, TextureXR.slices, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, dimension: TextureXR.dimension,
                                 enableRandomWrite: true, useMipMap: false, autoGenerateMips: false,
                                 name: string.Format("{0}_CloudsHistory1Buffer{1}", viewName, frameIndex)));
 }
        static RTHandle ShadowHistoryDistanceBufferAllocatorFunction(string viewName, int frameIndex, RTHandleSystem rtHandleSystem)
        {
            HDRenderPipelineAsset hdPipelineAsset = GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset;
            HDRenderPipeline      hdrp            = (RenderPipelineManager.currentPipeline as HDRenderPipeline);
            GraphicsFormat        graphicsFormat  = (GraphicsFormat)hdPipelineAsset.currentPlatformRenderPipelineSettings.hdShadowInitParams.screenSpaceShadowBufferFormat;
            int numShadowSlices = Math.Max((int)Math.Ceiling(hdrp.m_Asset.currentPlatformRenderPipelineSettings.hdShadowInitParams.maxScreenSpaceShadowSlots / 4.0f), 1);

            return(rtHandleSystem.Alloc(Vector2.one, slices: numShadowSlices *TextureXR.slices, dimension: TextureDimension.Tex2DArray, filterMode: FilterMode.Point, colorFormat: graphicsFormat,
                                        enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: string.Format("{0}_ShadowHistoryDistanceBuffer{1}", viewName, frameIndex)));
        }
Example #6
0
        // BufferedRTHandleSystem API expects an allocator function. We define it here.
        RTHandleSystem.RTHandle HistoryBufferAllocatorFunction(string viewName, int frameIndex, RTHandleSystem rtHandleSystem)
        {
            frameIndex &= 1;

            int d = ComputeVBufferSliceCount(preset);

            return(rtHandleSystem.Alloc(scaleFunc:         ComputeHistoryVBufferResolutionXY,
                                        slices:            d,
                                        dimension:         TextureDimension.Tex3D,
                                        colorFormat:       RenderTextureFormat.ARGBHalf,
                                        sRGB:              false,
                                        enableRandomWrite: true,
                                        enableMSAA:        false,
                                        /* useDynamicScale: true, // <- TODO */
                                        name: string.Format("{0}_VBufferHistory{1}", viewName, frameIndex)
                                        ));
        }
Example #7
0
 static RTHandle AmbientOcclusionHistoryBufferAllocatorFunction(string viewName, int frameIndex, RTHandleSystem rtHandleSystem)
 {
     return rtHandleSystem.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.R16G16_SFloat, dimension: TextureXR.dimension,
                                 enableRandomWrite: true, useMipMap: false, autoGenerateMips: false,
                                 name: string.Format("{0}_AmbientOcclusionHistoryBuffer{1}", viewName, frameIndex));
 }
Example #8
0
        // BufferedRTHandleSystem API expects an allocator function. We define it here.
        static RTHandleSystem.RTHandle HistoryBufferAllocatorFunction(string viewName, int frameIndex, RTHandleSystem rtHandleSystem)
        {
            frameIndex &= 1;
            var hdPipeline = (HDRenderPipeline)RenderPipelineManager.currentPipeline;

            return(rtHandleSystem.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: (GraphicsFormat)hdPipeline.currentPlatformRenderPipelineSettings.colorBufferFormat,
                                        enableRandomWrite: true, useMipMap: true, autoGenerateMips: false, xrInstancing: true,
                                        name: string.Format("CameraColorBufferMipChain{0}", frameIndex)));
        }
Example #9
0
        internal void InitializeVolumetricLightingPerCameraData(HDCamera hdCamera, int bufferCount, RTHandleSystem mainRTHandleSystem)
        {
            if (!hdCamera.frameSettings.IsEnabled(FrameSettingsField.Volumetrics))
            {
                return;
            }

            // Start with the same parameters for both frames. Then update them one by one every frame.
            var parameters = ComputeVBufferParameters(hdCamera);

            hdCamera.vBufferParams    = new VBufferParameters[2];
            hdCamera.vBufferParams[0] = parameters;
            hdCamera.vBufferParams[1] = parameters;

            hdCamera.volumetricHistoryIsValid = false;

            RTHandle HistoryBufferAllocatorFunction(string viewName, int frameIndex, RTHandleSystem rtHandleSystem)
            {
                frameIndex &= 1;

                int d = ComputeVBufferSliceCount(volumetricLightingPreset);

                Vector2Int ComputeHistoryVBufferResolutionXY(Vector2Int screenSize)
                {
                    Vector2Int resolution = ComputeVBufferResolutionXY(screenSize);
                    // Since the buffers owned by the VolumetricLightingSystem may have different lifetimes compared
                    // to those owned by the HDCamera, we need to make sure that the buffer resolution is the same
                    // (in order to share the UV scale and the UV limit).
                    // So we compute both resolution from the HDCamera RTHandleSystem and the main RTHandleSystem (passed as a parameters) and choose the biggest one.
                    Vector2Int mainRTHandleResolution = ComputeVBufferResolutionXY(rtHandleSystem.rtHandleProperties.currentRenderTargetSize);

                    resolution.x = Math.Max(resolution.x, mainRTHandleResolution.x);
                    resolution.y = Math.Max(resolution.y, mainRTHandleResolution.y);

                    return(resolution);
                }

                return(rtHandleSystem.Alloc(scaleFunc: ComputeHistoryVBufferResolutionXY,
                                            slices: d,
                                            dimension: TextureDimension.Tex3D,
                                            colorFormat: GraphicsFormat.R16G16B16A16_SFloat,
                                            enableRandomWrite: true,
                                            enableMSAA: false,
                                            /* useDynamicScale: true, // <- TODO */
                                            name: string.Format("{0}_VBufferHistory{1}", viewName, frameIndex)
                                            ));
            }

            if (bufferCount != 0)
            {
                hdCamera.AllocHistoryFrameRT((int)HDCameraFrameHistoryType.VolumetricLighting, HistoryBufferAllocatorFunction, bufferCount);
            }
        }
Example #10
0
        // BufferedRTHandleSystem API expects an allocator function. We define it here.
        static RTHandleSystem.RTHandle HistoryBufferAllocatorFunction(string viewName, int frameIndex, RTHandleSystem rtHandleSystem)
        {
            frameIndex &= 1;

            return(rtHandleSystem.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: RenderTextureFormat.ARGBHalf,
                                        sRGB: false, enableRandomWrite: true, useMipMap: true, autoGenerateMips: false,
                                        name: string.Format("CameraColorBufferMipChain{0}", frameIndex)));
        }
Example #11
0
 static RTHandleSystem.RTHandle IndirectDiffuseHistoryBufferAllocatorFunction(string viewName, int frameIndex, RTHandleSystem rtHandleSystem)
 {
     return(rtHandleSystem.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.OverrideRTGraphicsFormat(GraphicsFormat.R16G16B16A16_SFloat),
                                 enableRandomWrite: true, useMipMap: false, autoGenerateMips: false, xrInstancing: true,
                                 name: string.Format("IndirectDiffuseHistoryBuffer{0}", frameIndex)));
 }
Example #12
0
        // BufferedRTHandleSystem API expects an allocator function. We define it here.
        static RTHandleSystem.RTHandle HistoryBufferAllocatorFunction(string viewName, int frameIndex, RTHandleSystem rtHandleSystem)
        {
            frameIndex &= 1;

            return(rtHandleSystem.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R16G16B16A16_SFloat,
                                        enableRandomWrite: true, useMipMap: true, autoGenerateMips: false, xrInstancing: true,
                                        name: string.Format("CameraColorBufferMipChain{0}", frameIndex)));
        }
 // Keep constructor private
 internal RTHandle(RTHandleSystem owner)
 {
     m_Owner = owner;
 }
Example #14
0
        // BufferedRTHandleSystem API expects an allocator function. We define it here.
        RTHandleSystem.RTHandle HistoryBufferAllocatorFunction(string viewName, int frameIndex, RTHandleSystem rtHandleSystem)
        {
            frameIndex &= 1;

            int d = ComputeVBufferSliceCount(preset);

            // With stereo instancing, the VBuffer is doubled and split into 2 compartments for each eye
            if (TextureXR.useTexArray && XRGraphics.stereoRenderingMode == XRGraphics.StereoRenderingMode.SinglePassInstanced)
            {
                d = d * 2;
            }

            return(rtHandleSystem.Alloc(scaleFunc:         ComputeHistoryVBufferResolutionXY,
                                        slices:            d,
                                        dimension:         TextureDimension.Tex3D,
                                        colorFormat:       GraphicsFormat.R16G16B16A16_SFloat,
                                        enableRandomWrite: true,
                                        enableMSAA:        false,
                                        /* useDynamicScale: true, // <- TODO */
                                        name: string.Format("{0}_VBufferHistory{1}", viewName, frameIndex)
                                        ));
        }