Exemplo n.º 1
0
        void AllocRT(float scaleFactor)
        {
            m_AmbientOcclusionTex = RTHandles.Alloc(Vector2.one, TextureXR.slices, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R8_UNorm, dimension: TextureXR.dimension, useDynamicScale: true, enableRandomWrite: true, name: "Ambient Occlusion");
            m_PackedDataTex       = RTHandles.Alloc(Vector2.one * scaleFactor, TextureXR.slices, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R32_SFloat, dimension: TextureXR.dimension, useDynamicScale: true, enableRandomWrite: true, name: "AO Packed data");
            m_PackedDataBlurred   = RTHandles.Alloc(Vector2.one * scaleFactor, TextureXR.slices, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R32_SFloat, dimension: TextureXR.dimension, useDynamicScale: true, enableRandomWrite: true, name: "AO Packed blurred data");

            m_FinalHalfRes = RTHandles.Alloc(Vector2.one * 0.5f, TextureXR.slices, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R32_SFloat, dimension: TextureXR.dimension, useDynamicScale: true, enableRandomWrite: true, name: "Final Half Res AO Packed");
        }
Exemplo n.º 2
0
        void ScreenSpaceShadowInitializeNonRenderGraphResources()
        {
            // Allocate the final result texture
            int            numShadowTextures = Math.Max((int)Math.Ceiling(m_Asset.currentPlatformRenderPipelineSettings.hdShadowInitParams.maxScreenSpaceShadowSlots / 4.0f), 1);
            GraphicsFormat graphicsFormat    = (GraphicsFormat)m_Asset.currentPlatformRenderPipelineSettings.hdShadowInitParams.screenSpaceShadowBufferFormat;

            m_ScreenSpaceShadowTextureArray = RTHandles.Alloc(Vector2.one, slices: numShadowTextures * TextureXR.slices, dimension: TextureDimension.Tex2DArray, filterMode: FilterMode.Point, colorFormat: graphicsFormat, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: "AreaShadowArrayBuffer");
        }
Exemplo n.º 3
0
 protected override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd)
 {
     halfResTarget = RTHandles.Alloc(
         Vector2.one * 0.5f, TextureXR.slices, dimension: TextureXR.dimension,
         colorFormat: GraphicsFormat.B10G11R11_UFloatPack32, // We don't need alpha for this effect
         useDynamicScale: true, name: "Half Res Custom Pass"
         );
 }
Exemplo n.º 4
0
 public HDShadowAtlas(int width, int height, Material clearMaterial, FilterMode filterMode = FilterMode.Bilinear, DepthBits depthBufferBits = DepthBits.Depth16, RenderTextureFormat format = RenderTextureFormat.Shadowmap, string name = "")
 {
     m_Atlas         = RTHandles.Alloc(width, height, filterMode: filterMode, depthBufferBits: depthBufferBits, sRGB: false, colorFormat: format, name: name);
     m_Width         = width;
     m_Height        = height;
     identifier      = new RenderTargetIdentifier(m_Atlas);
     m_ClearMaterial = clearMaterial;
 }
