Exemple #1
0
    public L2DLPipeline
    (
        L2DLPipelineSettings pipelineSettings,
        L2DLDirectLightData directLightData,
        L2DLIndirectLightData indirectLightData,
        L2DLBufferTextures textureToView,
        L2DLDebugSettings debugSettings
    )
    {
        // Setup some of the pipeline settings
        L2DLPipelineData.s_backgroundDepthFromCamera = pipelineSettings.m_backgroundDepthFromCamera;

        L2DLPipelineData.m_drawingSettingsOpaque = new DrawingSettings(new ShaderTagId("SRPDefaultUnlit"), L2DLPipelineData.SortingSettingsOpaque)
        {
            enableDynamicBatching = pipelineSettings.m_dynamicBatching,
            enableInstancing      = pipelineSettings.m_instancing
        };

        L2DLPipelineData.m_drawingSettingsTransparent = new DrawingSettings(new ShaderTagId("SRPDefaultUnlit"), L2DLPipelineData.SortingSettingsTransparent)
        {
            enableDynamicBatching = pipelineSettings.m_dynamicBatching,
            enableInstancing      = pipelineSettings.m_instancing
        };

        L2DLPipelineData.s_emulateNoComputeShaderSupport = debugSettings.m_emulateNoComputeShaderSupport;

        m_cameraRenderer = new L2DLCameraRenderer(directLightData, indirectLightData, textureToView);
    }
Exemple #2
0
    // --------------------------------------------------------------------
    // Initilisation
    // --------------------------------------------------------------------

    // --------------------------------------------------------------------
    public L2DLCameraRenderer
    (
        L2DLDirectLightData directLightData,
        L2DLIndirectLightData indirectLightData,
        L2DLBufferTextures textureToView
    )
    {
        GraphicsSettings.lightsUseLinearIntensity = true;

        TextureToView = textureToView;

        m_directLightRenderer   = new L2DLDirectLightRenderer(directLightData);
        m_indirectLightRenderer = new L2DLIndirectLightRenderer(indirectLightData);
        m_indirectLightData     = indirectLightData;

        CameraRenderInstance = this;
    }
 public void CalculateShadowMap(ScriptableRenderContext _context, CommandBuffer _buffer, L2DLSpotLight _spotLight, L2DLDirectLightData _data, RenderTargetIdentifier i_occlusionMap, RenderTargetIdentifier o_shadowMap)
 {
     throw new System.NotImplementedException();
 }
 public void CalculateShadowMap(ScriptableRenderContext _context, CommandBuffer _buffer, L2DLDirectionalLight _directionalLight, L2DLDirectLightData _data, RenderTargetIdentifier i_occlusionMap, RenderTargetIdentifier o_shadowMap)
 {
     // Here we run the code that calculates the shadow map using standard rendering...
     _buffer.SetGlobalTexture("_OcclusionMap", i_occlusionMap);
     _buffer.SetGlobalInt("_SamplesPerPixel", m_samplesPerPixel);
     _buffer.SetGlobalFloat("_WorldDistPerStep", _directionalLight.Height / m_samplesPerPixel);
     _buffer.Blit(i_occlusionMap, o_shadowMap, DirectionalShadowMapRenderMaterial);
     L2DLRenderHelpers.ExecuteBuffer(_context, _buffer);
 }
 // --------------------------------------------------------------------
 public L2DLDirectLightRenderer(L2DLDirectLightData _directLightData)
 {
     m_directLightData = _directLightData;
 }
Exemple #6
0
 // --------------------------------------------------------------------
 void SetupCommonComputeShaderProperties(CommandBuffer buffer, ComputeShader shader, int kernel, IL2DLDirectLight light, L2DLDirectLightData _data)
 {
     buffer.SetComputeTextureParam(shader, kernel, "Occlusion", m_directLightOcclusionMapId);
     buffer.SetComputeTextureParam(shader, kernel, "Shadow", m_directLightShadowMapId);
     buffer.SetComputeIntParam(shader, "_TextureSize", (int)light.ShadowMapSize);
     buffer.SetComputeFloatParam(shader, "_DirectLightOcclusionMultiplier", _data.DirectLightOcclusionMultiplier);
 }
Exemple #7
0
    // --------------------------------------------------------------------
    public void CalculateShadowMap(ScriptableRenderContext _context, CommandBuffer _buffer, L2DLSpotLight _spotLight, L2DLDirectLightData _data, RenderTargetIdentifier i_occlusionMap, RenderTargetIdentifier o_shadowMap)
    {
        if (!L2DLRenderHelpers.SupportsComputeShaders())
        {
            return;
        }

        ReloadComputeShaders();

        int occlusionTraceComputeKernel = m_spotLightOcclusionTraceCompute.FindKernel("SpotLightOcclusionTrace");

        SetupCommonComputeShaderProperties(_buffer, m_spotLightOcclusionTraceCompute, occlusionTraceComputeKernel, _spotLight, _data);
        _buffer.SetComputeFloatParam(m_spotLightOcclusionTraceCompute, "_WorldDistPerStep", _spotLight.Range / (int)_spotLight.ShadowMapSize);
        _buffer.DispatchCompute(m_spotLightOcclusionTraceCompute, occlusionTraceComputeKernel, (int)_spotLight.ShadowMapSize / 64, 1, 1);
        L2DLRenderHelpers.ExecuteBuffer(_context, _buffer);
    }