Showing posts with label scanline. Show all posts
Showing posts with label scanline. Show all posts

Friday, September 19, 2014

PRMan RMS 18: Some tips on Rendering in Maya



RMS 19 is around the corner and will be released this fall. The new RIS engine works different than the RMS 18 reyes and ray tracer hiders but these old hiders will still be available. So why not write an article on how to get decent quality images out and how to streamline your workflow. Some of the workflow tips will still be useful in RMS 19.


What are my render options while working on a scene?


There are three ways to get your previews rendered. You can use the internal renderer. The interactive re-render option or the PRMan external renderer.
  • The internal renderer: Works just like the Maya renderer or Mental Ray. My biggest problem with this method is that Maya becomes unresponsive while rendering. You can stop the render process by pressing Esc but you can't modify any parameters in Maya. You can only twiddle your thumbs while waiting.
  • The re-render option: In this mode the renderer will constantly update the image while Maya stays responsive. You can change settings on the fly and see them change in de Render View. I have seen people using it successfully. Personally speaking I do not have a great experience with it. It does sometimes freeze Maya as it is still a process within Maya. This can really disrupt the workflow. It works best when you output your image to "it" and not to the render view in Maya.
  • The PRMan external renderer: In this mode the scene gets exported en queued up in the Local Queue manager (or the farm if you have one) and then rendered by RenderMan Pro Server. The big benefit is that it is an external process which won't block Maya from being used once the scene is launched. It is slightly less interactive than the re-render mode but is very stable. Since it uses the Local Queue it is possible to queue up multiple renders. It also uses "it" which is superior image viewer compared to the Render View.



How to speed up your workflow by using the external renderer


RMS 18 has two modes of rendering: reyes or ray trace. Reyes is a hybrid renderer (used to be scan line only) and the other mode is of course a full ray tracer. They both produce excellent results but they respond slightly different to the quality settings. I have made a test scene with a pencil and three black spheres lit with an HDR map.

Let's have a look at those settings (click on the images to see a full res version):


Image1: RenderMan Globals: Quality tab and advanced tab. (click image to see full res).

Under the advanced tab you can choose your render mode (or also called hider) (right window on image 1). When choosing reyes there is not much else to set in the hider tab. When choosing ray trace it is possible to tweak some settings. I prefer the adaptive path tracer. When you check incremental the image will start rendering noisy but will improve over time. I really like this as you get immediate results but you can also wait for more details to show up while it continues calculating the image. It allows you to judge the image quickly so you can start making tweaks. The image keeps rendering while you make those shading tweaks in Maya or when updating texture maps. (but does not incorporate them until the next render). For me it means I can do two things at once.

Image 2: RenderMan Render Options

To set up you external renderer you need to adjust some setting in the RenderMan Render Options.

  • Check the external renderer and choose "it" as your image display or your image viewer.
  • Choose local queue and local render (unless you have a complete render farm at your finger tips).
  • Set the environment key to "rms-18.0-maya-2015 prman-18.0". Important: You do need to have the RenderMan Pro server installed for this to work.


How to simply adjust quality.


The next section shows some differences in quality. Make sure to click the images to see the actual differences between them. The blurred reflection on the spheres and the text on the pencil are good places to look.

Reyes is easily controllable with the shading rate setting (left window on the image 1). Large values will produce course quality but will render very fast. A shading rate of 5 will give very quick renders but your texture maps will look blurred. This can be enough to see if everything renders but isn't very great to check the detail in your maps while you are painting them. The letters on the pencil are unreadable. Check out the test image below (Image 3):


Image 3: Reyes: shading rate 5, pixel samples 3x3

When you lower the shading rate, the quality will improve. Production renders are always on a shading rate of 1 or lower (like 0.5). This will increase rendering time. On the next image (Image 4) I lowered the shading rate to 0.1 which makes the small letters on the pencil very readable but the render time was 7 times as high as shading rate 5.

Image 4: Reyes: shading rate 0.1, pixel samples 3x3

The quality controls work a bit different when you are using the ray tracer. In general you can leave the shading rate on 1. It is in fact the pixel samples which control the quality of the image (check right window on Image 1). You can see on the next image (Image 5) that the ray tracer shows the texture maps more clearly but has more problems with noise and anti-aliassing. It is very noticeable in the blurred reflections.

Image 5: Ray trace: shading rate 1, pixel samples 2x2

Increasing the pixel samples will render better quality but will increase render times exponentially. On the next image (Image 6) we can see that 4x4 pixel samples is enough for a still image without depth of field. It is very comparable to the high quality reyes image.Once you start adding movement or shallow depth of field it needs much more samples to get rid of the noisiness.

Image 6: Ray trace: shading rate 1: pixel samples 4x4



Conclusion


As you can see, both the good old reyes and the newer ray tracer produce excellent results. I tend to lean to the ray tracer as I like the incremental path tracer. It is just great so your image improve over time. It is a bit slower than reyes though but delivers very sharp images  when the pixel samples are set correctly.

Wednesday, July 18, 2012

Render Farms



Projects range from small one person achievements to huge VFX productions where hundreds of artists contribute to the result. The thing they have in common is that they need computational power to finish certain steps in the process. Rendering is the first one that comes to mind but simulations and compositing take up their own share of CPU cycles.

It is possible to let your workstation chug away on those calculations and eventually it will get done but more often than not a tight deadline does nog give you this luxury.

The speed increase with a Render Farm

Render farms are all about speeding things up. Let's say you have only one workstation and you work 8 hours a day (Ok, you have to be lucky to work only 8 hour days in VFX, usually you need to do more to reach the deadline). That means that you have 16 hours left for rendering your sequence. Even with 10 minutes a frame, which is quite acceptable, it will give you 96 frames which is only 4 seconds of animation (at 24 fps that is) a day. You could try to simplify the scene to speed things up but that is not always possible.

The simplest form of a farm is to have second machine next to your workstation which can do calculations while you continue working. This will more than double your capacity and will get you 10 seconds of animation done per day for the same scene. When you have only one machine it is easy enough to manage the rendering of different scene files manually. No extra management software is needed at this point.

Let's move to a bigger setup where there are 5 artists in the shop and let's say they have a workstation each. With the same 10 minute a frame setup it means that they can render 20 seconds of animation each day when working 8 hour days. You can see that the math behind it is simple enough to make predictions once you got an idea how long a frame will take. I must agree that it can be tricky to predict render times when the contents of the scene and hence the render times per frame change a lot. But of course, an indication is better than nothing.

It becomes obvious: the more machines you get, the more complicated the managing of the jobs will become. In these circumstances it is wise to introduce a render manager into the pipeline.

The render manager

The render manager is a piece of software which automates the distribution of jobs to your render farm. It consists out of two parts. The server side program which is the actual manager and the client side program which activates the right renderer for the job. The server side program usually runs on a dedicated machine, very often the same machine as the license server for your software. The client program is installed on each machine which can handle a render job.

Instead of launching the job manually on the client machines it will be submitted to the render manager. When a job is accepted, the render manager has several tasks to do. First it checks the availability of the clients. It then will send a chunk of the job towards a client. The chunk size can be dictated by the user. It can go from part of a frame to a full frame to even a group of frames. If your frames render fast then it is usually better the group them otherwise one frame per client will do fine.

The render manager will now divide all the chunks between the clients. When a client is finished it will report back to the manager and a new job will be given automatically.

Another task of the render manager is to queue the jobs from the users. It allows several people to submit jobs without the fear that they will fail because the render farm might be too busy. The render managers usually have the option to prioritize jobs according to preset rules.

A good render manager will tell you when things go wrong. When a render fails it usually generates an error message which is passed on to the manager. It will then show you which jobs didn't render properly.

