public bool IsVisible(TressFXOITRenderer renderer) { if (this.light.type == LightType.Directional) { return(true); // Directional lights are global } return(false); }
/// <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; }
/// <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; }
public bool IsVisible(TressFXOITRenderer renderer) { if (this.light.type == LightType.Directional) return true; // Directional lights are global return false; }