The HOOPS Web Viewer component supports several different ways to draw the scene called "Draw Modes". Only one of them can be active at a given time. To activate a specific draw mode call the setDrawMode() function on the view object:
The following draw modes are currently supported:
Selecting one of those draw modes renders the scene with either faces and lines turned on, faces only or lines only. It is an easy way to turn off visibility of faces and lines for the whole model. Alternatively you can also use the functions view.setLineVisibility() and view.setFaceVisibility() to control this behavior. The code below turns on Wireframe mode meaning that only the lines in the model are displayed:
Hidden line removal (HLR) involves displaying only visible, unobscured lines. Faces of visible geometry will be used to obscure lines the lines in the model or draw them in a dimmed style but the faces themselves will not be drawn. Typically, HLR is used to provide a result suitable for hardcopy or screenshots since having shaded facets can clutter the scene. However, sometimes end-users are also interested in seeing a model rendered with hidden line mode on the screen.
There are various settings for hidden line mode that you can specify by retrieving and modifying the HiddenLineSettings object. For example, in order to make the obscured lines in the hidden line render invisible you would write the following code:
Hard Edge Detection
A new hard edge detection algorithm was added to HOOPS Communicator 2020 SP1 and is enabled by default. This new algorithm will cause hidden line mode to look different than previous versions. A new set of functions have been added to the View API to control this new behavior.
- setHardEdgesEnabled(), getHardEdgesEnabled()
- setHardEdgeColor(), getHardEdgeColor()
- setHardEdgeOpacity(), getHardEdgeOpacity()
- setHardEdgeThreshold(), getHardEdgeThreshold()
- setHardEdgeThresholdRampWidth(), getHardEdgeThresholdRampWidth()
The purpose of X-ray Mode is to make it easy to identify selected elements in a complex scene by turning the whole model except for the selected elements transparent. In the below example the selected part is inside the model and would normally just be displayed as an outline. With X-ray mode however the selected part is fully displayed without completely hiding the rest of the model.
Below are the API functions to control various aspects of X-ray mode:
As an example, let's change the opacity of the unselected lines to fully opaque: