XNA for C#
DirectX 9 for C#
DirectX 9 for C++
DirectX 9 for VB
Forum
   
My XNA Book
      
       Go to section on this site

Additional info


Latest Forum posts

 Tutorial 3 for Windows Phone 7
  Posted by: Anonymous
  When: 20/05/2013 at 02:30:13

 No download link for 2d series: shooter
  Posted by: zaboleq
  When: 07/05/2013 at 15:46:28

 Collision Class?
  Posted by: Anonymous
  When: 05/05/2013 at 19:03:59

 stack overflow
  Posted by: cityguy
  When: 07/04/2013 at 01:58:38

 Meshes looks strange.
  Posted by: ab_saratov
  When: 01/04/2013 at 04:31:08

 Lamppost Not loaded
  Posted by: Anonymous
  When: 22/03/2013 at 06:43:52

 Collision Class?
  Posted by: Da_Boom
  When: 21/03/2013 at 01:23:09

 Math boggles me
  Posted by: cityguy
  When: 17/03/2013 at 03:44:48

 Collision Class?
  Posted by: Da_Boom
  When: 16/03/2013 at 03:44:42

 Tree update
  Posted by: Anonymous
  When: 15/03/2013 at 21:11:22


Ads




XNA 3.0 Game Programming Recipes

Riemer Grootjans







Chapter 2: Setting Up Different Camera Modes in Your 3D World (144 pages)

In a 3D application, the camera is one of the most elementary components. The camera represents the viewpoint of the user in your 3D world. XNA renders your 3D world to the screen as it is seen by the camera. So before you can ask XNA to render the content of your 3D scene to the screen, you first need to specify the position and viewing direction of your camera.

This chapter starts off with some fundamental topics you need to master before you can create any 3D application.

The second part of this chapter covers some more advanced examples, such as camera flybys, quadtrees, octrees, and post-processing.

2-1. Set Up the Camera: Position, Target, and View Frustum
This beginner recipe introduces to the steps required to set up your own 3D World. The purpose of the camera is discussed, together with the View and Projection matrices. As an extra, the use and necessity of the Z-buffer is explained.

2-2. Specify the Target of Your Camera
To rotate a camera, you should only change its Target point. Although this can be done by diving into trigon maths, it’s far easier and more scalable to use simple transformations.

2-3. Create a First-Person Shooter Camera: A Quake-Style Camera
This recipes creates the QuakeCamera class, which is being used in almost all 3D recipes in this book. This camera mode allows you to fly through your 3D world using as seen in most first-person shooting games.

2-4. Create a Freelancer-Style Camera: Full 3D Rotation Using Quaternions
The Quaternion camera is quite different from the Quake Camera, as it allows the camera to rotate in all directions.

2-5. Check Whether an Object Is in Sight of the Camera
This recipe shows how to use the Contains method of the BoundingFrustum class. As an example, you learn how to check whether a single point, single Model or multiple Models are in sight of the camera.

2-6. Detect Camera Collision Against Models, Walls, or Terrains
This recipe uses a BoundingSphere to keep the camera at a certain distance from a Model or terrain grid.

2-7. Create a Camera Fly-by Action
Most 3D games allow for smooth Fly-By camera modes. This allows the game engine to bring some locations of the 3D world to the attention of the player. This recipe shows how to implement such Fly-By using a Bezier curve.

2-8. Remove the Solid Background Color: Skybox
An easy way to remove the solid background color of the screen is to render a cube around the camera and cover the cube with textures. The HLSL part of this recipe explains the texCUBE intrinsic.

2-9. Draw Only the Parts of the Scene That Are in Sight
of the Camera: Octree
Having tens or hundres of Models in your 3D World will severely slow down your application. This recipe shows how you can separate your 3D world in smaller parts, and render only those parts that are in sight of the camera.

2-10. Use a Quadtree to Hide Parts of a Grid That Are Not in Sight
This recipe introduces you to large terrain rendering. A large terrain is split up into multiple smaller grids, of which only those in sight of the camera are actually being rendered to the screen.

2-11. Create a Real-Time Camera-Dependant Optimally Adapting Mesh (ROAM) Terrain
In case the terrain you want to render for your game is so huge it cannot be handled by the previous recipe can’t handle, this recipe introduces you to a totally different way of rendering terrain. This is done by selecting for each triangle individually the optimal Level-Of-Detail that is should be rendered in.

2-12. Set Up a Post-Processing Framework
Almost all games come with a complete set of Post-Processing effects. These HLSL effects capture the final image before it is rendered to screen and modify the color content. This recipe shows how you can set up a Post-Processing framework, allowing you to easily add or drop Post-Processing effects.

2-13. Create a Blur/Glow Post-Processing Effect
Two examples of Post-Processing effects. The Glow effect is used to show how to use multiple pass alpha rendering, one of the more complex techniques to master in Post-Processing.

