I'm having problems creating an in-game video monitor that renders the view from an in-game camera. The screen of the in-game monitor is rendered with a "mask" shader which cuts a hole in the geometry, allowing the camera feed to be rendered behind the level geometry. I then tamper with the camera's projection matrix to scale, translate and distort it - just like photoshop's "free transform" command - so that it fits correctly behind the in-game monitor when viewed from any angle.
After much testing, I've learned that it IS possible, but the math has me beat. I can perform all the necessary transformations by individually tweaking the values of the camera matrix in the editor so that it fits the in-game monitor, but can't figure out how to write a script that will correctly adjust the projection matrix in real time. At the moment I can only translate and scale the camera output correctly in real time. I am not adjusting the view rect, only the projection matrix.
Obviously, I don't own Unity PRO, and can't use a render texture.
So... How do I use the viewport points of the in-game monitor to correctly distort the in-game video camera's projection matrix so that it conforms to the in-game monitor?
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
No one has followed this question yet.
The name 'Joystick' does not denote a valid type ('not found')
How to vertically stretch camera view
Minimap Camera Question
Easy way to determine which camera is clicked on?
smooth follow camera problem in unity iphone