What is needed for running a render farm

  • Computers: Ok, that is pretty obvious. Fast CPUs and a lot of memory are preferred. You do not want them to start swapping memory to disk. It will grind the render to a halt. Big hard drives are not important, do get server grade ones though. Rack machines are the preferred choice when not using workstations. They are space efficient and are usually server grade so they are made to run 24/7 at full capacity. Do not use the render manager server as a render box so you need one machine dedicated for the manager to run on.
  • Operating system: A good rendering manager works cross platform. It doesn't matter if Maya was installed under Windows, MacOSX or Linux. Most render farms run Linux as you can install it without a GUI. This saves memory and makes the machine more efficient (oh, and Linux is free!). Some software packages do not have a Linux or Mac version and then the choice of OS becomes obvious.
  • A render manager: If you are serious about rendering you need a render manager. It will automate everything, speed things up and take a lot of worry out of your hands. It will also make your farm very scalable. There are many different ones out there and all come at different prices so it is hard to recommend any of them.
  • Software Licenses: That's right, software is usually not free and you need to buy the right amount of licenses. Most VFX packages have separate render licenses. They tend to be cheaper and are sometimes sold in bundles. For example Maya comes with 5 render licenses when you buy a floating license. Take note that you can only use packages which have a command line render options. A render manager can not start GUIs.
  • Network: A fast network is a must. The bigger your farm becomes the more data you have to pull trough those wires. Yes, wires. Running a farm on WiFi is a bad idea.
  • A storage server: Rendering images or baking out data can fill up disks pretty quick. A good server with a RAID system for redundancy and continuity will be ideal for storing data. You do not want to loose all that render time because a disk went bad. Remember: a RAID is not a backup system, it was designed to let you keep on working even when a disk dies on you. If you want to be sure that your render data is safe, copy it to a second server after the render job finishes.

Scalability

One of the things we notice in VFX is that render and simulation times never seem to go down. We would assume that with faster processors our render times would go down but instead we see another evolution where the render times stay the same but the complexity of the scene goes up. 

Lucky for us, render farms are to a point very scalable. Just add in more machines and licenses when needed. It only becomes a problem when the server or the network can not handle the traffic anymore. You can imagine that a farm at ILM or Pixar is a complex matter to maintain.

If you you need a quick boost in render capacity but don't have the cash to expand the farm,  you can always hire the services of online render farms. You could say that it is rendering in the cloud. It works very similar as your local render farm with the main difference that you need to upload your data to the cloud first. With a slow internet connection this may take a while but once in the cloud the renders go really fast.

Friday, April 27, 2012

VFX Back to Basics Series: 6. What is lighting and rendering?


This is part of a series on the basic elements of Visual Effects. Each post will talk about a certain element which is one of the basic bricks used for building VFX shots.

In this sixth post I will talk about lighting and rendering.

A ray traced image with a directional light and a sky dome which is used for the image based lighting.

The reason why lighting and rendering usually goes together is because lighting technical directors handle both of them and certain render techniques influence directly how the scene is lit.

Rendering in a nutshell

Let's start this post with rendering and more specific with render engines. A render engine is a piece of software which translates scene data, like models, shaders and lights into a final viewable image. These calculations can go from mere seconds for a simple scene to hours for a complex scene just for one frame. Keep in mind that a movie in the theater needs 24 frames a second so you can imagine that movies packed with VFX are taking years to render, if it was done by a single CPU that is. Tackling a large number of frames is solved by using many CPU's at once. A room full of computers set up for this purpose is called a render farm.

The render engine can be seen as a separate entity and is not really part of the animation and modeling package although it might seem so. Most packages come with a built in renderer but external render engines usually are chosen when working on bigger projects. Photorealistic RenderMan, 3Delight, Mental Ray and V-Ray are only a few examples. There are plenty of good renderers out there. Just choose the one which works for you.

Diagram which shows the relationship between 3D packages and render engines.

The above diagram shows how the software packages like Maya and 3D Studio Max talk with the help of a translator to the rendering packages. Each render engine has its own "language" so the translator gets provided by the render engine.

There is one family of renderers which talks the same language which is the RenderMan standard. This standard was created by Pixar and for a long time Pixar was the only company which had a RenderMan compliant renderer. Now there are other commercial renderers availabe. The scene file from the 3D program gets translated to a RIB file which any RenderMan compliant renderer should be able to read and render out. This open standard is extremely powerful and flexible. It allows for very complex render pipelines so this is mostly used in VFX for film and not so much for small projects.


Render algorithms

Every renderer has its own algorithm but there are two distinctive paths on how to calculate an image: Scanline rendering and ray tracing. I am explaining shadow creation here as well although it can also fit in the lighting section below.

