I need an expert in trigonometry

Does anyone know how to find what is the 3d view ‘pseudo camera’ origin

I need to find the origin point af the 3d view (its frustum) but without using a camera object

I try to use these from the Blender.Window module:
GetViewMatrix()
GetViewOffset(ofs)
GetViewQuat()
GetViewVector()
But I am not sure about how to do this
Can someone clarify this to me because I am getting confuse ?

bonne annee
joyeux noel :slight_smile:

I’d love to know the answer to this question as well.

In orthographic view (and in C), the view location is

G.vd->viewinv[2] (the 3rd row of the inverse of the view matrix, where viewinv is declared as: float viewinv[4][4]; )

I believe that the view location in perspective mode is:
(intrr told me this, and I have not yet been able to verify it due to bugs in code that I am writing)

/* C code for the view location */
loc[0]= G.vd->dist*G.vd->viewinv[2][0];
loc[1]= G.vd->dist*G.vd->viewinv[2][1];
loc[2]= G.vd->dist*G.vd->viewinv[2][2];
VecSubf(loc, loc, G.vd->ofs);

I don’t know if G.vd->dist is available in Python, though.

I hope that helps!
Matt

I’ve doen some test and found that GetView Offset doesn’t work so use Get view matrix and matrix calculations.

pritning the straight window comes out as

[1.0000, 0.0000, 0.0000, 0.0000]
[0.0000, 1.0000, 0.0000, 0.0000]
[0.0000, 0.0000, 1.0000, 0.0000]
[0.0000, 0.0000, 0.0000, 1.0000]

the basics of the matrix works liek this

[rot, rot, rot, w]
[rot, rot, rot, w]
[rot, rot, rot, w]
[locx, locy, locz, n]

unfortuneatly thsi doesn’t accoutn to zooming in so yeah but if we shift+click move the world to the right we get this

[1.0000, 0.0000, 0.0000, 0.0000]
[0.0000, 1.0000, 0.0000, 0.0000]
[0.0000, 0.0000, 1.0000, 0.0000]
[-7.4435, 0.0677, 0.0000, 1.0000]

when you rotate the view a bit from a centered top view you get
[0.3455, 0.0040, 0.9384, 0.0000]
[0.1854, 0.9800, -0.0725, 0.0000]
[-0.9199, 0.1990, 0.3378, 0.0000]
[0.0000, 0.0000, 0.0000, 1.0000]

and finally from front and sie view
front:
[1.0000, 0.0000, 0.0000, 0.0000]
[0.0000, 0.0000, -1.0000, 0.0000]
[0.0000, 1.0000, 0.0000, 0.0000]
[0.0000, 0.0000, 0.0000, 1.0000]

side
[-0.0000, 0.0000, 1.0000, 0.0000]
[1.0000, -0.0000, 0.0000, 0.0000]
[0.0000, 1.0000, -0.0000, 0.0000]
[0.0000, 0.0000, 0.0000, 1.0000]

hope this helps a bit

MacBlender

Matrix math ain’t my strong suit, %| so … “use the source, Luke!”