Time to write rendering engine from scratch

Started by
24 comments, last by L. Spiro 11 years, 5 months ago
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?

Thanks in advance.
Advertisement
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

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

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 :)
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.

Previously "Krohm"

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"
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.

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. mellow.png

Your two posts are somewhat inconsistent with each other, is there something you're not telling us?

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”


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.


So by reading your first post, this is my toutghs :
- "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.
"There will be major features. none to be thought of yet"

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”?


It sounds as though you already know the answer, so good luck with your project.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

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.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

This topic is closed to new replies.

Advertisement