I noticed in the 4.9 release notes: New: Replaced experimental cylindrical postprocess projection with better but still experimental Panini projection.
UT has a Custom GameViewportClient class which modifies the projection for the weapons, so that’s where to look. Naturally it requires a fair bit of code to implement.
The reason they’ve also overridden the viewport is to place muzzle effects etc at the correct location I believe. it’s all very well transforming the projection but everything else needs to follow suit.
That’s neat. thanks.
I’m not too familiar with this technique but does that method is equivalent to set a FoV for the FPWeapon and have another FoV for the other assets?
Sort of, basically the Weapon has a consistent appearance regardless of FOV, along with anything else you apply the vertex shader too. The Post-Process version will affect everything on screen which you probably don’t want, since it’s pretty weird.
I’m applying it to a cockpit mesh for example, so the world outside the cockpit distorts based on FOV, but the cockpit mesh itself doesn’t.
We have some issue on FoV at the moment with our FPWeap and this technique will help to find a solution for sure.
Did you use the UT approach for your cockpit? or is it a simple mesh that you solve with a Material Function?
Excuse my blasphemy but I don’t really see the point of handling one thing in the material while everything else is done in code. If you’re already writing your own GameViewportClient you might as well take care of and adjust the weapon meshes as well right?
There’s no separate rendering channel you can draw the weapon mesh in, so that deformation of the mesh has to be handled in the material. However, it won’t actually move anything like the mesh sockets, so you need to transform those locations to the new ones.
I’m going to check, but I’m fairly certain that’s the case anyway and there’s no ability to render a particular object with a different projection style directly in the viewport.
Wow, this came just in time. Played around a little with the Panini Projection and it does help with the distortion. The blurriness is there too so that leads me to think I’ll need to review the UT Github’s repository and study what they did. I haven’t really played around with UE materials too much so this looks like a good time to do so.
Ideally I’d like to render one set of geometry into the backbuffer with one projection matrix, and another set of geometry with a different projection matrix. But I gather from your statement above that’s probably not an option.
That explains my confusion I assumed they just change the projection style in the viewport. Thank you very much.
Although I’m pretty sure I saw options regarding different projections like perspective versus orthographic in the camera components somewhere. I’ll probably look into the source code and see where that’s used.