Class SoDepthOffset
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.inventor.misc.SoBase
-
- com.openinventor.inventor.fields.SoFieldContainer
-
- com.openinventor.inventor.nodes.SoNode
-
- com.openinventor.inventor.nodes.SoDepthOffset
-
- All Implemented Interfaces:
SafeDisposable
public class SoDepthOffset extends SoNode
Property node that applies a depth offset. This node can be used to offset shapes that are co-planar, in order to resolve depth buffer artifacts, commonly called z-buffer "stitching".The effect is similar to
SoPolygonOffset
but this node uses a different algorithm (based on Lengyel's method from Game Programming Gems and improved by VSG) in which the projection matrix is modified to offset subsequent geometry. As a result it has advantages overSoPolygonOffset
in some cases. Specifically,SoDepthOffset
applies its offset value to all types of geometry, not just polygons, and does not require any additional per-vertex calculations on the GPU.The
offset
value is accumulated in the traversal state. For example: Note that if the accumulation of offset values during the traversal is greater than 1, the accumulated offset value is normalized so that, in this case, the offset values are not absolute but relative to each other.SoDepthOffset
has two limitations. First, since it modifies the projection matrix during traversal, it may prevent building a render cache for part of the scene graph. Second, the offset does not take into account the depth slope of the geometry (asSoPolygonOffset
does), so a larger offset may be required for geometry that is not perpendicular to the view vector (facing the camera).The presence of a
SoDepthOffset
node in the scene graph causes depth buffer values to be different, even if 'offset' is equal to 0.The render caching issue is easily handled, by adjusting your scene graph structure, just as you would for any non-cacheable node, to ensure that the actual shape nodes are cached even if the parent group node cannot cache:
For example, using this scene graph structure:
instead of this one:
File format/default:
DepthOffset {
offset 0.001 on true Action behavior:
- See Also:
SoPolygonOffset
,SoDepthBuffer
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.openinventor.inventor.nodes.SoNode
SoNode.RenderModes
-
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
-
Field Summary
Fields Modifier and Type Field Description SoSFFloat
offset
Offset to apply to the projection matrix.SoSFBool
on
Enables depth offset.-
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
-
Constructor Summary
Constructors Constructor Description SoDepthOffset()
Constructor.
-
Method Summary
-
Methods inherited from class com.openinventor.inventor.nodes.SoNode
affectsState, callback, copy, copy, distribute, doAction, getAlternateRep, getBoundingBox, getByName, getMatrix, getPrimitiveCount, getRenderEngineMode, getRenderUnitID, GLRender, GLRenderBelowPath, GLRenderInPath, GLRenderOffPath, grabEventsCleanup, grabEventsSetup, handleEvent, isBoundingBoxIgnoring, isOverride, pick, rayPick, search, setOverride, touch, write
-
Methods inherited from class com.openinventor.inventor.fields.SoFieldContainer
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
-
Methods inherited from class com.openinventor.inventor.misc.SoBase
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizable
-
Methods inherited from class com.openinventor.inventor.Inventor
getNativeResourceHandle
-
-
-
-
Field Detail
-
offset
public final SoSFFloat offset
Offset to apply to the projection matrix.
Positive values move geometry toward the camera (the opposite ofSoPolygonOffset
). Offset value must be in the range [-0.5 .. 0.5] (normalized depth coordinates). Default is 0.001
-
on
public final SoSFBool on
Enables depth offset.- Since:
- Open Inventor 8.1
-
-