Fly-Through:
Kidneys
Feet
Head
QuickTime VR:
Kidneys
Head
Heart 3D

The Shading Menu within OsiriX

The Shading Menu is a little feature, semi-hidden on the main toolbar.  I know that I was completely ignorant of this feature until recently.  It isn't going to completely revolutionize the way OsiriX renders anything, but it does add just a bit of a punch to your renders.  This tutorial was created using OsiriX version 3.3.2 for Mac OS 10.5 and higher.  (Most of these options should be available for earlier versions as well, but this has not been verified.)

Right click here to download a pdf version.

Initial Data loading

1. I chose to use the VIX data set (a CT data set of the foot – available from the DICOM Sample Image Sets) to initially demonstrate this, but I'll show examples from other data sets as well later in the tutorial.  First, open up the data set just as you would any other - double click on the VIX image set to open up the 2D viewer.

2. Then, select 3D Volume Rendering from the 2D/3D drop down menu.

3. I chose to quickly set the CLUT for this tutorial to better show the bones. 

If you want to use the same image, the settings that I used are:

Value 1: 116
Alpha 1: 0.000

Value 2: 212
Alpha 2: 0.723

Value 3: 350
Alpha 3: 0.737

Value 4: 1133
Alpha 4: 0.723

3b. I then right clicked within the graph area to save the curve so that I could set the data set back to full screen and still have the desired CLUT.  For more information on the 16bit CLUT editor, please see my other tutorial.


Shading menu

Now, the focus of this tutorial is the Shading menu. 

This menu is part of the default setting of the OsiriX toolbar.  It has a "Shading" toggle box, an "Edit" button, and numbers listed for the Ambient, Diffuse, and Specular settings.  Automatically, it is set to a default value that gives the following result.

4. We are going to leave the "Shading" toggle switch checked for right now and revisit that later.  To get into the options of the shading, click the "Edit" button to open up another menu.

5. This menu controls the numbers that can be seen in the box on the toolbar.  They have slightly different names within this menu.  However, they correspond with their display at the top. 

Ambient can be controlled by the Ambient Coefficient. (This will be called AC for the rest of the tutorial)

Diffuse can be controlled by the Diffuse Coefficient.  (This will be called DC for the rest of the tutorial)

Specular has two numbers associated with it: the first is the Specular Coefficient, and the second is the Specular Power.  (These will be called SC and SP respectively for the rest of the tutorial) 

Automatically, this menu is set to the "Default" setting.  This has the AC = 0.15, DC = 0.90, SC = 0.30, and SP = 15.00.

In general, these three settings have a few properties associated with them when referring to a 3D environment.  Ambient light generally refers to the overall lighting within a scene.  This setting is the darkest that a scene can get in the 3D world and has a flat fill effecta.  Diffuse is the color assigned to the object itself.  And Specular controls the highlights on the object.  For the most part, this also hold true within the OsiriX interface.  We will be exploring how these settings affect the output image in detail.

6. To start off with, there are three buttons within the Shading menu: a plus (+), a minus (-), and an edit button.  There is also a drop-down menu that allows you to pull up other preset values, but we'll address that later.  For now, lets look at those buttons. 

The plus (+) button allows another preset to be added to the drop-down menu.  The minus (-) button removes the selected preset. 

7. Now, you might notice that all of the numbers are currently grayed out.  If you click on them, they cannot be changed.  The presets can be toggled through in the drop-down menu, but the settings of one of these cannot be changed until the edit button is clicked at the bottom of this menu.

8. Now, the numbers are white, and the sliders can be moved to edit the settings.  Instead of fooling with the numbers under the default preset, lets go ahead and click the plus (+) button to create a new shading group. (IMPORTANT NOTE: be careful when adjusting numbers within the preset options – there is no “save” button.  What the numbers are changed to are automatically saved!)

9. This opens a new group, automatically called "Preset 5."  This name can be changed in the "Name:" box directly below the drop-down menu.  Lets call this preset "Test01."


As you can see, this automatically changes the name within the drop-down menu as well

10. Lets tackle each of these number individually to actually see what they control.  So, first, zero (0) out each of the settings.  This turns the image completely black.

11. As mentioned before, the Ambient setting controls the overall lighting of an object, setting the darkness of the shadows.  By bringing the AC value to one (1) and leaving all the other values at zero (0), you can see the very flat effect that is produced.  There are no shadows inherent to the object, just a generalized color fill.  In 3D programs, the Ambient setting can add information to the black areas, and gives a good background image to work from.  It generally isn't a setting that will be put to full strength unless a certain effect is desired.

12. Now, bring the AC value back down to zero (0).  Pull the DC value up to one (1) to see the effect of that value.  Where the ambient setting produced a very flat fill, the diffuse setting allows for what is a more "natural" light on the object. This also has a range of black to this current setting, the lightest that diffuse can go. The combination of Diffuse and Ambient produces a brighter image that still has form and shadows.

13. Again, bring all the values down to zero (0).  The last property within the Shading Editor has two inputs: the SC and SP settings are very closely related.  Without a SP setting, the SC turns the image completely white when set one (1), as seen here.  This is because the SP controls the tightness of the highlight.  With the SP set to zero (0), the highlight covers the entire object regardless of shape, causing the white silhouette effect.

14. Here, a couple of settings of SP are shown.  This demonstrates what I mean by the "tightness" of a highlight.  As the SP number increases, the specular highlight becomes more concentrated on the raised areas of the object.  Keeping a SC value of one (1), the following images show an increase of the SP value.

    

    

    

As the last image shows, the value of SP can be forced above the maximum slider setting. By default, the slider only reaches a setting of 50.0. However, typing 100.0 into the text box can force the SP value higher than the default settings. This can be done to any of the settings by typing a value into the text box. However, this can cause excessive graininess or poor rendering as the system was not designed with those values in mind.

15. The default maximum value of SC is 4.0. Keeping the SP at 100.0, the following image shows how the overall brightness and sharpness of the highlights increases when the SC value is set higher.

These are the settings within the Shading editor.  It is a combination of these values that produces the image generated on screen.  Now, lets take a very quick look at the other presets already within OsiriX.

Default:


Glossy Vascular:


Glossy Bone:


Endoscopy:


16. As I did not find what I was looking for in the presets, I have already created a setting (that I called Sarah01) that I use in my everyday OsiriX workflow. I found that the highlights were too bright or the object was too dim in the other presets. 


I used the following settings:

AC = 0.10
DC = 0.90
SC = 0.85
SP = 50.0

This gives a result similar to the default, but with a bit more specular highlight, and a few more shadows (higher SC/SP and slightly lower AC).  However, it doesn’t move to the extremes that some of the other presets do.  These presets can give very nice effects on other data sets, depending on the CLUT and desired emphasis.

17. Just to mention the “Shading” toggle box – it disables the Shading menu, placing the AC control at 1 and all others at 0.  This gives that same bright, flat look.  Also, while different presets can be selected from the drop-down menu, no effect is seen on the object.

    

Examples:

Brebix

Default:

My Shading Group:

Glossy Vascular:                         Glossy Bone:                             Endoscopy:

So, this menu allows for greater control over the look of your final image. Feel free to e-mail questions and suggestions, corrections, etc. to sarah@shegmann.com.