Showing posts with label shading. Show all posts
Showing posts with label shading. Show all posts

Thursday, October 11, 2012

RenderMan Studio 4 and RenderMan Pro Server 17




Last week Pixar released their latest instalment of RenderMan Studio and RenderMan Pro Server. This is quite exciting news so a good reason to write something about it.

Versions and Pricing for RenderMan Studio 4

Pixar used to have two product lines. The cheaper RenderMan for Maya which was a limited plug-in but with an embedded render license and the more expensive RenderMan Studio which had all the regular tools like Slim and "it" but needed a RenderMan Pro Server license to actualy render anything at all. Pixar has consolidated their two Maya plug-ins into one and has adjusted the pricing and functionality. The RenderMan for Maya product line no longers exists and only RenderMan Studio is now available. RenderMan Studio still has all functionalities but Pixar added an embedded render license. In combination with the price drop to $1300 a license this will give bigger companies a considerable expense cut and gives smaller companies the full set of tools for only $300 more than the old RenderMan for Maya license.

This new pricing gives smaller studios the opportunity to start building their RenderMan pipeline without the huge investment that it used to be.


New Features in RenderMan Studio 4

RMS 4 contains the following applications.
  • RenderMan for Maya 5
  • Slim 10
  • "it" 10
  • Pixar's RenderMan 17 (embedded version)
  • LocalQueue
  • Tractor 1.6
The two new applications are the embedded RenderMan 17 and LocalQueue. This last one is particularly handy for artists who like to render locally controlled by a render manager without having to set up an entire render management infrastructure. The embedded renderer is exactly the same as the Pro Server version so there is no difference if you render it locally or on the render farm.

There is a long list of improvements and efficiency updates but one of the more interesting features is "Phisically Plausible Shading". This is a new easy to use advanced shading and lighting workflow which creates very realistic results. Keep in mind that this new workflow is not compatible with the older RMS 3 workflow although the old workflow is still available if you wish to use it. You have to choose which workflow you like to use at the start of your project and stick with it.

Some interesting features of the new RMS 4 plausible shading workflow.
  • Raytraced and point-based global illumination: This is controlled with special global GI lights. It supports light linking so it is possible to use pre-computed point clouds for a set while rendering the hero objects with raytraced global illumination.
  • Image based lighting is now de-coupled from global illumination. The new RMSEnvLight is a bit slower to calculate but the quality has improved a lot.
  • New Area Lights: Area lights are quite hot nowadays. They provide realistic lighting and soft shadows.
  • Light Blockers: Although I used this feature many years ago as a custom light shader they have now included this as a standard. This is incredibly handy to subtract light in certain areas of your scene.
  • Subsurface scattering trough raytracing: No need to compute pre-passes anymore. This can be handy for relighting purposes as pre-passes can take up too much time.
To facilitate these features Pixar has added new shading nodes which are directly accessible in Maya or trough Slim. The general purpose surface shader supports layering which in my opinion is a very important feature.

New features in RenderMan Pro Server 17

RPS 17 is mainly a speed and efficiency update. I'll mention the features which I think are the more important ones. Hair and fur render up to five times faster and the new implementation of RSL has a 20% speed increase on average on shading calculations. There is also a volume rendering optimization and a new implementation of objects instancing.

Also new: RenderMan On Demand

Pixar also created a new online service called RenderMan On Demand. Whenever you have not enough render capacity it is possible to send your scenes to Pixar and let them render out your scenes. The service fee starts at 70 cent per core per hour.

Links:

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.

Thursday, March 29, 2012

VFX Back to Basics Series: 5. What is shading and texturing?


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 fifth post I will talk about shading and texturing.

In the previous posts I talked about 3d modeling and 3d animation. It is great to have cool animated models but without color they do look dull. Moreover, if you want a photo real result you need to spend some time on proper shading and texturing. Many styles are possible though. From very cartoony to hyper real.


The plain standard grey shader on a model of a gun.


Now we are getting somewhere. The shell has been properly shaded and textured.


Since good shading needs texturing let's start at the top and explain shading first. Almost every object in the real world reflects light. That reflected light makes us perceive color. The reason we perceive an object as being red for example is because the blue and the green wavelengths of the light shining on it get absorbed. Another important part of an object is its shape. A flat surface reflects light differently than a round surface. Computers need to simulate this behavior to get us the desired result.

In short shading is the art of defining the properties of the material of an object. These properties get used during the rendering stage to simulate how the light in the scene is reflected. Shaders are little programs which handle the incoming light, do some calculations and send that reflected light to the render camera. Most 3D packages have build in shaders so no need for programming there but if you really like to have full flexibility then programming them is the way to go. The most known shader language in the film industry is the RenderMan Shading Language or also called RSL and is specific to the RenderMan standard.


