Inheritance: ATressFXRender
Exemplo n.º 1
0
 public bool IsVisible(TressFXOITRenderer renderer)
 {
     if (this.light.type == LightType.Directional)
     {
         return(true); // Directional lights are global
     }
     return(false);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Renders the selfshadow map for this light and the specified renderer.
        /// </summary>
        public void RenderSelfShadows(TressFXOITRenderer renderer)
        {
            if (this.shadowMappingCamera == null)
            {
                Debug.LogError("Shadow mapping camera is null but shadow map rendering was requested!");
                return;
            }

            // Prepare material
            Material mat = depthPassMaterial;

            renderer.SetShaderParams(mat);

            // Create command buffer for self shadows
            CommandBuffer selfShadowCommandBuffer = new CommandBuffer();

            selfShadowCommandBuffer.name = "TressFX SelfShadows";
            selfShadowCommandBuffer.SetRenderTarget(new RenderTargetIdentifier(this.selfShadowMap));

            if (this.selfShadowMode == SelfShadowMode.Lines)
            {
                selfShadowCommandBuffer.DrawProcedural(Matrix4x4.identity, depthPassMaterial, 0, MeshTopology.Lines, renderer.g_LineIndicesBuffer.count);
            }
            else if (this.selfShadowMode == SelfShadowMode.Triangles)
            {
                selfShadowCommandBuffer.DrawProcedural(Matrix4x4.identity, depthPassMaterial, 1, MeshTopology.Lines, renderer.master.hairData.m_TriangleIndices.Length);
            }

            // Prepare cam & render
            var shadowDistance = QualitySettings.shadowDistance;

            QualitySettings.shadowDistance = 0f;

            this.shadowMappingCamera.AddCommandBuffer(CameraEvent.AfterEverything, selfShadowCommandBuffer);
            this.shadowMappingCamera.targetTexture = this.selfShadowMap;
            this.shadowMappingCamera.cullingMask   = 0;

            // Render shadows
            this.shadowMappingCamera.Render();
            this.shadowMappingCamera.RemoveAllCommandBuffers();

            QualitySettings.shadowDistance = shadowDistance;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Renders the selfshadow map for this light and the specified renderer.
        /// </summary>
        public void RenderSelfShadows(TressFXOITRenderer renderer)
        {
            if (this.shadowMappingCamera == null)
            {
                Debug.LogError("Shadow mapping camera is null but shadow map rendering was requested!");
                return;
            }

            // Prepare material
            Material mat = depthPassMaterial;
            renderer.SetShaderParams(mat);

            // Create command buffer for self shadows
            CommandBuffer selfShadowCommandBuffer = new CommandBuffer();
            selfShadowCommandBuffer.name = "TressFX SelfShadows";
            selfShadowCommandBuffer.SetRenderTarget(new RenderTargetIdentifier(this.selfShadowMap));

            if (this.selfShadowMode == SelfShadowMode.Lines)
                selfShadowCommandBuffer.DrawProcedural(Matrix4x4.identity, depthPassMaterial, 0, MeshTopology.Lines, renderer.g_LineIndicesBuffer.count);
            else if (this.selfShadowMode == SelfShadowMode.Triangles)
                selfShadowCommandBuffer.DrawProcedural(Matrix4x4.identity, depthPassMaterial, 1, MeshTopology.Lines, renderer.master.hairData.m_TriangleIndices.Length);

            // Prepare cam & render
            var shadowDistance = QualitySettings.shadowDistance;
            QualitySettings.shadowDistance = 0f;

            this.shadowMappingCamera.AddCommandBuffer(CameraEvent.AfterEverything, selfShadowCommandBuffer);
            this.shadowMappingCamera.targetTexture = this.selfShadowMap;
            this.shadowMappingCamera.cullingMask = 0;

            // Render shadows
            this.shadowMappingCamera.Render();
            this.shadowMappingCamera.RemoveAllCommandBuffers();

            QualitySettings.shadowDistance = shadowDistance;
        }
Exemplo n.º 4
0
 public bool IsVisible(TressFXOITRenderer renderer)
 {
     if (this.light.type == LightType.Directional)
         return true; // Directional lights are global
     return false;
 }