Exemplo n.º 5
0
        public void InitSharedBuffers(GBufferManager gbufferManager, RenderPipelineSettings settings, RenderPipelineResources resources)
        {
            // Set the flags
            m_MSAASupported      = settings.supportMSAA;
            m_MSAASamples        = m_MSAASupported ? settings.msaaSampleCount : MSAASamples.None;
            m_VelocitySupport    = settings.supportMotionVectors;
            m_ReuseGBufferMemory = settings.supportedLitShaderMode != RenderPipelineSettings.SupportedLitShaderMode.ForwardOnly;

            // Create the depth/stencil buffer
            m_CameraDepthStencilBuffer = RTHandles.Alloc(Vector2.one, depthBufferBits: DepthBits.Depth32, colorFormat: RenderTextureFormat.Depth, filterMode: FilterMode.Point, name: "CameraDepthStencil");

            // Create the mip chain buffer
            m_CameraDepthBufferMipChainInfo = new HDUtils.PackedMipChainInfo();
            m_CameraDepthBufferMipChainInfo.Allocate();
            m_CameraDepthBufferMipChain = RTHandles.Alloc(ComputeDepthBufferMipChainSize, colorFormat: RenderTextureFormat.RFloat, filterMode: FilterMode.Point, sRGB: false, enableRandomWrite: true, name: "CameraDepthBufferMipChain");

            // Technically we won't need this buffer in some cases, but nothing that we can determine at init time.
            m_CameraStencilBufferCopy = RTHandles.Alloc(Vector2.one, depthBufferBits: DepthBits.None, colorFormat: RenderTextureFormat.R8, sRGB: false, filterMode: FilterMode.Point, enableRandomWrite: true, name: "CameraStencilCopy"); // DXGI_FORMAT_R8_UINT is not supported by Unity

            if (m_VelocitySupport)
            {
                m_VelocityRT = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: Builtin.GetVelocityBufferFormat(), sRGB: Builtin.GetVelocityBufferSRGBFlag(), name: "Velocity");
                if (m_MSAASupported)
                {
                    m_VelocityMSAART = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: Builtin.GetVelocityBufferFormat(), sRGB: Builtin.GetVelocityBufferSRGBFlag(), enableMSAA: true, bindTextureMS: true, name: "VelocityMSAA");
                }
            }

            // Allocate the additional textures only if MSAA is supported
            if (m_MSAASupported)
            {
                // Let's create the MSAA textures
                m_CameraDepthStencilMSAABuffer = RTHandles.Alloc(Vector2.one, depthBufferBits: DepthBits.Depth24, colorFormat: RenderTextureFormat.Depth, filterMode: FilterMode.Point, bindTextureMS: true, enableMSAA: true, name: "CameraDepthStencilMSAA");
                m_CameraDepthValuesBuffer      = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: RenderTextureFormat.ARGBFloat, sRGB: false, name: "DepthValuesBuffer");
                m_DepthAsColorMSAART           = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: RenderTextureFormat.RFloat, sRGB: false, bindTextureMS: true, enableMSAA: true, name: "DepthAsColorMSAA");

                // We need to allocate this texture as long as msaa is supported because on both mode, one of the cameras can be forward only using the framesettings
                m_NormalMSAART = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: RenderTextureFormat.ARGB32, sRGB: false, enableMSAA: true, bindTextureMS: true, name: "NormalBufferMSAA");

                // Create the required resolve materials
                m_DepthResolveMaterial = CoreUtils.CreateEngineMaterial(resources.shaders.depthValuesPS);
                m_ColorResolveMaterial = CoreUtils.CreateEngineMaterial(resources.shaders.colorResolvePS);
            }

            // If we are in the forward only mode
            if (!m_ReuseGBufferMemory)
            {
                // In case of full forward we must allocate the render target for normal buffer (or reuse one already existing)
                // TODO: Provide a way to reuse a render target
                m_NormalRT = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: RenderTextureFormat.ARGB32, sRGB: false, enableRandomWrite: true, name: "NormalBuffer");
            }
            else
            {
                // When not forward only we should are using the normal buffer of the gbuffer
                // In case of deferred, we must be in sync with NormalBuffer.hlsl and lit.hlsl files and setup the correct buffers
                m_NormalRT = gbufferManager.GetNormalBuffer(0); // Normal + Roughness
            }
        }
Exemplo n.º 6
0
 public override void Setup()
 {
     if (Shader.Find("Hidden/Shader/LowResolution_RLPRO") != null)
     {
         m_Material = new Material(Shader.Find("Hidden/Shader/LowResolution_RLPRO"));
     }
     lowresTexture  = RTHandles.Alloc(Vector2.one * downscale.value, TextureXR.slices, colorFormat: GraphicsFormat.B10G11R11_UFloatPack32, dimension: TextureDimension.Tex2DArray, enableRandomWrite: true, useDynamicScale: true, name: "lowresTexture");
     highresTexture = RTHandles.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.B10G11R11_UFloatPack32, dimension: TextureDimension.Tex2DArray, enableRandomWrite: true, useDynamicScale: true, name: "highresTexture");
 }
