예제 #1
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);
     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();
         UpdateIESTexture(texCopyShader);
     }
 }
 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);
 }
예제 #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);
 }
예제 #4
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);
        }