UnityEngine.Rendering.CullingResults.ComputeDirectionalShadowMatricesAndCullingPrimitives(int, int, int, UnityEngine.Vector3, int, float, out UnityEngine.Matrix4x4, out UnityEngine.Matrix4x4, out UnityEngine.Rendering.ShadowSplitData)

Here are the examples of the csharp api UnityEngine.Rendering.CullingResults.ComputeDirectionalShadowMatricesAndCullingPrimitives(int, int, int, UnityEngine.Vector3, int, float, out UnityEngine.Matrix4x4, out UnityEngine.Matrix4x4, out UnityEngine.Rendering.ShadowSplitData) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 View Source File : ShadowUtils.cs
License : GNU Lesser General Public License v3.0
Project Creator : pepeizq

public static bool ExtractDirectionalLightMatrix(ref CullingResults cullResults, ref ShadowData shadowData, int shadowLightIndex, int cascadeIndex, int shadowmapWidth, int shadowmapHeight, int shadowResolution, float shadowNearPlane, out Vector4 cascadeSplitDistance, out ShadowSliceData shadowSliceData, out Matrix4x4 viewMatrix, out Matrix4x4 projMatrix)
        {
            ShadowSplitData splitData;
            bool success = cullResults.ComputeDirectionalShadowMatricesAndCullingPrimitives(shadowLightIndex,
                cascadeIndex, shadowData.mainLightShadowCascadesCount, shadowData.mainLightShadowCascadesSplit, shadowResolution, shadowNearPlane, out viewMatrix, out projMatrix,
                out splitData);

            cascadeSplitDistance = splitData.cullingSphere;
            shadowSliceData.offsetX = (cascadeIndex % 2) * shadowResolution;
            shadowSliceData.offsetY = (cascadeIndex / 2) * shadowResolution;
            shadowSliceData.resolution = shadowResolution;
            shadowSliceData.viewMatrix = viewMatrix;
            shadowSliceData.projectionMatrix = projMatrix;
            shadowSliceData.shadowTransform = GetShadowTransform(projMatrix, viewMatrix);

            // If we have shadow cascades baked into the atlas we bake cascade transform
            // in each shadow matrix to save shader ALU and L/S
            if (shadowData.mainLightShadowCascadesCount > 1)
                ApplySliceTransform(ref shadowSliceData, shadowmapWidth, shadowmapHeight);

            return success;
        }