cancel
Showing results for 
Search instead for 
Did you mean: 

GPU Developer Tools

Highlighted
Journeyman III
Journeyman III

Shaders in DirectX 9.0

How do I setup a multi-pass shader in DX 9.0

I know how to create a shader in Rendermonkey and load it into DirectX, but I am uncertain how to utilize a shader with multiple passes. I have located various websites which I know cover this topic like msdn.microsoft.com/DirectX but I have failed to come up with the proper key words to searching for this specific topic.

Any help would be much appreciated.

Thank you,

Kevin

Tags (2)
0 Kudos
Reply
2 Replies
Highlighted
Journeyman III
Journeyman III

Shaders in DirectX 9.0

Cortona VRML Client 5.0 supports DirectX 9.0c. The latest version of DirectX is available at

http://www.microsoft.com/windows/directx


Please make sure you have a DirectX 9.0 compatible graphics adapter with hardware shader support.

The implementation of programmable shaders corresponds to the X3D Programmable Shader Proposal. The supported shader languages are High Level Shader Language (HLSL) and nVidia Cg shading language. DirectX 9.0 FX format is supported.

Three new nodes were added to Cortona VRML Client for shader support: ShaderAppearance, VertexShader and FragmentShader.

 

ShaderAppearance

 

EXTERNPROTO ShaderAppearance [
exposedField SFNode fillProperties NULL
exposedField SFNode fragmentShader NULL
exposedField SFNode lineProperties NULL
exposedField SFNode material NULL
exposedField SFNode texture NULL
exposedField SFNode textureTransform NULL
exposedField SFNode vertexShader NULL
]
[
"urn:inetarallelgraphics.com:cortonaSmiley FrustratedhaderAppearance"
"http://www.parallelgraphics.com/vrml/proto/Cortona/extensions.wrl

VertexShader

 

VertexShader { exposedField MFString url #any number of field fieldType fieldName eventIn fieldType fieldName eventOut fieldType fieldName exposedField fieldType fieldName }

VertexShader node defines a vertex shader for modifying geometry's vertex values. Url field specifies shader programming language code. The prefix in the beginning of the url's field value shows the browser what shader language is used. Hlsl prefix means that High Level Shader Language is used, cg prefix means that nVidia Cg shading language is used.

This example demonstrates the vertex shader written in the HLSL:

 

VertexShader { url ["hlsl: ..."] }

Multiple valued url field could contain several different shader programs simultaneously. A description of order of preference for multiple valued URL fields may be found in the following document:

X3D Specification, 9.2.1, URLs

In addition to the url field, any number of different fields could be declared in the VertexShader node. These fields receive and process events of the scene.

 

FragmentShader

 

FragmentShader {
exposedField MFString url
#any number of
field fieldType fieldName
eventIn fieldType fieldName
eventOut fieldType fieldName
exposedField fieldType fieldName
}

FragmentShader node (more often it is known as a pixel shader) defines a pixel shader for modifying geometry's pixel values. All the fields of the FragmentShader have the same syntax as VertexShader's fields.

More detailed information about shaders can be found in the following documents:

 
Microsoft DirectX 9 SDK:
Programmable HLSL Shaders

 
X3D Specification, programmable shaders component, Microsoft High Level Shading Language (HLSL) Binding: J.3. Interaction other nodes and components,
( J.3.1, Vertex Shader J.3.2, Fragment Shader J.3.4, Vertex Attributes );
J.4. Data Types and Parameter Mappings

 
X3D Specification, programmable shaders component, nVidia Cg shading language binding: K.4. Interaction other nodes and components,
( K.4.1, Vertex Shader K.4.2, Fragment Shader K.4.4, Vertex Attributes );
K.5. Data Types and Parameter Mappings

#ShaderAppearance"
]

ShaderAppearance node is used instead of Appearance node. The vertexShader field contains VertexShader node. The fragmentShader field contains FragmentShader node. Detaialed description of VertexShader and FragmentShader nodes is placed below. The material, texture and textureTransform fields work as in the Appearance node. They define the visual properties of geometry only in the following cases:

 
The DirectX9 renderer is not activated.

 
Your hardware has no shader support.

 
Vertex or Fragment shaders are not specified or written in the language which is not supported by the browser.

FillProperties and lineProperties are not yet implemented. If these fields exist, they are ignored by the browser.

Edit: Removed advertising from signature

0 Kudos
Reply
Highlighted
Journeyman III
Journeyman III

Shaders in DirectX 9.0

Hello to everyone at this forum.....I am really new at this and wish a good time to spend discussing

0 Kudos
Reply