• Create Account

# Time to write rendering engine from scratch

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

25 replies to this topic

### #1bigneil  Members   -  Reputation: -49

Like
-2Likes
Like

Posted 01 November 2012 - 01:24 PM

I have a new assignment where my boss wants me to write the complete source code for a simple rendering engine that can load and render standard file formats like OBJ (at least one format) but it needs to be written from scratch.

It's been a while since I wrote one from the ground up (15 years or so), in fact it seems hardly anything in graphics is written from scratch these days. The pay is great so I don't have a problem doing it, but am at a loss for an estimate and wanted to get a consensus from those with experience.

How long would you estimate it would take to write an OpenGL program that can load say OBJ files and render models without fancy shaders?

Also, what file format is most straightforward to load and render?

Edited by bigneil, 01 November 2012 - 01:27 PM.

### #2L. Spiro  Crossbones+   -  Reputation: 21826

Like
13Likes
Like

Posted 01 November 2012 - 05:44 PM

That depends on the person. If I were tasked with just loading an OBJ file and rendering a static mesh, I would say 1 day to get it loaded and stored in a VBO and have most of the rest of the OpenGL foundation laid down (setting up a basic window, etc.), and 1 more day to make it interactive, handling input, moving the camera around, etc., and to debug it.
Whistles and bells such as generating index buffers, full-screen mode switching, etc., could add up to 1 more day.

If you are 15 years rusty, it is hard to say.
If you don’t know anything about the OBJ format, I would say 3 days to load it would be safe.
If you don’t know anything about OpenGL I would say 2 weeks would be safe.
If you are generally unsure of yourself (and it sounds as though you are), I would say you should give yourself no less than a month, maybe up to 2.

Because of the wide range of skills and experiences, I am not sure how helpful any of our answers would be.

L. Spiro

### #3Kaptein  Prime Members   -  Reputation: 2208

Like
1Likes
Like

Posted 01 November 2012 - 09:13 PM

I agree, it will take time to learn all the stuff necessary to write a serious and correct viewer that works according to the endless amount of specifications you'll need to know.
But, feel free to ask anything in here if you run into any problems..
I would start with GLFW for the openGL window, and go from there, as it is multiplatform (win, linux, mac), and handles the window, inputs and swapping (including vsync) for you.
Unless you also have to do that by hand

### #4Krohm  Crossbones+   -  Reputation: 4216

Like
1Likes
Like

Posted 02 November 2012 - 01:18 AM

I'd be extremely careful as the goal is not clearly defined. I use AssImp for the loading yet I'd find hard to take less than 5 working days. But perhaps my definition of "without fancy shaders" is different from yours.

Edited by Krohm, 02 November 2012 - 01:18 AM.

### #5Tordin  Members   -  Reputation: 604

Like
1Likes
Like

Posted 02 November 2012 - 05:09 AM

As L. Spiro say, it´s personal. And if you dont have any experiance in coding with either Dx or GL it will probably take a while to figure out how things work.

Use Assimp, it´s easy, it´s good, it´s fast and honestly saved me alot of work and time. it allso supports a ton of formats.
estimate to one month. thats a good start amount, you have room to develop, and to fix bugs, and to correct or rewrite stuff if you are forced to.
"There will be major features. none to be thought of yet"

### #6bigneil  Members   -  Reputation: -49

Like
-24Likes
Like

Posted 02 November 2012 - 08:35 AM

Generally unsure of myself? 15 years rusty?

And it would take Spiro 2 days and it would take me 2 months?

Who is Spiro trying to impress? A group of anonymous computer nerds?

FYI I've programmed OpenGL every day for the past 15 years, and patented my own rendering system in the process. My own product already served as a rapid prototyping tool and I solved their actual problem in my first few hours.

It just happens they want the source code (a license of which I sell for $250K). I'm just pointing out that people don't usually write rendering engines from scratch anymore (the one I wrote in 1997 is still working fine thank you), and if someone tells you they can write a rendering engine from scratch in 2 days they are lying. ### #7Bacterius Crossbones+ - Reputation: 11926 Like 3Likes Like Posted 02 November 2012 - 09:08 AM I'm just pointing out that people don't usually write rendering engines from scratch anymore (the one I wrote in 1997 is still working fine thank you), and if someone tells you they can write a rendering engine from scratch in 2 days they are lying. Your stated requirements were vague, basically "parse an OBJ model and display it to the screen with a basic shader". This as stated can be done very quickly, in a matter of days if you work hard at it. Of course, adding requirements and features will increase the time accordingly, but you did not mention these in your question, they were therefore not mentioned in the answer. Your two posts are somewhat inconsistent with each other, is there something you're not telling us? Edited by Bacterius, 02 November 2012 - 09:08 AM. “If I understand the standard right it is legal and safe to do this but the resulting value could be anything.” ### #8Tordin Members - Reputation: 604 Like 4Likes Like Posted 02 November 2012 - 09:36 AM Generally unsure of myself? 15 years rusty? And it would take Spiro 2 days and it would take me 2 months? Who is Spiro trying to impress? A group of anonymous computer nerds? FYI I've programmed OpenGL every day for the past 15 years, and patented my own rendering system in the process. My own product already served as a rapid prototyping tool and I solved their actual problem in my first few hours. It just happens they want the source code (a license of which I sell for$250K).

