protected override void Init(PipelineResources resources)
        {
            decalEvt.Init(resources);
            linearMat       = new Material(resources.shaders.linearDepthShader);
            linearDrawerMat = new Material(resources.shaders.linearDrawerShader);
            if (useHiZ)
            {
#if UNITY_EDITOR
                if (Application.isPlaying)
                {
#endif
                hizDepth.InitHiZ(resources);
                clusterMat = new Material(resources.shaders.clusterRenderShader);
#if UNITY_EDITOR
            }
#endif
            }
            ao         = RenderPipeline.GetEvent <AOEvents>();
            reflection = RenderPipeline.GetEvent <ReflectionEvent>();
            proper     = RenderPipeline.GetEvent <PropertySetEvent>();
        }
Esempio n. 2
0
        protected override void Init(PipelineResources resources)
        {
            proper             = RenderPipeline.GetEvent <PropertySetEvent>();
            lightingData       = RenderPipeline.GetEvent <LightingEvent>();
            reflectData        = RenderPipeline.GetEvent <ReflectionEvent>();
            lightingMat        = new Material(resources.shaders.volumetricShader);
            cameraNormalBuffer = new ComputeBuffer(3, sizeof(float3));
            blackCB            = new Cubemap(1, TextureFormat.ARGB32, false);
            blackCB.SetPixel(CubemapFace.NegativeX, 0, 0, Color.black);
            blackCB.SetPixel(CubemapFace.NegativeY, 0, 0, Color.black);
            blackCB.SetPixel(CubemapFace.NegativeZ, 0, 0, Color.black);
            blackCB.SetPixel(CubemapFace.PositiveX, 0, 0, Color.black);
            blackCB.SetPixel(CubemapFace.PositiveX, 0, 0, Color.black);
            blackCB.SetPixel(CubemapFace.PositiveX, 0, 0, Color.black);
            downSampledSize = exampleSize * (enableSuperSample ? 2 : 1);

            volumeDesc = new RenderTextureDescriptor
            {
                autoGenerateMips   = false,
                bindMS             = false,
                colorFormat        = RenderTextureFormat.ARGBHalf,
                depthBufferBits    = 0,
                dimension          = TextureDimension.Tex3D,
                enableRandomWrite  = true,
                height             = downSampledSize.y,
                width              = downSampledSize.x,
                memoryless         = RenderTextureMemoryless.None,
                msaaSamples        = 1,
                shadowSamplingMode = ShadowSamplingMode.None,
                sRGB        = false,
                useMipMap   = false,
                volumeDepth = downSampledSize.z,
                vrUsage     = VRTextureUsage.None
            };
            volumeTex            = new RenderTexture(volumeDesc);
            volumeTex.filterMode = FilterMode.Bilinear;
            volumeTex.wrapMode   = TextureWrapMode.Clamp;
            volumeTex.Create();
        }
 public void Init(PipelineResources res)
 {
     cbdrShader       = res.shaders.cbdrShader;
     copyMat          = new Material(res.shaders.copyShader);
     proper           = RenderPipeline.GetEvent <PropertySetEvent>();
     lightingEvt      = RenderPipeline.GetEvent <LightingEvent>();
     decalBuffer      = new ComputeBuffer(INITCOUNT, sizeof(DecalStrct));
     decalIndexBuffer = new ComputeBuffer(CBDRSharedData.XRES * CBDRSharedData.YRES * CBDRSharedData.ZRES * (CBDRSharedData.MAXLIGHTPERCLUSTER + 1), sizeof(int));
     decalAlbedoAtlas = new RenderTexture(new RenderTextureDescriptor
     {
         colorFormat = RenderTextureFormat.ARGB32,
         dimension   = TextureDimension.Tex2DArray,
         msaaSamples = 1,
         width       = atlasSize,
         height      = atlasSize,
         volumeDepth = max(1, textures.Length)
     });
     decalNormalAtlas = new RenderTexture(new RenderTextureDescriptor
     {
         colorFormat = RenderTextureFormat.RGHalf,
         dimension   = TextureDimension.Tex2DArray,
         msaaSamples = 1,
         width       = atlasSize,
         height      = atlasSize,
         volumeDepth = max(1, textures.Length)
     });
     for (int i = 0; i < textures.Length; ++i)
     {
         Graphics.SetRenderTarget(decalAlbedoAtlas, 0, CubemapFace.Unknown, i);
         copyMat.SetTexture(ShaderIDs._MainTex, textures[i].albedoTex);
         copyMat.SetPass(0);
         Graphics.DrawMeshNow(GraphicsUtility.mesh, Matrix4x4.identity);
         Graphics.SetRenderTarget(decalNormalAtlas, 0, CubemapFace.Unknown, i);
         copyMat.SetTexture(ShaderIDs._MainTex, textures[i].normalTex);
         copyMat.SetPass(1);
         Graphics.DrawMeshNow(GraphicsUtility.mesh, Matrix4x4.identity);
     }
     Object.DestroyImmediate(copyMat);
 }
        protected override void Init(PipelineResources resources)
        {
            decalEvt.Init(resources);
            linearMat       = new Material(resources.shaders.linearDepthShader);
            linearDrawerMat = new Material(resources.shaders.linearDrawerShader);
            motionVecMat    = new Material(resources.shaders.motionVectorShader);
            if (useHiZ)
            {
#if UNITY_EDITOR
                if (Application.isPlaying)
                {
#endif
                hizDepth.InitHiZ(resources, new Vector2(Screen.width, Screen.height));
                clusterMat = new Material(resources.shaders.clusterRenderShader);
#if UNITY_EDITOR
            }
#endif
            }
            ao            = RenderPipeline.GetEvent <AOEvents>();
            reflection    = RenderPipeline.GetEvent <ReflectionEvent>();
            proper        = RenderPipeline.GetEvent <PropertySetEvent>();
            downSampleMat = new Material(resources.shaders.depthDownSample);
        }
 protected override void Init(PipelineResources resources)
 {
     proper = RenderPipeline.GetEvent <PropertySetEvent>();
     if (useEmissionGeometry)
     {
         geometry.Init();
     }
     if (useNoiseEvents)
     {
         noiseEvents.Init(resources);
     }
     lightingData       = RenderPipeline.GetEvent <LightingEvent>();
     reflectData        = RenderPipeline.GetEvent <ReflectionEvent>();
     lightingMat        = new Material(resources.shaders.volumetricShader);
     cameraNormalBuffer = new ComputeBuffer(3, sizeof(float3));
     blackCB            = new Cubemap(1, TextureFormat.ARGB32, false);
     blackCB.SetPixel(CubemapFace.NegativeX, 0, 0, Color.black);
     blackCB.SetPixel(CubemapFace.NegativeY, 0, 0, Color.black);
     blackCB.SetPixel(CubemapFace.NegativeZ, 0, 0, Color.black);
     blackCB.SetPixel(CubemapFace.PositiveX, 0, 0, Color.black);
     blackCB.SetPixel(CubemapFace.PositiveX, 0, 0, Color.black);
     blackCB.SetPixel(CubemapFace.PositiveX, 0, 0, Color.black);
 }
