|
Home
Old News
Book Info
Book II Info
Resources
Book Store
Forum
Links
| |
Resources
|
Papers
|
Corresponding Source Code |
| D3DSplitWnd |
Download Code |
 |
| Remarks: This demo uses Direct3D with
MFC to create an SDI application that renders to four view windows
(created by the CSplitterWnd class). After using the VC++ wizard to
create the SDI application, most (not all) of the code additions take
place in the main frame and view class. A view class instance is
associated with each of the four panes of the split window. Direct3D
is initialized in the main frame class with a tiny 1x1 back buffer and no
depth/stencil buffer. This is because we do not use the implicit
swap chain associated with the device for rendering. Instead we use
IDirect3DDevice9::CreateAdditionalSwapChain and
IDirect3DDevice9::CreateDepthStencilSurface to create a swap chain and
depth/stencil for each view instance. These buffers are sized to
match their view pane's client area. In addition, each view has a
camera and properties that indicate how to render the scene (stored in the
single document class--SDI applications only have one). By default,
we use one perspective projection with solid fill mode and three
orthographic projections with wireframe fill mode. The CMainFrame::initD3D()
function is called in the CD3DSplitWndApp::InitInstance() method after the
pointer to the main frame window (m_pMainWnd) becomes valid. The
drawing code is executed in the OnDraw method of the view class; to
specify which window the device is to render to, we use the
hDestWindowOverride parameter of IDirect3DSwapChain9::Present. |
| Mesh
Hierarchies and Animation |
Download Code |
 |
| Remarks: This paper and sample demonstrates hierarchal mesh
animation. The planets are parented to the sun and the moons are
parented to their respective planets. The simulation is not
physically realistic. |
| Skinned Mesh
Character Animation
|
Download Code
Download
Binaries
|
 |
| Remarks:
To simplify the sample code some assumptions and restrictions were
made. Please be aware of them when trying to use your own .X file
with the sample code. 1) We assume the .X file contains only one
skinned mesh. This means that if your mesh contains more than one
skinned mesh, the sample will only load the first one it finds. 2)
The sample programs are currently coded to handle a maximum of 35
bones. So if your skinned mesh has more, you will likely get a blank
screen when trying to render it. You can go through the code and
change these hard coded values. However, be aware that your graphics
device may not have enough constant registers to store a lot of
bones. Page 16 of the paper discusses this problem in more detail. |
| Basic Terrain Rendering Part II |
Download Code |
 |
Remark 1: In Chapter 13 of Introduction
to 3D Game Programming with DirectX 9.0, we textured the terrain by stretching one
texture across the entire surface of the terrain such that one texture
element spanned one quad of the terrain. Although this technique is
easy to implement, the problem with it is that one quad does not
correspond to exactly one screen pixel, but typically numerous screen
pixels. Consequently, we use one texture element to color several
pixels. In other words, a screen space triangle of the terrain will
typically be much larger than the corresponding texture triangle (at least
near the viewer). Thus, Direct3D will have to magnify the texture
triangle to fit using a filtering algorithm (Section 6.3). However,
if the magnification is drastic then the resulting image becomes blurred
and loses details. When stretching a single texture over a large
terrain, the magnification will be drastic and this is why the textured
terrain made in Chapter 13 only gives rough colors and not high frequency details.
The goal of this paper and sample is to describe a new technique where
high frequency details can be preserved. This new method is fairly
easy to implement, but will assume knowledge of pixel shaders. Also
note that to execute the sample, your video card must support vertex and
pixel shader versions 2.0.
The sample also includes twenty-one .RAW heightmap files and two
skybox textures,
which you can use for your own projects. Both the heightmaps and
skyboxes where made in Bryce.
Remark 2: A Mr. K.A. Bahar has implemented a managed DirectX
version of this sample; it can be downloaded here.
The corresponding article is here
(not English language).
Remark 3: If after mixing several texture layers, you still find
parts of the terrain to still be too repetitive, you can mix in
some random color variations into the vertex color.
|
| |
|