Making Render Target Texture Screen-Space and perspective corrected

ImBuGs46
Thu, 13 Apr 2023 05:16:06 +0000
Blueprint

Hello! I am relatively new to UE, been doing Unity for a while.

I have a prototype i’m trying to recreate in Unreal that is basically a copy of Dishonored 2’s “A Crack in the Slab” level.

Basically, the level operates by having two levels render simultaneously and having the player be able to switch between them. That part is done as it is relatively easy. However, the main draw is having a sort of “mirror” or mesh to be able to “see” the other “reality”. In Unity this is relatively easy as well, the hard part is writing the correct shader so the perspective in the mirror perfectly matches that of the level layout. Here’s an image of the correct way to do it:

Here in Unreal, the way I have set up so far is by having the BP_FPCharacter with two cameras, one being exactly -5000 Z local.

This works for the very basic setup. However, as you can see, the texture is projected into the plane entirely, not matching the player perspective. I assume this involves making the projection screenspaced and then correcting it based on the players perspective.

I have no clue how to tackle this within Unreal’s Material Editor. So any help would be appreciated.

1 post - 1 participant