Bad quality of visualized shapes

Hi all,
please take a look on this snapshot
Why the quality of surfaces in viewer is bad with high zoom?
There are "holes" and the shadow surface is different than the wireframe surface.
There is a way to control the quality when zooming?

My configuration is:
- Linux Fedora Core 8
- nVidia Quadro NVS 110M

Any suggestion?

Svetlozar Kostadinov's picture

Hi, Marco, I am not very familiar with this problem, but I saw it a lot of times. Consider a investigation of these methods of AIS_Shape





Marco Matt's picture


Applying the following settings the quality is really better without any notable performance or memory degration.

myAISContext->SetDeviationAngle(myAISContext->DeviationAngle() / 10);
myAISContext->SetDeviationCoefficient(myAISContext->DeviationCoefficient() / 10);
myAISContext->SetHLRDeviationCoefficient(myAISContext->HLRDeviationCoefficient() / 10);
myAISContext->SetHLRAngle(myAISContext->HLRAngle() / 10);

Svetlozar Kostadinov's picture

Yes, the modern graphics hardware is maybe 10-100 times more powerfull since the first version of OpenCascade. I've experienced the same problem as you and possibly will test this code on our project.

Dmitry Khabi's picture

I don't agree with you marco:
"any notable performance"

If the setting are following:


I have a bad visualisation in Shading mode but good one in Wireframe (How can it be ?)

With setting:


Thje visualization is good, but performance is very bad (much more time to load the Shapes in AIS Context.)
The Graphic Card is fast....

Paul Jimenez's picture

A graphics card being fast is related to its ability to draw more quickly on screen, or to render more frames per second, than other cards or, worse, software emulation.

Creating the triangulation and feeding the graphics card with it is a different story. It's not like you are passing the internal TopoDS_Shape of the AIS_Shape to the graphics card and it'll do all triangulation using its GPU. It's an operation that is still CPU bound.

Dmitry Khabi's picture

You are right.

But One question:
I have a good quality of IsoLines, but a bad quality of shading model.
For example a cylinder:

1. With a lot of Iso-Lines I see one cylinder, ever with the very small quality's parameter.
2. In Shading mode I see crooked cylinder. To see a "good" cylinder i have to set a realy big quality's parameter

The different is realy big.

Is it possibly to do something. Is it complett different algorithmus to calculate ISOLines and Triangulation?

Dmitry Khabi's picture

Is it deppend on format of file ?

1. To Transfer the file to the Document ?
2. The time, that OCC needs to pass a Shape to Graphic Card ?

Paul Jimenez's picture

The slowdown would occur when OCC has to convert the shape to something that can be used to send to the graphics card. It should happen when OCC computes the presentation of the shape, which happens once for every mode (and for every shape), unless you force a re-computation.

The way it's sent to the graphics card may also hurt performance. I haven't checked how OCC does that.

Paul Jimenez's picture

I haven't checked into it, but maybe, just maybe, some of those parameters may influence a single presentation mode. Another option would be to write your own version of AIS_Shape that uses different parameters when calculating the different presentation modes.

That's all I can think of. I hope that helps.

Dmitry Khabi's picture

Thank you !
have a good day

Dmitry Khabi's picture

Does somebody know the Program CADMai ?
The program based on OpenCascade Version 5.0.
The CadMai need less than 20% of time to import step fiel and to show the imported shape, than OCC 6.3 with standard methods. The quality is not bad.
Is the Version 5.0 so fast ? Has somebody some expirience with 5.0 ?

Paul Jimenez's picture

I see the logo of OpenGL in their website. It could happen, as some people have already done it, that they are using another visualization library instead of the services provided in OCC. I think the author of HeeksCAD did that (you can find about it in the forums), and I also had a conversation with someone who told me they developed a visualization module using an existing library instead of using OCC's AIS and friends for a project that uses OCC.

Dmitry Khabi's picture

After the study of HeeksCAD and some other projects, I have detected in my program that:

The behavior of the transformation of TopoDS_Shape to the Graphic card is a little bit curious :
such way to show a TopoDS_Shape:
create TopoDS_Shape and aAISObject

leads to bad quality of the shown Shape. I have had to increase the quality factor of the AIS_Interactive context in order to increase the quality->very slow.


If you load the TopoDS_Shape / ASI_Shape AT FIRST in the Wireframe-mode and AFTER THAT switch it to the Shaded mode:

the quality is good and it happens more faster (not very slower than bei HeeksCAD).

What is the reason ? Is it is depend on the mode, how the Shape will be transformed to the GraphicCard ....?