## Introduction to 3D Game Programming with DirectX 9.0c: A Shader Approach

Frank Luna

Mentioned 8

Introduction to 3D Game Programming with DirectX 9.0c: A Shader Approach presents an introduction to programming interactive computer graphics, with an emphasis on game development, using real-time shaders with DirectX 9.0. The book is divided into three parts that explain basic mathematical and 3D concepts, show how to describe 3D worlds and implement fundamental 3D rendering techniques, and demonstrate the application of Direct3D to create a variety of special effects. With this book understand basic mathematical tools used in video game creation such as vectors, matrices, and transformations; discover how to describe and draw interactive 3D scenes using Direct3D and the D3DX library; learn how to implement lighting, texture mapping, alpha blending, and stenciling using shaders and the high-level shading language (HLSL); explore a variety of techniques for creating special effects, including vertex blending, character animation, terrain rendering, multi-texturing, particle systems, reflections, shadows, and normal mapping;f ind out how to work with meshes, load and render .X files, program terrain/camera collision detection, and implement 3D object picking; review key ideas, gain programming experience, and explore new topics with the end-of-chapter exercises.

I know there are several topics about this question, but I want to specifiy what Iam looking for.

So I learned OpenGL and got the basics of shaders (programmable pipeline), vertex buffers, index buffers, all together so called "Modern OpenGL".

Iam interested if such a term exists for DirectX.

There are several opinions about which DirectX version to choose. 9 does run on nearly all Windows PCs, while 11 is limited to newer GPUs and Windows Vista+.

My GPU supports 9, while my OS supports 11. Should I choose software accelerated 11 or hardware accelerated 9?

Is DirectX9 is something like deprecated OpenGL? So if I learn DirectX9 instead of 11, is it wasted time or is it usable? In other words. Does DirectX9 offer what modern OpenGL offers?

If so, which sources (tutorials/books/videos) should I use to get the basic skills of using shaders, buffer etc. in DirectX? For example in one tutorial I found this line: d3dDevice->BeginScene(); And it very much reminded me of deprecated OpenGL. I don't want to learn cutting edge DirectX, but I want to make a good trade between compatibility and modern concepts.

In an other thread I found this book: http://www.amazon.com/dp/1598220160/?tag=stackoverfl08-20

But Iam a little bit scared if I waste my time on deprecated old stuff.

To sum up, I need some help, I really can't make a picture of which way to go.

I hope you get my points.

DirectX allows you to pick what version of DirectX you want to use while creating the device, so don't worry about that.

This is done in the D3D11CreateDeviceAndSwapChain in the D3D_FEATURE_LEVEL.

A pointer to an array of D3D_FEATURE_LEVELs, which determine the order of feature levels to attempt to create.

What I would recommend you do is download the DirectX SDK June 2010 and check out some the samples that comes with it. Than you should decide how you want to move forward.

For books I would recommend Introduction to 3D Game Programming with DirectX 11 or DirectX 10 or Directx 9. Which ever version you decide to go with.

I'm fairly familiar with C / C++ / java, but I have mostly only ever done command line programming (with the exception of GUI in java).

I am really interested in 3D programming, but the problem I am having is I feel I know so little that I'm not even sure where to start so I am having difficulty searching for said resources.

I was hoping someone could point me in the right direction as to some resources / tutorials to get started.

I understand the two large platforms are OpenGL and Direct3d. My questions is which would be "better" to learn?

I originally started with a little OpenGl with some tutorials at http://nehe.gamedev.net but I later found out that most of the stuff there is depreciated / bad style.

I then learned the most recent version of OpenGL is 4.x, and my barely a year old VG card only supports OpenGL 2.x (HD 4890).

I would like to learn how to basically "walk" through some 3 dimensional environment, e.g. a maze.

This: http://www.amazon.com/Introduction-Game-Programming-Direct-9-0c/dp/1598220160 is a great book for learning "modern" (aka shader based) graphics programming with DirectX. There's also a newer DX10 edition that I'm sure is good as well but I have not actually looked at it.

I'm not aware of an equivalent OpenGL book, maybe somebody else can suggest one. Once you master the basic concepts though (vertex buffers, shaders, render states, etc) it's not very difficult to move between GL and DX since they're both basically interfaces to the same graphics hardware.

I'm pretty familiarity with c++. I'v made a few games like tetris and solitaire with it. But what I would really like is some nice textured graphics for those games :-p GDI just isn't doing it for me anymore.

Really, all I would need to know is:

• DX scene initialization
• making something simple like a round rectangle and basic shapes
• ability to move those shapes in X and Y
• dispose of the objects

anything that would cover these concepts would be really useful Thanks

I've got a copy of Beginning DirectX 10 Game Programming. I haven't done much with it (lack of time, mostly), but it is well-written and covers the basic concepts step-by-step and has the complete code you need to accomplish the tasks in the chapters.

I created a small 2D game (Othello for a school project) using PNGs loaded at run-time, and I could not have done it without the book (I am a complete beginner in Windows and DirectX programming :D).

Introduction to 3D Game Programming with Direct X 9.0c: A Shader Approach by Frank Luna is probably the best "intro" game programming book out there. Enough material to get something interesting on screen and start playing around. I can't recommend it enough.

In 3d terrain that consists of thousands of cubes (i.e. Minecraft ), what is a way to handle each block in terms of location and rendering? More specifically, I know that drawing a primitive of a cube and world transforming it everywhere in directX 9 is probably a ridiculous way to accomplish this since there are so many performance issues, so I was wondering what a more reasonable method would be.

Should each cube be a mesh that's copied many times, or is their a way to create the appropriate meshes from the data in your vertex buffer?

