|Topic was automatically imported from the old Question2Answer platform.
I’m trying to create oblique near clipping plane matrix for camera for rendering portals as seen in this tutorial
I’ve managed to edit engine’s source code so now Camera object has new projection called “Oblique” so I can now specify Quat for near clipping plane.
Here’s code i’ve added to the engine to generate oblique matrix: https://pastebin.com/t6NcTe3E
I’ve grabbed this piece of code from there.
If you’re interested here is some science paper about oblique near plane
Next I wrote some code to calculate Quat for Oblique matrix(as seen in the tutorial at the beginning of question(code from repo))
_multiply_point and _multiply_vector are my interpretation of similar functions from this Unity repo(Find MultiplyPoint and MultiplyVector)
Now to question part:
1) Sky box is somewhat distorded when I use my new projection matrix but mesh rendering is OK. I have no idea why this is happening.
Sky should not be upside down.
Sun is distorded near the horizon.
2) main one. Somewhat calculations are wrong and near clipping plane is doing whatever it wants to. I’ve done same calculations by myself in Unity and everything is working perfectly.(Here’s repo from tutorial above)
I have NO idea what and where could possibly go wrong. I’ve tried swapping matrix indexes, moving _multiply_point and _multiply_vector to source code, swapping variables and etc.
I’ve just been successful in applying your solution to my project, up to the point where the only thing going wrong is the skybox too.
I’ve tried to give the portal camera the same environment as the player-camera, but, to no avail (likely because it was already inheriting it by default).
I think there must be some relationship between skyboxes and the camera that must be accounted when applying the oblique matrix.
If you’ve had any success in the 1.5 years since you posted, please let me know, otherwise I will try to update with my progress towards a solution.
qaptoR | 2021-11-10 18:09