protected override void Init(PipelineResources resources)
 {
     cbdr = new CBDRSharedData(resources);
     for (int i = 0; i < cascadeShadowMapVP.Length; ++i)
     {
         cascadeShadowMapVP[i] = Matrix4x4.identity;
     }
     cubeDepthMaterial = new Material(resources.shaders.cubeDepthShader);
     spotBuffer        = new RenderSpotShadowCommand();
     spotBuffer.Init(resources.shaders.spotLightDepthShader);
     irradianceVolumeMat = new Material(resources.shaders.irradianceVolumeShader);
     lightingMat         = new Material(resources.shaders.lightingShader);
 }
        protected override void Init(PipelineResources resources)
        {
            randomBuffer = new ComputeBuffer(downSampledSize.x * downSampledSize.y * downSampledSize.z, sizeof(uint));
            NativeArray <uint> randomArray = new NativeArray <uint>(randomBuffer.count, Allocator.Temp, NativeArrayOptions.UninitializedMemory);
            uint *randPtr = randomArray.Ptr();

            rand = new Random((uint)System.Guid.NewGuid().GetHashCode());
            for (int i = 0; i < randomArray.Length; ++i)
            {
                randPtr[i] = (uint)System.Guid.NewGuid().GetHashCode();
            }
            randomBuffer.SetData(randomArray);
            randomArray.Dispose();
            cbdr      = PipelineSharedData.Get(renderPath, resources, (res) => new CBDRSharedData(res));
            volumeMat = new Material(resources.volumetricShader);
        }
Example #3
0
 protected override void Init(PipelineResources resources)
 {
     proper = RenderPipeline.GetEvent <PropertySetEvent>();
     if (useTBDR)
     {
         minMaxBoundMat = new Material(resources.shaders.minMaxDepthBounding);
     }
     needCheckedShadows = new NativeList <ShadowAvaliable>(20, Allocator.Persistent);
     cbdr = new CBDRSharedData(resources);
     for (int i = 0; i < cascadeShadowMapVP.Length; ++i)
     {
         cascadeShadowMapVP[i] = Matrix4x4.identity;
     }
     cubeDepthMaterial = new Material(resources.shaders.cubeDepthShader);
     spotBuffer        = new RenderSpotShadowCommand();
     spotBuffer.Init(resources.shaders.spotLightDepthShader);
     lightingMaterial = new Material(resources.shaders.lightingShader);
 }
Example #4
0
 protected override void Init(PipelineResources resources)
 {
     proper = RenderPipeline.GetEvent <PropertySetEvent>();
     if (useTBDR)
     {
         minMaxBoundMat = new Material(resources.shaders.minMaxDepthBounding);
     }
     needCheckedShadows = new NativeList <ShadowAvaliable>(20, Allocator.Persistent);
     cbdr = new CBDRSharedData(resources);
     for (int i = 0; i < cascadeShadowMapVP.Length; ++i)
     {
         cascadeShadowMapVP[i] = Matrix4x4.identity;
     }
     cubeDepthMaterial = new Material(resources.shaders.cubeDepthShader);
     spotBuffer        = new RenderSpotShadowCommand();
     spotBuffer.Init(resources.shaders.spotLightDepthShader);
     lightingMaterial = new Material(resources.shaders.lightingShader);
     whiteTex         = new Texture2DArray(1, 1, 1, TextureFormat.ARGB32, false, false);
     whiteTex.SetPixels(new Color[] { Color.white }, 0);
     if (iesTextures.Length > 0)
     {
         ComputeShader texCopyShader = resources.shaders.texCopyShader;
         iesAtlas = new RenderTexture(new RenderTextureDescriptor
         {
             colorFormat       = RenderTextureFormat.R8,
             dimension         = TextureDimension.Tex2DArray,
             width             = 256,
             height            = 1,
             volumeDepth       = iesTextures.Length,
             enableRandomWrite = true,
             msaaSamples       = 1
         });
         ((RenderTexture)iesAtlas).Create();
         texCopyShader.SetTexture(5, ShaderIDs._IESAtlas, iesAtlas);
         for (int i = 0; i < iesTextures.Length; ++i)
         {
             texCopyShader.SetTexture(5, "_IESTex", iesTextures[i]);
             texCopyShader.SetInt(ShaderIDs._Count, i);
             texCopyShader.Dispatch(5, 256 / 64, 1, 1);
         }
     }
 }
Example #5
0
        protected override void Init(PipelineResources resources)
        {
            cbdr             = PipelineSharedData.Get(renderPath, resources, (a) => new CBDRSharedData(a));
            shadMaskMaterial = new Material(resources.shadowMaskShader);
            for (int i = 0; i < cascadeShadowMapVP.Length; ++i)
            {
                cascadeShadowMapVP[i] = Matrix4x4.identity;
            }
            pointLightMaterial = new Material(resources.pointLightShader);
            cubeDepthMaterial  = new Material(resources.cubeDepthShader);
            Vector3[]             vertices    = resources.sphereMesh.vertices;
            int[]                 triangle    = resources.sphereMesh.triangles;
            NativeArray <Vector3> allVertices = new NativeArray <Vector3>(triangle.Length, Allocator.Temp, NativeArrayOptions.UninitializedMemory);

            for (int i = 0; i < allVertices.Length; ++i)
            {
                allVertices[i] = vertices[triangle[i]];
            }
            sphereBuffer = new ComputeBuffer(allVertices.Length, sizeof(Vector3));
            sphereBuffer.SetData(allVertices);
            allVertices.Dispose();
            spotBuffer = new RenderSpotShadowCommand();
            spotBuffer.Init(resources.spotLightDepthShader);
        }