Esempio n. 6
0
        /* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* *//* */

        protected override void Init(PipelineResources resources)
        {
            GTAOMaterial     = new Material(resources.shaders.gtaoShader);
            propertySetEvent = RenderPipeline.GetEvent <PropertySetEvent>();
        }
Esempio n. 7
0
        private void SSR_UpdateVariable(SSRCameraData cameraData, Camera RenderCamera, ref PipelineCommandData data, PropertySetEvent proper)
        {
            Vector2Int    CameraSize = new Vector2Int(RenderCamera.pixelWidth, RenderCamera.pixelHeight);
            CommandBuffer buffer     = data.buffer;

            cameraData.UpdateCameraSize(CameraSize, 2);
            buffer.SetGlobalMatrix(ShaderIDs._VP, proper.VP);
            Matrix4x4 proj = GL.GetGPUProjectionMatrix(RenderCamera.projectionMatrix, false);
            Matrix4x4 warpToScreenSpaceMatrix = Matrix4x4.identity;
            Vector2   HalfCameraSize          = new Vector2(CameraSize.x, CameraSize.y) / 2;

            warpToScreenSpaceMatrix.m00 = HalfCameraSize.x; warpToScreenSpaceMatrix.m03 = HalfCameraSize.x;
            warpToScreenSpaceMatrix.m11 = HalfCameraSize.y; warpToScreenSpaceMatrix.m13 = HalfCameraSize.y;

            Matrix4x4             SSR_ProjectToPixelMatrix = warpToScreenSpaceMatrix * proj;
            NativeArray <SSRData> dataArr = new NativeArray <SSRData>(1, Allocator.Temp, NativeArrayOptions.UninitializedMemory);
            SSRData *ptr = dataArr.Ptr();

            ptr->ScreenFade         = ScreenFade;
            ptr->Thickness          = Thickness;
            ptr->HiZ_RaySteps       = HiZ_RaySteps;
            ptr->HiZ_MaxLevel       = HiZ_MaxLevel;
            ptr->HiZ_StartLevel     = HiZ_StartLevel;
            ptr->HiZ_StopLevel      = HiZ_StopLevel;
            ptr->MaximumBiasAllowed = MaximumAllowedTemporalDepthBias;
            ptr->TemporalWeight     = float2(StaticTemporalWeight, DynamicTemporalWeight);
            ptr->ScreenSize         = float2(CameraSize.x, CameraSize.y);
            ptr->rayCastSize        = float2(CameraSize.x, CameraSize.y) / 2;
            ptr->projection         = proj;
            ptr->inverseProj        = proj.inverse;
            ptr->viewProjection     = proper.VP;
            ptr->worldToCamera      = RenderCamera.worldToCameraMatrix;
            ptr->cameraToWorld      = RenderCamera.cameraToWorldMatrix;
            ptr->projToPixelMatrix  = SSR_ProjectToPixelMatrix;
            ptr->brdfBias           = brdfBias;
            ptr->inverseLastVP      = propertySetEvent.inverseLastViewProjection;
            ssrDatas.SetData(dataArr);
            buffer.SetGlobalConstantBuffer(ssrDatas, SSRDatas, 0, ssrDatas.stride);
            dataArr.Dispose();
        }
 protected override void Init(PipelineResources resources)
 {
     taaMat = new Material(resources.shaders.taaShader);
     proper = RenderPipeline.GetEvent <PropertySetEvent>();
 }
Esempio n. 9
0
 public void Init()
 {
     proper       = RenderPipeline.GetEvent <PropertySetEvent>();
     decalTargets = new RenderTargetIdentifier[2];
 }
Esempio n. 10
0
 protected override void Init(PipelineResources resources)
 {
     proper = RenderPipeline.GetEvent <PropertySetEvent>();
     blur.Init(resources.shaders.rapidBlurShader);
 }
Esempio n. 11
0
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 protected override void Init(PipelineResources resources)
 {
     proper        = RenderPipeline.GetEvent <PropertySetEvent>();
     SSGi_Material = new Material(resources.shaders.ssgiShader);
 }
 protected override void Init(PipelineResources resources)
 {
     proper = RenderPipeline.GetEvent <PropertySetEvent>();
 }