Choosing a Shading Model

HOOPS Luminate offers a few built-in material models or it can be used in a custom and flexible way by defining custom shaders and materials. The guidelines and hints below all apply to hardware rendering.

Using Built In Materials

A complete material can be created in one call: RED::IMaterial::SetupGenericMaterial or RED::IMaterial::SetupRealisticMaterial. Resulting materials will be both made of several HOOPS Luminate built-in shaders. For instance a simple generic material will use (among other shaders):

  • A RED::RenderShaderAmbient in RED::MTL_PRELIT

  • A RED::RenderShaderLambert in RED::MTL_LIT

  • A RED::RenderShaderEnvironmental in RED::MTL_POSTLIT

So we can see that this will potentially imply several rendering passes for the scene (see in the doc Real-Time Rendering of 3D Datasets in the section Accumulating Rendering Passes), so potentially, this can slow down the display of the model.

Of course, then, this is very flexible, as lights can be dynamically added and removed and the rendering will dynamically show changes that have occurred. Each built-in HOOPS Luminate shader for the RED::MTL_LIT pass supports all kinds of lights that exist in HOOPS Luminate, so it’s easy to assemble a high quality real-time view of a model.

So often, the drawback is there: this flexibility comes at the expense of a rendering pass per light present in the model, plus one pass for the pre-lighting and another one for the post-lighting. If lights are focused and have limited effect areas, this may not be a problem; but if lights have wide effect areas and if there are many of them to render each frame, this can consume time, and it may be somehow interesting to switch to a custom shading model.

Using a Custom Shading Model

HOOPS Luminate materials can be customized. Custom shaders can be written. See Writing a Custom Material for details. A deferred lighting pipeline can be setup (see Deferred Shading Using Multiple Render Targets), so there’s no real limitation to the level of customization that can take place for the rendering of a given model in a HOOPS Luminate based application.

That being said, most important is the fact that the geometry should be processed once. One single rendering pass is a must have, to avoid rendering all the triangles, lines or primitives that are contained in the scene, when this number of primitives is the performance bottleneck.

The RED::RenderShaderViewport is also a all-in-one CAD style viewporting shader that can be used to speed-up the display of a given model. The book Improving CAD Graphics also details a customized “one pass” shading model.