Exemplo n.º 7
0
        public VTBufferManager(HDRenderPipelineAsset asset)
        {
            m_DownSampleCS         = asset.renderPipelineResources.shaders.VTFeedbackDownsample;
            m_DownsampleKernel     = m_DownSampleCS.FindKernel("KMain");
            m_DownsampleKernelMSAA = m_DownSampleCS.FindKernel("KMainMSAA");

            // This texture needs to be persistent because we do async gpu readback on it.
            m_LowresResolver = RTHandles.Alloc(m_ResolverScale, colorFormat: GraphicsFormat.R8G8B8A8_UNorm, enableRandomWrite: true, autoGenerateMips: false, name: "VTFeedback lowres");
        }
Exemplo n.º 8
0
 public override void Setup()
 {
     if (Shader.Find("Hidden/Shader/ColormapPaletteEffect_RLPRO") != null)
     {
         m_Material = new Material(Shader.Find("Hidden/Shader/ColormapPaletteEffect_RLPRO"));
     }
     lowresTexture = RTHandles.Alloc(Vector2.one / pixelSize.value, TextureXR.slices, colorFormat: GraphicsFormat.B10G11R11_UFloatPack32, dimension: TextureDimension.Tex2DArray, enableRandomWrite: true, useDynamicScale: true, name: "lowresTexture");
     m_Init        = true;
 }
            internal ScreenSpaceAmbientOcclusionPass()
            {
                m_CurrentSettings = new ScreenSpaceAmbientOcclusionSettings();

                m_SSAOTexture1     = RTHandles.Alloc(new RenderTargetIdentifier(s_SSAOTexture1ID, 0, CubemapFace.Unknown, -1), "_SSAO_OcclusionTexture1");
                m_SSAOTexture2     = RTHandles.Alloc(new RenderTargetIdentifier(s_SSAOTexture2ID, 0, CubemapFace.Unknown, -1), "_SSAO_OcclusionTexture2");
                m_SSAOTexture3     = RTHandles.Alloc(new RenderTargetIdentifier(s_SSAOTexture3ID, 0, CubemapFace.Unknown, -1), "_SSAO_OcclusionTexture3");
                m_SSAOTextureFinal = RTHandles.Alloc(new RenderTargetIdentifier(s_SSAOTextureFinalID, 0, CubemapFace.Unknown, -1), "_SSAO_OcclusionTexture");
            }
Exemplo n.º 10
0
		private void SetupPPTempBuffer(CustomPassContext ctx)
		{
			if (_postProcessTempBuffer == null)
				_postProcessTempBuffer = RTHandles.Alloc(
														 scaleFactor: Vector2.one,
														 colorFormat: ctx.cameraColorBuffer.rt.graphicsFormat,
														 filterMode: ctx.cameraColorBuffer.rt.filterMode,
														 name: "JTRP PP Temp");
		}
Exemplo n.º 11
0
 public override void Setup()
 {
     if (Shader.Find("Hidden/Shader/NoiseEffects_RLPRO") != null)
     {
         m_Material = new Material(Shader.Find("Hidden/Shader/NoiseEffects_RLPRO"));
     }
     texTape = RTHandles.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.B10G11R11_UFloatPack32, dimension: TextureDimension.Tex2DArray, enableRandomWrite: true, useDynamicScale: true, name: "texLast");
     stop    = false;
 }
        public void Init(HDRenderPipelineRayTracingResources rpRTResources, SharedRTManager sharedRTManager)
        {
            m_SimpleDenoiserCS = rpRTResources.simpleDenoiserCS;

            m_SharedRTManager = sharedRTManager;

            m_IntermediateBuffer0 = RTHandles.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.R16_SFloat, dimension: TextureXR.dimension, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, autoGenerateMips: false, name: "IntermediateBuffer0");
            m_IntermediateBuffer1 = RTHandles.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.R16_SFloat, dimension: TextureXR.dimension, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, autoGenerateMips: false, name: "IntermediateBuffer1");
        }
