Subsurface Scattering in mental ray
2007-04-27 20:39
447 查看
General
Subsurface scattering is a term used in computer graphics to describe the method for attaining the 'softer' look of natural materials such as skin, marble, and milk. The term comes from medical and light science. It means that light coming into the material scatters around below the surface, and then comes out again. It may be useful to know that even tiny amounts of scattering can enhance the apparent ''softness'' of a surface.mental images provides two kinds of shaders for subsurface scattering. One approach implements subsurface scattering with volume scattering -- a physically correct simulation of the light scattering underneath the surface. The second approach does not use volumetric scattering at all, but rather simulates its appearance using light maps in a layered approach. This provides for a faster, easier-to-control method for achieving the SSS effect, and is especially tailored for rendering human skin.
Each approach has its unique strength regarding the tradeoff of desired visual effect and performance. For example, the physical approach uses photon tracing and handles the ability to pass caustics through the medium using the SSS material. It handles deeper SSS effects. Whereas, the non-physical approach doesn't require photon tracing, and handles shallower softening effects such as skin, leaves, grass, wax, plastic, etc. The information in the following sections should help you understand which approach is right for your project.
Concepts for Physical SSS
Object volume captures photonsphoton maps used local to object
Requires
photons
raytracing
GI, caustics (preferred)
used as both material and photon shader
The physical subsurface scattering shader simulates the volumetric scattering of light underneath the object's surface. It uses a photon map (kd-tree) dedicated to this object to store the photon information. A photon map isn't a map as much as a list of 3D points with light information. To illustrate this, the picture at right shows these photons on the inside of the dragon object. At each 3D location inside the dragon, the photon shader stores data about the incoming light. Each ray can bounce around inside, scattering and storing multiple times within the object. |
The simulation separates into three types of scattering -- diffusion, single scattering, multiple scattering -- as depicted in the following diagram.
Image courtesy Paolo Berto - mental images
Usage Tips
Turn on photon tracingThe physical SSS shaders require photon tracing. Either Global Illumination or Caustics must be enabled. Check your light energy, or Photon Intensity in Maya 6.
Don't waste photons
This is a general tip when using GI or caustics. Avoid point lights because they shoot photons 360 degrees in a sphere around the point. In general, use a spot light with a beam centered on the object(s) receiving the photons. For more control, try using two coincident lights: one for general lighting, and one dedicated to filling the photons in the SSS object.
Show me the photons
This can be an extremely useful visualization tool. Start with max photons = 1, and very small radius to envision photon coverage. Each is stored as primary red, green or blue color.
Original scene created in Maya, and exported to mi file by Dominika Waclawiak. Permission to hand edit and rerender also courtesy of Dominika Waclawiak.
max_photons 1, max_radius 1 | max_photons 10, max_radius 2 |
max_photons 100, max_radius 8 | max_photons 1000, max_radius 20 |
max_photons 1, max_radius 1, [5,000 photons apiece] | max_photons 1, max_radius 1, [original 50,000 apiece] |
max_photons 1000, max_radius 20, [5,000 photons apiece] | max_photons 1000, max_radius 20, [original 50,000 apiece] |
The material and transmission inputs of the physical SSS shader can take in textures or other material shaders. If these inputs are too complex, it can confuse your understanding of the sss parameters. So when learning how to use the parameters, start with a simple color, or lambert shader for the material. To envision just the photons, try a black material, white transmission color.
max_photons 1, max_radius 1, material 0 0 0, transmission 1 1 1 1 | max_photons 1, max_radius 1, [original green texture] |
max_photons 1000, max_radius 20, material 0 0 0, transmission 1 1 1 1 | max_photons 1000, max_radius 20, [original green texture] |
Use existing coefficients, for example from milk, or dragon, and then turn the conversion factor to match your world units. Keep in mind that the coefficients supplied by mental images are in millimeters, so that a conversion factor of 25.4 will change units to inches, and about 300 will convert to feet. You may also need to readjust the light energy. The conversion factor above is 10. Below we try some values on either side of that.
scale_conversion 1 | scale_conversion 4 |
scale_conversion 10 | scale_conversion 14 |
Scene Example
To get a better feel for some of these parameters (especially what the units mean), we'll create a unit cube, using a spot light from the front while we look at single photons scattered into the cube from the side. If you want to skip the setup, we have both an.mafile and an
.mifile. The
.mifile is stripped of maya specific dependency.
.mifile | Maya 6 .mafile |
---|---|
cubesss.mi | cubesss.ma |
Using our tips, the cube has black material and white transmission, 1 for max_photons and 0.4 max_radius. Across r, g and b, the absorption coefficient is low at 0.001, and the scattering coefficient is set to 1. In our unit space, we're thinking that this is in millimeters (mm), so we set the scale conversion up to 20, to indicate just less than an inch on each side of the cube. Here are all the parameters:
material | 0. 0. 0. 1. |
transmission | 1. 1. 1. 1. |
ior | 1. |
absorption_coeff | 0.001 0.001 0.001 |
scattering_coeff | 1. 1. 1. |
scale_conversion | 20. |
scattering_anisotropy | 0. |
depth | 4. |
max_samples | 4 |
max_photons | 1 |
max_radius | 0.4 |
approx_diffusion | on |
approx_single_scatter | off |
approx_multiple_scatter | on |
lights | ["spotLight1"] |
To view these parameters in the attribute editor for the maya scene supplied above, select
misss_physical1. [I tend to just type it in the sel text entry box.]
Lets talk about mean free path length. It is the typical distance a photon will travel before being either absorbed or scattered. In our case, we set the absorption coefficient low enough that we'll just look at scattering. Think of yourself as a photon going through a room with tables in it; the higher the scattering coefficient, the more tables. The average distance you can freely travel is your free path length.To get this distance, invert the coefficient, ie, in our example, 1/1. Except that we also have a scale conversion factor. Multiply the scale conversion by the coefficient before inverting, so the mean free path length in our example will be 1/20 of the length of the unit cube. If the coefficient were 0.5, it would be twice as long, or 1/10.
Next consider depth, the distance at which diffusion takes over instead of multiple scattering. Depth is a multiplier of mean free path length, and therefore depends on the coefficients as well. For example, our depth of 4 indicates that the depth is 4 * 1/20, or 1/5 of the unit cube. Diffusion occurs below this depth from the surface, while multiple scattering occurs above this depth. When setting up correctly, values between 2-8 are typical. In this example, if depth were 10, ie 10/20, at 1/2 of the unit cube, the diffusion layer would dissappear because there is not much depth that far in from the surface of the unit cube.
Note the apparent layer on the left side of the cube where the light is entering. Now if we isolate diffusion from multiple scattering, we can envison the layers more clearly.
multiple scatter only | diffusion only | both |
depth 2 | depth 4 | depth 6 |
samples 1 | samples 4 | samples 16 |
max_radiusis divided by
scale_conversion, so we set it to 20 to cover the whole interior of the cube. Then by increasing the photons, we see:
max_photons 10 | max_photons 100 | max_photons 1000 |
multiple scatter only | diffusion only | both |
max_photons 10 | max_photons 100 | max_photons 1000 |
Maya 6 .mafile for above |
---|
grapesss.ma |
For those wishing to work with mi files, we put a grape in the place of the cube in the above example. And for more, we added GI and caustics to the floor.
相关文章推荐
- Practise Skin Sub Surface Scattering (SSS) Effect In RenderMan Production
- 次表面散射Subsurface Scattering(SSS)
- mental ray feat. “Physically Based Shading Models in Film and Game Production: Practical Implementation at tri-Ace"
- Fast Subsurface Scattering
- Unity3d shader之次表面散射(Subsurface Scattering)
- Tips on Importons and Irradiance Particles in mental ray
- 如何加强角色渲染的真实感(self shadow + subsurface scattering + rim lighting)
- Indirect Illumination in mental ray
- Realtime Subsurface Scattering Skin Rendering On the GPU 演示视频
- Subsurface Scattering(SSS,次表面散射)介绍
- 《Ray Tracing in One Weekend》——Chapter 5: Surface normals and multiple objects
- Shader Types in mental ray
- Unity3d shader之次表面散射(Subsurface Scattering)
- 次表面散射(SubSurface Scattering) Shader
- 实现Subsurface Scattering效果(Subsurface Scattering shader by InvalidPointer : Half-Lambert + Fresnel Term)
- [置顶] Unity3d 屏幕空间人体皮肤知觉渲染&次表面散射Screen-Space Perceptual Rendering & Subsurface Scattering of Human Skin
- Fast Realtime Subsurface Scattering Skin Rendering
- Realtime Subsurface Scattering Skin Rendering On the GPU 视频
- Unity3d 屏幕空间人体皮肤知觉渲染&次表面散射Screen-Space Perceptual Rendering & Subsurface Scattering of Human Skin
- 次表面散射(SubSurface Scattering) Shader 【转】