Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This tool loads and renders D3DX effects (*.fx) and 3D mesh objects from DirectX X (.x) files that are compliant with DirectX standard annotations and semantics (DXSAS). It can be used to verify changes made to .x files and to effects (.fx) files, and to see how changes to effects or meshes look when loaded.
If an effects (.fx) file or an X (.x) file changes while it is loaded in the viewer, the viewer automatically reloads the file. This is especially useful for quickly checking the validity of any effects files as you are modifying them.
For details on DXSAS, see DirectX Standard Annotations and Semantics Reference.
Direct3D 9 | Direct3D 10 | 64-bit Native Mode | Windows XP | Windows Vista |
---|---|---|---|---|
Yes |
Yes |
Yes |
Yes |
Yes |
You can start DirectX Viewer at the command line by running dxviewer or from the Start menu.
To launch DirectX Viewer from the Start menu
- Click Start, point to All Programs, then to Microsoft DirectX SDK, then to DirectX Utilities, and then click DirectX Viewer.
DirectX Viewer provides several keyboard shortcuts.
Pressing the HOME key resets the camera to the default position. Other keys place the camera at the edge of the model's bounding sphere along the locations described in the following table.
Keyboard Shortcut | Location on the Model's Bounding Sphere |
---|---|
X | Negative X axis |
Y | Negative Y axis |
Z | Negative Z axis |
Shift+X | Positive X axis |
Shift+Y | Positive Y axis |
Shift+Z | Positive Z axis |
To load X (.x) files and effects (.fx) files, click Open. If an effects file is loaded, it is rendered onto default geometry, usually a sphere. The X files and effects files that ship in the SDK are located in DirectX SDK root\Samples\Media.
Load a file by clicking on the Open button.
Select a file and click Open. A 3D object will load with the default effect.
Note You may also load .x files or .fx files by dragging and dropping them into the View window.
When opening a file with the CTRL key held down, you can change the model's geometry by selecting an .x file, or change the model's material by selecting an .fx file.
After loading an .x file (or .fx file), you can use the left mouse button to rotate geometry and the right mouse button to rotate the camera; use the mouse wheel to zoom the camera in or out. The buttons in the DirectX Viewer window are covered in the following sections.
Push the view button to launch the view button dialog to change how the geometry will be viewed.
The options and settings in the View dialog box are described in the following table.
View Dialog Options | Description |
---|---|
Environment | Load an environment map from a DDS texture, provided that the currently loaded effect handles environment maps. |
Fill Mode | Solid, Wireframe, or to use the fill mode specified in the effect, Auto. |
Statistics | Displays video card type, frames per second, display format, and other info. |
Manual Refresh | Refresh the viewer only when the Refresh Button is clicked. |
Adjacency | Draw adjacency data as dark purple lines. |
Binormal | Draw binormals (or bitangents) as green lines. |
Bounds | Draw bounding boxes around the geometry with white lines. |
Creases | Draw creases as orange lines. |
Edges | Draw triangle edges as purple lines. |
Normals | Draw vertex normals as red lines. |
Points | Draw points as yellow squares. |
Tangents | Draw tangents as blue lines. |
Close | Close the menu. |
Push the Effect Options button to launch the Effect Options dialog to experiment with effect parameters.
The options and settings available in Effect Options are described in the following table.
Effect Button Options | Description |
---|---|
Technique | Select a render technique. |
Pass Mode | Effect pass to render (see Pass Index also). There are three choices:
ItemDescription
All PassesRenders all passes for a technique
Selected PassRenders only the selected name or referenced pass by index for a technique
Up to selected passRenders all passes up to the selected named or referenced pass by index for a technique.
|
Pass Index | Effect pass index. Displays the named passes and indexes for the selected techniques or all available if the first valid technique is chosen for technique. |
Defines | Specify DXSAS data binding defines for the effects. |
Includes | Set up include paths that are needed when compiling shaders. |
Debug Pixel Shaders | Force pixel shading to run on the CPU and enable debug info. |
Debug Vertex Shaders | Force any vertex shaders to use vertex processing, so they are run on the CPU and enable debug info. |
Optimize Shaders | Enables or disable shader optimization for the shader compiler. |
Validate Shaders | Enable or disable HLSL shader validation. |
Allow Preshaders | Enable or disable preshaders. |
Allow Partial Precision | Enable or disable partial precision. |
Prefer Dynamic Flow / Avoid Dynamic Flow | Enable or disable dynamic flow control. |
The Refresh button is unavailable unless you select manual refresh. You can change the refresh by clicking View and selecting or clearing Manual Refresh. Once manual refresh is selected, click View to render the geometry.
This button switches the viewer between Direct3D 9 mode and Direct3D 10 mode. The viewer starts in Direct3D 9 mode by default. The Direct3D 10 mode only works if the viewer is running on Windows Vista. In Direct3D 10 mode, only Effects with Technique10 will load.
The Help button opens up the SDK documentation.
There are a few additional features:
- File Change Monitoring
- Setting Start Up Conditions
DirectX Viewer automatically detects changes in files that are being viewed, and it reloads these files to display the results. This allows you to edit an .x file or .fx file while it is loaded in DirectX Viewer, and automatically view the results of the edit.
As an example, you can see DirectX Viewer automatically load changed made to Glow.fx, by executing the following steps:
Launch DirectX Viewer and open Glow.fx, located in DirectX SDK root\Samples\Media\SharedFx.
Open Glow.fx in Notepad (or some other text editor), and change GlowColor's value from the following (on line 17):
float4(0.5f, 0.2f, 0.2f, 1.0f)
to the following:
float4(0.0f, 0.0f, 1.0f, 1.0f)
Save Glow.fx.
DirectX Viewer automatically detects the changes saved to the file and reloads the file to display the changes. The following figure shows the original and edited versions of Glow.fx.
Configure the tool using the following command line syntax.
DirectX Viewer supports the following command-line syntax:
dxviewer [ -shape { cube | sphere | cylinder } ] [ -Zip ] [ -Ziv ] [ -Zi ] [ -D string ] [ -I string ] [ file names ]
The following table describes these command-line options.
Switch Options | Description |
---|---|
-shape { cube | sphere | cylinder } | Default geometry. If the user specifies the default shape (-shape) and an .x file (which also has geometry), the default shape will take priority and the .x file will not be loaded. |
-Zip | Debug pixel shaders. |
-Ziv | Debug vertex shaders. |
-Zi | Debug pixel and vertex shaders. |
-D string | List of defines, delimited by semicolons. |
-I string | List of included paths, delimited by semicolons. |
file names | Optional file names, either .x or .fx files, with the following constraints:
|
DirectX Standard Annotations and Semantics Reference
Send comments about this topic to Microsoft
Build date: 3/11/2010