Exemplo n.º 13
0
    RTHandle RTAllocator(AOVBuffers bufferID)
    {
        if (bufferID == AOVBuffers.Color)
        {
            return(rtColor ?? (rtColor = RTHandles.Alloc(diffuse.width, diffuse.height, 1, DepthBits.None, GraphicsFormat.R8G8B8A8_SRGB)));
        }

        return(null);
    }
Exemplo n.º 14
0
 void InitRecursiveRenderer()
 {
     m_RaytracingFlagStateBlock = new RenderStateBlock
     {
         depthState = new DepthState(false, CompareFunction.LessEqual),
         mask       = RenderStateMask.Depth
     };
     m_FlagMaskTextureRT = RTHandles.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.R8_SNorm, dimension: TextureXR.dimension, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: "FlagMaskTexture");
 }
Exemplo n.º 15
0
        public override void Setup()
        {
            Debug.Log("Setup");

            // Load assets from Resources folder
            _nnModels = new NNModel[]
            {
                Resources.Load <NNModel>("adele_2"),
                Resources.Load <NNModel>("model_32channels")
            };

            Debug.Assert(Enum.GetNames(typeof(ModelType)).Length == _nnModels.Length);
            Debug.Assert(_nnModels.All(m => m != null));

            ComputeInfo.channelsOrder = ComputeInfo.ChannelsOrder.NCHW;

            // Compile the model asset into an object oriented representation
            _model = ModelLoader.Load(_nnModels[(int)modelType.value], debugModelLoading.value);

            float scale = 1;             //inputResolution.value.y / (float)Screen.height;

            _rtHandle = RTHandles.Alloc(
                colorFormat: GraphicsFormat.R16G16B16A16_UNorm,
                scaleFactor: Vector2.one * scale,
                wrapMode: TextureWrapMode.Clamp,
                enableRandomWrite: true
                );
            _rtHandlePregamma = RTHandles.Alloc(
                colorFormat: GraphicsFormat.R16G16B16A16_UNorm,
                scaleFactor: Vector2.one * scale,
                wrapMode: TextureWrapMode.Clamp,
                enableRandomWrite: true
                );
            _rtHandlePostgamma = RTHandles.Alloc(
                colorFormat: GraphicsFormat.R16G16B16A16_UNorm,
                scaleFactor: Vector2.one * scale,
                wrapMode: TextureWrapMode.Clamp,
                enableRandomWrite: true
                );
            _rtHandleStyle = RTHandles.Alloc(
                256, 256,
                colorFormat: GraphicsFormat.R16G16B16A16_SFloat,
                wrapMode: TextureWrapMode.Clamp,
                enableRandomWrite: true
                );

            _pregammaMat = new Material(Shader.Find("Barracuda/Activation"));
            _pregammaMat.EnableKeyword("Pow");
            _pregammaMat.EnableKeyword("BATCHTILLING_ON");
            _postgammaMat = new Material(_pregammaMat);
            _postgammaMat.CopyPropertiesFromMaterial(_pregammaMat);

            //Prepare style transfer prediction and runtime worker at load time (to avoid memory allocation at runtime)
            PrepareStylePrediction();
            CreateBarracudaWorker();
        }
Exemplo n.º 16
0
        void AllocateRenderTexture()
        {
            if (m_Atlas != null)
            {
                m_Atlas.Release();
            }

            m_Atlas    = RTHandles.Alloc(width, height, filterMode: m_FilterMode, depthBufferBits: m_DepthBufferBits, sRGB: false, colorFormat: m_Format, name: m_Name);
            identifier = new RenderTargetIdentifier(m_Atlas);
        }
