• Advertisement
Sign in to follow this  

[.net] Starting out with 3D in C#?

This topic is 4678 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've coded for a long time in C++ and wrote a few games(Tetris/Pong/Asteroids in 2D, and a MUD server which is coming along really nice). However, I want to move into the realm of 3D. But, as C# is way nicer than C++ in general terms of usage, I wonder if there are any GOOD resources out there, to get me started with 3D. Toolmaker

Share this post


Link to post
Share on other sites
Advertisement
The Managed DirectX 9 SDK should be a good starting point, assuming you want to do D3D. I learned the basics from there, then filled in the blanks with Managed DirectX 9 Graphics and Game Programming Kickstart by Tom Miller (project lead of Managed DirectX). I don't have any experience doing OpenGL on .NET, but there are some libraries out there for that as well. For the more general 3D side of things, Real-Time Rendering and Computer Graphics: Principles and Practice are two must-haves. The first one being an introduction go general 3D graphics stuff, and he second being an encyclopedia of graphics techniques. If you aren't familiar with Algebra II and Trigonometry, you'll need that knowledge to do 3D graphics as well. Good luck!

Share this post


Link to post
Share on other sites
Quote:
Original post by Johnny Watson
I learned the basics from there, then filled in the blanks with Managed DirectX 9 Graphics and Game Programming Kickstart by Tom Miller (project lead of Managed DirectX).

I also recommend this book, its served as a great reference and tutorial.

The other book I bought is "3d Math Primer for Graphics and Game Development." It's been worth its weight in gold to me since I've had little background in linear algebra.

Best of luck.

Share this post


Link to post
Share on other sites
Come and visit us at Inner Realm, we have links to resources related to Managed Game Programming including Managed DirectX.

Share this post


Link to post
Share on other sites
Thank you guys. I'll mess around a bit, and I'll buy the since I got a truckload of book coupons waiting for me.

1 more question: Someone told me that building a (simplistic) 3D engine in MDX is much harder than DX. I kind of found this strange, as the MDX interface was meant to make life easier, not harder...

How much experience do you guys have, and if you guys have experience with both, which way do you prefer?

Also: Rate++ for the people who replied :)

Toolmaker

Share this post


Link to post
Share on other sites
I don't think it is harder, just the amount of resources on the net in reference to programming with DX are immensly in more quantity than those for MDX.

Might want to check out Coding4Fun...

Share this post


Link to post
Share on other sites
imo opinion for what its worth building 3d games is much much more simple in mdx then regular dx. Technically all you need to get a scene up and running is

Device device;

InitGraphics()
{
PresentParameters para = new PresentParameters();
para.Windowed = true;
para.SwapEffect = SwapEffect.Discard;
para.AutoDepthStencilFormat = Format.D16
para.EnableAutoDepthStencilFormat = true;

device = new Device(.....)

}

OnPaint()
{
device.Clear(Target | ZBuffer , Color.Blue,1.0f,0);
device.BeginScene();
device.EndScene();
device.Present();

this.Invalidate();
}


now thats form memroy (I dont have any code on me) but thats pretty much it. Thats even easier then OpenGL far as Im concerned. Now granted pending on what you want to do there could be a lot more code involved but to get a basic game up and working thatll do it for you. Looks pretty simple to me :-)

Share this post


Link to post
Share on other sites
Quote:
Original post by Toolmaker
Someone told me that building a (simplistic) 3D engine in MDX is much harder than DX. I kind of found this strange, as the MDX interface was meant to make life easier, not harder...


I would keep some salt handy (you can get a 50lb bag at your local feed store -- that hould last a couple of weeks) when fielding comments of this sort. DirectX it really the same under the hood regardless of your choice of managed or unmanaged so -- though I am no C++ expert -- you can probably change statement in your mind to something like:

"building a (simplistic) 3D engine in MDX is not particularly different than DX"

