Set custom project matrix in Camera

Discussion of proposed new features.

Re: Set custom project matrix in Camera

PostPosted by godan » 21 Aug 2016, 15:01

Interesting. @Ergobo, I hadn't thought about the case where another component would call GetFov(). So yes, good point that those values need to be split out anyway.

I'll take a stab at recovering the various values - basically writing the inverse function to GetProjectMatric(bool apiSpecific).
User avatar
godan
Active user
Active user
 
Posts: 122
Joined: 23 Sep 2014, 20:28

Re: Set custom project matrix in Camera

PostPosted by cadaver » 21 Aug 2016, 15:19

We could support arbitrary custom projection matrices by extracting the view frustum from it (ie. inverse transform the clip space corner points)

However to be a friendly and useful feature, we should only require the user to pass the projection matrix in one format. Preferably the D3D one as that is used internally by occlusion rendering & screen rays.

But when using OpenGL, we'd need to be able to convert it to OpenGL format for the actual rendering. Ogre had code for conversion (it was rather doing OpenGL to D3D) but I'm not convinced that it was correct. As it stands now the formulas for D3D & OpenGL projection matrices are quite different.
User avatar
cadaver
Urho3D author
Urho3D author
 
Posts: 1802
Joined: 16 Jan 2014, 14:52
Location: Finland

Re: Set custom project matrix in Camera

PostPosted by cadaver » 22 Aug 2016, 19:10

I dug up the original post on the Ogre forum (where projection matrix conversion was being proposed)
http://www.ogre3d.org/forums/viewtopic.php?f=4&t=13357

and the formulation appears to be working, at least for a typical perspective and ortho matrix.

Need to test the frustum definition from the matrix, but if that works too, then it's worth implementing the ability to supply an arbitrary projection matrix, since it would then work without any shortcomings / bugs.
User avatar
cadaver
Urho3D author
Urho3D author
 
Posts: 1802
Joined: 16 Jan 2014, 14:52
Location: Finland

Re: Set custom project matrix in Camera

PostPosted by weitjong » 23 Aug 2016, 03:07

Thanks Lasse, I am also looking forward to this one.
YaoWT - Leave no window unbroken ♪ (^。^) 
User avatar
weitjong
Contributor
Contributor
 
Posts: 1094
Joined: 16 Jan 2014, 15:34
Location: Singapore, 新加坡

Re: Set custom project matrix in Camera

PostPosted by cadaver » 26 Aug 2016, 12:02

Custom matrix code has been merged to master. It's not mega-accurately tested, but we'll then see if it causes any issues.
User avatar
cadaver
Urho3D author
Urho3D author
 
Posts: 1802
Joined: 16 Jan 2014, 14:52
Location: Finland

Re: Set custom project matrix in Camera

PostPosted by godan » 26 Aug 2016, 16:27

Amazing! Thanks cadaver.
User avatar
godan
Active user
Active user
 
Posts: 122
Joined: 23 Sep 2014, 20:28

Previous

Return to Feature Request

Who is online

Users browsing this forum: No registered users and 0 guests

cron