How to set custom camera Matrix

Sort of newbie question:

I would like to setup camera with my own (Dimetric) projection.

From the code I figured out that for camera I can set type: Perspective or Orthographic and corresponding params (lens shift_x shift_y clip_start clip_end or ortho_scale ), but this is not what I need for Dimetric projection I would compute camera matrix myself and provide to camera.

There is mathutils.Matrix.OrthoProjection which can provide me with matrix, I can code something the same for Dimetric projection, the question remains - how to set this matrix to Camera. Or for what reason mathutils.Matrix.OrthoProjection exists?

Do I get it right that I need to change C code then compile Blender myselft to get another sort of camera in Blender?

For anyone interested dimetric and trimetric projection ( see http://www.significant-bits.com/a-laymans-guide-to-projection-in-videogames ) (for preview at least, not in render though ) could be achieved by having custom wmOrtho something like:

void wmOrthoCustom(float x1, float x2, float y1, float y2, float n, float f,float scalex,float scaley,float scalez)
{

float l=x1/*x1*/, r=x2, b=y1, t=y2/*y1*/ , f_=f/*f*/ , n_=n/*n*/; //n - ear f - far r - right 

glMatrixMode(GL_PROJECTION);
glLoadIdentity();


orig_projmat[0]=scalex*(2./(r-l));  orig_projmat[4]=0;     orig_projmat[8] =0;         orig_projmat[12]=-(r+l)/(r-l);
orig_projmat[1]=0;      orig_projmat[5]=scaley*2/(t-b);    orig_projmat[9] =0;         orig_projmat[13]=-(t+b)/(t-b);
orig_projmat[2]=0;      orig_projmat[6]=0;      orig_projmat[10]=scalez*(-2/(f-n));    orig_projmat[14]=-(f+n)/(f-n);
orig_projmat[3]=0;      orig_projmat[7]=0;      orig_projmat[11]=0;                    orig_projmat[15]=1;

glLoadMatrixf(orig_projmat);

glMatrixMode(GL_MODELVIEW);

}

can this be done with python or only C ++?

and it cannot be used for the render output ?

did you check if this can be done in YAFARAY for instance ?

salutations

It cannot be done with Python currently ( though I made hackish ( just to take a look at the result ) export to python to use this capability from script ) due to that no other than Ortho or Perspective matrix is known to python.

as for render - just the same projection matrix should be inserted somewhere in render output and it can be done in YAFARAY, again, after tweaking projection matrix.

may be you could ask on IRC if there are any possibilities ?
who knows there might already be a solution for this !
in any case it would be interesting to have this feature in 2.5 !

good luck
happy 2.5

I will drop a line to dev list

hello, i would like to know hwo you apple your wmOrthoCustom function to a Camera in the 3D scene?with python?

can you put that may be in a small script using a sinple panel like too pro and give 2 choices for dimetric and trimetric
as a script example

at least other people might be able to do it faster !

nice to know there is a way here

thanks happy 2.5