HOOPS Visualize is one of the very successful visualization SDKs that is available in the market and is claimed to be used in about 300 applications. It is available on Windows, Mac and Linux platforms. It is developed and marketed by a company called TechSoft3D. I have been developing applications based on HOOPS for over a decade now. Out of that I spent around four years at TechSoft3D where I was part of the HOOPS development team as well as I consulted many companies in making the best use of HOOPS for their applications. Today, I am sharing with you a few ways that I found to be most effective in unlocking the power of HOOPS.
1 Don’t re-invent the wheel – Use Sample code: HOOPS distribution has tons of sample code, right from a simple “Hello World” like programs to very complex applications. There are samples in various languages (C, Java, C# etc.) as well as samples which use MFC, Qt and other UI frameworks. All these sample programs are developed by HOOPS development team and are arguably the best usage of the given APIs. I found many developers getting into writing the same code and learning things the hard way than benefiting from the sample code.
2 Grab the low hanging fruits – Display Lists, Hardware Rendering, Backplane culling: When it comes to 3D, it’s always about performance. Many developers spend too much time focusing on optimizing language aspects viz. loops, lists etc. to squeeze out the performance from their HOOPS based system. What they forget is simple switches in HOOPS that can boost performance in multiples. These are enabling hardware rendering (hardware Z-buffer), setting up display lists, using backplane culling, disabling line/edge thickness etc. Again, referring to sample code might help in uncovering some of these secrets. At the same time, being through with the documentation and playing around with settings would be another way to unlock these power-ups.
3 Use HOOPS 3D Part viewer as your lab: HOOPS 3D Part viewer is an MFC based sample application that ships with HOOPS SDK. It has many features and perhaps covers the most of HOOPS APIs. Any behavior demonstrated by this application, for e.g. rendering performance, rendering quality etc., can be considered as a benchmark.
The part viewer has many features that can be used to analyze HOOPS scene and behavior. In this, the HOOPS Segment Browser is one of the most effective tools. It displays HOOPS scene graph in a tree form and allows you to manipulate the segment and geometry. Apart from that, support of various import and export formats, performance counter and various options (rendering, driver etc.) are also very useful. Part viewer is also a very effective validation and bug reporting platform for HOOPS.
4 HMF – HOOPS Magic file: I mean, HOOPS Meta File. But it is magical. I have solved numerous problems with the help of this ASCII text formatted file. It captures the HOOPS scene graph in a human-readable text file. A few ways I have used it are:-
- Dump the scene graph in HMF at a particular execution point in your application and then load the file in HOOPS Part viewer to validate the behavior.
- Manually review, search and edit HOOPS scene graph by loading the HMF file in a text editor of your choice.
- Compare the differences between the two scene graphs for their attributes, etc. using any diff. tool viz. WinDiff or Araxis Merge.
5 Navigate like a Pro – Use Segment Browser: I did briefly mention the Segment Browser Dialog feature in HOOPS 3D Part viewer demo application of HOOPS Visualize. It has a section which gives you a brief summary of the contents of the scene graph and includes the number of segments, different geometry items, etc. Often this information is enough to give you a hint on problems for e.g. when nothing appears on screen, check if the number of geometry items is 0 or not.
There is a tree view section which can be expanded to understand the hierarchy. You can navigate segments, geometry items, attributes, include and style links. A lot of valuable information such as segment names, geometry details, and attribute values are very easily accessible. You can also create, edit, move and delete the tree nodes. Part of the tree can be exported in a separate file. Finally, the tree can be searched for a specific attribute.
6 Leverage HOOPS/MVO: HOOPS/MVO (Model-View-Operator) is a very powerful set of C++ classes built on top of HOOPS/Visualize. It contains a full set of most commonly used features of a 3D application, e.g. view manipulation, selection & highlighting, file loading and saving, utility classes, etc. It also has a plugin architecture which makes it easy to support your own custom file format. With all this, one can have a basic application up in a couple of days.
Having said that I would recommend applying your prudence while using HOOPS/MVO. Since MVO has been released in a readable source code form, there is a tendency for developers to go in and tweak the code for a quick fix. I have been seen that this shortcut results into a huge pain later on when newer versions of HOOPS SDK are released. MVO is very dynamic and even though the interfacing classes may remain backward compatible, it can change a lot internally. This becomes hard for developers to keep porting their quick fix to the latest versions.
7 Always enable warnings and errors: Quite often I have noticed the first HOOPS line of code that an application has is HC_Define_System_Options(“no errors, no warnings”). And this is done so early in the development stages that at a later point of time, it’s too late to enable them. You just cannot execute the program 100 lines further without getting flooded with warning and error messages. HOOPS warnings and error messages are very powerful indications of early problems creeping into your application. Ignore warnings and error; you will suffer. Suppress the; you are dead. It’s perhaps alright to disable them in your production version, but they should always be on in your development builds.
8 Upgrade Regularly: They say “Stitch in time saves nine”. I say, “Update in time saves ninety”. HOOPS SDK is currently in its nineteenth version and a new release comes out almost every year. For many reasons, HOOPS users tend to assign a low priority to the task of upgrading to the latest version of HOOPS. In my experience, the porting efforts are directly proportional to the difference in the version number of your currently used SDK and the version you are trying to port to.
In one case, a customer had about 5 versions behind and it was a dedicated consulting project just to bring them to the latest version. And why did they have to? They were forced to. The performance improvements in the newer versions were tenfold than older versions.
9 Code generate: I have had an opportunity to review numerous HOOPS based applications and it never fails to surprise me the different ways HOOPS APIs are used to produce fascinating results. While this is definitely a good news, the biggest challenge is faced when a developer encounters a problem which she thinks could be a HOOPS issue. To be able to communicate this problem to the support team and help them reproduce it (without having to release the complete source code of your application!) is a herculean task.
Use code generation (HC_Define_System_Options(“code generation = on”)). A very powerful, but often unknown capability of HOOPS to log every API call made to it along with the parameter data. These are written in various C program files which are ready to be compiled. In a matter of minutes, the entire HOOPS behavior is captured and reproduced without giving away any of your software source code. Code generation can be a little tricky to use at first, but once you get used to it, it works like a charm. We have helped many of our customers who report problems and get them fixed using this feature of HOOPS.
10 Get Support: The technical support team of HOOPS is backed by the people who have been developing HOOPS code for years. They have some of the most in-depth insights into the capabilities of HOOPS and its effective use. Instead of approaching the support team when it is too late, I would highly recommend getting an advice when making big decisions. For example, when faced with a rendering problem, you may find turning off the display lists makes it work. The decision to switch off the display lists for the entire application may sound the best way forward at that moment, but it really isn’t. The penalty you will pay for this is that the rendering of 90 percent of your other models is going to slow down tremendously. A classic situation when you should consult the HOOPS support team.
I hope these ten little pearls of wisdom will help you with your HOOPS application development. If there is any other area where you think we can help, please feel free to contact us.
Before I sign out, here’s a trivia. HOOPS means
- Sports: Basketball
- Ring: Hula-Hoops
- Software: Hierarchical Object-Oriented Picture System