GeeXLab
Current version: 0.45.1
>GeeXLab homepage

FurMark
Current version: 1.30.0
>FurMark homepage

GPU Caps Viewer
Current version: 1.55.0.0
>GPU Caps Viewer homepage

GPU Shark
Current version: 0.26.0.0
>GPU Shark homepage


Blogs
>JeGX's HackLab

Geeks3D's Articles
>GPU Memory Speed Demystified

>Multi-Threading Programming Resources

>GeForce and Radeon OpenCL Overview

>How to Get your Multi-core CPU Busy at 100%

>How To Make a VGA Dummy Plug

>Night Vision Post Processing Filter

PhysX FluidMark
Current version: 1.5.4
>FluidMark homepage

TessMark
Current version: 0.3.0
>TessMark homepage

ShaderToyMark
Current version: 0.3.0
>ShaderToyMark homepage
>ShaderToyMark Scores

Demoniak3D
Current Version: 1.23.0
>Demoniak3D
>Download
>Libraries and Plugins
>Demos
>Online Help - Reference Guide
>Codes Samples
 
oZone3D.Net - Demoniak3D Developer Guide


» Back To Index

The <shader_program> node

Function

The shader_program node makes it possible to load and compile shader programs. These shaders programs are the famous vertex and pixel shaders. In the current version of Demoniak3D, only the shaders programs written in GLSL (OpenGL Shading Language) high level language are supported.

A GLSL shader can be specified either by giving the location of a file (filename attribute) including the source code, either by giving the name of a GLSL plugin (shader_plugin_name attribute). Another possibility is to directly write the shader's code within the XML file in the raw_data element.

General syntax

<shader_program
	name=""
	active="TRUE"
	filename="TRUE" 
	hardware_target="ALL" 
	shader_plugin_name="TRUE" >

	
	<constant_1i
		name=""
		x="0" />

	<constant_2i
		name=""
		x="0" 
		y="0" />

	<constant_3i
		name=""
		x="0" 
		y="0" 
		z="0" />

	<constant_4i
		name=""
		x="0" 
		y="0" 
		z="0" 
		w="0" />

	
	<constant_1f
		name=""
		x="0.0" />

	<constant_2f
		name=""
		x="0.0"
		y="0.0" />

	<constant_3f
		name=""
		x="0.0"
		y="0.0"
		z="0.0" />
	
	<constant_4f
		name=""
		x="0.0"
		y="0.0"
		z="0.0"
		w="0.0" />

	
	<constant_4x4f
		name=""
		object_name=""
		transformation_type="NONE"
		m0="0.0"
		m1="0.0"
		m2="0.0"
		m3="0.0"
		m4="0.0"
		m5="0.0"
		m6="0.0"
		m7="0.0"
		m8="0.0"
		m9="0.0"
		m10="0.0"
		m11="0.0"
		m12="0.0"
		m13="0.0"
		m14="0.0"
		m15="0.0" />
		
	<constant_4x4f_view_matrix
		name=""
		transformation_type="NONE"  />
		
	<constant_4x4f_modelview_matrix
		name=""
		object_name=""
		transformation_type="NONE"  />

	<constant_1f_elapsed_time
		name="" />

	<constant_4f_object_position
		name=""
		object_name=""
		transformation_type="TRANSFORMATION_VIEW_SPACE" />
	
	<vertex_attrib
		name=""
		value="1" />
		
	<raw_data>
		<![CDATA[
		
		]]>
	</raw_data>
		
</shader_program>


shader_program element

shader_program is the xml tag that defines a shader_program node.

Attributes:
  • name - [STR127] - name of the node. This name will make it possible to refer this node throughout the XML script.

  • filename - [STR255] - full name of the file containing the source code of the shader relatively to the XML script file. The shader must be written in GLSL.

  • shader_plugin_name - [STR127] - name of the GLSL plugin located in the GLSL plugins directory of Hyperion (glsl_plugins /). The name of the plugin must be specified without its extension (ex: shader_plugin_name="HYP_Plugin_GLSL_MaterialBumpMapping").

  • active - [BOOLEAN] - enables (TRUE) or disables (FALSE) the shader - default value: TRUE

  • hardware_target - [ENUM] - specify on which hardware/manufacturer a shader can run:
    • NVIDIA: only on nVidia.
    • ATI: only on ATI
    • ATI_NVIDIA: only on ATI and NVIDIA
    • OTHER: on all manufacturers but ATI and nVidia
    • NVIDIA_OTHER: on all manufacturers and nVidia but ATI
    • ATI_OTHER: on all manufacturers and ATI but nVidia
    • ALL: all manufacturers - valeur par défaut

constant_1i element