I'm just pointing out that people don't usually write rendering engines from scratch anymore (the one I wrote in 1997 is still working fine thank you), and if someone tells you they can write a rendering engine from scratch in 2 days they are lying.

- "It's been a while since I wrote one from the ground up (15 years or so), in fact it seems hardly anything in graphics is written from scratch these days. The pay is great so I don't have a problem doing it, but am at a loss for an estimate and wanted to get a consensus from those with experience."

Here you state it was a long time you wrote it from the ground and up. (by just sligtly reading, this is easy read as "i havent done it in 15 years" )
And to add the title states, "Time to write rendering engine from the scratch", this adds more to the idea that you havent done it in a while.

- "How long would you estimate it would take to write an OpenGL program that can load say OBJ files and render models without fancy shaders?"
This gets me to think, you are asking for advice out from experienced developers to get some estimate on how long this task would take, because you sound like a rookie on the sentence befor. ( you might not be a rookie )

- "Who is Spiro trying to impress? A group of anonymous computer nerds?"
I belive none, in fact, i think you got this on the wrong hand. as we got your "Question" on the wrong hand aswell.
If you have been writing OpenGL for 15 years, the you would be pretty sure of how long it would take you to develop that stuff, due to the fact that you know the problems, the issues, and the solutions for it. and you would allso give an planned approach and estimate upon that.

Edited by Tordin, 02 November 2012 - 09:37 AM.

"There will be major features. none to be thought of yet"

### #9L. Spiro  Crossbones+   -  Reputation: 21826

Like
2Likes
Like

Posted 02 November 2012 - 08:09 PM

it would take Spiro 2 days and it would take me 2 months?

I don’t know. How long would it take you?
That is what we are trying to determine.

I wwebsite as on the internet

You obviously know more about yourself than any of us, but put that aside for a moment and read your post and then my reply.

If you can’t handle the answer, don’t ask the question. If you do ask the question, you should provide all of the necessary information. When estimating how long it would take you to complete a task in OpenGL, it would be a good idea to mention any experience you have in OpenGL up-front.

It’s generally assumed that if you come here to ask a question, you want to find people who are more experienced than yourself so you can get help from them.
If this wasn’t your thinking, then what was? Did you hope to find a bunch of people saying, “It would take me 3 weeks,” so that you could say to yourself, “What a loser, I am so much better than him or her”?

L. Spiro

Edited by L. Spiro, 05 November 2012 - 05:37 PM.

### #10mhagain  Crossbones+   -  Reputation: 10076

Like
4Likes
Like

Posted 02 November 2012 - 08:57 PM

Just to elaborate on L Spiro's first answer (which is quite correct, by the way), your first task is to create a window, get a basic message loop running, and write a basic render function that just clears the screen and does a swap buffers.

Depending on how familiar you are with that process, depending on how many platforms you want to support, depending on whether you need to write platform-native code or are allowed to (or are allowing yourself to) use any helper frameworks, depending on whether you need to learn a new platform from scratch, this could take anything from minutes to weeks or even longer.

It really is that open-ended and you've supplied insufficient info in your original question to allow anyone to correctly gauge your level of knowledge or ability here. 15 years experience in OpenGL means squat when it comes to having to learn the intricacies and pitfalls of a new platform from scratch - even someone like John Carmack still makes basic mistakes on the platform he's most familiar with, so please don't try to imagine that you won't.

From there you need to load and parse a model format. Go back and re-read your opening question again; does it read like the kind of question asked by someone who is familiar with a good variety model formats? Now, .obj is a plain text format so you've got some nasty parsing and conversion ahead of you; have you given any indication that you're aware of this? Do you see now why your open-ended question could elicit an open-ended response?