Exemplo n.º 17
0
 public void CreateBuffers(RenderPipelineSettings settings)
 {
     FeedbackBuffer = RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GraphicsFormat.R8G8B8A8_UNorm, useDynamicScale: true, name: "VTFeedbackForward");
     if (settings.supportMSAA)
     {
         // Our processing handles both MSAA and regular buffers so we don't need to explicitly resolve here saving a buffer
         FeedbackBufferMsaa = RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GraphicsFormat.R8G8B8A8_UNorm, bindTextureMS: true,
                                              enableMSAA: settings.supportMSAA, useDynamicScale: true, name: "VTFeedbackForwardMSAA");
     }
 }
    public RTHandle GetNewRTHandle(HDCamera camera)
    {
        var width  = camera.actualWidth;
        var height = camera.actualHeight;
        const GraphicsFormat RTFormat = GraphicsFormat.R16G16B16A16_SFloat;
        var rt = RTHandles.Alloc(scaleFactor: Vector2.one, colorFormat: RTFormat);// RTHandles.Alloc(width, height,  colorFormat: RTFormat);

        // rtHandles.Add(rt);
        return(rt);
    }
Exemplo n.º 19
0
 public override void Setup()
 {
     if (Shader.Find("Hidden/Shader/Glitch2Effect_RLPRO") != null)
     {
         m_Material = new Material(Shader.Find("Hidden/Shader/Glitch2Effect_RLPRO"));
     }
     _trashFrame1 = RTHandles.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.B10G11R11_UFloatPack32, dimension: TextureDimension.Tex2DArray, enableRandomWrite: true, useDynamicScale: true, name: "_trashFrame1");
     _trashFrame2 = RTHandles.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.B10G11R11_UFloatPack32, dimension: TextureDimension.Tex2DArray, enableRandomWrite: true, useDynamicScale: true, name: "_trashFrame2");
     SetUpResources(resolutionMultiplier.value);
 }
 public void Init(RenderPipelineResources renderPipelineResources)
 {
     m_Blit            = CoreUtils.CreateEngineMaterial(renderPipelineResources.shaders.blitPS);
     m_DrawRayCount    = CoreUtils.CreateEngineMaterial(renderPipelineResources.shaders.debugViewRayCountPS);
     m_RayCountCompute = renderPipelineResources.shaders.countTracedRays;
     s_DebugFontTex    = renderPipelineResources.textures.debugFontTex;
     // UINT textures must use UINT32, since groupshared uint used to synchronize counts is allocated as a UINT32
     m_RayCountTex         = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R32G32B32A32_UInt, enableRandomWrite: true, useMipMap: false, name: "RayCountTex");
     s_TotalRayCountBuffer = new ComputeBuffer(3, sizeof(uint));
 }
Exemplo n.º 21
0
 public void InitializeNonRenderGraphResources()
 {
     m_LightCountBuffer         = RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GraphicsFormat.R32_SFloat, enableRandomWrite: false, useMipMap: false, name: "LightVolumeCount");
     m_ColorAccumulationBuffer  = RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, enableRandomWrite: false, useMipMap: false, name: "LightVolumeColorAccumulation");
     m_DebugLightVolumesTexture = RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, enableRandomWrite: true, useMipMap: false, name: "LightVolumeDebugLightVolumesTexture");
     m_DepthBuffer = RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, depthBufferBits: DepthBits.None, colorFormat: GraphicsFormat.R8_UNorm, name: "LightVolumeDepth");
     // Fill the render target array
     m_RTIDs[0] = m_LightCountBuffer;
     m_RTIDs[1] = m_ColorAccumulationBuffer;
 }
