XYZ

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • in reply to: 作业二 颜色出现问题 #11379 Score: 0
    XYZ
    Participant

    zNear = -zNear;
    zFar = -zFar;
    Eigen::Matrix4f projection = Eigen::Matrix4f::Identity();
    projection = Eigen::Matrix4f::Zero();
    eye_fov = eye_fov / 180 * MY_PI;
    projection(0,0) = zNear;
    projection(1,1) = zNear;
    projection(2,2) = zNear + zFar;
    projection(2,3) = -zNear * zFar;
    projection(3,2) = 1.0;
    projection(3,3) = 0.0;

    Eigen::Matrix4f ort = Eigen::Matrix4f::Identity();;

    float t = tan(eye_fov / 2) * abs(zNear);
    float r = t * aspect_ratio;
    ort(0,0) = 1.0 / r;
    ort(1,1) = 1.0 / t;
    ort(2,2) = 2.0 / (zFar – zNear);
    ort(2,3) = (zNear + zFar) / 2;
    projection = ort * projection;
    return projection;

    in reply to: 作业二 颜色出现问题 #11325 Score: 0
    XYZ
    Participant

    应该是你的projection矩阵哪里出现的问题,你需要讲znear和zfar取负数 只在求top的时候使用距离时abs用绝对值。

    in reply to: 作业二 颜色出现问题 #10991 Score: 0
    XYZ
    Participant

    谢谢你的解答,我已经解决了这个问题,应该是透视矩阵的错误导致的

Viewing 3 posts - 1 through 3 (of 3 total)