views:

56

answers:

2

Okay, I know absolutely nothing about 3D projection, but I need to figure out a way to project pictures in Silverlight (<Matrix3D/>) based on some predetermined variables that I have available to me. I've searched high and low for some sample code or a really basic "for stupidies" set of articles, but have yet to find anything that makes any sense. Even the great Khan Academy wasn't simple enough for me. Cameras, field of view, rotations - my brain just can't wrap itself around this stuff.

I have a need for the following projections:

  • Isometric
  • Orthographic
  • Oblique
  • Perspective

So, I have a number of variables provided to me like X, Y and sometimes Z. For example, this -

Type: Orthographic
X:    70°
Y:    10°
Z:    20°

somehow turns this -> normal into this -> orthographic and

Type: Isometric
X:    314.7°
Y:     35.4°
Z:    299.8°

into this -> isometric

I have other information, like the coordinates of where the picture appears on a canvas, it's width/height, etc. if that information is useful too.

Does anyone know of any resources that can explain this (scratch Wikipedia please - that stuff doesn't make any sense to me). Or do you know how these calculations work (.NET, sans WPF 3D functions)?

+1  A: 

Okay. Matrix3D itself is a simple class what is hard it to know what to fill in the matrix. Before you jump into coding read through any one the following:

  1. Any book on computer graphics
  2. 3D Programming for Windows®: Three-Dimensional Graphics Programming for the Windows Presentation Foundation by Charles Petzold
  3. In the worst case if you dont have any time then atleast read through 3 chapter of opengl redbook (Just the math of transformation matrices).

You may wonder why I am asking you to read some huge books while what you need is a quick solution. In my opinion 3D graphics programming will be dead simple if you understand the math behind that (It is not complicated). If not then you will spend double the amount of time in trying to find out why your program doesn't do what you want.

ferosekhanj
@ferosekhanj: thanks for the recommendations. i've taken a look at the opengl redbook as it's online and still didn't get much out of it. i'll look for the petzold book at a book store later today and see if that is helpful. i think what i'm lacking here is a knowledge of what to do with the details I have (width, height, X, Y, Z). everything i read is about actual 3d objects, but as you can see i'm dealing with just 2d pictures. i really just need an understanding of where to get started with calculations using the values i have.
Otaku
+1  A: 

This site has a pretty good introduction on performing matrix operations in .net: http://www.simple-talk.com/dotnet/.net-framework/building-a-simple-3d-engine-with-silverlight/

Also, take a look at Wikipedia for some backround on matrix rotations: http://en.wikipedia.org/wiki/Rotation_matrix

And you can never go wrong with a bit of Petzold: http://www.charlespetzold.com/blog/2009/07/Using-the-Matrix3DProjection-Class-in-Silverlight-3.html

This is also a great introduction into using matrices to handle linear transformations: http://polymathprogrammer.com/2008/09/01/cartesian-coordinates-and-transformation-matrices/

Alison
The Petzold Matrix3D article was exactly what I was looking for, great!
Otaku