Downloads
| Windows ConvertX Utility New!
winconvx.zip (22 KB, .exe only)
This utility is a Windows front-end for the DOS SDK tools: Conv3ds.exe,
Convx.exe and Convxof.exe. The application was written using Visual
Basic.NET, so you must have the .NET Framework installed to run this utility.
(You can get the .NET Framework from the Windows Update site) See the
readme.txt file included in the .zip file for more details.
|
| D3DX Helpers (Code Module)
D3DXHelpers.zip
(3 KB, with source)
A Visual Basic 6 code module containing several D3DX8 helper functions.
Many D3DX functions do not provide the result of their operation in the return
value. This module is simply a wrapper to return the function parameters as
return values.
|
| D3DX Texture Converter New!
TexConv.zip (27 KB, with source)
Using the D3DPOOL_SCRATCH flag introduced in DX8.1 has some cool benefits with
D3DX. This sample shows you how to load a file into a texture object,
create a mipmap chain, edit the filtering and resize the texture. Then
the texture can either be saved to a BMP file (no mipmaps) or a
compressed DDS file; the program can even do an entire folder of files at
once. Since we are using the scratch pool, we are not limited by the
device on what formats we can support. Also, we don't have to limit
ourselves to the REF device (this app uses HAL) for texture conversion.
Demonstrates: D3DPOOL_SCRATCH , D3DX.CreateTextureFromFileEx,
D3DX.SaveTextureToFile and simple device initialization.
|
| Render to Surface Text
rtstext.zip (11.6
KB, with source)
This sample demonstrates how to render text to a surface that can be mapped
onto a quad in world space.
Demonstrates: D3DX.CreateRenderToSurface, D3DX.CreateTexture and
D3DX.CreateFont.
|
Check out these VB adaptations of Rich's
C++ Code to be
included in his upcoming book for
Addison-Wesley called The
Direct3D Graphics Pipeline. Many thanks to
Rich and
Robert Dunlop for helping me convert
the samples to Visual Basic 6 code.
There are still more samples to come, so stay tuned!
Content is not to be duplicated without permission from the
authors.
| Minimal Direct3D Application
minimal.zip (8.16
KB, with source)
Source code for a minimal well-behaved Direct3D8 application.
|
| Minimal Direct3D Application (Frame)
minimalframe.zip
(76.7 KB, with source)
Source code for a minimal well-behaved Direct3D8 application, based on the
DX 8.1 SDK framework.
|
| Gingerbread Man
gingerbread.zip
(9.73 KB, with source)
Based on the minimal application above, this program computes a chaotic
orbit in 2D and displays the orbit as color coded points. The chaotic nature
of the orbit makes each painting of the window's client area slightly
different, appearing animated. This can be a very simple way to experiment
with an animated effect without coding timers. Drag the window size handles
and watch.
|
| Gingerbread Man (Frame)
gingerbreadframe.zip (323 KB, with
source)
The gingerbread man fractal enhanced with the DX 8.1 SDK framework. Unlike
the 'minimal' style gingerbread man fractal above, this sample provides you
with much more control over the rendering using the D3D framework: interactive
device switching, a toggle from windowed mode to exclusive mode, start/stop
and single-step the animation, FPS counter and other rendering statistics.
Most of this comes from simply using the framework's implementation. Extending
the framework to provide more GUI elements is as easy as adding some menu
items and a command handler.
You can watch the chaotic orbit in the plane as diffuse points or textured
points. The points are rendered with alpha blending to allow them to
accumulate to a dense image. The standard color chooser dialog is augmented
with an alpha channel edit control, letting you edit all the colors used in
the sample. (See the COLORSEL.DLL sample below for more details.) On-screen
help, bounding box toggle, view animation, status display toggle, foreground
and background color editing.
Demonstrates: diffuse colored points, texture creation, 2D texture
coordinate generation, textured points, single stage texture setup, RGBA color
picker, accumulating renderings in the back buffer, locking and filling vertex
buffers, world transformation, simple camera animation, Direct3DVertexBuffer8,
DrawPrimitive, DrawPrimitiveUP, ValidateDevice.
|
| Gamma Correction
gamma.zip (91.5 KB, with source)
Did you know that RGB(128, 128, 128) is not half as bright as RGB(255, 255,
255)? Surprise! Welcome to the world of CRT monitors and their non-linearities.
LCD displays and printers also have non-linearities in their color response.
For CRTs, the non-linearity can be modeled as a simple power function
correlating intensity I with CRT voltage V to the gamma power. The use of
gamma in this formula is why the process of compensating for the nonlinearity
is called "gamma correction". Direct3D provides support for gamma correction
directly in the GetGammaRamp and SetGammaRamp methods of the device.
You can model a CRT's gamma as a single value for all phosphors or you can
measure separate values for the red, green and blue phosphors. SetGammaRamp
allows both techniques to be used. This program lets you interactively measure
the gamma characteristics of your monitor, both as a single gamma value and as
separate gamma values for red, green and blue phosphors. It also provides a
test rendering that you can use to visualize the effects of gamma correction.
Demonstrates: D3DGAMMARAMP, SetGammaRamp(), technique for
interactively measuring a monitor's gamma value, when to gamma correct
yourself or let Direct3D do it, gamma test rendering, single gamma model, RGB
gammas model, manual gamma correction.
|
| D3DX Shapes
d3dxshapes.zip
(81.3 KB, with source)
Sample based on the DX 8.1 framework, the boiler plate classes that
Microsoft uses for their DirectX SDK sample programs. This sample was started
by using the 'New Sample Apprentice' (vb_Apprentice) below to generate a blank
sample and then add demonstrations of D3DX.CreateBox, D3DX.CreateCylinder,
D3DX.CreateSphere, D3DX.CreateTeapot and D3DX.CreateTorus. Interactive control
over the detail of the generated mesh is provided through the arrow keys on
the keyboard.
Demonstrates: device initialization, simple viewing, simple
lighting, Z buffering, D3DX.CreateBox, D3DX.CreateCylinder, D3DX.CreateSphere,
D3DX.CreateTeapot, D3DX.CreateTorus, D3DXMatrixLookAtLH, D3DXMatrixOrthoLH,
D3DXMesh, D3DXBuffer, D3DXMesh.OptimizeInPlace.
|
| D3DX Text
text.zip (199 KB, with source)
Demonstrates drawing text with D3DX. Screen-space text is drawn using
D3DXFont. World space text is drawn as a mesh created as a 3D extruded
character outline with D3DX.CreateText. The menus let you change what text is
displayed each frame, alter the color of the displayed text, and select each
method's font.
Demonstrates: D3DXFont, D3DX.CreateText.
|
| D3DX Sprites
d3dxsprites.zip
(206 KB, with source)
Demonstrates drawing 2D sprites with D3DX. You can display a sprite tiling
the entire surface of the window and a dynamically rotating collection of
sprites. Use the arrow keys to increase or decrease the number of dynamically
rotating sprites.
Use the menus to change the sprites that are displayed each frame, alter
the color of the background, the sprite modulation color and the sprite
texture's color key. You can also changing mirroring options for the tiled
sprite.
Demonstrates: D3DXSprite, D3DX8.CreateTextureFromFileEx
|
| Direct3D Lighting
lighting.zip (224
KB, with source)
Visualizes lighting and material parameters and render states: D3DLIGHT8,
D3DMATERIAL8, RS Ambient, RS Color Vertex, RS Lighting, RS Local Viewer, RS
Normalize Normals, RS Ambient Material Source, RS Diffuse Material Source, RS
Specular Material Source, RS Ambient Material Source, RS Specular Enable, RS
Shade Mode, and RS Fill Mode.
Simple dialogs let you change all the relevant material and light
parameters and visualize their results on the Utah teapot.
Demonstrates: D3DXMatrixPerspectiveFovLH, D3DXMatrixOrthoLH,
D3DX8.ComputeBoundingBoxFromMesh, D3DXMesh.OptimizeInPlace,
D3DXMesh.CloneMeshFVF, D3DXMesh.GetVertexBuffer, D3DX8.TessellateNPatches,
DXLockArray8, DXUnlockArray8, D3DLIGHT8, D3DMATERIAL8, Creating D3DX8 shapes,
etc.
|
| Frame Buffer Processing
framebuffer.zip
(117 KB, with source)
Visualizes frame buffer processing: alpha test, stencil/depth test, stencil
masking, stencil stippling, alpha blending (including blend modes using
destination alpha), multisample antialising, multisample motion blur,
multisample depth of field, dithering, and color channel masking.
This sample makes use of destination alpha and stencil planes by default.
Your hardware may not support these. If you're getting a dialog box saying
that no suitable devices could be found and that the reference rasterizer will
be used instead, then try running the program with the following command-line
switches:
-nodest Don't use destination alpha.
-nostencil Don't use stencil planes.
Demonstrates: D3DRS_MULTISAMPLE_ANTIALIAS, D3DRS_MULTISAMPLE_MASK,
D3DX8.CreateTorus, D3DX8.CreateTexture, Direct3DDevice.CreateImageSurface,
D3DVertexBuffer8SetData, locking surfaces, matrix texture transforms, etc.
|
| Rasterization Render States
rasterize.zip
(201 KB, with source)
Demonstrates the rasterization related render states RS Last Pixel, RS Edge
Antialias, and RS Line Pattern. A scene consisting of a screen-space grid and
a world-space circle is rendered with lines.
To best observe the effect of RS Last Pixel, set the grid color to
something less than fully opaque and use a pixel zoom utility to examine the
intersections of the grid. The effect can also be seen where the lines forming
the circle touch to complete the circle, but being only a single pixel it may
be difficult to observe.
Demonstrates: Direct3DDevice.CreateVertexBuffer,
D3DVertexBuffer8SetData, D3DVertexBuffer8GetData
|
| DX8.1 SDK Direct3D Sample Application Apprentice
vb_Apprentice.zip (40.7 KB, with source)
What's an application apprentice? Well its a code generator that's not
quite smart enough to be called an Application Wizard. The apprentice is a
code generator, just like an AppWizard, but its just an extremely dumb code
generator. All it knows how to do is make a new Direct3D sample from a
template with your entered project name substituted in a few places.
This is a simple vbscript program called vb_NewSample.vbs that
prompts you for the name of a new sample and creates a blank sample of that
name. The generated sample does nothing but display some frame rate and device
statistics. You can then modify the routines for creating device objects,
rendering scenes, and so-on.
The template is based on the D3D framework, like all the other Direct3D SDK
samples, so your new sample will be based on that as well. Please note that
framework is not intended to be a bona-fide application framework. Feel free
to customize it to suit your needs.
Note: This script presumes the presence of Windows Scripting Host on
your computer. WSH is included with Windows 98/Me/2K/XP. Its available as a
free download for Windows NT/95. See the readme.txt file included in
the zip for more details on the VB script.
|
| rt_Apprentice 2.0
rt_Apprentice.zip (107 KB, with source)
Similar to the above example, yet this apprentice allows you to create a
minimal Win32 C++ application, a minimal C++ console application, and a C++
screen saver; in addition to a Visual Basic 6 application. Instead of using
VBScript, this apprentice is an HTA (HTML Application, requires IE5 or later)
that lets you choose the new sample type.
Note: Be sure to use a valid identifier for the project name (i.e.
no spaces or other characters prohibited in identifiers) as the project name
is substituted into pieces of code as an identifier in some instances. This
sample can also be downloaded from
Rich at
http://www.xmission.com/~legalize/book/snippets/index.html#7.
|
| Color Selection (w/Alpha)
colorsel.zip (116
KB, .DLL and sample app source)
Do you need an easy way to select a color, without having to use the .OCX
included with Visual Basic? The common dialog color picker does not provide a
way to specify an alpha value! Besides, it returns the color bits in the
incorrect order for setting Direct3D color values.
Using our COLORSEL.DLL you can add a color picker to your application that
has a text box where the alpha component can be specified. The color value
usage is also compatible with Direct3D functions and methods.
Note the Alpha text box to the left of the Lum:
Text box.
Includes a sample Visual Basic 6 application demonstrating the usage of the
DLL, with full comments. This software comes with absolutely no warrantee and
no guarantees as to fitness or correctness. |
"All it takes is for the rendered image to look right."
- Jim Blinn
|