Now coding at all in a managed language is different, but we should all know better by now than to venture an opinion as to its relative difficulty or usefulness.

The truth is you don't really have to build a simplistic engine at all in MDX as the SDK comes with one (ie: the Sample Framework).

Share this post


Link to post
Share on other sites
Well the structure of classes and what not is a little bit different. I dislike the fact that there is no way to define global variables for an entire project...

Share this post


Link to post
Share on other sites
Quote:
Original post by Krisc
Well the structure of classes and what not is a little bit different. I dislike the fact that there is no way to define global variables for an entire project...


Do you mean in Managed Code? Something like:

public class Global {
public static int Variable = 123;
}

Share this post


Link to post
Share on other sites
Want resources for getting started with 3D in C#?

http://irrlicht.sourceforge.net/index.html
http://www.axiom3d.org/

These are the 2 most popular ones I'm aware of.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
It's true that comparing the difficulty of programming against different APIs is subjective and somewhat arbitrary. However, I can tell you what I think of them. I've done OpenGL using VC++ 6.0 and VC++ .NET unmanaged. I've also done DX7 in VB6 using Patrice Scribe's type libraries, unmanaged DX8 with VC++ .NET, and Managed DX in C# and VB.

The easiest in my opinion? MDX with VB by a very large margin. My game engine is actually turning into something since Managed DX came along. I got my own implementation of GeoMipMapped terrain in very little time (my first managed DX attempt!). There are some things that are just plain hard no matter what. Animation blending, for instance. I've pored over (and ported) TONS of code just to get that working. I finally got it with the help of a book called "Programming a Multiplayer FPS in DirectX", even though everything uses C++.

I guess that's the real difficulty with Managed DX. Sparse documentation/samples/tutorials. Fortunately much of it is simple enough to figure out on your own. Patience, grasshopper!

Share this post


Link to post
Share on other sites
Quote:
Original post by Krisc
I don't think it is harder, just the amount of resources on the net in reference to programming with DX are immensly in more quantity than those for MDX...

That said, techniques on the internet can be easily converted to MDX as the calls made have similar names. Also, many techniques nowadays use effect files which are the same for DX and MDX, so taking away much of the converting load anyway!

Don't worry, it can't be too difficult because I learnt DX for VB 6 from modifying the 'Billboard' sample from DX SDK when I was 11! It wasn't too hard to learn just fiddling about and I finally got the 'tiny'.x' model from SDK following me avoiding the crummy billboarded trees!
I now use C# 1.1 with MDX.

Oh - I realised you might not know what billboarding is, being new to 3D, so I found this. It is for OpenGL, not DirectX so ignore what they're saying about the matrices; DirectX uses a left-handed coordinate system while OpenGL uses a right-handed one.

Good luck!

Share this post


Link to post
Share on other sites
You did that while you were 11? I was still coding lemonade stand for VB6...

;) - It get's easier as time goes by my friend, and yes, converting from C++ to C# is quite easy.

Share this post


Link to post
Share on other sites
Quote:
Original post by Krisc
You did that while you were 11? I was still coding lemonade stand for VB6...

;) - It get's easier as time goes by my friend, and yes, converting from C++ to C# is quite easy.

Yeah, I actually regret not having started sooner, but I suppose it was writing all those useless little apps and the Other One that made me into a good programmer, and not just someone who can write a rubbish little macro in Excel!

Have you programmed in C++? You know, I've never actually written C++,but I taught myself the langauge when I was 11 too, from Sams 'Teach Yourself C++ in 21 Days' (I've always been so proud that I read it in 7). Nevertheless (is that a word?) it's been invaluable in my understanding of all the code on the internet in C++, and in writing faster code (keeping stuff in the processer cache etc).

PS: Lemonade stand is such a cool game! It was even a craze in school once! You did well my friend *pats on back*

PS2: Class hierarchies involving multiple inheritance are a little tricky to redesign though...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement