• Advertisement
Sign in to follow this  

Writing my own 3d engine

This topic is 4689 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

Hey, I've been thinking lately about trying to write a nice little graphics engine. The only problem is that I don't know what it takes in means of math education. I was hoping one of you guys could tell me the requierments and maybe guide me to a useful website that walks you through the basiscs... Any useful answers will be nice :) Asaf Polturak, Israel

Share this post


Link to post
Share on other sites
Advertisement
Basically, I'd suggest you get a grasp on matrix and vector math. Do you necessarily need to memorize how a Cross product is performed or how to multiple two matrices together? No, not really. I think you need to understand what's available and generally what operations can do for you. Vector math is pretty easy to find good explainations on via google. Matrix can be a little tougher to find stuff in layman's terms, but here's a site that helped me out a ton:

http://www.sjbaker.org/steve/omniv/matrices_can_be_your_friends.html

Hope that helps you out!

Share this post


Link to post
Share on other sites
I second that.

You don't even need a full grasp of linear algebra for most things. If you know that an object's orientation and location is stored in a 4x4 matrix and how multiplications with other matrices affect it, there won't be any problems for you unless you plan on also creating a physics engine.

-Markus-

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
hi:To walk through the basics just visit the folowing link
opengl.org
open the www.google.com then type in the search " ne he openGL " and go to the first link .i think u ll find all the answers u neede for that.
im from pakistan and also working on similar kind of project
regards
nadia

Share this post


Link to post
Share on other sites
Thanks for the fast replies but it wasn't exactly what I was looking for.

The thing is that I took a linear algebra course in college, so I got that part covered :)

But I don't know where to start in actually writing a 3d engine. The last link that was given wasn't helpful (I didn't quiet understand what it meant...),

If anyone has a link or some advice for a starting point, that would be great.

btw - I don't know what's a physics engine, so if you could explain that too...

Thanks

Share this post


Link to post
Share on other sites
Quote:

btw - I don't know what's a physics engine, so if you could explain that too...

Hmm, Suppose you could explain it as, a physics engine applies how things would react in the real world to your 3d enviroment.

If your not shure where to start writing, API Abstraction, Math library and a scene graph is a good start.

One thing that helped me alot was actually just diving into a 3d package(eg, blender, lightwave, maya, ...), it's easier to see the concepts in action, leaves you thinking of ways to implement that feature in your engine.

</2 cents>

Share this post


Link to post
Share on other sites
That was actually usefull, but i'm not sure that is the best place to start, plus it's kind of up in the air...

The best thing really, is if someone could point me to a place that explains the first steps of writing your basic graphics egnine.

Share this post


Link to post
Share on other sites
First off, are you familiar with any of the 3d programming apis such as OpenGL or DirectX? If not i'd suggest you learn how to use one of em. I suggest DirectX because of the d3dx library.

Second, how advanced are your programming skills?

Third, after you're able to render and grasp one of the apis being able to manipulate geometry and how the rendering pipelines work. You might want to think about what a 3d engine realy is and what you want yours to do.

A very basic and generalised list of features that you need to program just to get your program up and running is:

Some core code to get your windows app running and using your "Renderer".
Writing and thinking about an "Input" system. (Mouse, Keyboard etc)
A resource manager of sorts. I find it easy to divide em up so that you'll create a "TexturePool" class that handles loading in textures that's requested as well as de-allocating them when requested. Such resource classes should use a programming design called "Singleton". If you don't know what that is i suggest you use google.

Once you've got those basics up and running you're going to have to think about how and what you want to render. Why? Well depending on what you want to render and how, you're going to have to write "SceneGraph"s to handle it. A scenegraph is basically a class that manages geometry and renders it using your "Renderer".

There are alot of ways to manage your basic level geometry such as BSP, Quad-/Octtrees, Tiles etc etc.

What i've covered here is just a rough estimate of what you'll need in your 3d engine, not even considering if you're going to use the fixed function pipeline or write your own shaders.

Understand something, you go under the section of "I want to make a game ^_^ WEE fun!! Where's the button i push to be carmack? :D".

I can't think of any other form of programming that's as complex as writing your own serious 3d engine. And to boot, a 3d engine is just a tool to render geometry. The next step is writing a game engine. And what a game engine contains is pretty much all the logic as to when to load in the data. How the data is handled, what's moved... what's loaded... everything... scripting... you name it :S

Share this post


Link to post
Share on other sites
Well, my programming skills are good enough (I was actually insulted by the whole singleton issue :) )

I also recently wrote a nice little game using managed directx.
I most certainly have the math needed. I believe that It's all a matter of getting to a place where I will be guided. Hanging in this kinda forums getting advices from people such as yourself isn't a bad idea as well...

Share this post


