How do I learn 3D programming?

I have experienced 3D game programming with few engines such as Panda3D and irrlicht. But now I want to move onto something more challenging. I would like to make simple 3D game from complete scratch. Meaning that I don't want to use 3D library.

So my question is, where do I start? Any good resources?


(I'm doing this for fun so don't say it's waste of time)
Last edited on
I think you mean you don't want to use a 3D engine, because you still need a 3D library to do 3D rendering.

So the two most common 3D Libraries (well, technically they are API's) out there are OpenGL, and DirectX.

They are both essentially the same thing, but DirectX works only on windows, and OpenGL works on windows, linux, and mac. They also use different shading languages, DirectX uses HLSL, and OpenGL uses GLSL.

I haven't delved into 3D programming, but from my experience, LazyFoo created some nice SDL tutorials, and maybe it could be the same for his OpenGL tutorials. But note that they are not in 3D sadly, but it could give you the basics for setting it up, and learning the syntax.
What i'm saying is that I want to use 2D library to create 3D game.(I want to know how 3D vectors work, not how to rendering them) But OpenGL does all the math stuffs, doesn't it?


So my question is not how to create 3D games, my question is where do I learn all those 3D maths so that I can use them?
Your wish is to get more fundamental in 3D programming as i understand.
There are few things you must know and alot of research you must do on your own to make
the decision.

First thing is that the Panda3D and irrlicht are 3D engines.
3D engines uses Opengl or/and DirectX to render things on your screen.
Opengl and DirectX are bridges between Cpu (central processing unit)[in my words: protsessor] and Gpu (graphics processing unit)[in my words: video card].

I think your wish is to get more control of how things are rendered on screen, how skeleton moves, pretty much they very basics of the game.

I dont know much about DirectX but I'm coding a 3D game engine in opengl
and coding your own 3D game engine is perhaps the thing you wish.

This is where you 'can' 'create' your own 3D math.
There are some common maths we all use.
One is matrix and this is the thing with what you bring 3D world into 2D world ( in your screen )

We use formulas, math ways what already exists and manipulation with them.

What you need to do is to find the tutorial of opengl or directx what doesn't include
libraries like SDL.

Now about going more fundamental than using opengl or directx.
You can try but there is reason why no one do it and uses those 2 instead.
I haven't done research about it but i think it would be very very hard to create one like opengl. Not because of the math but because video cards are different it is pain.
You have worked on 3D engine, you dont know yet that but try working with opengl or directx first and then you will understand that you dont really want to go deeper.



Sorry to bump this, but you mentioned that he does not need a tutorial that includes libraries like SDL, and you should know that if you read my sentence again, Lazyfoo has a completely separate tutorial between SDL and OpenGL.
What i'm saying is that I want to use 2D library to create 3D game.

What I get from this is that you want to do 3D software rendering (<- this is the term you want to google).

This guy here has a nice relevant video tutorial list:

https://www.youtube.com/playlist?list=PLEETnX-uPtBUbVOok816vTl1K9vV1GgH5
+10 for Giyove one suggesting Irrlicht. I found this engine ridiculously easy to use and very encouraging for product development. The only thing easier for me so far has been Unity but that's offset by having to learn C# (I admit that I haven't tried all 3D game engines in the world and my opinion is no less anecdotal then anyone elses.). It's an absolute whore when it comes to resources in comparison to straight OpenGL. But as long as your not running it on 10 year old hardware you shouldn't notice too much.

As for this:
What i'm saying is that I want to use 2D library to create 3D game

Are you asking about games like Doom 1&2, the original Serious Sam? In that case, there are no 3D vectors, that would have been a waste of what was very limited processing power back then. In titles like this they are essentially faking everything. Enemies don't get closer to you, or further away; their hit boxes and sprites just get smaller and larger. Also, they aren't "On platform above you", the sprite is just drawn that way and the hit box stays in the same place; this is where the concept of auto-aim came from. There is another approach where the hit-box just tests for visibility of that section and the X coord effectively making it a vertical column, but the effect is the same, it's all faked.
closed account (2EwbqMoL)
Originally, I sought to do the same thing with 2d graphics when I was just beginning, but as others said, there is no basis for this in C++ (or in fact, any language)

it all starts out with rendering -- for example a 2d image is composed of pixels, and from my understanding, originally, the core graphics functions are modifying what is already there rather than outputting graphics -- rendering a single pixel on the screen is not an easy to do thing in C++, rahter youd have to somehow modify a letter or byte to be just one pixel, then have the controls set to move that around, then draw basic shapes and start from there...

with 3d, im sure its possible... or 2d... but you'd have to look into how the graphics libraries are built. SDL and openGL are open source and you can see the source code...

but building a whole game from scratch lke this isnt really feasible -- just setting up the libraries is a task and a half. usually, people take rendering libraries like OpenGL and code a game engine from there... then make the game.

the libraries that do this work for you have been worked on for a LONG time... and while Im sure this is a worthy endeavor of study in understanding it, or even making an alternative library... I dont think its feasable to make a whole game.

to put it simply, you CANT just take a 2d library and make a 3d game, it is NOT possible. You have to set up everything from nothing.... and its a task and a half I am sure...
to put it simply, you CANT just take a 2d library and make a 3d game, it is NOT possible.


Software rendering.

If you have pixel-level control with a 2D lib, you can draw anything. Even 3D graphics.

Of course that's not a good idea at all. I'm just saying that it's possible, not that anyone should ever do it.
Last edited on
where do I learn all those 3D maths


Mathematics for 3D Game Programming and Computer Graphics by Eric Lengyel
Both of these are excellent tutorials I've followed recently that make a software renderer (no libraries, no graphics acceleration, no dependencies, no installing of crap). The first is in javascript/html5 - which he teaches you and it only takes 1/2 hour to learn if you don't know it. The second is in Java and is easy for an intermediate java programmer, I dont really know about the difficulty of rewriting it in c++. These tutorials, especially the first one helped me alot but alas when the tutorial ends youre going to need strong vector maths to take it further by yourself (ie if you wanted to move a viewpoint around a scene rather than just watch a cube/object spin).

1: http://www.cores2.com/blog/?p=204
2: https://www.youtube.com/watch?v=wWoaNOLG6sA


I'm afraid I cannot recommend Irrlicht at all.

The Irrlicht Engine supports 6 rendering APIs, which are 5 more than most other 3D engines do:
Direct3D 8.1
Direct3D 9.0
OpenGL 1.2-3.x
The Irrlicht Engine software renderer.
The Burningsvideo Software Renderer
A null device.

These are all depreciated versions of the APIs, which are very slow due to their outdated concepts and not optimal for modern hardware. OpenGL 3.x isn't really outdated, however Irrlicht's usage with it is very outdated, not making it better than the other APIs.

D3D8 and D3D9 are dead and useless today.
OpenGL 1.x and 2.x are useless today.
Pretty much any software renderer is suboptimal and useless today, unless you're referring to the multi-million dollar software renderers that are shipped with modelling packages such as the Maya.

Not only is the renderer outdated, but it's also far from suitable for modern hardware.
_________________________

I went more into it here: http://www.cplusplus.com/forum/general/152181/

It's not something I'd really invest or use.

All of those rendering API's are important because of game portability. Because there are public computers out there that have an old DirectX, and OpenGL versions.
spiroth10 wrote:
to put it simply, you CANT just take a 2d library and make a 3d game, it is NOT possible.


I have done some tests in SDL when designing my interpolation algorithms that allowed me to display 3d triangles in a 2d library- not much but it certainly is possible to use the knowledge you have to make a 3d game.

however

OpenGL uses GPU processing. It is unlikely you'd like to take the time to integrate your software with each manufacturer's GPU protocols, so you'll be working with a pretty large handicap by using only the CPU.
Topic archived. No new replies allowed.