PDA

View Full Version : Understanding The Basics of 3D Graphics



vampm
23-02-2012, 06:17 PM
Glad to be here guys! I am skeptical on this.. First of all I want to make a 3d engine just for me, not for use in anything, unless its lightweight enough to create a simple 3d game. But the point is that making a 3d engine from the very zero, as I do, means that its running in cpu.

The "cube" that I made, uses ONLY the putpixel function of the graph unit to turn on/off pixels; all the routines that transform the points and creating the lines are made by me. The graph unit can already do etc the lines by itself, but I dont use it since the goal for me is to create the 3d engine by myself. Anyway, if I can create a simple lightweight engine, then I will try to create a simple game. Now if that game is rpg or anything else is another story, so it can wait.

For the time being I want to play with pixels in delphi7 (I think its more than enough this version for me), just turn on/off pixels very fast, and from what you said delphix is not a good option. So besides Andora2d and Jedi-SDL, any other lightweight option?

SilverWarior
23-02-2012, 08:43 PM
Don't get me wrong but working directly with pixels isn't good as it can be werry slow and CPU consuming. Nowadays most of graphic engines use OPenGL or DirectX for renderning graphics becouse both of theese alows to use hardware support for speeding everything up. Also todays graphic engines works with faces and textures.
But I think I understand why you want to do this all by yourself as it can be great lerning expirience. At some point I was trying to do something similar by myself but have abandoned all becouse I didn't get the expected performance out of it.

WILL
24-02-2012, 07:37 AM
Hey guys, I moved these posts over into their own thread so we aren't running over the Welcome to PGD thread. :)

Please continue your conversation as you need. Should you want to discuss something else simple create a new thread in the appropriate forum. This is only done to keep all topics organized for easier reading by all members.

I still say start with 2D, however if you really feel confident in taking on such a large topic as 3D graphics. You can start with something like OpenGL. However if you do not know simple concepts like working with sprites, rotation, scaling, etc... then you should definitely start with 2D before even looking at 3D as a project. Your built knowledge with 2D will become useful when you do start on 3D and are looking at texturing 3D objects and so on.

Also knowing to work with 2D and the 3 basic effects and how well they perform in "software" only you will learn to appreciate hardware acceleration all that much more. The three I'm referring to are of course: scaling, rotation and alpha blending.

JEDI-SDL (http://pascalgamedevelopment.com/jedi-sdl/) (uses the SDL API (http://www.libsdl.org/)) is a great starting library and is used by the PP4S project because of it's easy of learning and how it helps you move into other advanced graphics programming using OpenGL. It is also supported by any version of Delphi or Free Pascal/Lazarus.

Both (Un)DelphiX and Andora2D are great libraries and have great features but:


The downside to DelphiX is that it is a very very old library that has been updated by many hands and is not as simple to setup as it once was. There is so much better out there now.
The downside to Andora2D (in my own opinion) is that the author no longer updates it and future development is looking towards a complete rewrite. Not a great library for long term use.


There are others, but you don't get as near a low-level feel as you get with SDL. I suggest starting with JEDI-SDL which is easy to setup and then once you have an understanding of working with the basics --make a few small games-- then you can have a better look of what is out there and what will work best for how you want to code and what you want to support.

If you pop onto the front page and look under our affiliates display, there are some great resources that will help you learn SDL quite quickly. I recommend FreePascal-meets-SDL (http://www.freepascal-meets-sdl.net/) to learn how to get started with SDL and the "PPS" (aka Pascal Programming for Schools) project site (http://www.pp4s.co.uk/) has some great example programs created by talented high school students who have been working with and learning SDL. Some lead into OpenGL and 3D programming as well.

pstudio
24-02-2012, 12:20 PM
Glad to be here guys! I am skeptical on this.. First of all I want to make a 3d engine just for me, not for use in anything, unless its lightweight enough to create a simple 3d game. But the point is that making a 3d engine from the very zero, as I do, means that its running in cpu.

The "cube" that I made, uses ONLY the putpixel function of the graph unit to turn on/off pixels; all the routines that transform the points and creating the lines are made by me. The graph unit can already do etc the lines by itself, but I dont use it since the goal for me is to create the 3d engine by myself. Anyway, if I can create a simple lightweight engine, then I will try to create a simple game. Now if that game is rpg or anything else is another story, so it can wait.

For the time being I want to play with pixels in delphi7 (I think its more than enough this version for me), just turn on/off pixels very fast, and from what you said delphix is not a good option. So besides Andora2d and Jedi-SDL, any other lightweight option?

So what do you wish to achieve? Do you wan't to make your own simplistic 3D renderer, where you draw lines and faces pixel by pixel and do your own transformation matrices? Or do you wish to make a simple 3D engine where it's all about defining geometry which the engine will automatically render?

For the 3D renderer you can just use SDL or even just TCanvas. I see this as an exercise for understanding the very basics of 3D graphics programming. It won't be fast but it doesn't matter.

If it is an engine you wish to make go for OpenGL or DirectX. This is still low level but the rendering of polygons is handled by hardware now. You won't need to set each and every pixel but there's still plenty of challenges to overcome.

LP
24-02-2012, 09:18 PM
For the time being I want to play with pixels in delphi7 (I think its more than enough this version for me), just turn on/off pixels very fast, and from what you said delphix is not a good option. So besides Andora2d and Jedi-SDL, any other lightweight option?

You don't need any additional libraries if you want to process pixels yourself. Standard TBitmap and Delphi's form will suffice.

Check this article:
Manipulating Pixels With Delphi's ScanLine Property (http://www.efg2.com/Lab/ImageProcessing/Scanline.htm).