Link to post
Share on other sites
Why not try either getting a book on 3D Game Engine programming or 3D Graphics Engine programming, or take a look at some of the free open source game/graphics engines on the net. There are plenty to choose from.

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
hi:To walk through the basics just visit the folowing link
opengl.org
open the www.google.com then type in the search " ne he openGL " and go to the first link .i think u ll find all the answers u neede for that.
im from pakistan and also working on similar kind of project
regards
nadia


This was probably more helpful than you realised - NeHe is a gamedev hosted OpenGL tutorial website (OpenGL is one of the two main APIs for programming in 3D)

It's at http://nehe.gamedev.net.

It's a pretty good starting point - talks you through bit by bit how to go from rendering a single triangle to a full blown scene, besides lots of other little graphical tips.

Share this post


Link to post
Share on other sites
NeHe and as any other tutorial site never gets to the point in my opinion. Just another sample application completely focused on doing what the tutorial is intended to teach. In the end, sure it was nice to learn how to do that single effect, but being able to design a whole flow chart in order to design and implement a complete engine with a complex scengraph, exporter plugins and how to manage your rendering queue is something that i've never seen anything about.

All those books about writing a 3d engine is a totally waste of money in my experience, the only things those books contains is:
2/5 How you draw your triangle using their screwed up wrapping system
1/5 Some math
1/5 Lighting and texturing that triangle
1/5 Their hardcoded game that's using a crappy heightmap and moves a couple of models around with hardcoded logic as to how things should work and interact with each other.

Where's the tutorials and articles concerning what you realy need to learn?! If i see another triangle or heightmap tutorial i'm going to throw up, seriously...

Write articles on advanced scenegraphs such as the node tree in 3dsmax and how the matrices translation is inherited downwards through the scenegraph or maybe that was just a feature we added, can't remember. Talk about extracting geometry, sorting it, how to optimize texture management over more than one mesh. Let's talk about writing a complex rendering queue pipeline with full shader support, no one uses the fixed function pipeline any more.

How about some advanced tutorials people?! And how about getting to see em with the full picture instead of a god damn sample framework with specialized code just to make it run.

I'm hoping my point is getting through. The problem with programming is never learning syntax or how the code works, that's the easy part. The hard part is knowing what systems you need to design and program in order to fullfill a certain purpose... hell, just finding out about the singleton design is a mayor leap forward for anyone that never even knew it existed.

Resource pools, rendering queues with sorting, different types of scenegraphs, how to integrate a physics engine into a scenegraph, that alone requires a completely new way of thinking, smart and easy texturing techniques like splatting and tons more... Hell they're not hard, but finding out that they even exist is!

Oh and sorry asafpolt, never intended to insult you.

Just found this link
http://developer.nvidia.com/docs/IO/9078/Modern-Graphics-Engine-Design.pdf
don't know how informative that pdf is, i haven't read it but i'm going to check out what it says, can't hurt.

Share this post


Link to post
Share on other sites
Id definatly recomend taking a trig class unless you allready understand the trigometric functions. Besides that, look at any calculus book and you will see most of what you need + alot of extra crap. At the school im in it goes

Algebra
Trig
PreCal -> Im here
Calc1,2,3
Differential equations
Matrix theory

The most useful was definatly trig, althought i consider it pretty simple now, you wont get far without it. Notice im also only at precal so i might not know what im talking about !!

Share this post


Link to post
Share on other sites
As i said earlier, knowing the math is great, but don't overdo it. Knowing how certain trig/algebraic functions work is great when programming how objects interact and move around and such... But in the end it's a small part of the 3d engine considering all that needs to be designed and programmed. (And seriously, if you're going to write "your own math lib" let me know, so i can come over and put you out of your missery. I can't stress how important the statement - don't reinvent the wheel - is in this buisiness.)

Share this post


Link to post
Share on other sites
Quote:
Original post by Cybrosys
Such resource classes should use a programming design called "Singleton".


Could, not should.

There is more than one way to do pretty much everything when it comes to programming. Be wary of anyone touting 'the way to do it' - what they are showing you is a way to do it, and that way will have pros and cons just like everything else. The choices that will suit you depend almost completely on what you want to achieve - I mean, "graphics engine" is a very vague term. 2D or 3D? Indoor or outdoor environments? Software or hardware rendering? Realtime or offline? What kind of rendering capabilities - photorealism, highly stylised, artist-controllable? What hardware do you want to use, what data formats do you want to work with, which techniques do you want to try implementing? I can come up with more questions if you want [smile] The point is that the majority of successful projects start with a specification - a list of things to be achieved. At what point does your code stop being a DX/OGL init/shutdown with some triangles, and start being a graphics engine?

Oh, and on the subject of reinventing the wheel - it's extremely funny that such a comment is made in a thread about creating a 3D engine [grin] If you're looking to do this because you want to use it to create a game, then there are many freeware engines out there already that you can use (not to mention ones like Source, which you could mod). You're not going to be writing your own hardware drivers so you'll be handing off to code that somebody else wrote at some point. The only question is when.

Share this post


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

  • Advertisement