I’m trying to make the projection shadow of objects not too long when the directional light is near horizon. I tried to modify the ShadowSetup.cpp, changing the function SetupWholeSceneProjection. What I’ve tried is to restrict the WorldToLight Matrix of Initializer before calculating the TranslatedWorldToView.
checkf(
Initializer.WorldToLight.M[3][0] == 0.0f &&
Initializer.WorldToLight.M[3][1] == 0.0f &&
Initializer.WorldToLight.M[3][2] == 0.0f,
TEXT("WorldToLight has translation") );
const FMatrix FaceMatrix(
FPlane( 0, 0, 1, 0 ),
FPlane( 0, 1, 0, 0 ),
FPlane(-1, 0, 0, 0 ),
FPlane( 0, 0, 0, 1 ) );
// My codes here. What Ive done is something like just pass a Matrix of zero or something else to substitude the WorldToLight Matrix.
TranslatedWorldToView = Initializer.WorldToLight * FaceMatrix;
But it doesnt seem to work at all.