Something to remember: Shaders are render engine dependent. Shaders programmed for the RenderMan standard do not work with other engines like Mental Ray or V-Ray. Shaders programmed for Mental Ray can only be used with Mental Ray and so on. It is good practice to choose a render engine before you start shading your models. Most software packages have a built in render engine but have also plug-ins to allow others.

The two most important shader types are surface shaders and displacement shaders.


Surface shaders

At the base of a surface shader there is a Bidirectional Reflectance Distribution Function or in short BRDF. Without getting too technical, it is a function that describes how light is reflected. Common models are Lambert, Blinn, Phong and Oren-Nayar.


Four common BRDF examples. From left to right: Lambert, Blinn, Phong, Oren-Nayar with a high  roughness value.

Surface shaders are usually divided in several components. Diffuse, specular, reflection and refraction are the most prominent ones. These components are combined to get a result for the final image.
  • Diffuse means that the reflected light is scattered and no clean reflections are visible.
  • Specular is invented to simulate highlights from light sources. It is a kind of simplified reflection which is only affected by lights. This can be very useful as calculations for a a specular highlight are much cheaper than true reflections. Nowadays when going for photo real renderings specular gets replaced by true reflections.
  • Reflections are just what they mean, they reflect the environment, including light sources but also other objects in the scene.
  • Refractions are needed when it is possible to look trough objects like glass or a liquid. These type of objects also bend the light that is passing trough them.

Diffuse color only.

Specular highlight only.

Reflections only.


Displacement Shaders

Displacement shaders handle light a bit differently. Instead of handling the light itself, they change the apparent shape of the object and this has an influence on how light is bounced back. There are three methods commonly used and one newer one which combines two of the others.
  • Bump mapping is the simplest and most economic method. It only changes the normals in one direction and give an apparent relief to the material.
  • Normal mapping is the advanced version of bump mapping and moves the normals in three directions (xyz) instead of one. It gives a lot more detail to an object for a fairly low cost on rendering times. The bump and normal mapping methods do not alter the geometry itself.
  • Displacement mapping is also a one dimensional move just as bump mapping but does actually move the geometry and therefor alters the space the object takes in a scene. Although it can give very nice results it does affect render times.
  • The last one is vector displacement mapping. This is a combination of normal mapping and displacement mapping. It moves the geometry in three dimensions and can give highly realistic results.

An example of bump mapping. The pattern apparently shapes the geometry but if you look at the edges you can see that they are still smooth.

An example of true displacement. You can see on the edges that the geometry has been altered.

Three dimensional maps for normal mapping and vector displacement mapping are harder to make and you need specialized software like Mudbox to create them while one dimensional mapping can be done in any paint program like Photoshop.


Texturing

So how does texturing come into all this. Textures are two dimensional images which are wrapped around the three dimensional geometry which drive the calculations of the shader. There are procedural textures which are generated by functions in the shader code or regular textures which are regular images. Photographs are a good source for textures but texture artists can do some amazing hand painted textures too.


A network for a procedural checkerboard shader in Maya. 


Simple hand painted map to drive the color of the diffuse channel.

First we need to make sure the texture fits on the geometry. If the geometry is a NURBS object then the mapping is straightforward as a NURBS patch has fixed texture coordinates. When using polygons or subdivision surfaces there is need for a UV map to define the relationship between the 3D geometry and the 2D map. This UV map can be seen as the polygon mesh being unwrapped on a plane. The UV map can then be used as a guide to create texture maps.


Clean UV map of the shell used in the other images. This can be used as a template for painting the textures.


A procedural checkerboard texture used to check if the UV's are properly mapped. All the squares seem to have the same size so the UV layout is a success.

Each component of a shader, like diffuse and specular can be driven by a texture map. The map influences the color and value of that particular component to create patterns. Let's have a look at two more maps which drive the shader for the shell used in the examples.
A bump map. The lines are very obvious on the render of the gun as they are dark. The lighter pattern is only a subtle effect on the result.


A grime map to control the reflections. The darker the color, the more the reflections get blocked.

Shaders are not only functional to create materials to show in a beauty pass but can also be used to enhance compositing. Ambient occlusion, reflection occlusion and material ID shaders are a good example of that.

There are also more advanced shaders which handle calculations like subsurface scattering. Although these are extremely interesting shaders it would go beyond the basics and thus the scope of this series.

This concludes the fifth 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.