Scanline rendering is a technique which sorts the geometry according to depth and then renders a row at the time. It is very efficient as it discards geometry which is invisible and therefor limits calculations. Shadow calculations are usually done trough shadow mapping. Shadow maps are depth maps which can be stored in a file and be reused. High resolutions depth maps can be expensive to calculate but their reusability in certain circumstances make up for that. It handles large amounts of geometry rather well. Although it has been a very popular technique and is used for example by PRMan, it is being replaced more and more by ray tracing.

Very simple example of shadows made with a shadow map. This one has not a high enough resolution to have a nice shadow. The edges are pixelated.

A new render with a higher resolution shadow map. The edges aren't pixelated anymore.

This how a shadow map looks like. It is a depth map where the lighter grey is closer to the camera than the  darker grey.

Raytracing is a technique which calculates a pixel at the time. It shoots a ray from the camera to the the objects which bounces of to the lights present in the scene. Shadows are an automatic result of this technique and therefor easy to make but they can become rather expensive when soft shadows are needed. This increases the rays per pixel and affects directly the render times. The big benefit is true reflections and refractions are possible. Mental Ray and V-Ray belong to this category.

Ray traced shadows. These are sharp clean shadows.

An attempt to get softer shadows but not enough samples are used and it looks bad and pixelated.

This render has more samples as the previous image and has therefor a much smoother result but render times have gone up considerably. From 7 seconds to 23 seconds.

Render times in both techniques are influenced by the objects in the scene and the complexity of the shaders and lights used. It is imperative to keep render times under control when running a production. Render algorithms can be combined. It can be possible to use a scanline renderer and activate the ray traced shadows if the render engine allows this.

There are more subcategories like global illumination and radiosity but that is a bit too specialized for this article.

Lighting

A 3D scene without light would turn out black just like in the real world. The techniques for lighting a scene are pretty much like lighting for a live action set. There are some differences though. It is impossible to subtract light (and I do not mean block) in the real world whereas in the digital world it is a matter of mathematics. Shadows are another difference. It is possible to change the color, softness without affecting the light itself or even turn it off completely. This gives a huge amount of flexibility but be careful when lighting for a photorealistic scene. Using these tricks usually makes the scene look less real.

Classic lights

Lights in a 3D scene are controlled by light shaders just like surface shaders. Most of the time you do not have to assign a light shader to your light though as most packages do this automatically. A light shader is a little program which defines the properties of the light. Light shaders are also render engine specific. All 3D packages have a ready to use set of lights available. Here are the most important examples.
  • Point light: light emitting from a single point like a light bulb.
  • Spot light: A light like a regular spot on a set. It can be controlled by barn doors and by adjusting its diameter.
  • Directional light: A light source with parallel light beams. It is well suited for simulating the sun for example. 
  • Area light: A light which emanates from a surface. Good examples are Kino Flo lamps and light trough a window into a room.
Take notice that area lights are a special case for shadows. The light is bigger than a point and will therefor give always soft shadows. Soft shadows are nice but are always a bit more expensive in calculations especially when you don't want them to look to grainy.

Newer techniques

When lighting for CGI which needs to be incorporated into live action another technique can be used if your renderer allows it. This is called image based lighting or in short IBL. Instead of lighting the scene completely yourself it is possible to use the lighting which was present on the set. This can be done by taking high a dynamic range (or HDR) panorama photograph. The HDR images contain much more information than a regular photograph. Hot spots in the image are not clipped and the blacks are not crushed.

A panoramic image of a kitchen. This is just a representation of an HDR image. Real HDR images are not supported to be shown on the web.

The renderer will use this HDR image as base to light  the scene. This can give highly realistic results. There are two main techniques to make these photographs. The cheap way is to use a mirror ball. It works well for grabbing the lighting but has certain limits when the image is used for crisp reflections on the CGI objects. The more expensive way is to use a fish eye lens.

If you're interested in good lighting make sure you read some books on cinematography. There is much to learn from the real thing. Understanding color theory and how light behaves is very important.


This concludes the sixth part of the VFX Back to Basics series.
Make sure to subscribe (at the top) or follow me on Twitter (check the link on the right) if you want to stay informed on the release of new posts.