I found this article that walks through some of the theory behind implementing what I want to implement, but I've never used octrees before so I wasn't able to take too much from the source code. If octrees are indeed the way to go, where is a good starting point to learn about them? Most of my google searches only turned up blog posts about theory with little or no implementation examples.

It seems like using voxels would be useful in doing this, but like with octrees, I'm coming from no experience here, so I don't really know what to study first.

Anyway, thanks for any advice\resources\book names you can spare. I'm sure it's obvious, but I'm still very new to 3d programming, so I appreciate your help.

First off if you're using Minecraft as your reference, think of their use of chunks and relate it to Oct-trees. Minecraft divides up their world into smaller chunks to handle the massive amount information that is needed to be stored so use Oct-trees to organize this data that will be stored. Goz has a very accurate description of how Oct-trees and Quad-trees work, so use his information as a reference.

Another thing to consider is that you don't actually want to draw every cube to the screen as this will eat up your framerate. Use Object Culling to only draw visible cubes to the screen. Again if you think Minecraft; have you ever encountered a glitch where you can see through the blocks and under the world? This is because Minecraft only draws the top layer of blocks. With this many objects on screen, it would be a worthwhile investment to look into Object Culling using both the camera frustum and occlusion query.

For information on using DirectX I would recommend any book by Frank Luna. I own this book myself and it never leaves my side when programming in DirectX. http://www.amazon.com/Introduction-Game-Programming-Direct-9-0c/dp/1598220160/ref=sr_1_3?ie=UTF8&qid=1332478780&sr=8-3 I highly recommend this book as I've learned almost everything I know about DirectX from it.

Upon a Google search I found this link that discusses Occlusion Culling, because Luna doesn't cover occlusion culling, only frustum culling. I hear the Programming Gems series mentioned a lot, but I can't attest to its name personally. http://http.developer.nvidia.com/GPUGems/gpugems_ch29.html

Hope this helps.

I've been programming for a little over 2 years now, and I want to get started with graphics programming and make some simple games to start with. A lot of the books I've looked at for learning directx assume you know the basics of it, which I don't, or that they'll just give you some snippets and assume you'll be able to digest their cryptic code without an explanation. So what are some good books for somebody that is truly new to graphics programming but has a some knowledge with general programming?

Hands down, the best 'graphics programming' book I have ever seen is "An Introduction to 3D Game Programming with DirectX 9.0c: A Shader Approach" by Frank Luna. It starts from the ground up with a linear algebra primer (absolutely critical), then explains how the 3D pipeline works (model, world, camera, ndc, view) and how to deal with the programming nightmare that is Directx ;)

It also covers some advanced techniques, suchs as reflections and refractions etc, but once you've gotten the essentials down (the first 8 chapters) you can basically write anything you want in directx and the rest of your graphics programming time will be spent reading books like the "Shader X" series by Wolfgang Engel, (Shader X7 is particularly good), GPU Pro (same author), and Nvidia's GPU Gems, which they have on their website for free: Gpu Gems.

Android NDK Game Development Cookbook http://www.amazon.com/Android-NDK-Game-Development-Cookbook/dp/1782167781 has pretty few things to do with Android NDK. However, it focuses on implementing a portable game engine from scratch in C++, regardless of the platform. Its topics mainly include low level things like filesystem, networking, audio and so on.

Possible Duplicates:
Good books or tutorials for beginning Direct X with c++
directx tutorials c++

what tutorials did you use to learn directx 9 or books.......

I started with Frank D. Luna's book:

http://www.amazon.com/Introduction-Game-Programming-Direct-9-0c/dp/1598220160/

and then coded myself into all sorts of trouble until I got things working.

I decided to learn directx on my old laptop that has an ATI Radeon X1200 card. Using the program GPU-Z.0.7.2 I found that my card support directx 9 /SM2.0 and has shadrers of 4 Pixel / 2 Vertex. Using dxdiag on my windows 7 I found that directx version is directx 11. Then I downloaded visual studio 2012 express but I did not install it yet. Since my card supports only directx 9 im going to read the book Introduction to 3D Game Programming with DirectX 9. Now what version of the direct SDK do I have to download ? and after downloading the SDK what should I install first the SDK or visual studio 2012 express ? Is the book ok ? I mean there are other editions of the book but they supprt directx 9c , directx 10 and directx 11.

Thank u so much.

Using dxdiag on my windows 7 I found that directx version is directx 11.

This is the DirectX runtime version, not SDK version. so it does not matter which version of SDK you use to develop your program.

As others said, the installation order does not matter.

The book you mentioned is good for new starters. but I recommend you to start from the shader version, since fixed pipeline functionalities such as transforming and lighting was abandoned start from DirectX 10, they all moved to shaders, there is a shader version of that book.

there are lots of materials and resources to learn DirectX, I paste some pages for your reference.

http://www.directxtutorial.com/LessonList.aspx?listid=9

http://www.braynzarsoft.net/index.php?p=DX11Lessons

http://www.rastertek.com/tutindex.html

DirectX SDK examples are also very good choice.

I am trying to learn how to use the Direct3D function D3DXTessellateRectPatch: msdn.microsoft.com/en-us/library/bb205471(v=VS.85).aspx

I have found the MSDN documentation quite useful and have been able to implement tessellation of a single rectangle patch.

I am now trying to tesselate a mesh that consists of thirty two bicubic Bezier 3D patches (the Utah teapot).

I have tried a simple approach - tesselate each Bezier curve individually, then join the vertices and indices appropriately, taking into account vertex offsets, to create a tessellated merged mesh.

However, this does not quite seem to have the desired result.

If anyone has hints on this problem or, even better, code samples, much appreciated.

Specifically, I have checked: Www.directxtutorial.com http://www.amazon.com/Introduction-Game-Programming-Direct-9-0c/dp/1598220160/

And another Direct3D reference, as well as Google.