constant_1i specifies the name and the value of an integer constant to pass to the vertex/pixel shader. The name of this constant must be declared in the source code of the shader.

Attributes:
  • name - [STR64] - name of the constant

  • x - [INTEGER] - value of the constant

constant_2i element

constant_2i specifies the name and the value of a 2D vector of integers to pass to the vertex/pixel shader. The name of this constant must be declared in the source code of the shader.

Attributes:
  • name - [STR64] - name of the constant

  • x - [INTEGER] - x componant of the vector
  • y - [INTEGER] - y componant of the vector

constant_3i element

constant_3i specifies the name and the value of a 3D vector of integers to pass to the vertex/pixel shader. The name of this constant must be declared in the source code of the shader.

Attributes:
  • name - [STR64] - name of the constant

  • x - [INTEGER] - x componant of the vector
  • y - [INTEGER] - y componant of the vector
  • z - [INTEGER] - z componant of the vector

constant_4i element

constant_4i specifies the name and the value of a 4D vector of integers to pass to the vertex/pixel shader. The name of this constant must be declared in the source code of the shader.

Attributes:
  • name - [STR64] - name of the constant

  • x - [INTEGER] - x componant of the vector
  • y - [INTEGER] - y componant of the vector
  • z - [INTEGER] - z componant of the vector
  • w - [INTEGER] - w componant of the vector

constant_1f element

constant_1f specifies the name and the value of a float constant to pass to the vertex/pixel shader. The name of this constant must be declared in the source code of the shader.

Attributes:
  • name - [STR64] - name of the constant

  • x - [REAL] - value of the constant

constant_2f element

constant_2f specifies the name and the value of a 2D vector of reals to pass to the vertex/pixel shader. The name of this constant must be declared in the source code of the shader.

Attributes:
  • name - [STR64] - name of the constant

  • x - [REAL] - x componant of the vector
  • y - [REAL] - y componant of the vector

constant_3f element

constant_3f specifies the name and the value of a 3D vector of reals to pass to the vertex/pixel shader. The name of this constant must be declared in the source code of the shader.

Attributes:
  • name - [STR64] - name of the constant

  • x - [REAL] - x componant of the vector
  • y - [REAL] - y componant of the vector
  • z - [REAL] - z componant of the vector

constant_4f element

constant_4f specifies the name and the value of a 4D vector of reals to pass to the vertex/pixel shader. The name of this constant must be declared in the source code of the shader.

Attributes:
  • name - [STR64] - name of the constant

  • x - [REAL] - x componant of the vector
  • y - [REAL] - y componant of the vector
  • z - [REAL] - z componant of the vector
  • w - [REAL] - w componant of the vector

constant_4x4f element

constant_4x4f specifies the name and the value of a 4 dimension constant square matrix to pass to vertex/pixel shader. The name of this constant must be declared in the source code of the shader. The 4x4 matrix to be used can come from 2 sources:
  • a matrix entered by manual keyboarding (m0 with m15 attributes)
  • a reference object's global transformation matrix that is automatically recorded at each frame (ref_object attribute)
The 4x4 matrix is stored in the OpenGL format (column matrix). For more details, it is recommended to refer to a good book about OpenGL programming.

If the ref_object attribute is specified, then the m0 and m15 values will be ignored.

Attributes:
  • name - [STR64] - name of the constant

  • object_name - [STR127] - name of the reference object whose total transformation matrix will be used.

  • transformation_type - [ENUM] - indicates the transformation to be carried out on the position of the object:
    • NONE: the matrix is transmitted just as it is to the shader, no transformation is applied.
    • INVERSE: the matrix is inversed before it is transmitted to the shader.
    • TRANSPOSE: the matrix is transposed before it is transmitted to the shader.
    • INVERSE_TRANSPOSE: the matrix is inversed and then transposed before it is transmitted to the shader.
    • GET_UPPER_3x3: the 3x3 upper matrix is passed to the shader. In this case, it is necessary to declare a mat3 type matrix in the shader.


  • m0 - [REAL] - value of element 0 of the matrix - default value: 0.0

  • m1 - [REAL] - value of element 1 of the matrix - default value: 0.0

  • m2 - [REAL] - value of element 2 of the matrix - default value: 0.0

  • m3 - [REAL] - value of element 3 of the matrix - default value: 0.0

  • m4 - [REAL] - value of element 4 of the matrix - default value: 0.0

  • m5 - [REAL] - value of element 5 of the matrix - default value: 0.0

  • m6 - [REAL] - value of element 6 of the matrix - default value: 0.0

  • m7 - [REAL] - value of element 7 of the matrix - default value: 0.0

  • m8 - [REAL] - value of element 8 of the matrix - default value: 0.0

  • m9 - [REAL] - value of element 9 of the matrix - default value: 0.0

  • m10 - [REAL] - value of element 10 of the matrix - default value: 0.0

  • m11 - [REAL] - value of element 11 of the matrix - default value: 0.0

  • m12 - [REAL] - value of element 12 of the matrix - default value: 0.0

  • m13 - [REAL] - value of element 13 of the matrix - default value: 0.0

  • m14 - [REAL] - value of element 14 of the matrix - default value: 0.0

  • m15 - [REAL] - value of element 15 of the matrix - default value: 0.0

