Designing Computer Animation Software?
"Essentially I want the core of the software to be written in Standard C++, and then be able to tie into the Win32 API, or X, or QuickDraw (etc.) for display and input. The main concepts, such as procedural 2D and 3D geometry, 3D geometric transformation, polygon modeling, NURBS modeling, subdivision modeling, keyframe based animation of parameters, motion capture control of parameters, physics-based animation, sound synthesis, texture-mapping, lighthing, rendering, and so on are generally abstract ideas that do not need to depend on (but can certainly take advantage of) any particular API or environment. Of course, the idea is to eventually visualize the abstraction onto the screen, allowing the user to interact via the 2D pointer and keyboard input, and ultimately rasterize it, which will mean turning to various operating system standards. It will also be open as a plugin host and have a built in scripting language. Any design suggestions? I know that this is probably the most intelligent audience to communicate with, and any feedback would certainly be appreciated"
Of course, I'm giving you advice on Slashdot, so what do I know? :-P
Wait 3 months [and] Purchase 3D Studio Max
If you can't get your software from 0 to at least barely usable in nine days, then wait for blender.org to go live on October 13. My $10 helped; did yours?
Will I retire or break 10K?
I know that this is probably the most intelligent audience to communicate with, and any feedback would certainly be appreciated.
You're new around here, aren't you?
Now that the Blender Foundation have collected all the money (100k.. wow) to buy the blender source from NaN, they will be releasing the source under the GPL very soon (paid members pre-release due tomorrow).
Blender is a full fledged 3d program with some animation capabilities. Maybe looking at their design will give you some good ideas.
My intuition says that there is years of work in this project. And, you ask, how does a professional programmer approach such a task? This kind of project is difficult and expensive even for teams of professionals with a lot of money behind them. They start with whiteboards, and use cases, and specs, etc.
.mdl file - and try that first. Perhaps there's a need out there for a model viewer. A project of the scope has a chance of completion, and if you're still enthusiastic at that point you can expand the scope of your app, building on the code you already have.
If I were you, the first thing I would do is identify a very small subset of the functionality - say, the ability to parse and view a
Again, I'm sure you're smart and understand coding and the right physics, but the one thing the experience of a professional programmer would give you is a sense of the scope of this task.
Everyone knows that damage is done to the soul by bad motion pictures. -Pope Pius XI
- Is your intent commercial software, free software or other?
- If your intent is free software then are you thinking Open Source?
- If your intent is commercial software, then why do you think this product would be any better than the other commercial packages out there?
- What is the overall goal for this - professional quality animation? Movie or TV quality work? Video Game design?
- Are you working alone?
- How is it that you will have the time to devote to this? What makes you think you will finish?
- And finally, if it turns out that you are an individual from a commercial organization willing to undertake such a tremendous task in a crowded field with such strong players, why do you think Slashdot will be a good place to get meaningful advice?
Don;t get me wrong - I'm not trying to slam you or your idea or anything but these are the questions that popped into my head when I read this. I know history is filled with projects like this but for every Linus Torvalds who sits down and makes his own OS (and yes I have read the GNU/Linux FAQ) there are thousands that get 10% in and say screw it.Schnapple
Steve Streeting had a similar concept in mind when he implemented his OGRE 3D Engine. He also has designed his engine so that it is written in C++, has a modular plug-in architecture that enables extensibility without recompilation (for certain portions of it, obviously), offers multiple 3D API support and builds both with MSVC++ 6 & 7 and also gcc 3+. The MS builds require STLport, an open-source replacement STL that's more compliant than Microsoft's -- ha, imagine that ... -- but that's along the lines of what you're talking about.
He's got a number of interesting design ideas and, from what I understand, is fairly accessible.
Also, and let me offer this, I have no idea about your programming skill and knowledge other than what you've claimed, but please ignore whatever posts come up that try to tell you how incredibly difficult this all is and how you're just better off joining an open source project or buying a package and saving yourself the hassle. If you want to do it, can really do it, and enjoy doing it then, not meaning to quote Nike's marketing department or anything, but: Just do it.
I think this is one of those situations where if you have to ask slashdot, you're not up to the challenge ;)
Looking for a computer support specialist for your small business? Check out
If you are intending a serious replacement for professional packages, perhaps you need to talk to some of the users of those packages. I'm sure some game developers (just as myself) and animation folks lurk on Slashdot, but to get really great feedback you really ought to go to a more special purpose forum.
That said, some things I'd consider if you're planning a truly professional quality package are:
- Support and documentation. Especially really great documentation and samples. Plan a lot of time on this. Getting this piece right will pay for a lot of fuckups on the rest of the design.
- Extensibility. Every pro user I know uses an array of in-house extensions, for everything from custom data format importers and exporters to plugins for procedural geometry, custom shaders, special lighting models, and a whole slew of other things. Make everything scriptable, overrideable, and customisable. Consider writing the bulk of your standard features using the same toolkit people will use to write plugins, because then they serve as sample apps.
- Consider providing compatibility modes for people migrating from other pro packages. Artists get very set in their ways. Unless you have a truly revolutionary and more productive UI, follow some of the existing conventions, or at least make it an option.
- Provide a batch processing mode, so that offline tools can invoke the power of your package without firing up the whole damn UI. In the games business, we have a lot of build process running on our artwork from assorted batch files, Perl scripts, and whathaveyou. I'm sure the same is true in other pro environments too.
An important thing to remmember, especially for motivational projects (projects that require a lot of motivation to keep going), is to write code incrementally.
One of the best methods I know to write code incrementally is to rapidly model it in a Rapid Development language such as Python.
Since I get excited by seeing results quickly, I'd probably start by deciding on a GUI toolkit, and find some Python bindings for it. Perhaps an OpenGL GUI of my own, in any case, that's where I'd start. Whatever excites you the most (Perhaps rendering ray-traced images of simple objects excites you, and you can start there), is where you should start. As long as you're excited about what you're doing, you can easily keep on going.
Then, when you have a GUI (Or a simple renderer for that matter), you need to generate "stubs" for other components. There are various meanings of the word "stub" flying around, so I'll explain mine: A simple replacement of the interface a software component, that is trivial to implement, lacks any of the functionality, and is intended to later be re-written.
This enables you to work on an exciting Skeleton of your program, that lacks almost all of the functionality, but there is already a bit of something very exciting to you, and perhaps to others who share your interests, to work with.
Notice this is the same method used in the early development of Linux.
Linus provided a very simple Skeleton of a Kernel, with either stubs or extremely naive implementations of almost all kernel subsystems. This is much better than the alternative, of trying to create the 2.4.19 kernel, component by component, from scratch.
Linux 2.4.19 shares very little in design and in code with Linux 0.1, and the actual implementation decisions of Linux 0.1 don't really matter at all now.
This is why I emphasize that you should start before you know exactly where its going, because there's a good chance you'll be stuck planning it forever, if you try to get it all right in the first time. If you don't bind yourself to backwards compatability, it doesn't really make a difference what kind of design error you make now, it can be corrected with time and with rewrites. Don't worry - rewrites are much shorter than the original designs and writes, as they come after a lot of experience, and can often reuse most of the code.
Keep excited, start coding. Whenever there are tidbits of work you don't like doing, but must, keep in mind how the great cool exciting things that depend on it will look like.
Don't code without design, but do code what little parts you know the design of already.
The posts here remind me of a story I once heard. There was a bucket full of lobsters. The lobsters hated being in the bucket, and were all trying to get out. Every time it looked like one lobster was about to pull itself over the edge, the others would grab ahold of it in the hopes of being dragged out too. Instead of being finding their freedom, they would pull the lobster back down and they would all be back where they started.
Why are you being a bunch of lobsters, Slashdotters? Why can't you support this guy and move him along towards his dream? Trolling and cynicism: is that what we have all come to?
On the other hand, the guy does sound like a fucking idiot.
The middle mind speaks!
Ok, I thought I would try to make this stand out a bit, since I specialize in 3D graphics for a living. I am by no means the top guy at my company, but do have experience in design implementation, as well as reading the Open GL reference guide several times. Let's start with general advice:
1. Keep all your rendering loops tight. Avoid doing any extraneous operations such as caching. Use arrays instead of linked lists(this keeps the data inside your cache). Avoid recursion unless you can be sure that your complier is not pushing and popping the function stack(some compilers are smart and will not create a stack unless you pass data as a parameter).
2. Try to perform as much work as possible at startup or while the user is editing. Remember you want to make as many operations as possible a once only thing. The last thing you want to do is put a bunch of crap in your rendering loop.
3. Take advantage of caching on your graphics card by using display lists and vertex buffers. On nvidia cards this alone can speed up your application by 3x. Only use immediate mode rendering when necessary. Keep in mind that most graphics cards use extra memory when you put the data inside a display list, so there are times when display lists can be slower.
4. Perform depth sorting for proper rendering of alpha blended objects. (this is something we failed to do in the initial design of our application, which was written in 1992 before alpha blending was a widely used feature).
5. Try to keep interface code generic, and try to make rendering code specific. It's always a tradeoff between readability and performance.
6. Learn assembly, not because you're going to use it that much, but so that you can spot areas of slowdown. Learning which operations are expensive is crucial. Function calls, random memory access, pointer deferences can all slow your program down.
7. As mentioned in six, optimize your access to memory, pay attention to byte alignment, which will allow you to pack more data into the cache. Also look into AMD and Intel's articles on optimizing for performance. The most crucial aspect is how you access memory. There are new instructions which allow you to load data from memory into cache before it's used. This can often speed computations up significantly in real-time applications. There are also many other tips, but I'll leave up to you to go to AMD and Intel's websites and download the white papers.
You mention animation, the project that I worked on for the last year tackled this problem:
The project was to integrate animation into an application that was not designed to do this, and to make it generic enough so that the user could animate anything. Here are some simple concepts to get you started in designing an app that allows users to animate in an intuitive manner:
1. Timelines - A timeline is a graphical way of representing time. You can use something that looks similar to a ruler, with time marked in units of usually every second.
2. Keyframes - These are points on this timeline that are specificed by the user. Keyframes always have a time associated with them. If I want to animate positional data, then that keyframe will have a time as well as data about the X,Y,Z position of that object. When the user hits play, the application will interpolate between points on the timeline.
Here's where C++ comes in handy. You can make both timelines and keyframes a class. Then, let's say I want to animate clouds, I can simply create a class called cloud timeline that contains cloudkeyframes. When the user clicks a keyframe, an interface opens up that allows him to edit that data, which in the case of a cloud might be both transparency and position. Then when the user hits play both position and transparency are animated according to the values of the keyframes given. The neat thing is, that a cloud timeline can be derived from positiontimeline, which means that you only have to do the work of creating an interface for animating position and orientation once.
Next, it is important to remember that timelines are a property of some object within the scene. I would say that it you can also keep object data organized in a generic manner. I would recommend using a scene graph. So, what the user would see is a scene represented by a tree, with the root node being the terrain and child nodes being objects on that terrain. You can also pull some neat tricks with scene graphs, such as nested transforms. This would allow you to have an object such as a car, with four wheels, to have wheels that are child nodes of that car. In this way, you could create a timeline for the entire car, and then the wheels could have their own timelines which would animate their rotation. The wheels would not know anything about the fact that they are moving along with the car. There are of course other ways of animation, such as writing your own scripting language, which I have never done. I have written a VRML parser, however, and I can tell you that learning both Bison and Lexx is important if you want to implement a language. There are other types of parsers, but using these compiler tools tends to be more straightforward. In the least it would be good to pick up a book on language designed and construction. The book I studied in College was "Compiler Construction: Principles and Practice" by Kenneth C Louden, but there are others that may be better. Anyway, that's enough rambling, and since most on slashdot are pedantic, please forgive any technical erros, it's Friday night and I wrote this in about 20 minutes.
Mr. Linus, it is my understanding that you intend to write your own operating system from scratch. I just want you to know your "Linux" kernel is a stupid idea. Why don't you just buy Unix from one of the many vendors out there? It is a waste of your time and resources to try and reinvent the wheel.
There are many things I have written that have been "reinventing the wheel", from a merge sort to converting a Windows BMP to JPEG. But I learned a ton from doing it. Heck if he just wants to write something just to learn more about 3D modeling, more power to him. And you never know if in 5 years we will be raving about a new open source 3D modeler giving 3DSMax a run for its money...
Brian Ellenberger