Back to .obj; like I said, there is some nasty parsing and conversion to be done, but for the most part this is already a solved problem. But you say "from scratch", so for you you may first need to learn the format, then write a loader, then decide how you're going to draw it (as this will greatly influence your loader). Are you going to use immediate mode? Vertex arrays? VBOs? How much experience do you have in these? It's possible to spend 15 years doing OpenGL without ever having gotten within spitting distance of a VBO (especially if the codebase you're most familiar with dates back to 1997) so do you need to learn VBOs from scratch too? You may need to if "it must run fast" is part of your specification (which you haven't clarified).

Again, do you see how open-ended this is?

From there, and since you mention that you're not using shaders (or are you just not using fancy shaders?) I'm going to assume that you're back in familiar territory and can form your own estimate - you're the person in the best position to do that. But do note that I said "assume" here. And also note that I left out anything relating to whether or not the model needs to animate.

As for the simplest model format to load, that would be a proprietary format that you design yourself and that is set up so that you can just read the data directly into the most appropriate in-memory format for rendering from. It could be as basic as a single fread followed by a single glBufferData call - can't get much simpler than that. As a general rule, the more open a model format is the more complex it is as it needs to be able to support the needs of multiple programs doing different types of rendering, but it can virtually always be guaranteed to take the flexibility side of the tradeoff.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.

### #11bigneil  Members   -  Reputation: -49

Like
-6Likes
Like

Posted 05 November 2012 - 01:30 PM

I'm not sure how "It's been a while since I wrote (a rendering engine) from the ground up" was interpreted as "it's been a while since I programmed graphics (in any capacity)", or who wouldn't take "you sound rusty and unsure of yourself" as less than insulting, but I appreciate the advice. Thanks everyone.

### #12phil_t  Crossbones+   -  Reputation: 5935

Like
5Likes
Like

Posted 05 November 2012 - 08:21 PM

If you have coded in OpenGL every day for the past 15 years, why are you coming to an internet forum to ask strangers how long it would it would take you to complete a task involving OpenGL? That doesn't make any sense.

Edited by phil_t, 05 November 2012 - 08:24 PM.

### #13bigneil  Members   -  Reputation: -49

Like
-11Likes
Like

Posted 06 November 2012 - 03:11 PM

Because I was just tasked with writing a rendering engine from scratch I wanted to get a consensus on what people who have written rendering engines more recently thought.

In the end I decided to whittle down my own code since it works perfectly (and recompiles in 6 seconds to all you A-holes who write programs that take 2 hours to compile (see Electronic Arts).

But man, I forgot what a bunch of d*uche b*gs are on this site. Members here (what an appropriate term) pride themselves on their blog rating here and you'll never find a site more likely to neg you for one post that doesn't stroke their ego. Try saying you don't like Goto for example - they'll neg you all the way to negative 1000.

Most of the people here with high ratings don't actually have computer science jobs (or formal experience) which is why they have so much time (and why they are so bitter).

Worse, they provide best-case scenario estimates - an enormous disservice to themselves, coworkers and the industry. A wise man once said "The more I know the less I understand" - and members here understand everything.

If you've worked in the industry you know you'll never find smarter people who are willing to do exactly what they are told (by their boss, the FDA and the TSA) - Developers in a crisis will (according to Meyer Briggs) "go with what the group does".

Oh well, I'd rather be making $90 an hour programming OpenGL for my own business than to have a high db rating, but if you make less be sure to neg me. Anytime you do something worthwhile you're going to offend someone. ### #14achild Crossbones+ - Reputation: 2108 Like 1Likes Like Posted 06 November 2012 - 03:51 PM Whoa whoa whoa If... If... If... If you are generally unsure of yourself (and it sounds as though you are), I would say you should give yourself no less than a month, maybe up to 2. Because of the wide range of skills and experiences, I am not sure how helpful any of our answers would be. 1) I don't believe LS was tearing you down or diminishing your character. And I'm pretty sure the way you reacted to LS and similar answers set this thread downhill. Clarification on your part probably would have went a long way. 2) Plenty of people here don't like goto (unless absolutely positively necessary, which it usually isn't). 3) I don't believe you can get a negative rating - perhaps I am wrong about that one though. Please try to reconsider your perspective on all this - it's not what you think it is. ### #15Bacterius Crossbones+ - Reputation: 11926 Like 1Likes Like Posted 06 November 2012 - 04:02 PM 3) I don't believe you can get a negative rating - perhaps I am wrong about that one though. No you actually can. Lowest I've seen so far is -350 or so. Not that ratings matter that much anyway. I've come to the conclusion that the thread creator is a troll, and you know what they say about trolls. Edited by Bacterius, 06 November 2012 - 04:05 PM. “If I understand the standard right it is legal and safe to do this but the resulting value could be anything.” ### #16L. Spiro Crossbones+ - Reputation: 21826 Like 12Likes Like Posted 06 November 2012 - 05:17 PM Members here (what an appropriate term) pride themselves on their blog rating here and you'll never find a site more likely to neg you for one post that doesn't stroke their ego. Try saying you don't like Goto for example - they'll neg you all the way to negative 1000. That’s funny, because among all of your down-votes, none of them came from me. You probably down-voted me twice, but I haven’t touched your rating at all, despite being the main target of all of your attacks. But man, I forgot what a bunch of d*uche b*gs are on this site. No Dutch bugs here. I think. My perfectly working code compiles in 6 seconds; anyone’s whose doesn’t is an asshole. I make money bags and have my own business; anyone who makes less is an angry negger. My work is worthwhile. I wwebsite as on the internet. You are obviously trying to attack back, but back from what? My answer was intended to be as helpful as possible with what little information you gave. Why are you the only one who can’t see this? My guess is every time you read your first post you subconsciously add bits of information. “It’s been a while since I wrote one from the ground up (but I have programmed with OpenGL for 15 years).” We don’t have all that extra information; we have only what is in the post. Based on what you posted, it could literally be a few days’ worth of work, as others have agreed. That doesn’t mean anyone is stroking any ego. If you think it should take longer, why don’t you post any extra requirements you may have left out of your previous posts? If animation is necessary, that will definitely take more than a few days. Most of the people here with high ratings don't actually have computer science jobs (or formal experience) which is why they have so much time (and why they are so bitter). Worse, they provide best-case scenario estimates - an enormous disservice to themselves, coworkers and the industry. A wise man once said "The more I know the less I understand" - and members here understand everything. If you've worked in the industry you know you'll never find smarter people who are willing to do exactly what they are told (by their boss, the FDA and the TSA) - Developers in a crisis will (according to Meyer Briggs) "go with what the group does". Oh well, I'd rather be making$90 an hour programming OpenGL for my own business than to have a high db rating, but if you make less be sure to neg me.

By this point I have every right to put you in your place, but out of respect for this site and in an attempt to keep as many posts on this site as professional as possible I will just very politely explain this.
Looking at the top-members list I can confirm a lot of us do have industry jobs, and almost all of the rest I believe (but can’t confirm) do. Only a few (maybe 3?) I know to be hobbyists.
I myself actually have 2 jobs: I act on Japanese TV and in Japanese movies regularly and the rest of the time I make video games for a major studio in Japan.

As I said in my first post, there is a vast range of skills and experiences on this site, so it is an extremely bad idea to bring an inferiority complex here if you are asking for help. Inferiority complexes make you see legitimate answers as personal attacks.

We don’t care what your salary is nor how fast your code compiles.
We care about attitude. Fix yours or leave.

L. Spiro

### #17mhagain  Crossbones+   -  Reputation: 10076

Like
2Likes
Like

Posted 07 November 2012 - 07:49 AM

I can only second L Spiro here.

You ask a question, which it must be assumed was well-intentioned and in good faith.
You get some answers that also read as well-intentioned and in good faith.

From there it seems that you didn't like the answers you got and the resulting conflagration borders on thermonuclear war. Not good.

I'm not saying that you're obliged to like the answers, but there is such a thing as basic manners - people have freely and willingly given of their own time here.

One can only answer a question based on the information contained in that question; if the answers recieved are believed to be inadequate or otherwise lacking then there is obviously a communication deficit of some kind to be addressed. Strikes me that it would have been far more productive to address that deficit than to engage in flaming out.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.

### #18Caffeware  Members   -  Reputation: 151

Like
1Likes
Like

Posted 07 November 2012 - 02:36 PM

### #19bigneil  Members   -  Reputation: -49

Like
0Likes
Like

Posted 08 November 2012 - 03:35 PM

Excellent Caffeware - I downloaded it and it ran instantly - this is how all software should be written!

### #20bigneil  Members   -  Reputation: -49

Like
-3Likes
Like

Posted 08 November 2012 - 03:36 PM

Yes! I almost achieved my negative rating!

This shows what a farce it is.

When you're a 20 year veteran of the 3D graphics industry and already worked on Madden Football, Far Cry, Doom, Descent and other games, the rating system doesn't disprove you, you disprove the rating system.

Edited by bigneil, 08 November 2012 - 03:39 PM.

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

PARTNERS