2-14. Write a Custom Content Importer
As a more advanced recipe on the Content Pipeline, this recipe shows you how you can load custom defined objects into the Content Pipeline, and how you can extract and present their contents to a Content Processor.




Recipe 2-11: Real time ROAM terrain engine for rendering huge outdoor environments.


Google
 
Webwww.riemers.net


If you appreciate the amount of time I spend creating and updating
these pages, feel free to donate -- any amount is welcome !



- Website design & XNA + DirectX code : Riemer Grootjans -
©2003 - 2011 Riemer Grootjans
Translations

This site in English
This site in Korean
This site in Czech

Microsoft MVP Award



2007 - 2011 MVP Award
DirectX - XNA

Contents

News
Home
Forum
XNA 2.0 Recipes Book (8)
Chapter 1
Chapter 2
Chapter 3
Chapter 4
Chapter 5
Chapter 6
Chapter 7
Chapter 8
XNA 3.0 Recipes Book (8)
Chapter 1
Chapter 2
Chapter 3
Chapter 4
Chapter 5
Chapter 6
Chapter 7
Chapter 8
Downloads
Extra Reading (3)
Matrices: geometrical
Matrix Mathematics
Homogenous matrices
Community Projects (1)
Team Project (1)
News
Tutorials (160)
XNA 4.0 using C# (89)
2D Series: Shooters (22)
Starting a project
Drawing fullscreen images
Positioning images
SpriteBatch.Draw()
Rotation
Keyboard input
Writing text
Angle to Direction
Direction to Angle
Smoke trail
Manual texture creation
Random terrain
Texture to Colors
Coll Detection Overview
Coll Detection Matrices
Putting CD into practice
Particles
Additive alpha blending
Particle engine
Adding craters
Sound in XNA
Resolution independency
3D Series 1: Terrain (13)
Starting a project
The effect file
The first triangle
World space
Rotation - translation
Indices
Terrain basics
Terrain from file
Keyboard
Adding colors
Lighting basics
Terrain lighting
VertexBuffer & IndexBuffer
3D Series 2: Flightsim (14)
Starting point
Textures
Loading the floorplan
Creating the 3D city
Loading a Model
Ambient and diffuse
Quaternion camera
Flight kinematics
Collision detection
Adding targets
Point sprites
Alpha blending
Skybox
Camera delay
3D Series 3: HLSL (18)
Starting point
HLSL introduction
Vertex format
Vertex shader
Pixel shader
Per-pixel colors
Textured triangle
Triangle strip
World transform
World normals
Per-pixel lighting
Shadow map
Render to texture
Projective texturing
Real shadow
Shaping the light
Preshaders
3D Series 4: Adv. terrain (19)
Starting code
Mouse camera
Textured terrain
Multitexturing
Adding detail
Skydome
The water technique
Refraction map
Reflection map
Perfect mirror
Ripples
The Fresnel term
Moving water
Specular highlights
Billboarding
Region growing
Billboarding renderstates
Perlin noise
Gradient skybox
Short Tuts (3)
Run XNA on older pcs
MessageBox in XNA
Normal generation
DirectX using C# (54)
Series 1:Terrain (14)
Opening a window
Linking to the Device
Drawing a triangle
Camera
Rotation - Translation
Indices
Terrain creation
Terrain from file
DirectInput
Importing bmp files
Colored vertices
DirectX Light basics
Mesh creation
Mesh lighting
Series 2: Flightsim (19)
Starting code
Textures
The floorplan
Creating the 3D City
Meshloading from file
Ambient light
Action
Flight kinematics
Collision detection
Skybox
Texture filtering
Adding targets
Point sprites
Alpha blending
DirectSound
Sounds in 3D
Playing MP3 files
Displaying text
Going fullscreen
Series 3: HLSL (19)
Starting point
HLSL Introduction
Vertex Shader
Shaded triangle
Pixel Shader
Textured Triangle
Triangle Strip
World transform
Adding normals
The first light
Shadow mapping
Render To Texture
Projective texturing
The first shadow
Shaping the light
Preshaders
Multiple lights
Adjusting Z values
Finishing touch
Short Tuts (2)
Resizing problem
Checking Device caps
DirectX using C++ (15)
Series 1: Terrain (15)
Opening a window
Ending the game loop
Linking to the Device
Clearing your window
Drawing a triangle
Culling
Camera
Rotation - Translation
Indices
Terrain creation
Terrain from file
DirectInput
Importing .bmp files
Adding colors
DirectX Light basics
DirectX using VB (2)
Series 1: Intro (2)
The first triangle
Rotation - translation
-- Tree view --


Thank you!

Support this site --
any amount is welcome !

Stay up-to-date

I don't have the time to keep a News section, so stay informed about the updates by clicking on this RSS file!