For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings


Need to speed up your development?
Have a look at our:

Samples & Tools


Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Camera Vision Simulation 2

JALLON's picture

Hi all,

As explained in the previous "Camera Vision Simulation" post, I would like to simulate the vision of a camera. The problem is that the result is not realistic and really, I don't know why.

Below, my code:

// A simple box 100x100x100 centered at (0,0,0)
BRepPrimAPI_MakeBox B(gp_Pnt(-50,-50,-50),100,100,100);
Handle(AIS_Shape) Box = new AIS_Shape(B.Shape());

double Focal=50, CCDSizeX=10, CCDSizeY=10; // Aperture: 11.4°

// Step 1: Mapping definition
Visual3d_ViewMapping Mapping = View->ViewMapping();

Mapping.SetProjectionReferencePoint( Graphic3d_Vertex(0,0,Focal) ); // Eye() position in View Reference Coordinate system
Mapping.SetViewPlaneDistance(0); // ViewPlane = FrontPlane
Mapping.SetWindowLimit( -CCDSizeX/2, -CCDSizeY/2, +CCDSizeX/2, +CCDSizeY/2 ); // Not sure ???


// Step 2: Orientation definition
Visual3d_ViewOrientation Orient = View->ViewOrientation();

Orient.SetViewReferencePoint( Graphic3d_Vertex(0,-1000,0) ); // At() position = CCD position
Orient.SetViewReferencePlane( Graphic3d_Vector(0,-1,0) ); // Camera Axis = OY Axis
Orient.SetViewReferenceUp( Graphic3d_Vector(0,0,1) );


// Positionning Analyze
double X, Y, Z;

View->At(X, Y, Z); // OK = (0,-1000,0)
View->Eye(X, Y, Z); // OK = (0,-1050,0)
View->FocalReferencePoint(X, Y, Z); // OK = (0,-1050,0)
View->Proj(X, Y, Z); // OK = (0,-1,0)
double angle = (Handle(V3d_PerspectiveView)::DownCast(View))->Angle(); // OK = 0.199rad = 11.4°
double focale = View->Focale(); // OK = 50
double depth = View->Depth(); // OK = 50

// Invalid Drawing: very small cube !!!

If someone can help me...

Laszlo Kudela's picture

Hello Jallon,

it's been a couple of years since you asked this question, but have you found a solution after all?

Forum supervisor's picture

Dear Laszlo,
Last time manipulation of the viewer has been seriously revised.
Coming soon OCCT 6.8.0 will support notion of the camera thus allowing natural manipulations with it.
Best regards

Forum supervisor's picture

Dear Laszlo,
See also link to related discussion at development portal:
Mys be it will be useful for you too.

Laszlo Kudela's picture

Okay, thanks.

Is there going to be a meaningful description in the guide about how the projection pipeline works?


Forum supervisor's picture

Dear Laszlo,
We plan to make update of OCCT 6.8.0 visualization User's Guide in part regarding new camera API usage in an application.
Best regards

Laszlo Kudela's picture

I mean, what the guide says about SetWindowLimits is probably true, but regardless of what value I set there, I always get the same view. (I tried a lot of different combinations)

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.