Post

ProgramShader

Overview

ProgramShader defines a shader that consists of one or more individually programmable, self-contained pieces. ProgramShader contains IS/connect and programs [ShaderProgram] nodes.

The ProgramShader node belongs to the Shaders component and requires at least level 1, its default container field is shaders. It is available from X3D version 3.0 or higher.

Hierarchy

1
2
3
4
+ X3DNode
  + X3DAppearanceChildNode
    + X3DShaderNode
      + ProgramShader

Fields

SFNode [in, out] metadata NULL [X3DMetadataObject]

Information about this node can be contained in a MetadataBoolean, MetadataDouble, MetadataFloat, MetadataInteger, MetadataString or MetadataSet node.

Hint

SFBool [in] activate

activate forces the shader to activate the contained objects.

Warning

  • It is an error to define this transient inputOnly field in an X3D file, instead only use it a destination for ROUTE events.

SFBool [out] isSelected

isSelected indicates this shader instance is selected for use by browser

Warning

  • It is an error to define this transient outputOnly field in an X3D file, instead only use it a source for ROUTE events.

SFBool [out] isValid

isValid indicates whether current shader objects can be run as a shader program.

Warning

  • It is an error to define this transient outputOnly field in an X3D file, instead only use it a source for ROUTE events.

SFString [ ] language “” [“Cg”|”GLSL”|”HLSL”|…]

The language field indicates to the X3D player which shading language is used. The language field may be used to optionally determine the language type if no MIME-type information is available.

Hint

  • Recognized values include “Cg” “GLSL” “HLSL”.

MFNode [in, out] programs [ ] [ShaderProgram]

ProgramShader contains zero or more ShaderProgram node instances. In general, only two ShaderProgram instances are needed: one each for vertex and fragment processing.

Hint

  • Each shader language defines required behavior for processing this field.

Advice

Hint

  • Apply default containerField='shaders' when parent node is Appearance.

Warning

  • ProgramShader contains no field declarations and no plain-text CDATA block source code.

See Also

This post is licensed under CC BY 4.0 by the author.