|
|
|
|
|
|
float atlasWidth = (float)m_ShadowSettings.shadowAtlasWidth; |
|
|
|
float atlasHeight = (float)m_ShadowSettings.shadowAtlasHeight; |
|
|
|
|
|
|
|
float deviceZRangeScale = 1.0f; |
|
|
|
|
|
|
|
// Currently CullResults ComputeDirectionalShadowMatricesAndCullingPrimitives doesn't
|
|
|
|
// apply z reversal to projection matrix. We need to do it manually here.
|
|
|
|
if (SystemInfo.usesReversedZBuffer) |
|
|
|
|
|
|
proj.m22 = -proj.m22; |
|
|
|
proj.m23 = -proj.m23; |
|
|
|
deviceZRangeScale = 0.5f; |
|
|
|
} |
|
|
|
|
|
|
|
Matrix4x4 worldToShadow = proj * view; |
|
|
|
|
|
|
textureScaleAndBias.m11 = 0.5f; |
|
|
|
textureScaleAndBias.m22 = deviceZRangeScale; |
|
|
|
textureScaleAndBias.m22 = 0.5f; |
|
|
|
textureScaleAndBias.m23 = deviceZRangeScale; |
|
|
|
textureScaleAndBias.m23 = 0.5f; |
|
|
|
textureScaleAndBias.m13 = 0.5f; |
|
|
|
|
|
|
|
// Apply texture scale and offset to save a MAD in shader.
|
|
|
|