Visualization of the model cross-section using OpenGL

Forums: 

Clipping visualized 3D models with user-defined clipping planes is one of basic OpenGL features that allows the user to look inside the models.

However, in some cases it is more interesting to investigate the cross-section shape rather than the model's internals. For this purpose, the cross-section should be visualized in shading using some distinctive visual attributes (specific color, hatching).

Solving this task geometrically might be a heavy work with large complicated CAD models. If visualization of the cross-section is the only goal, this task can be solved efficiently using OpenGL-based capping algorithm.

Currently, the capping algorithm is being implemented in the OCCT visualization component. Capping will be applicable on per-object basis. Visual attributes for cross-section will be defined at the level or individual clip planes. An important consequence of this improvement is that clipping planes in general will be applicable to both the whole 3D view and individual 3D presentations. Capping is optional property of the improved clipping plane API.

It should be noted that OCCT interactive selection will be also improved to take object-specific clipping planes into account, to avoid interactive selection of the object parts that were clipped. The current development results can be obtained from OCCT Git branch CR24070_2.

A snapshot showing sample results of the capping algorithm (three object-specific clipping planes, different visual attributes used for each of the three sections):

Denis's picture

Hello, Sergey

I'm trying to make a capping as in the picture above.
I created a box and want to reproduce it:

vinit
vclipplane create pln1
vclipplane set pln1 view Driver1/Viewer1/View1
vclipplane change pln1 equation 1 0 0 -7
vclipplane change pln1 capping on
vclipplane change pln1 capping hatch on
#green color
vclipplane change pln1 capping hatch color 0 1 0
vsettexturemode Driver1/Viewer1/View1 2
box m 10 10 10
vdisplay m
vfit
#red.png is a simple rectangle filled with red color
vclipplane change pln1 capping texname D:\\red.png
vclipplane change pln1 capping texscale 1.0 1.0

I expected that a capping will be as green lines over a red background, but only hatching is shown now.
Is there any way to combine both texture and hatch? Or is there a way to combine solid background with hatch lines?

Thanks, Denis

Sergey Anikin's picture

Hello Denis,

Hatching and texturing are two mutually exclusive visual styles for capping.
In fact, the visual result you mentioned can be achieved simply by using a proper texture, can't it?

Changing the capping API following your idea would complicate the things - so we need to be absolutely sure there is no other way to reach the goal.

Maybe if you explain your needs a bit more and attach a couple of screenshots that illustrate the current and desirable result, we could be more helpful.

Best regards,
Sergey

Denis's picture

Sergey, thank you for your fast answer

I wanted to do it by hatch because it doesn't changed by view scaling, but a texture does. Is there any way to prevent texrure scaling with respect to the camera and keep it constant (as in OnShape application, for example):

http://i65.tinypic.com/2n07889.png

And in DRAWEXE (scaling is changed)

http://i64.tinypic.com/2qiqxjr.png

Thank you in advance
Denis

Sergey Anikin's picture

Thanks for explaining!
Please, report an issue in OCCT Mantis describing the capping improvement to put it in the queue.
Also you can apply for our customer support services to get things done much faster and with the highest priority.

Best regards,
Sergey

Denis's picture

Hello Sergey,

Thanks a lot for your help.
I will register that request in mantis

Denis