Can I make the camera draw to a specified region of the game window?

Some background information: I’ve built a gameplay prototype in Unity 3D, and I’m moving to UE4 for production (mainly because I would like more robust networking and demo recording).

One aspect of my prototype that I’m having trouble duplicating in UE4 is the screen configuration. The game is played in portrait orientation, with the in-game camera rendering to the top half of the screen, and the HUD filling the bottom half to leave the player’s view unobstructed.

In Unity, this is very easy - all cameras simply have a ViewportRect attribute which determines what part of the (normalized) screen space they render to. But UE4 doesn’t seem to expose this functionality directly. I can see where [GameViewportClient][2] uses information from [FPerPlayerSplitscreenData][3] to set up different cameras to different parts of the screen, but:

A.) I’m unsure how to control this in my own C++ classes without hacking it into the engine itself, and

B.) I don’t know if I would still be able to render HUD elements in the remaining screen space.

Obviously, I could use the brute force solution of rendering the camera view to a texture and then drawing that texture in the UI, but since this is a mobile game I would like to avoid the memory and draw call overhead if at all possible.

I would greatly appreciate any insights anyone can offer! Thanks. :slight_smile:

Hello I hope I understood what you want cuz im in hurry right now.

I printed a crosshair at a specific point on the map with blueprints using ConvertWorldLocationToScreenLocation from the Player Controller and then drawed a texture at the x and y cords of the return. In blueprints it also returns whether the location is on the screen.

You can look for ConvertWorldLocationToScreenLocation in the PlayerController from the HUD class and Draw a rectangle.

If you want the edges to be smooth you would have to combine draw line functions and draw circle funktions.

Good luck!

I asked separately and as a result there is a pending feature request. Vote for it and hopefully it becomes a reality.