Rendering order When rendering object graphics atoms with transparency, the order the atoms are rendered (i.e. the order the atoms are created and added to the hierarchy) determines what can be seen. You want to draw the atoms from back to front when the front items are transparent. The same principle holds true for iTools since they use object graphics.

If you add atoms to a model in the wrong order, you can always change the order with the IDL_Container::move method. With the iTools, you can use the BringToFront, SendToBack, BringForward, and SendBackward operations. These are available from the “Edit” menu or the context menu for a visualization. You can use these operations with code as well. First create a surface iTool and get its object reference (we’ll assume data has been read in already).

isurface, d
id = itGetCurrent(tool=otool)

To make the surface transparent, we’ll get its identifier and use the IDLitTool::doSetProperty method.

surfID = otool->findIdentifiers('*surface', /visualization)
result = otool->doSetProperty(surfID[0], 'Transparency', 50)
otool->commitActions

The IDLitTool::commitActions method tells the iTool that it should put any actions (like our property change) into the undo/redo buffer and refresh the window. Now, we’re ready to add a second data set.

iplot, x, y, z, /overplot

Finally, we find the identifier for the SendToBack operation and do it.

sendToBackID = otool->findIdentifiers('*sendtoback', /operations)
result = otool->doAction(sendToBackID)

Unlike doSetProperty, the IDLitTool::doAction does not need commitActions for its action to be added to the undo/redo buffer.

Here’s what the results look like:

Polylines in front (added last); you can’t see through the supposedly transparent surface. Polylines sent to back; now you can partially see the polyline behind the surface.

Here are the source code and docs for the demo.