Hello,
I want to improve my own shader (see "Code Snippets" forum), but due to my lack of mathematical skills I don't make any progress at the moment.
I want to create an orthogonal matrix for my camera which starts at a given point (at the "near" value of the active camera) and ends at another specific point ("far" value of the camera), but I have no idea how I can calculate that.
My idea is to get the distance between those points from the perspective of the shadow camera, i.e. the width and height will vary. Does anyone know how to proceed there?
Thanks in advance
Matrix for shadow mapping
Re: Matrix for shadow mapping
I'm probably missing something. But Irrlicht matrix has the function buildProjectionMatrixOrthoLH which allows you to set the near and far plane and width/height. The world-view transformation is the same as for other cameras.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Matrix for shadow mapping
What I am struggling with is to limit my shadow maps so that they start exactly at the near values of the player's camera's view frustum and don't go too far. In my test application I have added a scene node which shows the view frustum (from the light's perspective), and once I pitch the camera up or down the shadow covers more than necessary, i.e. it doesn't start with the active camera but behind it.
I tried a little this afternoon but didn't get anywhere, at the moment I think my shadows are ok the way they are
I tried a little this afternoon but didn't get anywhere, at the moment I think my shadows are ok the way they are
Re: Matrix for shadow mapping
Ah yes - covering exactly how much you need is a bit tricky. But having a bit more won't hurt much.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
