Skip to content

Commit

Permalink
Use shadow near plane from light for shadow casting [closes #38]
Browse files Browse the repository at this point in the history
  • Loading branch information
Delt06 committed Apr 11, 2023
1 parent 4fa230f commit faccaa9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Assets/ToonRP/Runtime/Shadows/ToonVsmShadows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public void ReserveDirectionalShadows(Light light, int visibleLightIndex)
_shadowedDirectionalLights[_shadowedDirectionalLightCount++] = new ShadowedDirectionalLight
{
VisibleLightIndex = visibleLightIndex,
NearPlaneOffset = light.shadowNearPlane,
};
}
}
Expand Down Expand Up @@ -212,7 +213,7 @@ private void RenderDirectionalShadows(int index, int split, int tileSize)
for (int i = 0; i < cascadeCount; i++)
{
_cullingResults.ComputeDirectionalShadowMatricesAndCullingPrimitives(
light.VisibleLightIndex, i, cascadeCount, ratios, tileSize, 0f,
light.VisibleLightIndex, i, cascadeCount, ratios, tileSize, light.NearPlaneOffset,
out Matrix4x4 viewMatrix, out Matrix4x4 projectionMatrix, out ShadowSplitData splitData
);
shadowSettings.splitData = splitData;
Expand Down Expand Up @@ -297,6 +298,7 @@ private Matrix4x4 ConvertToAtlasMatrix(Matrix4x4 m, Vector2 offset, int split)
private struct ShadowedDirectionalLight
{
public int VisibleLightIndex;
public float NearPlaneOffset;
}
}
}

0 comments on commit faccaa9

Please sign in to comment.