Camera z axis aligned with the object doesn't apply foreshortening

Viewed 19

enter image description here

  get c_matrix() {
    return Mat4.identity.translate(Vec3.make(0, 500, 1000))
  }

If I use this original version with these parameters:

  get c_matrix() {
    return Mat4.lookAt(this.o, this.l, Vec3.up)
  }

  // 
  camera.l = Vec3.zero
  camera.o.z = -500
  camera.o.y = 100

It kind of skews a little. Is this how it is supposed to work, or something is wrong.

I place the object like this:

this.g.texture(0xcccccc, 
     /* x rotation, a_pi changes */ a_pi, 0, 0,
     0, 0, 50, /* x y z */
     /* other params */
     112 * 10, 32 * 50, 0, 0, 112, 32, 1024, 1024)

So if camera is at 0 0 -500, object is at 0 0 0, I get no foreshortening. I also tried moving the object up and down in y direction but still no foreshortening. Finally if I move the camera +y direction, it starts foreshortening.

Perspective matrix, which is multiplied by camera inverse:

p_matrix = Mat4.perspective(Math.PI*0.4, 16/9, 10, 1000)

Also I tried to render three axis, but the z axis is not visible (the rotating axis):

enter image description here

With these parameters:

this.c.o.z = -50
this.c.o.y = -200
this.c.o.x =-100


this.g.texture(0xcccccc, 0, 0, 0, 0, 0, 0, /* rotation and position */
 200, 4, 0, /* scale x y z */
 0, 10, 10, 1024, 1024)
this.g.texture(0xcccccc, 0, 0, 0, 0, 0, 0, 
4, 200, 0, /* scale x y z */
0, 10, 10, 1024, 1024)
/* the problem z axis */
this.g.texture(0xcccccc, 0, a_pi, 0, 0, -100, 0, /* rotation is a_pi changing value */
200, 4, 0, 
 0, 10, 10, 1024, 1024)
0 Answers
Related