Subsurface scattering in Mental Ray

Source: Internet
Author: User
Document directory
  • General
General

Subsurface ScatteringIs 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 scatteringVolume 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 shoshould help you understand which approach is right for your project.

Concepts for physical SSS
  • Object volume captures photons

    • Photon 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 initialize strate 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 parameters of this shader control how the light bounces around with actual physical coefficients for absorption and scattering.

The simulation separates into three types of scattering -- diffusion, single scattering, multiple scattering -- as depicted in the following disince.


Image courtesy Paolo Berto-mental images

Usage tips

Turn on photon Tracing

The 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) Locking ing 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

As you increase the number of Max photons in the misss_physical shader, the colors blend together. keeping that in mind, go back and adjust the light energy/intensity and number of stored photons to ensure there are enough in your volume. for your reference, the above images store 50,000 Global illumination, and 50,000 caustic photons. compare to using 5,000 apiece below.


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]
Start with simple inputs

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

Max_photons 1, max_radius 1,
[Original green texture]

Max_photons 1000, max_radius 20,
Material 0 0 0, Transmission 1 1 1

Max_photons 1000, max_radius 20,
[Original green texture]
Use Conversion factor as a knob.

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.maFile and.miFile..miFile is stripped of Maya specific dependency.


.miFile Maya 6.maFile
cubesss.mi cubesss.ma

In this scene, the spot light has an energy of 1000 1000 1000, (color of 1 1 1 and intensity of 1000), with 20,000 globillum photons.

Using our tips, the cube has black material and white transmission, 1 for max_photons and 0.4 max_radius. except ss 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, selectmisss_physical1. [I tend to just type it in the SEL text entry box.]

 

Lets talk aboutMean 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. using t 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 wocould be twice as long, or 1/10.

Next considerDepth, 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 wocould dissappear because there is not much depth that far in from the surface ofUnitCube.

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

Now put both multiple scattering and diffusion back on, and lets examine different depths. try re-rendering with a depth of 2, and it will go closer to the left side. try rendering with a depth of 6, and it will go further from the left side.


Depth 2

Depth 4

Depth 6

One more note. this might also be a good situation to experiment with max_samples, the number of photon map lookups evaluated in single/multiple scattering. at 1 it is on the surface, and more samples go deeper. try Setting samples to 1, and you'll only see samples taken singly at the surface for generating color. try getting by with as few samples as possible. the following pictures all have a depth of 4.


Samples 1

Samples 4

Samples 16

Once you think the photons are behaving, increase the max_photons and max_radius to smear the color. Note thatmax_radiusIs dividedscale_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

Note that the inner diffusion layer is adding quite a bit of energy. if you increase the absorption coefficients, it will decrease the energy of light reaching below depth. here, with absorption at 0.01 0.01 0.01, and max_photons 1000, we see the different layers. also note the blue tint.


Multiple scatter only

Diffusion only

Both

And now here's a similar example, using a grape from Dominika, which also adds a Lambert shader with a texture into the material slot of the misss_physical shader.


Max_photons 10

Max_photons 100

Max_photons 1000

Maya 6.maFile for above
grapesss.ma

If using the Maya scene file, change the texture maps to link to some of your own.

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.