Howto modify the projection matrix

Thank You, Hurricane!

So You added a camera movement.
Say. What to do with antialias. These jaggy graphics are looking awfull. Are You controling them in code?

Hi same problem here withh th HeadMontedDisplay
any news ?

anyway, any news about how to modify the camera frustum with a more elegant way than this code copy ?

Is there solution for antialias?

Hi, @hurricane86!

Wow, this seems exactly what I’m looking for. But unfortunately I don’t see a “transparent plane” in offaxistest_v2 and it doesn’t look like OffAxis.
I built everything and loaded the level “Starter Map”.

Are there any other steps to do? Sorry, if this is a stupid question. I’m really new to UE.

Hi Vicky3, You don’t see a plane - you have to kind of imagine the placed camera position is as if you’ve got your nose right against the glass - then you adjust the x,y,z position to match your ‘eyes’ position - works great if you’ve got an oculus for tracking. - So, to be clear you don’t move the camera - just the offsets.

Haha lol, I finally got it!

Here is the information that I missed - in case other guys have the same problems that I had:
The “test map” is right in the Content folder, not e.g. in maps. There’s a Blueprint to show the behaviour.

For thos who like to use C++: UOffAxisGameViewportClient* c = (UOffAxisGameViewportClient*)GetWorld()->GetGameViewport();
c->SetOffAxisMatrix(c->GenerateOffAxisMatrix(0.7, 0.395, FVector(xPos, yPos, zPos)));

Thanks a lot for this creat file!

Getting close, but when I moved to a real scene, things got weird. Can someone please call out where the objects need to be and whether they need specific names?
(FYI - I modded a version for 4.9.2, and it seems to work, just is off a bit).
Camera position? 0,0,0 or doesn’t matter?
The plane - does it need to be near the camera? Does the name matter?
And then - the eye position Z is just how far away the ‘viewer’ is?
Right now, I can’t make the plane and fixed plane match up.

Hey @hurricane86, thanks for posting about the “magic” fix. I was tearing my hair out trying to figure out why my custom projection matrix caused such strange occlusion and depth buffer issues. Your magic fix solved my issues. But why does it work? How did you come up with the magic fix?

Darn, It’s not only too long for making me sense, It’s also I don’t know where to start, I’m rounding this topic all the time but I need a clean start, please somebody explain me how to approach off-axis projections for a head tracking project. Darn, since the wiimote desktopvr I’m looking for this and seems like everybody can do it but nobody is doing it at the same time, it’s that hard?

Thanks, I’m able to load the map and test it, but I’m trying to get it working with the freetrack plugin to link movement to my facetrack. I have both installed and working in the same project, but I can’t setup the correct values so the image is always overdistort and maybe not corrected aligned, Could you take some time and explain exactly how your system works and how to adapt it to diferent scenarios? Thanks in advance.

Hi Hurricane, Just wondered if you’re still tinkering with this. I had a good play with it at the time and now i’m trying to drive the eye position with a vive controller but need a more recent build than 4.7 in order to get the controller transform. Tried to compile on a later version but VS is spewing errors, probably due to re-factored game window source.

I’m also going to be looking at nVidia’s new projection based api when I get round to it. Maybe this will give access to a cleaner way to drive off axis projection?

Regards!

Dan

Hey Huricane,

great work but i got some issues with newer versions of UE. For Example the Method PushViewportCanvas is no longer part of IStereoRendering. Thus i cant build the project. But i need this stuff in 4.12.

Can you may help me? How to replace this code so that it works again?.

Best Regards

I got it working in the way i need it but i still got a question.
Do you might know how i could possibly update the projections matrices for two different windows on different screens with different eye positions?

thx in advance and best regards

Impressive in 2 hours! Care to share how you did it? I’m not too slick with c++ and would love to get this working on an up to date build.

Its workaround which will only work for specific setups.

I neither need SBS Stereo 3D nor HMD support.

Thus I removed everything which appeals to that.

Afterwards I only had to change some includes.

But i guess that wont help you sry.

Hi Folks,

For everyone who is still interested in this or needs this, here comes an updated version for 4.12 (still experimental but you should get it to work immediatly) I added the Stereo Support again after 4.12 Standards.
I originaly removed them for my own purposes as I said in my post before but in this package they are back again.

link text

Thanks again to Huricane etc. for making this great thread without them I would not get those Information at all.

I am still strugglin a little to get just the right Projection but I am getting closer.

Best Regards

Hope you enjoy it

Hi - thanks so much for this - i’ve kind of got it working, at least it’s working the same as it did a few versions ago which is great. If anyone else is battling with this it’s a bit tricky as the X,Y and Z are a bit mixed up - also, I don’t really know what the requirement for the screen dimensions are - do they just enable the correct aspect ratio? I’ve found if you increase or decrease this in ratio nothing happens. What i’d really like to do is increase the FOV of the camera but the slider/value doesn’t seem to affect the camera’s view.

I think what i’m thinking of looking at is defining an unbound volume in the game - the rear face of this representing your physical monitor screen, and an object’s position in that volume will drive the calculation. Then you should be able to scale and move the volume about making it more useful.

Any interested collaborators here?

I’m a bit confused about the math here. Why does it matter where the camera is if the eye position is being set in blueprint?

Hi Duke, the camera position represents the point dead centre of your monitor. It’s the convergence point i suppose.

Thanks for the response - what about line 230, where wcsPtTopLeftScreen has a negative Y value and wcsPtBottomRightScreen has a positive Y value. Shouldn’t they be the other way around?