Exemplo n.º 22
0
        public void RebuildTextures(int resolution)
        {
            bool updateNeeded = m_SkyboxCubemapRT == null || (m_SkyboxCubemapRT.rt.width != resolution);

            // Cleanup first if needed
            if (updateNeeded)
            {
                RTHandles.Release(m_SkyboxCubemapRT);
                RTHandles.Release(m_SkyboxGGXCubemapRT);

                m_SkyboxCubemapRT    = null;
                m_SkyboxGGXCubemapRT = null;
            }

            if (!m_SupportsMIS && (m_SkyboxConditionalCdfRT != null))
            {
                RTHandles.Release(m_SkyboxConditionalCdfRT);
                RTHandles.Release(m_SkyboxMarginalRowCdfRT);

                m_SkyboxConditionalCdfRT = null;
                m_SkyboxMarginalRowCdfRT = null;
            }

            // Reallocate everything
            if (m_SkyboxCubemapRT == null)
            {
                m_SkyboxCubemapRT = RTHandles.Alloc(resolution, resolution, colorFormat: RenderTextureFormat.ARGBHalf, sRGB: false, dimension: TextureDimension.Cube, useMipMap: true, autoGenerateMips: false, filterMode: FilterMode.Trilinear, name: "SkyboxCubemap");
            }

            if (m_SkyboxGGXCubemapRT == null && m_SupportsConvolution)
            {
                m_SkyboxGGXCubemapRT = RTHandles.Alloc(resolution, resolution, colorFormat: RenderTextureFormat.ARGBHalf, sRGB: false, dimension: TextureDimension.Cube, useMipMap: true, autoGenerateMips: false, filterMode: FilterMode.Trilinear, name: "SkyboxGGXCubemap");
            }

            if (m_SupportsMIS && (m_SkyboxConditionalCdfRT == null))
            {
                // Temporary, it should be dependent on the sky resolution
                int width  = (int)LightSamplingParameters.TextureWidth;
                int height = (int)LightSamplingParameters.TextureHeight;

                // + 1 because we store the value of the integral of the cubemap at the end of the texture.
                m_SkyboxMarginalRowCdfRT = RTHandles.Alloc(height + 1, 1, colorFormat: RenderTextureFormat.RFloat, sRGB: false, useMipMap: false, enableRandomWrite: true, filterMode: FilterMode.Point, name: "SkyboxMarginalRowCdf");

                // TODO: switch the format to R16 (once it's available) to save some bandwidth.
                m_SkyboxMarginalRowCdfRT = RTHandles.Alloc(width, height, colorFormat: RenderTextureFormat.RFloat, sRGB: false, useMipMap: false, enableRandomWrite: true, filterMode: FilterMode.Point, name: "SkyboxMarginalRowCdf");
            }

            m_CubemapScreenSize = new Vector4((float)resolution, (float)resolution, 1.0f / (float)resolution, 1.0f / (float)resolution);

            if (updateNeeded)
            {
                m_NeedUpdate = true; // Special case. Even if update mode is set to OnDemand, we need to regenerate the environment after destroying the texture.
                RebuildSkyMatrices(resolution);
            }
        }
            RTHandle[] m_InScatteredRadianceTables; // Air SS, Aerosol SS, Atmosphere MS, Atmosphere one order, Temp

            RTHandle AllocateGroundIrradianceTable(int index)
            {
                var table = RTHandles.Alloc((int)PbrSkyConfig.GroundIrradianceTableSize, 1,
                                            colorFormat: s_ColorFormat,
                                            enableRandomWrite: true,
                                            name: string.Format("GroundIrradianceTable{0}", index));

                Debug.Assert(table != null);

                return(table);
            }
Exemplo n.º 24
0
        public void Init(HDRenderPipelineRayTracingResources rpRTResources, SharedRTManager sharedRTManager)
        {
            // Keep track of the resources
            m_TemporalFilterCS = rpRTResources.temporalFilterCS;

            // Keep track of the shared rt manager
            m_SharedRTManager = sharedRTManager;

            // Allocate the temporary buffers
            m_ValidationBuffer = RTHandles.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.R8_UInt, dimension: TextureXR.dimension, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, autoGenerateMips: false, name: "ValidationBuffer");
        }
