This is a discussion page for my book WPF 3D, Three-Dimensional Graphics with WPF and C#. Please post questions, thoughts, and suggestions here in the “Leave a Reply” box at the bottom of the page. I will moderate posts and reply as appropriate.
[ Overview – Table of Contents – Questions and Discussion – Errata – Sample Pictures – Source Code (17.2 MB) ]
[ Buy at: Amazon ]



Pingback: WPF 3d: Table of Contents - C# HelperC# Helper
Pingback: Book Sample Pictures: WPF 3d - C# HelperC# Helper
Pingback: Book Errata Page: WPF 3d - C# HelperC# Helper
Rod,
I just purchased your book on Amazon, should get here shortly. It’s great to have another book on 3D programming with WPF, I have Charles Petzold’s book “3D Programming for Windows” as well. Although I have a graduate in Comp Science, I never got into 3D stuff, basically staying with OS design and low level programming. However, a project my employer started me on using the MPU-9250 has changed much of this – basically I have to project a 3D object’s gyro movements via a USB link to a computer. As well, I have started into 3D MAX to further my development in this field, proving an old tiger might be able to change stripes!
Hi John,
I hope you enjoy the book! Let me know if you have questions as you work through it. Or if you create any cool pictures, please post them.= so everyone else can see! And, of course, post a review on Amazon if you have a chance.
Hi Rod,
I was wondering if your WPF 3D book is available in an electronic version such as PDF or Kindle. If not, is this something that you are considering.
This is my first time on your site and all of your work looks intriguing.
Thank you.
Sorry but the book is not available in electronic format and I’m not looking at that right now.
Rod:
I got the book in the weekend. Literally, I could not drop it from my hand. It is a superb book. Your helper functions and their algorithms are superb. I wish I could think of them earlier. I am developing a scientific (engineering) application which requires some 3D visualizations and I was in the process of testing Helix 3d wpf toolkit which works. But your approach is going to get rid of a lot of overhead and will give me a lot more flexibility to design my program.
I am now diving into the material in the book. I will post any comments or suggestions as I go along. My initial intuition tells me the perhaps I can suggest alternative triangulation algorithms using Delaunay triangulation or Voronoi diagrams. I will let you know when I get there.
Thank you again for writing a beautiful book.
ikonuk
Hi Ikonuk,
Thanks for the kind words. Post a review when you have a chance!
I thought about making Delaunay triangulations but decided that it was too much work. There are also some related topics such as making three-dimensional splines to define surfaces. I decided not to include those, mostly to save space and to focus on the graphics and not spend as much time on those algorithms.
If you build something that you think others might find useful, feel free to post a link in the comments.
Thanks for the book. I just got it. I’m using VS2012 I bought a while back. I’m also on Windows 8.1 Professional. I got busy and entered the code in a WFP project and it compiles fine, I just cant see a Cube. Chapter 2. Since it compiles without any issues I would expect a Cube to display. Anyway I downloaded the source and I will see if there are any discrepancies between what I have and what you have. Have not tried the XAML example yet; Chapter 1. I will try that to. Looking forward to seeing it all work and adding graphics to my projects. I will let you know if I run into any ongoing issues, or what I did to correct them. The only thing I can think of currently the issue may be a setting in VS2012 I’m missing. If you have any knowledge on this please share.
I don’t know why it wouldn’t work in VS 2012. I have written similar programs in VS 2008 and they work just fine. There may be some property set on the controls or perhaps the control hierarchy is slightly different. Please post what you find so we can all see what the difference is.
Hello, Dear Rod, I’m interested in your book ‘WPF 3d: Three-Dimensional Graphics with WPF and C#’, But i have a question:
I want to learn 3D from the basics, i want to learn all the math of 3D, Projections and all the process of making a 3D scene absolutely from scratch (Converting 3D Coordinates to screen coordinates, etc, etc), I don’t want to use any of WPF’s built in 3D capabilities, I don’t want to use any 3D library, What i want is to learn how to create my own 3D world totally from zero. (In C# WPF of course).
Are these issues discussed in your book?
Unfortunately that book doesn’t cover the underlying mathematics. It does cover some important stuff like the coordinate systems and how to produce different kinds of projections (like orthographic and cavalier).
My book “Visual Basic Graphics Programming” covers that, but it’s not the main focus of the book, so there are only 5 chapters about 3D graphics, and one of those is about ray tracing.
If you want to build your own, you might want to consider ray tracing. It produces a result that is better in many ways and in some ways it is more elegant. It is also slower, but if you do this yourself, you’re not going to get stunningly fast performance in either case. (I’ve written a book about ray tracing as a follow-on to “WPF 3d” but haven’t had the time to publish it yet. I really need to do that.)
Also note that WPF probably won’t give you a lot of help if you want to do this with your own code, so you could use Windows Forms instead. The big advantage of WPF is the 3D viewport, which you won’t be using.
I’ve been looking for this other book too and found it seems the first chapter contents can be found in another book but not the others. Isn’t there any other more up-to-date book with this content? I have found it to be very expensive (at least here in Brazil) for a 20+ yo book.
If you mean “Visual Basic Graphics Programming,” then yes it is an older book that is out of print. You may be able to get a used copy somewhere like ebay, but I doubt you can find a new copy.
There are other books that cover the mathematics of 3D graphics. They tend to be more academic and use pseudocode instead of C#. If you search Amazon for “mathematics of 3d graphics” you’ll see some books that may help. (All books are pretty expensive these days, though. 🙁 )
Yes, it was about that book. It would be great if there was such a book with C# examples but I’ve found some on Amazon and will check them out. Thanks.
Note that that book was written for Visual Basic 5/6. You may find the mathematics and ideas interesting, but the code won’t translate into .NET very well.
Thank you!! Very appreciated!! So helpful!!
Hello, just started with the book and I have a question.
Chapter 1, first example (cube):
why did you define 24 points, 8 should have been sufficient?
In WPF (and at least some other 3d modeling tools) if two triangles share a point then the system smooths them so the edge between them is not visible. For example, that’s how you can make a sphere look smooth rather than built out of a bunch of triangles.
The cube example uses separate points so you can see the edges of its sides. The two triangles that make up a side can share, so we need 4 points per side for a total of 24.
You might want to try making the cube with just 8 vertices to see the result. It’s pretty interesting and very confusing if you don’t know what’s happening.
Ah, I see. So even if the coordinates are exactly equal, there is a difference. Thank you.
Yes, the points are the same but they have different indices in the vertex list.
The book arrived yesterday. I got the cube working. I followed your advice and started to fiddle with the code. I wanted to create a button that would change color from light blue to say red.
I tried this:
group3d.Children[2] is where the GeometryModel3D object is located. This made the image disappear. Is there a better way than [2] to navigate the group3d data structure?
Never mind. I got it working. Indexing group3d.Children[2] works but it doesn’t seem the right way to find where to change the data structure.
Sorry I didn’t reply sooner. I’ve been crazy busy tech editing some books for other authors.
I think if you save a reference to the model that you want to change, you can change that object’s material without using its location in the child array. Some of the examples later in the book, notably in Chapter 32, show how to change materials. Basically they just change the material for the object that you select with the mouse.