SoShadowGroup Class |
Shadow casting group node.
Namespace: OIV.Inventor.Nodes
The SoShadowGroup type exposes the following members.
Name | Description | |
---|---|---|
SoShadowGroup | Default constructor. | |
SoShadowGroup(Int32) | Constructor that takes approximate number of children. |
Name | Description | |
---|---|---|
AddChild | Adds a child as last one in group. | |
AffectsState | Returns true if a node has an effect on the state during traversal. | |
Callback | (Inherited from SoGroup.) | |
Copy | Calls Copy(false). (Inherited from SoNode.) | |
Copy(Boolean) | Creates and returns an exact copy of the node. | |
CopyFieldValues(SoFieldContainer) | Calls CopyFieldValues(fc, false). (Inherited from SoFieldContainer.) | |
CopyFieldValues(SoFieldContainer, Boolean) | Copies the contents of fc's fields into this object's fields. | |
Dispose |
Releases all resources used by SoDisposable.
(Inherited from SoDisposable.) | |
Distribute | (Inherited from SoNode.) | |
DoAction | (Inherited from SoGroup.) | |
EnableNotify | Notification at this Field Container is enabled (if flag == true) or disabled (if flag == false). | |
Equals | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
FieldsAreEqual | Returns true if this object's fields are exactly equal to fc's fields. | |
FindChild | Finds index of given child within group. | |
Get | Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string. | |
GetAllFields | Returns a list of fields, including the eventIn's and eventOut's. | |
GetAlternateRep | This method is called by actions to allow the node to provide an "alternate representation" when appropriate (typically depending on the action type). | |
GetBoundingBox | (Inherited from SoGroup.) | |
GetChild | Returns pointer the child node with the given index. | |
GetEventIn | Returns a the eventIn with the given name. | |
GetEventOut | Returns the eventOut with the given name. | |
GetField | Returns a the field of this object whose name is fieldName. | |
GetFieldName | Returns the name of the given field in the fieldName argument. | |
GetFields | Appends references to all of this object's fields to resultList, and returns the number of fields appended. | |
GetHashCode |
Overrides GetHashCode().
(Inherited from SoNetBase.) | |
GetMatrix | (Inherited from SoGroup.) | |
GetName | Returns the name of an instance. | |
GetNumChildren | Returns number of children. | |
GetPrimitiveCount | (Inherited from SoGroup.) | |
GetRenderEngineMode | Returns the supported Render engine mode. | |
GetRenderUnitID | (Inherited from SoNode.) | |
GetStringName | (Inherited from SoBase.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
GLRender | Called during GLRender action. | |
GLRenderBelowPath | (Inherited from SoNode.) | |
GLRenderInPath | (Inherited from SoNode.) | |
GLRenderOffPath | (Inherited from SoNode.) | |
GrabEventsCleanup | (Inherited from SoNode.) | |
GrabEventsSetup | (Inherited from SoNode.) | |
HandleEvent | (Inherited from SoGroup.) | |
HasDefaultValues | Returns true if all of the object's fields have their default values. | |
InsertChild | Adds a child so that it becomes the one with the given index. | |
IsBoundingBoxIgnoring | Used by BoundingBoxAction to known if bounding box computation should be ignored or not. | |
IsNotifyEnabled | Notification is the process of telling interested objects that this object has changed. | |
IsOverride | Returns the state of the override flag. | |
IsSupported | Calls IsSupported(OIV.Inventor.Nodes.SoShadowGroup.ShadowingMethods( .SoShadowGroup.VARIANCE_SHADOW_MAP )). | |
IsSupported(SoShadowGroupShadowingMethods) | Indicates if shadow casting is supported by your graphic board. | |
IsSynchronizable | Gets the ScaleViz synchronizable state of this object. | |
Pick | (Inherited from SoGroup.) | |
RayPick | (Inherited from SoNode.) | |
RemoveAllChildren | Removes all children from group. | |
RemoveChild(Int32) | Removes child with given index from group. | |
RemoveChild(SoNode) | Removes first instance of given child from group. | |
ReplaceChild(Int32, SoNode) | Replaces child with given index with new child. | |
ReplaceChild(SoNode, SoNode) | Replaces first instance of given child with new child. | |
Search | (Inherited from SoGroup.) | |
Set | Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format. | |
SetName | (Inherited from SoBase.) | |
SetOverride | Turns the override flag on or off. | |
SetSynchronizable | Sets this to be a ScaleViz synchronizable object. | |
SetToDefaults | Sets all fields in this object to their default values. | |
ToString |
Converts this SoBase structure to a human readable string.
(Inherited from SoBase.) | |
Touch | Marks an instance as modified, simulating a change to it. | |
Write | (Inherited from SoGroup.) |
Name | Description | |
---|---|---|
boundingBoxIgnoring | Whether to ignore this node during bounding box traversal. | |
intensity | Specifies the intensity of the shadow. | |
isActive | Activates/deactivates the shadowing. | |
IsDisposable | ISafeDisposable interface implementation.
(Inherited from SoDisposable.) | |
lightBleedingReduction | In some cases, a halo may appear around shadows intersecting each other. | |
method | Specifies the shadowing technique to use. | |
minVariance | Increasing this value will decrease possible self-shadowing artifacts but will make shadows fade away. | |
precision | Specifies the precision of the shadow. | |
quality | Specifies the quality of the shadow. | |
shadowCachingEnabled | Indicates if a cache should be used for computing the shadows. | |
smoothFactor | Set the smoothness of shadows. | |
UserData |
Gets or sets the user data to be contained by the field container.
(Inherited from SoFieldContainer.) | |
visibilityFlag | Specifies how OIV.Inventor.Nodes.SoShadowGroup.visibilityRadius is interpreted. | |
visibilityRadius | Shadows are only computed within "visibility radius" distance from the camera position. |
This group node performs real-time shadow casting. Because shadows depends on a lot of OpenInventor elements, it is recommended to put children of this group under a OIV.Inventor.Nodes.SoSeparator in order to have a cache. Each shape within this group will be included in the shadow casting computation. A shape may cast a shadow on other shapes or on itself (self-shadowing), and/or may be shadowed by other shapes within the group. The current shadow style is used to determine if shapes cast a shadow and/or can be shadowed (see OIV.Inventor.Nodes.SoShadowStyle).
This class defines a single shadowing method. The OIV.Inventor.Nodes.SoShadowGroup.method field allows for future shadowing methods to be added.
VARIANCE_SHADOW_MAP : This mode allows to display soft shadows. The OIV.Inventor.Nodes.SoShadowGroup.smoothFactor field can be used to increase or decrease the softness. Aliasing won't be displayed, but on large scenes shadows will progressively fade away. Increasing OIV.Inventor.Nodes.SoShadowGroup.quality will reduce this problem. Only the last on state directional light is used during rendering, other lights are ignored.
Shaders Only the VARIANCE_SHADOW_MAP method is available with shaders (custom or internal). In order to use shadows with user defined GLSL shaders (OIV.Inventor.Nodes.SoShaderProgram or OIV.VolumeViz.Nodes.SoVolumeShader), the following functions must be used in the shader programs. In the vertex shader:
void OivSetupShadowVertex(): Must be called in the vertex shader.
In the fragment shader:
float OivComputeShadow(): Returns a scalar in [0-1]. 0 means fragment is fully shadowed, 1 means no shadow. Should be used to modify the fragment color.
void OivGenerateShadowMap(): Must be called during the shadowmap pass in order to create the shadowmap. During this pass, the shader must not write to gl_FragColor. Use the uniform OivShadowPass to know when the shadowmap is being computed.
The following uniform is available in vertex and fragment shaders:
uniform bool OivShadowPass: Is true if the shadowmap is currently being rendered
The following code can be used as a skeleton for a GLSL shader that works with shadows:
void OivSetupShadowVertex(); void main() { ..userCode.. //Needed for shadowing OivSetupShadowVertex(); } uniform bool OivShadowPass; void OivGenerateShadowMap(); float OivComputeShadow(); void main() { if ( !OivShadowPass ) { ..compute fragment color here.. // Define the final color gl_FragColor.xyz = fragColor.xyz * OivComputeShadow(); gl_FragColor.w = fragColor.w; } else { // Output the shadowmap during the shadow map pass OivGenerateShadowMap(); } }
Transparency: Transparent objects are treated as follows, depending on the transparency type:
NO_SORT: Transparent objects cast a shadow and are shadowed but the shadow intensity doesn't depend on the transparency value (the same shadow is displayed for full transparent shapes and opaque shapes).
OPAQUE_FIRST, SORTED_OBJECT and SORTED_PIXEL: Same as previous case for VARIANCE_SHADOW_MAP.
Texture units: In VARIANCE_SHADOW_MAP mode, this node reserves texture unit OIV_SHADOW_TEXTURE_UNIT0 for its rendering (see OIV.Inventor.SoPreferences to set these). If this value is not set the application can specify which texture units OpenInventor should automatically use by setting environment variables (see OIV.Inventor.SoPreferences). The texture units between OIV_FIRST_RESERVED_TEXTURE_UNIT and OIV_FIRST_RESERVED_TEXTURE_UNIT+SoShaderProgram.getNumReservedTextures()-1 inclusive are reserved for internal OpenInventor use. If OIV_FIRST_RESERVED_TEXTURE_UNIT is not set, its default value is OIV.Inventor.Nodes.SoFragmentShader.GetMaxTextureImageUnit()-SoShaderProgram.getNumReservedTextures(). Note: The value returned by OIV.Inventor.Nodes.SoShaderProgram.GetNumReservedTextures() may change between OpenInventor versions. The total number of available texture units depends on the graphics hardware.
Hardware requirements: The Shadow and Depth Texture OpenGL extensions (standard in OpenGL 1.4) are used if they are available and generally improve performance. In order to increase quality and performance of the shadows, OpenGL PBuffers are used. PBuffers are a limited resource on some systems. Set OIV_PBUFFER_ENABLE to 0 to disallow use of PBuffers.
A DirectX 10 graphics board is needed to support VARIANCE_SHADOW_MAP.
Use the OIV.Inventor.Nodes.SoShadowGroup.IsSupported(OIV.Inventor.Nodes.SoShadowGroup.ShadowingMethods) static method to determine if the current graphics board supports shadowing.
Limitations
OIV.Inventor.Nodes.SoShadowGroup cannot be nested by design.
Notes:
Geometry cannot receive shadows if lighting is disabled. For example if an OIV.Inventor.Nodes.SoLightModel node sets the lighting model to BASE_COLOR.
Geometry cannot receive shadows if a texture is applied using the DECAL or REPLACE models.
ShadowGroup {
isActive | true |
isShapesBefore | false |
intensity | 0.5 |
precision | 0.5 |
quality | 0.5 |
shadowCachingEnabled | true |
visibilityRadius | 1.0 |
visibilityFlag | LONGEST_BBOX_EDGE_FACTOR |
smoothFactor | 1 |
minVariance | 1e-5 |
method | VARIANCE_SHADOW_MAP |
lightBleedingReduction | 0.01 |