Exemplo n.º 25
0
        void InitRaytracingDeferred()
        {
            m_RayBinResult     = new ComputeBuffer(1, sizeof(uint));
            m_RayBinSizeResult = new ComputeBuffer(1, sizeof(uint));

            m_RaytracingDirectionBuffer = RTHandles.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, dimension: TextureXR.dimension, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: "RaytracingDirectionBuffer");
            m_RaytracingDistanceBuffer  = RTHandles.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.R32_SFloat, dimension: TextureXR.dimension, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: "RaytracingDistanceBuffer");

            m_RaytracingGBufferManager = new GBufferManager(asset, m_DeferredMaterial);
            m_RaytracingGBufferManager.CreateBuffers();
        }
Exemplo n.º 26
0
    // It can be used to configure render targets and their clear state. Also to create temporary render target textures.
    // When empty this render pass will render to the active camera render target.
    // You should never call CommandBuffer.SetRenderTarget. Instead call <c>ConfigureTarget</c> and <c>ConfigureClear</c>.
    // The render pipeline will ensure target setup and clearing happens in an performance manner.
    protected override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd)
    {
        fullscreenMaterial  = CoreUtils.CreateEngineMaterial("FullScreen/EdgeDetection");
        edgeDetectionBuffer = RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, useDynamicScale: true, name: "EdgeDetection Buffer");

        compositingPass   = fullscreenMaterial.FindPass("Compositing");
        copyPass          = fullscreenMaterial.FindPass("Copy");
        targetColorBuffer = TargetBuffer.Custom;
        targetDepthBuffer = TargetBuffer.Custom;
        clearFlags        = ClearFlag.All;
    }
Exemplo n.º 27
0
    protected override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd)
    {
        outlineShader     = Shader.Find("Hidden/Outline");
        fullscreenOutline = CoreUtils.CreateEngineMaterial(outlineShader);

        outlineBuffer = RTHandles.Alloc(
            Vector2.one, TextureXR.slices, dimension: TextureXR.dimension,
            colorFormat: GraphicsFormat.B10G11R11_UFloatPack32, // We don't need alpha for this effect
            useDynamicScale: true, name: "Outline Buffer"
            );
    }
 public override void Setup()
 {
     if (Shader.Find("Hidden/Shader/ArtefactsEffect_RLPRO") != null)
     {
         m_Material = new Material(Shader.Find("Hidden/Shader/ArtefactsEffect_RLPRO"));
     }
     texLast      = RTHandles.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.B10G11R11_UFloatPack32, dimension: TextureDimension.Tex2DArray, enableRandomWrite: true, useDynamicScale: true, name: "texLast");
     texfeedback  = RTHandles.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.B10G11R11_UFloatPack32, dimension: TextureDimension.Tex2DArray, enableRandomWrite: true, useDynamicScale: true, name: "texfeedback");
     texfeedback2 = RTHandles.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.B10G11R11_UFloatPack32, dimension: TextureDimension.Tex2DArray, enableRandomWrite: true, useDynamicScale: true, name: "texfeedback2");
     previous     = RTHandles.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.B10G11R11_UFloatPack32, dimension: TextureDimension.Tex2DArray, enableRandomWrite: true, useDynamicScale: true, name: "previous");
 }
Exemplo n.º 29
0
        public void SetUp()
        {
            _buffer1 = RTHandles.Alloc(1024, 1024, 1,
                                       dimension: TextureXR.dimension,
                                       colorFormat: GraphicsFormat.R8G8B8A8_UNorm,

                                       useDynamicScale: false, name: "_SharedRenderTexture"
                                       );

            StaticProps.TextureId = _buffer1.rt.GetNativeTexturePtr().ToInt32();
        }
Exemplo n.º 30
0
        public void InitRecursiveRenderer()
        {
            m_RaytracingFlagTarget   = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R8_SNorm, enableRandomWrite: true, useMipMap: false, name: "RaytracingFlagTexture");
            m_DebugRaytracingTexture = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: "DebugRaytracingBuffer");

            m_RaytracingFlagStateBlock = new RenderStateBlock
            {
                depthState = new DepthState(false, CompareFunction.LessEqual),
                mask       = RenderStateMask.Depth
            };
        }