constant_4x4f_view_matrix element

constant_4x4f_view_matrix makes it possible to transmit the current view matrix to the vertex shader.

Attributes:
  • name - [STR64] - name of the constant

  • transformation_type - [ENUM] - indicates the transformation to be performed on the position of the object:
    • NONE: the matrix is transmitted just as it is to the shader, no transformation is applied.
    • INVERSE: the matrix is inversed before it is transmitted to the shader.
    • TRANSPOSE: the matrix is transposed before it is transmitted to the shader.
    • INVERSE_TRANSPOSE: the matrix is inversed then transposed before it is transmitted to the shader.
    • GET_UPPER_3x3: the 3x3 upper matrix is transmitted to the shader. In this case, it is necessary to declare a mat3 type matrix in the shader.

constant_4x4f_modelview_matrix element

constant_4x4f_modelview_matrix makes it possible to transmit the current matrix of model-view to the vertex shader. Although this matrix is already accessible directly in the vertex shader by the gl_ModelViewMatrix variable, it can be useful to have a transformed version of this matrix.

Attributes:
  • name - [STR64] - name of the constant

  • object_name - [STR127] - name of the reference object that will use the matrix of global transformation.

  • transformation_type - [ENUM] - indicates the transformation to be performed on the position of the object:
    • NONE: the matrix is transmitted just as it is to the shader, no transformation is applied.
    • INVERSE: the matrix is inversed before it is transmitted to the shader.
    • TRANSPOSE: the matrix is transposed before it is transmitted to the shader.
    • INVERSE_TRANSPOSE: the matrix is inversed then transposed before it is transmitted to the shader.
    • GET_UPPER_3x3: the 3x3 upper matrix is transmitted to the shader. In this case, it is necessary to declare a mat3 type matrix in the shader.

constant_1f_elapsed_time element

constant_1f_elapsed_time specifies the name and the value of a constant to be passed to the vertex/pixel shader. The name of this constant must be declared in the source code of the shader.
constant_1f_elapsed_time is used to transmit to the shader the current elapsed time (in milliseconds) from the beginning of the Hyperion script.

Attributes:
  • name - [STR64] - name of the constant

constant_4f_object_position element

constant_4f_object_position specifies the name and the value of a 4d constant vector to be passed to the vertex/pixel shader. The name of this constant must be declared in the source code of the shader. constant_4f_object_position is used to transmit to the shader the current position of the referred object (master object).

Attributes:
  • name - [STR64] - name of the constant
  • master_object_name - [STR127] - name of the master-object
  • transformation_type - [ENUM] - indicates the transformation to be performed on the position of the object:
    • TRANSFORMATION_NONE: no transformation is applied to the position of the object.
    • TRANSFORMATION_VIEW_SPACE: the position of the object is tranformed in the space of the active camera when executing the shader.

vertex_attrib element

vertex_attrib specifies the name and the value of a vertex attribute to be exclusively transmitted to the vertex shader. The name of this constant must be declared in the source code of the shader.

It is possible to declare at the maximun 5 vertex attribute (from 1 to 5). The first 2 attributes are automatically initialized by the oZone3D engine and correspond to the tangent vectors (attrib 1) and binormal vectors (attrib 2). It is possible to initialize each attribute thanks to the HYP_SetMeshVertexAttrib() function of the Lua HOST API.

Attributes:
  • name - [STR64] - name of the constant

  • value - [INTEGER] - integer numerical value specifying the index of the attribute. Must be greater than or equal to 1 - default value: 1

raw_data element

raw_data makes it possible to integrate the source code of a shader directly within the XML code without requiring an external file.
Example
<shader_program  >
	<raw_data><![CDATA[	 
	[Vertex_Shader]
	void main()
	{
		gl_Position = ftransform();
	}
	[Pixel_Shader]
	void main()
	{
		gl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);
	}
   	]]></raw_data>
</script> 


GeeXLab demos


GLSL - Mesh exploder


PhysX 3 cloth demo


Normal visualizer with GS


Compute Shaders test on Radeon


Raymarching in GLSL



Misc
>Texture DataPack #1
>Asus Silent Knight CPU Cooler
Page generated in 0.0022950172424316 seconds.