AIS_ViewCube strange display in perspective projection

Hello everyone, I found that when the camera is set to Projection_Perspective, ais_viewcube becomes strange, but when Projection_Orthographic, ais_viewcube is normal. I don't know how to modify it? Thank you all.

    switch (projectionType) {

        case PROJECTION_TYPE_ORTHOGONAL: {
            myView->Camera()->SetProjectionType(Graphic3d_Camera::Projection_Orthographic);
        }
            break;
        case PROJECTION_TYPE_PERSPECTIVE: {
            myView->Camera()->SetProjectionType(Graphic3d_Camera::Projection_Perspective);
        }
            break;
    }

 

Kirill Gavrilov's picture

I suppose what you've called "becomes strange" is a perspective projection distortions, which are expected when you enable perspective projection (you may see on screenshots that View Cube has similar distortions as a Grid).
Distortions grow closer to view boundaries, so that one option is moving View Cube farther from boundaries or to recude Field of View camera parameter.

w d's picture

Ok. Thank you so much. I created this AIS_VIEWCUBE through Graphic3d_TransModeFlags, so I think its display effect should not be affected by the lights and cameras in the 3D scene, but it is not. I should have understood it wrong.

I guess that the default camera FOV of 3dsmax should be relatively small, so its ViewCube has no distortion in perspective and orthogonal projection modes.

Thank you again. It's been a long time since I saw you. Can you help me look at these questions again?

https://www.opencascade.com/content/brepoffsetapimakeoffset-wire-and-face-odd-occt-740

https://www.opencascade.com/content/occt-740-doubts-about-using-ocaf

https://www.opencascade.com/content/use-face-split-solid-how-exactly-retrieve-left-or-right-splitted-solid

https://www.opencascade.com/content/approxcurve3d-convert-wire-geombsplinecurve

https://www.opencascade.com/content/project-curve-surface-and-divide-surface-two-parts

https://www.opencascade.com/content/brepoffsetapimakepipeshell-bspline-error

Excuse me again, thank you。

Kirill Gavrilov's picture

Can you help me look at these questions again? 

Please don't bloat topics with unrelated questions and references - this messes up a forum structure.
If you have asked some question long time ago and have not received an answer, consider to:

  • Take a look onto question again. Check if it describes problem good enough and provides necessary details, screenshots, test files, etc..
    If it does not - edit topic head (probably adding some comments like "last edited on _" if forum engine doesn't put this automatically).
  • Post a "ping" message into related forum thread (NOT to other threads) as a reminder that you still have no luck with the problem.
    Something like "Ping. Problem is still not resolved and I would appreciate any feedback".
    Don't abuse this too much (don't "ping" topics massively or too regularly).
  • Add new details to thre thread of what you have tried / read since question has been originally asked.
    This will show your good attend to the problem resolution and will stimulate others to help you (counter to the topic like "please solve my problem, I have no idea what to do").
  • If you have asked some question before, haven't received feedback and then solved your problem on your own - don't leave an orphan on a forum and share your solution.
    Try helping other users, when you can.
  • Forum is an open space where users may willingly ask for help and willingly help others.
    Answering others question might require specific expertise (there is no person knowing an every single algorithm in OCCT framework), time and motivation to help (see previous points).
    This is not a service - you may receive more reliable help by attending to support services.

This is my personal opinion on how forums are supposed to work. It is not a golden bullet to receive a help, but it might help ;).

Kirill Gavrilov's picture

I created this AIS_VIEWCUBE through Graphic3d_TransModeFlags, so I think its display effect should not be affected by the lights and cameras in the 3D scene, 

Transform persistence in OCCT tries to fit object into 3D world space while preserving some aspects (size, orientation, position on the screen, etc.).
In particular, it does not affect projection matrix at all; it may affect only camera orientation matrix, as you can see in Graphic3d_TransformPers::Apply() implementation.

It doesn't mean, however, that other systems implement viewcube-alike presentations in the same way - they may decide to draw them using orthogonal projection matrix or in some other way.

Han Hu's picture

Hi Kirill,

I'm new to this community. Unfortunately, from the link you provided, I still do not figure out how to set the matrix accordingly.
I have the same issue after "view->Camera()->SetProjectionType(Graphic3d_Camera::Projection_Perspective);".
How can I apply such a change to my AIS_ViewCube?
Thanks.

w d's picture

Thank you very much for the "using orthogonal projection matrix" you mentioned, it is very useful.

Sorry to messes up a forum structure. I am a little worried. I will try to do this.

Thank you again.