Saturday, August 18, 2012

RenderMan Basics




I recently put my old graduation animation online (which you can watch on youtube: A Plug's Life). It was made back in 2001 and it was my first big project working with Maya and Pixar's RenderMan.

The other day I was asked in the video comments if I could write some tutorials on the use of RenderMan. That sounds like a great idea but before I want to come up with some hands on tutorials it is important to learn something about the RenderMan architecture.

I often hear that RenderMan is not suitable for small studios as it is too complex and is for tech heads and not artists. I beg to differ. RenderMan is a very efficient render engine and small studios which do not have a lot of render capacity can really benefit here by lowering render times. The shading tools are quite extensive and can give superb results without the need of any programming.


What is RenderMan?

First I like to define RenderMan. RenderMan is actually an API (application programming interface) and not a render engine. For a long time Pixar was the only one having RenderMan compliant renderer (as they invented the standard) called Photorealistic RenderMan or in short PRMan. People quickly started to call it RenderMan though and it has stuck ever since. Today there are more commercial render engines available which are RenderMan compliant like 3Delight.

Since Pixar's RenderMan is the industry standard (they say so themselves and honestly it is true), I will use their software to explain my examples.


RIB or RenderMan Interface Bytestream

Since PRMan is a renderer and Maya an animation package, there is need of a common language between the two. The API mentioned before is this language. Have a look at the following schematic.

The scene translator converts Maya data into a RIB file which the render engine understands.

The scene information from Maya is translated into a RIB file. This RIB file contains everything from geometry and information on which shaders are used to render resolution and certain render settings like shading rate. Since a RIB file is written in the common RenderMan language every RenderMan compliant renderer can interpret it and render it.

The RIB file can be displayed as an ASCII file, looks a bit like a programming language and is actually quite readable. We often opened up the RIB file to see where things went wrong when the renderer didn't give us the expected results.

In larger studios this RIB file is usually hacked to add in extra elements before the the final render is made.


RSL or RenderMan Shading Language

Shaders are render engine dependent. This means that when you go from one render engine to another you need to redo the shading. To tackle this problem between RenderMan compliant renderers, the standard provides a common shading language called RenderMan Shading Language. This is a simplified programming language to code shaders. These shaders are then compiled and used by the render engine.

Coding shaders is not what most artists want to do but since RenderMan Studio has a visual tool to create shaders called Slim, artists don't have to feel left behind. Understanding how to code shaders can give you a better insight in how shading works in CGI though.


RenderMan Studio

Pixar's RenderMan is available as a package called RenderMan Studio. It contains:
  • RenderMan for Maya (Pro)
  • Slim
  • it
  • Tractor
RenderMan for Maya is the core plug-in. It deals with the scene settings and takes care of translating the scene information into a RIB file. It comes with its own Maya menu and custom shelf.

Slim is the shading management tool. It is an external running program but can be connected to your Maya scene. Custom shading networks can be generated visually as well as trough coding in RSL.

"It" is the image tool. When rendering out your images you can do so to the Maya renderview but also to "it". "It" is much more flexible and allows even simple compositing trough scripting. It also allows the use of Look Up Tables and displays actual pixel values, something the Maya renderview is lacking.

Tractor is the render farm tool which queues and manages your renders. Not only can you manage your RenderMan renders but also other jobs like Nuke composites which you want to be calculated on the render farm.

RenderMan Studio comes with an embedded render license so even small VFX studios can get started straight away.


Links:

Monday, August 06, 2012

CGI Workstations



Because I am a bit of a techie I often get the question what kind of workstation people should get to do their post production and CGI work on. In this article I look into what is useful and what is merely fluff. Since hardware specifications change regularly I will try to be as general as possible so hopefully this article will still be valid in years to come.

The machine

Any computer can be used to do graphics on but I am sure you will get frustrated quickly when things don't move along smoothly. Let's not kid ourselves though, machines get faster every year but scene complexity goes up as well. In the end you always need a good machine to do CGI.

CPU or processor

Let's start with the heart of the workstation. The CPU will take care of most calculations. A fast processor is great to have but there are some things to consider.
  • MHz vs cores: Multicore processors are quite common the last couple of years. These are great for multitasking but also for programs which are multithreaded. Most CGI software is multithreaded and uses more than one core at the time. Having a fast CPU with several MHz will help you along as well as it will execute a thread faster. To find the balance is a bit tricky but I always check these CPU benchmark reports. They give added performance of all cores in a processor. This way you can see if it is better to go for that high MHz quad core processor or for the lower MHz hexa core processor.
  • Price vs performance: Now that you have an idea how each processor performs you have to balance it with how much it costs. Most processor series have a sweet spot where you get the best performance for its price. It is usually a good idea to pick the one which performs a couple of steps better than the sweet spot one. Yes, it is more expensive but these are a bit more future proof. If you got unlimited funds you can pick the fastest one but keep in mind that these are only 20% to 30% faster but more than triple the price.
I am a fan of lot of cores since my main competence lies in lighting and rendering. It used to be that you had to buy a render license for each core but luckily those days are over. Buying a 12 core machine over a 8 core one could be beneficial if your post production software is really expensive.

I also like to suggest to take server rated processors like the Intel Xeon and the AMD Opteron series. They are a bit more expensive but have no trouble running 24/7.

Memory or RAM

Next up is memory. 3D, compositing and render software use tons of memory. The good part is that in comparison to processors memory is rather cheap. Don't skimp on it! I know it is easy to add in more but getting enough memory will help you a long way. It also allows to have multiple programs open at the same time. I often have Maya and Nuke open while rendering a scene in the background with Mental Ray.

When you run out of memory the workstation will start swapping memory to disk. This really grinds it to a halt as disks are death slow in comparison to RAM. Once it starts swapping you will pull your hair out of frustration and it can take literally minutes before your machine becomes responsive again.

So how much should you get you ask? As a rule of thumb take at least twice as much as the market puts in machines by default. For example most good performing machines have 8 GB of RAM at the time of release of this article. I suggest you put in 16 GB. Each year this number will go up so adjust accordingly.

Make sure to choose the right RAM for your motherboard. Some motherboards need the more expensive ECC memory.

Graphics Cards

Graphics cards are probably the most discussed items in a workstation. They are not only important to show your graphics on the screen but also have some calculation capabilities which gives a boost to the performance of the workstation.

  • Game card vs Professional card: This is one of the big questions. Should you get a cheaper good performing game card or a slower very expensive professional card. The reason there is so much discussion about it is that it is a difficult question to answer. Post production software usually claims they are only certified to work with professional cards. In practice we see that most game cards cope quite well though. If you build a dedicated workstation and are willing to spend the money then it might be worth to get the professional card. If you are on a limited budget and also like to use your machine for games, go for good processors first and get a good performance game card. NVIDIA has a document which promotes the Quadro series over their GeForce series for professional work. Look it up and see what is important to you.
  • NVIDIA or ATI (from AMD): The race to make the fastest graphics card is an ongoing process. NVIDIA has the Quadro series and ATI has the FirePro series for professional graphics. In my opinion NVIDIA is the clear winner here. They have developed the very popular CUDA which allows to run calculations on your graphics card which usually are done by the CPU. A lot of programs are already taking advantage of this. Even the game cards support this technology.
At the time of writing this article there is not much choice when you are using a Mac Pro as your workstation and want an NVIDIA card. Only the expensive Quadro 4000 is currently available. I hope this will change in the near future.

Motherboard

Since processors dictate what kind of technology you use, choosing a motherboard becomes slightly less important. Most of the time the hardware manufacturers won't even give you a real choice. If you go for server rated processors then you usually also get a server rated motherboard which is good enough.

Hard drives

Most computers have only one hard drive. If you work in a facility with a server then this one disk will be enough. It just needs to be big enough to store all your post production software. All created content will be stored on the server so multiple people can have easy access to it.

If you have a standalone workstation then it is a good idea to get two extra disks and put them into a RAID 0. This RAID disk will be used for all your data while your main disk will contain the operating system and the installed software. It will increase reading performance quite a bit. There is a caveat with this kind of setup though. Since data is divided over two disks the chance of a hard disk failure is doubled. Make sure to backup your data regularly, preferably onto an external disk (which can be a SAN).

Take server rated drives which run at 7200 rpm or faster. These are manufactured to run 24/7. Cheap green disks just don't have enough performance for this kind of work.

Sound card

Most motherboards have built in audio and if you are not making any music then this will do.

Mouse and keyboard

Just pick a keyboard you feel comfortable with but do pay some attention to the mouse. Most mice are too light and are not comfortable to work with. Keep in mind that the mouse is used a lot while creating graphics and getting Carpal tunnel syndrome because of a bad mouse will kill your VFX career rather quickly. A heavy mouse works more accurately. I use game mice with a good grip on which I can add little weights. Most post production software make heavily use of the middle mouse button. This is usually a scroll wheel so make sure it feels comfortable enough to be used as a button too.

Tablet and pen

This is a bit of an investment but I have a tablet since 2000 and I really can't mis it anymore. I don't use it for Maya but it is incredibly handy when editing, compositing and, last but actually really important, when doing Photoshop paintwork. It has a complete different feel than a mouse and it just works way faster for certain things.

Monitors

Depending on what you do you can get a cheap one (when modeling or animating) or an expensive one (when doing color critical work like painting or lighting). I suggest not to skimp too much on a good monitor. I only use 1920 by 1200 LCD panels nowadays. They have enough pixels to show all important screen assets and can handle full HD. If you do have color critical work make sure to get a monitor which can be calibrated. It will save you a lot of hassle later on. 

I worked for production companies who didn't bother too much to get good monitors and the result was that everything we produced looked different on each monitor. You can imagine that it can become quite frustrating when a director sees your image on his screen and tells you it is too dark or too red while on your own screen it is too light and too green. If you work together with other people and can't afford multiple good monitors, you need to pick a reference monitor on which everyone will judge the color fidelity of the entire project. This way everyone sees the same image with the same color balance.

Other Peripherals

Feel free to add in other peripherals that may ease up your life like a Blu-ray player or an old school floppy drive. Do check that they do not eat too much resources like CPU power and memory.

Conclusion

You might have noticed that building a dedicated workstation can cost quite a bit of money. Yes, it usually surpasses the price of a very expensive gaming rig. If you are a hobbyist it might be enough to use that gaming rig. If you are a professional trying to make money out of VFX work then you better go for a professional workstation. Having a decent system will accelerate your workflow and since time is money you can make the calculations yourself how much money you can save over time by making the the initial investment.