Download

Camera Projection Matrices

The inability to modify camera projection matrices in blueprint (and the extreme difficulty of doing it in C++) puts a big damper on several very creative effects.

Exposing the FMatrix on a camera lets us do fun off-axis projections like this:
https://youtube.com/watch?v=90kHhOUzeQc

Additionally, proper Portals and Mirrors may be implemented as well.

A blueprint node that allows for the creation and modification of arbitrary FMatrix objects and their application to Cameras and SceneCapture2D actors would be great to this end.
(It’s important they’re FMatrix objects and not FPerspectiveMatrix objects since FPerspectiveMatrix doesn’t support off-axis projection).

I agree, I managed to modify the projection matrix in C++ but when I added an off-axis projection I got a funny blurry effect.

Did you manage to solve this? I’ve been trying to do an off-axis projection for a while now but it looks really weird.

Same here. To modify the projection matrix, I followed the suggestions in this post and extended the GameViewportClient using my own draw method.
Replacing the projection and view matrix of the SceneView with my own results in blurry images as mentioned by KennyBobby.

Disabling AntiAliasing and MotionBlur removes these artifacts as well as any impact on the resulting image I usually would expect using a different projection - it just looks the same as if I never had changed the matrix at all, except for some messed up lighting.
So currently my assumption is that overriding the viewport client’s draw function is not enough to actually apply a different type of projection to the entire rendering process, but given that I am quite new to both Unreal Engine and implementing custom projections, that might be an entirely wrong conclusion and I’d appreciate any inspiration that might point me in the right direction :confused:

How can i remove blurry effect??

Hi!!

I was changed projection matrix value ( Red box ).
Then occured blurry effect.

I have to use changed value, but I want to remove blurry effect.

How can i do that?

1.PNG

Have you tried disabling motion blur?

Yes. I changed disable at show->post process->motion blur option.
But Result is same.

Even with the suggestions from here I still have the same issues:
9fa383ce08a65b730c93b92013136e276c5598ca.jpeg
So I started to modify the source and I noticed it works better for me to modify scenecapture2d:
c3dda7c70e6c0f053617e687af6e97fa4c4a2b48.jpeg
I noticed the function I modified was virtual so I figured I could do the same thing.



void FScene::UpdateSceneCaptureContents(USceneCaptureComponent2D* CaptureComponent)


from SceneCaptureRendering.cpp which was declared in ScenePrivate.h

The problem is it’s in FScene and extending FScene is a nightmare. If anyone can lend a hand it would be very much appreciated.

P.S. I’m trying to do it in 4.6

Guys. Is this possible for You to write an instruction how to achieve projection matrix effect (better on some surface) as it would be projection mapping or portal texture? Please!

Hi,
I am working on since few weeks on Unreal in order to make apps in a CAVE environment. I have already made a VRPN plugin, now I need to adapt the camera frustum (projection matrix) on real time. Does anyone have any news on how to access the projection matrix ? is it still impossible ? (my collegue did it on Unity in one afternoon …)
thx

You will need to make a plugin based on IHeadMountedDisplayModule or IStereoRendering (IHeadMountedDisplayModule is probably better because it will get loaded automatically by the engine). In there you need to implement GetStereoProjectionMatrix() and CalculateStereoViewOffset() to set the matrices. Search the engine source for FFakeStereoRenderingDevice or the Oculus plugin, I used those two as an example when I implemented it.
Also in a cave you will have an off-axis frustum, temporalAA does not play nice with it right now but you can disable it or apply this patch: https://github.com/EpicGames/UnrealEngine/pull/912

hi, thank you for the HMD advice, did you made a CAVE plugin ?
btw your link for the patch is not working…
thanks again

Yes we did manage to get it working in our CAVE, see https://forums.unrealengine.com/showthread.php?57519-Unreal-Engine-on-a-multi-projector-wall-display for more info on how far we are and our setup.

As for the link to the patch. You need to be logged in Github and have your github account linked with your Unreal Engine account else you will get a 404 page.

Hi Pjotr
I have read you message yesterday, your did a great work, I have send you an private message.
thank you for your answer

Hi Vinaxus
How did you manage to add off axis projection into a scene capture component 2D ? did you modify the UE4 source code into FScene::UpdateSceneCaptureContents ?
Thank you

I would love to see more control over projection matrices from blueprints (and clip planes). Could be real handy to create portal like effects.

hei man!
I am trying to work on a similar problem, could you please tell us how did you maneged how to modify the point of view ?
Do you have any part of code that you can share with us?
Thanks a lot man :wink:

Laura

Yep, This is a must to develop feature I’m seeking too, should be nice sharing how to achieve it.

anyone has progressed with this topic ?
can someone share some code so I can contribute too ?

Hey guys,
Does anyone have news on this topic? I’m currently looking for the matrix applied to this cam.
As a newbie, your help will be really appreciated.
Thanks a lot