MurdocJensen said:
Was just wondering if anyone here has tried 3D programming. If you have, what language did you write in, what difficulties did you have, and what did you find interesting about it?
As of now I know of Direct3D and OpenGL, but, if I'm not mistaken, you can use different languages to write shaders for these different APIs. For example, the Cg language can be used to write shader programs for both APIs, while HLSL is used for Direct3D specifically, and GLSL for OpenGL specifically.
That's the extent of what I 'think' I know.
I used to do this kind of thing daily in a job. Here's my advice:
Understand the math
Things involving geometry like:
Convex Hulls, different types of projections (orthographic,perspective),Splines in different dimensions (curves,surfaces,volumes),other interpolation techniques (Catmull-rom,Hermite,etc),matrix and vector techniques, and quaternions are things you should know.
Although you don't have to do this anymore, its helpful to understand triangle rendering, sampling techniques (texture sampling that is) things like filtering (anti aliasing) and if you're keen ray-tracing and radiosity (not required by any means though).
Understand the architecture of GPU's and standards
DirectX and OpenGL do have differences but the fact is that rendering a triangle in OpenGL is going to be the same as rendering one in DirectX and both standards are often motivated by the same ideas (both have a matrix pipeline, both have shader standards and so on).
One thing that is different is when you get into extensions (like in OpenGL). When a GPU adheres to a standard its guaranteed to have all of the functionality in that standard. But GPU cards also offer extra things that are on top of the standard. One example is with Doom 3: The nVidia cards like Geforce 2 offered a texture operation called DOT3 which is basically a vector dot product operation. You use this for the normal mapping technique which takes the dot product of a lighting vector and another texture to give the sense that a surface "looks like a complex surface" rather than a plane.
Using something like Cg can greatly speed up development time and I don't hesitate in recommending something like that.
One last piece of advice: simulation engines (whether its a game engine like Unreal or some scientific visualization package) are complex systems. When you're writing these kinds of things try to think about the right kind of interfacing/encapsulation that say a renderer should have and say a geometric primitive should have.
For example a geometric primitive should have a function that exports its geometric structure to triangles since that is the standard primitive that GPU's use. You would probably also benefit by adding a standardized ray-intersection function that returns the point of intersection and the reflection vector from that surface.
When GPU's offer support for non-linear objects (ie objects other than triangles) like for example splines, then you can add something in your renderer to override behaviour for spline rendering.
Its a lot to take in I know, but if you get your hands dirty, you'll understand what I mean and you'll no doubt get better with progression of time.