How do you make a scene capture 2d orthographic

const FMatrix ViewMatrix = FTranslationMatrix( -ViewInitOptions.ViewOrigin, ) * ViewInitOptions.ViewRotationMatrix ;
const FMatrix InvViewMatrix = ViewMatrix.InverseFast();
const FMatrix InvProjectionMatrix = ViewInitOptions.ProjectionMatrix.InverseFast();
FSceneView::DeprojectScreenToWorld( ScreenPosition, ViewInitOptions.GetViewRect(), InvViewMatrix, InvProjectionMatrix, RayOrigin, RayDirection );

return true;
}
else
return false;
}

hello,

I couldn’t find issue. you sure it’s still existing somewhere?

cheers

Should I send a PR to Epic? As I actually implemented this for my July Game Jam entry. Basically I just added orthographic options to Scene Capture 2D component, and then modified code to use a different projection matrix when rendering scene capture.

EDIT: I see there are numerous pull requests already submitted as stated above, so I guess not then.

Uploaded to my fork: https://github.com//UnrealEngine/tree/Orthographic_SceneCapture2D

I don’t know when this was integrated, but it’s there in 4.19 :slight_smile:

However it doesn’t captures lighting (lighting from lightmaps, to be more accurate). If I switch to Perspective, it does. Any idea how to solve this?

Notice, in minimap, sphere is getting shaded, but yellow-colored lighting in ground around cube is absent, and so are shadows.

Nevermind, turns out this is an issue of orthographic cameras in general, not just scene capture ortho. Check Shadows not working in Orthographic - Rendering - Epic Developer Community Forums and vote here Unreal Engine Issues and Bug Tracker (UE-11026)

Wait… removing cascaded shadow maps from my directional light (or switching to Static) solved it :slight_smile: lightmaps I mean.

But still no dynamic shadows; if you want those, check reply above.

Epic, sometimes I really love you!

Thank you so much for implementing this… 2D minimaps ahoy!

(To anybody searching for this post 4:19, there is a Set Projection Type node on Scene Capture Component 2D!!!)

:slight_smile:

1 Like