Search This Blog

Welcome to Rendering Tutorial Site

Welcome to Rendering Tutorial site. This site is develop to help artist, architects, advertisers, visual artists and hobbyist a place to share, gain and learn from tutorial writers, important knowledge, tricks and tips in using rendering and image processing software. Some of the link here were cross posted from other sites, some of them were develop for this site, and some of them were shared wholeheartedly by different individuals.

Thursday, 20 December 2012

DMC Sampler

DMC sampler is known to be the most important setting in VRAY. This part can either take your render to a few minutes or days, so it's a must to know what is this. Toni Bratincevic written this very interesting article at interstation3d. Visit his site HERE. This article demystifies VRAY DMC Sampler. Encourage you to visit more of his writings. Here is his explanation about DMC Sampler. All images and writings are owned by Toni Bratincevic.

Introduction

In this tutorial I will focus on giving you the basic technical background of DMC sampler, but before we go into any technical details about DMC sampler, we will go over alternative sampler integrated in VRay, Adaptive Subdivision sampler. I won't be mentioning fixed sampler technique since it's pretty straight forward and in case you don't know how Fixed sampler works, it will be easy to figure out from gained knowledge. Adaptive Subdivision sampling is a technique used in almost every other biased render engine on market. It's relatively old technique and behaves very good in most of the cases. It will give you clean and well sampled image, it's perfect for rendering still images, but compared to DMC sampler it usually oversamples image in places where you can make it even with lower number of glossy reflection samples (for example). As I said, subdivision sampler can be found in most of the competitive biased render engines but it seams to me like some of these engines, based on positive user experience from VRay, are jumping on board and delivering some similar sampling algorithms like DMC. There is one render, that I know, that is using similar technique to DMC and both renders are more and more being used in high end production environments for this reason ... DMC is by far the best raytracing based technique to get in camera depth of field and 3D motion blur with reasonable render times.

Sampling process, Adaptive sampling

Common thing about all biased engines is that most of them are adaptive. What does that mean? Let's simplify it for now and take area of 3x3 pixel resolution for next examples. When you click render, Vray, or some other render, will cast initial 9 samples, which means one sample per every pixel... for now we will assume that samples are taken at the center of pixel.

3x3 INITIAL SAMPLING
1 SAMPLE PER PIXEL 

For those of you who don't know too much about how raytracing works, let's go over it quickly, it's very simple. Imagine that you have a camera and have a grid in front of that camera representing resolution of your final render (3x3 in this example). Let's say you have some objects that are placed inside the scene. When VRay starts rendering it will draw the line from center of the camera going through the mid area of pixel (individual grid box) to the nearest object that intersects that line. Vector is actually cast from point of camera and it's blindly going forward into the scene until it hits something. Point where eye ray hits something (object) is intersection point and that's when render will start to calculate all the color information about that object at that point in space(is it reflective, refractive, what color is it etc, how it reacts to light, is it in shade or directly lit etc...) and it will return collected information to VRay saying this is the color behind that pixel and that's the way you should color that pixel. Ray casted from camera is called eye ray or primary ray, every other ray cast from material to collect information about light, gi, reflections etc is called secondary ray. Remember this because we will be mentioning these two types of rays in this tutorial. Let's go over simple illustration for better understanding of raytracing...


Same procedure is done for every pixel in that 9pixel grid space, and you basically get your image. The problem over here is that every pixel got only one sample, and that sample only returned color information about one infinite small point in space, which was intersection point or eye ray and object. In reality however, if you put that grid in front of your camera you would actually get not only one but average of infinite number of points sampled behind that pixel. Since that's almost impossible to do in rendering engines, you can't just shoot infinite number of rays in render engine because it would take forever, programmers developed some smart ideas how to oversample particular pixels or part of that grid where it's needed. That's called adaptive sampling, since number of rays are adapting based on the complexity of the rendered image ... so in areas where there is high contrast between pixels it will cast more samples, let's say it will send 25 rays into one pixel and average that result, where in the areas where we have constant color or empty space it will send only one sample and will not waste any time oversampling those pixels. 

AFTER INITIAL SAMPLING RENDER
WILL RETURN COLOR FOR
THAT PIXEL
BASED ON DIFFERENCE DEFINED BY
THRESHOLD, RENDER WILL CAST
MORE SAMPLES AT SOME PIXELS
AND COLOR WILL BE UPDATED

Next few images show the benefit of adaptiveness ... first example is made with 1 sample per pixel only, second one is made with 100 fixed number of samples for every pixel and the third one is adaptive technique made with minimum 1 and maximum 100 samples per pixel... you can clearly see how much time is wasted when doing fixed sampling compared to adaptive sampling that is way faster and we are getting almost same quality as in fixed sampling.


FIXED SAMPLING
1 SAMPLE PER PIXEL

RENDER TIME: 1.9 SEC

FIXED SAMPLING
100 SAMPLES PER PIXEL

RENDER TIME: 2 min 55 SEC

ADAPTIVE SAMPLING
MINIMUM 1 MAXIMUM 100 SAMPLES

RENDER TIME: 1 min 1 SEC
Now, common thing with Adaptive Subdivision and DMC samplers is that both of these are adaptive, but they work in different way. Let's start with subdivision sampling because that's the oldest technique and it's good to know something about it since I will try to point out benefits of using DMC, but I can't do it before you get a good feeling how subdivision sampling works.

Subdivision sampler

When talking about sampling in previous paragraphs I mentioned how initial samples are shot through the pixel center. Subdivision sampler actually works in different way, samples are not placed in the pixel center but in the pixel corners like in next image:
SUBDIVISION SAMPLER WILL PLACE
INITIAL SAMPLES AT THE EDGE OF
THE PIXEL 

After initial rays are cast into the scene and information is collected, subdivision sampler analyses this information and decides which pixel needs more samples and which one doesn't. For every pixel, samples that are taken at the edge of the pixels are used and compared... if the color difference is above color threshold (next image) defined in render options Vray will subdivide that pixel one more time and it will take more samples inside that pixel.


Based on Clr Thresh defined in render options, VRay will check if
difference in color between samples from edges inside pixel is
higher than threshold value, if it is, it will cast more samples
inside that pixel, if it's not, it will finish sampling and it will
return final pixel color.
 
EXAMPLE A


initial samples are cast at the edge
of each pixel, color informations are
gathered. 1st pixel is very close to
color of 2nd pixel. Since color difference
is under threshold defined in
render settings, render will decide that
it's not worth adding more samples
to the pixels.
EXAMPLE B


Color difference between 1st and
2nd pixel is very high, over
Color Threshold, which means
render will send more samples
to those pixels. Maximum
number of samples allowed will
be defined by Max rate. 2 in
this case means maximum 16
additional samples per pixel, plus
those already cast at the edges.

This process is done couple of times till color threshold number is met or if we hit maximum number of allowed samples per pixel defined by Max. rate. Remember, that max subdiv value set in Subdivision sampler doesn't represent maximum number of samples taken per pixel, it represents how many times the pixel will be subdivided, which means 0=1 samples,1=4,2=16,3=64. Remember that some samples are shared between pixels (on edges) so basically if you set Max Rate to 2 it will actually use 25 samples for that pixel... 9 local for that 1 pixel only plus 16 (on edges) shared with other pixels. For Max Rate 1 it's 1 local sample per pixel and 8 shared with other pixels. Let's go over next image for more intuitive explanation:

ADAPTIVE SUBDIVISION SAMPLER
... for some pixels more samples are cast, for some less, it all depends on color contrast difference from samples inside and on the edge of the pixel. This example has Subdivision sampler set to Min 0 Max 2, which means 1 initial sample is cast per pixel, but since it's at the edge of pixel it's shared with surrounding pixels, and then based on color difference, oversampling can go up to 16 additional samples per pixel. 

Now, the main problem over here is that the subdivision sampler only bases his decision to take more samples to the pixel on information gathered at the edge of that pixel. It basically doesn't know complete color information of surrounding pixel, it only knows what's going on at the edges of those pixels. This works in some scenes, but in situations where there are a lot of tiny objects and detailed textures, samples color information coming only from the edges is not enough. What we need to make a good decision to oversample pixel is full color information of surrounding pixels. That's exactly what DMC sampler is doing, and for that reason in highly detailed scene with a lot of thin lines (for example) DMC sampler will make a much better decision where to place those additional samples inside the scene and the final image, specially if we are talking about animation, it will be cleaner, more stable, without some sharp changes from frame to frame. Next image shows this:

DECISION TO CAST...
... rays inside pixel is based on color information gathered at the edge of pixel. This is specific to Adaptive Subdivision sampler and can create problems when sampling a scene with high amount of details where knowing complete color information surrounding individual pixels would be more efficient.

ADAPTIVE SUBDIVISION SAMPLER
... has a big problem sampling thin objects in the scene.
In this simple example you can see how lines are cracked,
not enough samples are cast into areas where needed,
and only because adaptive subdivision sampler is
basing it's decision to sample more on information it gets
from edge of pixel. In this example I've set Color Threshold
to 0.01, Min subdivs to 0 which means 1 initial sample
per pixel, and Max Subdivs to 3 which means if needed
it will subdivide pixel 3 times casting maximum 64
additional samples. Maximum 64 samples is more than
enough to get nice lines but V-Ray just doesn't
get enough feedback from initial samples cast into the scene.
DMC SAMPLER
... doesn't’t have these kind of problems because it’s basing its decision on information gathered from complete pixels surrounding pixel that’s being sampled. Because of this, it can detect very thin lines and sample it in efficient way without any artifacts. As with subdivision sampler, DMC was set to Minimum 1 and Maximum 8 subdivs which in this case means it will cast initial 1 sample for every pixel, and where needed it will cast maximum of 64 samples. Color threshold was set to 0.01 like in subdivision sampler.
When using subdivision sampler, every area of the scene that is using some sort of oversampling to get clean results, like glossy reflection, refraction, brute force GI, DOF and motion blur will cast almost exact number of samples set in those options (subdivs), everything will be averaged together and combined into color information, and that color information will be compared to surrounding samples, and decision to oversample that pixel will be made. What this means is that if you have 20 samples available to sample depth of field, 10 for motion blur, and 100 for glossy reflection of the objects in the scene, it's possible you will calculate extremely high number of samples for one pixel. This will produce nice and clean result but at the expense of slow render times, because for every additional image sample taken inside that pixel you will be casting X number of additional samples for motion blur, DOF, glossies etc even if sometimes you don't need such high amount of secondary rays (reflection, refraction, shadow etc) to get nice sampling of the image.. This is where centralized adaptive algorithm like DMC comes into place... it actually controls every single area of the scene where more than 1 sample is needed to get clean information (like glossy reflection).
But before we jump to DMC sampler examples let's go over VRay DMC Sampler tab and how options from this tab are influencing rendering. Remember that this tab is not only used when DMC sampler is activated, it's actually active when Subdivision of Fixed sampling is active, the only difference is that when using Adaptive Subdivision sampler image sampling process (taking eye ray samples) is detached from taking samples (secondary rays) in materials like glossy reflection, where with DMC everything is combined into these options (image sampling and all other subdiv sampling in the scene).
 

DMC Sampler options

Let's go over these options one by one... you can also check VRay help, but maybe this will be easier explanation than one in help. I will be describing case where X number of glossy reflection rays are cast from material... which happens after image sample is taken from camera trough pixel and when that ray hits some object and material with that glossy reflection is called. Remember that these are extreme cases made to be different from image to image so that you can get a better understanding, but in practice changing these options can, and probably will, result in smaller differences.

Adaptive amount – example: if in material you have 100 samples (10 subdivs) available to sample some glossy reflection, setting adaptive to 0.5 will make Vray cast fixed amount 50 (50% of 100 available) reflection samples and then it will decide if you need more samples and how much you need. Actually after those initial 50 samples, more samples are cast 1 by 1 and every time new sample is taken, VRay compares it to averaged color of samples already casted. If contribution to that value is not so high it will stop taking more samples because it will figure out that taking more samples doesn't make sense since it's not contributing a lot to the ones already taken. If adaptive amount is set to 0.7 you will cast 30% of those 100 samples, 0 will cast all 100 samples and 1 (fully adaptive) will cast number of samples set in Min Samples option and after that it will be adaptive, taking only samples needed to clean up that glossy reflection. Min samples in last case is there for safety reasons because sometimes if Adaptive amount is set to 1 VRay can't make a smart decision if it needs more reflection samples based on only 2 initial samples taken for glossy reflection ... so with Min samples you are making sure that whatever you set in Adaptive amount, minimum number of samples taken for glossy reflection (or rafraction, shadow etc) will be 8, after which it will start being adaptive.
ADAPTIVE AMOUNT 0
all reflection samples in material are taken for every eye ray that hits that floor
ADAPTIVE AMOUNT 0.5
50% of glossy reflection samples are taken after which it glossy reflection calculation will become adaptive casting only number of rays needed to satisfy Noise threshold
ADAPTIVE AMOUNT 1.0
since Adaptive is set to 1, Min samples is activated which means 8 initial glossy reflection samples are taken after which its glossy reflection calculation will become adaptive casting only number of rays needed to satisfy Noise threshold
Remember my visual raytracing explanation, let's go over this again but from a different perspective:
Noise threshold – if adaptive amount is set to 0.5, and if, let's say we have some material with glossy reflection in the scene with 100 available samples (10 subdivs), vray will cast 50 samples and after that it will be adaptive based on this noise threshold ... which means every new sample taken after initial 50 samples will be averaged with those 50 samples and if its contribution to those 50 samples is more than value defined in noise threshold it will send one more sample till it hits that noise threshold... but if contribution is not so high and is below noise threshold Vray will stop sampling that reflection and finalize glossy reflection calculation for that material. These are some examples to show how changing Noise threshold influences the quality of reflections. This is really important parameter and for finals should be kept in a range from 0.005-0.01.
NOISE THRESHOLD 0.01 NOISE THRESHOLD 0.1 NOISE THRESHOLD 1.0

Min Samples – If adaptiveness is set to 1 (fully adaptive), even if you have 100 reflection samples available to sample glossy reflection, Vray will cast only 1-2 reflection samples and it won't be able to make a smart decision if it needs to take more samples. To prevent this, Min Samples is the bottom limit of number of samples that needs to be taken before adaptiveness kicks in. Vray will always take those 8 samples for every glossy value in the scene before it starts to be adaptive.
MIN SAMPLES 50 MIN SAMPLES 8 MIN SAMPLES 2

Global Subdivs samples – This is a multiplier for every value in the scene that needs some subdivision (multisampling) to clean up the result. This can be area shadows subdivs in area light, subdivs for glossy reflection or refraction, motion blur subdivs, DOF subdivs etc. So, for example, if you set glossy reflection in material to 10 and Global Subdivs is set to 2, subdivs in material will actually be 20 (10x2). If it's set to 0.2, it will lower that reflection subdivs and you'll have subdivs of 2. Raising this value up will get you a cleaner result but at the expense of render time. Remember that this influences every single Subdiv value in the scene, and I recommend if you have some sampling problems to go into specific material and tweak subdivs value rather than just taking an easier route and raising Global subdivs multiplier.
GLOBAL SUBDIVS MULTIPLIER 10 GLOBAL SUBDIVS MULTIPLIER 1 GLOBAL SUBDIVS MULTIPLIER 0.1

Welcome to non intuitive wonderland, DMC sampler.

With the knowledge we gathered so far it will be easier to figure out how DMC sampler works. First thing that we need to know, and it's a very important feature of DMC sampler, is that complete pixel information surrounding pixel that VRay is sampling is taken into consideration when deciding if it needs to oversample that pixel or not. Result of this is shown in the image we already saw, where I showed you a teapot with thin lines. But let's see this in a different form.
ADAPTIVE SUBDIVISION SAMPLER
with Subdivision sampler only samples taken at the edge of the pixels are taken into account when deciding if pixel needs more samples.
DMC SAMPLER
with DMC sampler complete color information from surrounding pixels is used when deciding if center pixel needs more samples or not.
Maybe this doesn't sound so important, but it is, since it really helps to catch all the small details in the scene. Compared to DMC sampler, where initial samples are taken at the edge of the pixel, DMC sampler takes first samples at random points inside of each pixel, and if it decides to oversample one pixel it will not distribute samples based on regular grid like Adaptive Subdivision sampler, samples distribution in DMC will be more random without exactly defined pattern... although deterministic means it will follow some pattern but it will be based on low discrepancy numbers that has some form compared to QMC which was used in earliest version of Vray.
People are usually wondering what is the reason that DMC sampler can handle motion blur and DOF way faster than Subdiv sampler. The reason lies in the way DMC sampler controls and influences every single area of the scene where we need to do some oversampling (subdivs), and because of that you will cast lowest number of samples needed to get a clean pixel without oversampling some areas of the scene that won't influence the quality of the pixel in the end.

In technical terms this means that DMC sampler, based on maximum number of DMC samples set in DMC sampler rollout, will subdivide every single Subdivs value in scene (material, light, etc). This is not happening with subdivision sampler, and this is the main difference between these two samplers:


Let's repeat it again: if, for example, material X in the scene has glossy reflection and you set this to 40 subdiv, and light used in scene has smooth shadow that is using shadow subdiv of 10, by setting DMC max samples to 5, maximum number of glossy subdivs taken in that material (for one eye sample) will be 8 (40/5) and maximum number of subdivisions available for light shadow will be 2 subdivs. Remember, we are talking about number of sampler per every eye ray sent into the scene. But, if pixel that VRay is sampling needs more than 1 eye ray sample, and let's say we need maximum number of DMC samples which is 5 subdivs in this case (5x5=25 samples), it is still possible that VRay will use all 40 subdiv glossy reflection defined in that material, because for every eye ray sent into the pixel VRay will cast 8 subdivs (64 samples), and since it will cast Max 5 DMC subdiv samples (25 samples), 5x8 will make 40 reflection subdivs. Confusing?... maybe, it took me a couple of days to figure this out since it's not explained in Vray's documentation.
This represents a simple graphical way of describing how DMC handles subdivision of glossy values in the scene. Glossy reflection in material by default has 100 subdiv set. In 1st case DMC has maximum 5 subdivs for eye samples so by knowing that, it will lower number of subdivs in material to 20. In last case DMC knows that it can subdivide pixel 50 times casting maximum 2500 samples ... knowing that, it can oversample pixel so many times with eye rays taking only 2 subdivs reflection samples for every eye ray sent through pixel.
So now that we figured out how DMC subdivides every subdiv value in the scene, we can go over adaptiveness and how it's handled inside the scene subdiv values. This was straight forward in Adaptive subdivision sampler since that sampler didn't influence (divide) values around the scene.
Because of the way DMC works and how it subdivides every value in the scene that needs multisampling, adaptiveness options will play some role if you keep DMC Max samples really low. If you keep DMC Max Subdivs to 1 you will get same effect as with Subdivision sampler in terms of how much secondary samples will be cast for reflection, refraction, area shadows etc. But, since the nature of DMC algorithm, by raising Max DMC setting really high, let's say 50, adaptiveness will not play any role after some point and you can just forget about it. The reason for that is that if you set Max DMC to 50 (for example), Vray will subdivide every subdiv value in the scene to 1, which means for every ray sample sent to the scene you will be sending only 1 glossy sample for reflection, 1 for area light, motion blur etc. The reason why Vray is doing that is that it knows that it can cast 50 subdivs eye samples, which is around 2500 eye samples in the scene and it still can get nice glossy reflections coming from material even if for every eye ray it's casting only 1 sample for glossy reflection.

The reason why this is useful is that in the scenes with 3D DOF, Motion Blur, a lot of glossy reflections etc... Vray will try to cast minimum number of samples needed to get a clean result. In these kinds of situations it's best to keep DMC values really high... and if needed, you can always go into the scene materials and tweak those individually where needed. Usually, when object is in motion and is blurred you don't need to cast so many reflection samples in its material because everything is gonna be smeared in the end. Subdivision sampler doesn't know this and will try to cast high number of samples for every eye sample, even if that glossy reflection color doesn't play big influence in final result. Next example is one simple case where I used Adaptive subdivision sampler and DMC sampler and you can clearly see how DMC sampler outperforms Adaptive Subdivision.
3D MOTION BLUR
DMC SAMPLER
3D MOTION BLUR
ADAPTIVE SUBD SAMPLER
The biggest flaw of DMC is that it can be really confusing and counter intuitive to setup. Sometimes in scenes with a lot of details, many lights, motion blur and DOF it's good to keep DMC settings really high like Min 1 Max 50 because having Max DMC set to low value like 4 can increase render time drastically. Let's go over few practical examples.
 

EXAMPLE 01: Hair

Hair can be a big problem to sample. It has huge amount of small details and most of the raytracers can't handle sampling of hair in efficient and fast way. Adaptive subdivision samples performs worse in these cases, it just can't decide where it needs to place more samples. DMC on other hand performs quite good, it can sample hair really fast and without artifacts that you get with Adaptive subdivision sampler (broken hair strings, flickering). Given same time frame DMC will outperform Adaptive Subdivision sampler, which is clearly visible in next image. Settings that I used were for DMC Min 1 Max 50 Color threshold 0.02, for Adaptive Subdivision Min 0 Max 2 Color Threshold 0.5. I use really high Threshold value for Adaptive Subdivision because when I used 0.1 or 0.05 which is what should be used for animation, Adap Sub estimated render time went to about 20 minutes.
ADAPTIVE SUBDIVISION SAMPLER
DMC SAMPLER
Now we are left with the question of what settings should you use for Hair. I usually put DMC Minimum samples to 1 or 2, and Maximum to 50. If you have some problems detecting small details in animation, setting Min to 2 will probably fix that. Color threshold can be pretty low like 0.02 or 0.005. Forget about DMC sampler options in Setting tab because Adaptiveness are basically ignored because Max DMC was set to 50 which subdivided almost every subdivs value in scene to 1... which means for every eye ray, VRay will cast only 1 sample to calculate area shadows, 1 for glossy reflection etc. In this case this works great since you know that because of complexity of hair number of eye rays needs to be really high (sometimes more than 100-300).
MIN 1 MAX 4 MIN 1 MAX 10 MIN 1 MAX 50
As you see 3rd image works best. Everything looks smooth and I can assure you that you won't see a lot of flickering, even in animation. When working at Blur I usually setup our passes in the way that I render hair as separate pass with Min 1 and Max 50 samples with rest of geometry set as matte (VRay properties) and then I composite hair in postprocessing, because there is no point of using DMC Max 50 for the rest of the scene (in most of the cases).

EXAMPLE 02: Flat surfaces, glossy reflections

Funny thing is that in some other situations having DMC set to 4 can lead to a cleaner image in less time. This is true for images where you have flat surfaces with some glossy reflections and not so many details, so you are more concentrated on sampling materials than sampling geometry:
MIN 1 MAX 5
REFLECTION SUBDIV 50
MIN 1 MAX 10
REFLECTION SUBDIV 50
MIN 1 MAX 50
REFLECTION SUBDIV 50
MIN 1 MAX 50
REFLECTION SUBDIV 100
MIN 1 MAX 50
REFLECTION SUBDIV 300
MIN 1 MAX 50
REFLECTION SUBDIV 1000
Let's see what's going on with the sampler and how when changing DMC Max from 5 to 50 you will see more eye samples cast into the scene.
MIN 1 MAX 5
REFLECTION SUBDIV 50
MIN 1 MAX 10
REFLECTION SUBDIV 50
MIN 1 MAX 50
REFLECTION SUBDIV 50
MIN 1 MAX 50
REFLECTION SUBDIV 100
MIN 1 MAX 50
REFLECTION SUBDIV 300
MIN 1 MAX 50
REFLECTION SUBDIV 1000
Strange, isn't it? First image where DMC sampler Max is set to 5 has just a fraction of the samples compared to DMC Max 50. Remember when I was explaining how DMC Max subdivides every glossy value in the scene. Well, this is exactly what's happening over here. For glossy reflection in material I set Subdiv value to 50, which means, in 1st case where DMC Max is set to 5 for every eye ray that hits that glossy floor it will cast maximum 100 (10 subdivs) reflection samples, but when DMC is set to 50 it will cast only 1 sample. Which means, for DMC set to 50 VRay won't be able to get clean reflection with few eye ray samples so it needs to send more eye samples to the pixels even if we don't need more eye ray samples since some areas are just flat surfaces with reflection.
Second row uses DMC Max 50 but I was tweaking reflection subdivs in material for floor and walls... you can clearly see how by changing Refl Subdiv you take load of DMC sampler (eye rays)... so, in situations like these don't be scared to bump up Refl Subdiv to 300 because when subdivided by DMC Max 50 you will get only 6 subdivs per one eye ray, and this can actually speed up your render and you'll get a smoother reflection.

EXAMPLE 03: Subpixel mapping (V-Ray: Color mapping tab)

Most of the times I'm using subpixel mapping to render my scenes and animations. If you are doing still images you can turn this option off if you want to achieve the most realistic result, but in animation where you are using in camera 3D motion blur and DOF, it will be wise to turn it on because your render time will go down and you will need far less samples to clean up DOF or 3D motion blur. Difference between using subpixel mapping and not using it is that with subpixel on, every eye sample that render takes, when sampling pixel, will be tonemapped first and then averaged with next samples if VRay is oversampling that pixel. When subpixel is off all the samples will be taken and averaged first and then when you get final pixel color VRay will apply tonemaping. This process is shown in next image.
SUBPIXEL MAPPING ON
... when Subpixel mapping is on every new sample taken inside pixel is tonemapped first (compressed to color scale you defined in Color Mapping tab or Camera exposure) and merged over existing pixel color.
SUBPIXEL MAPPING OFF
... when Subpixel mapping is off, every sample is calculated and then they are merged together and finally when sampling is done whole pixel color is tonemapped forming final color value of pixel. This produces more realistic result but tends to introduce some noise to the image specially when using 3D motion blur and DOF.
In practice it looks like this:

SUBPIXEL OFF
DMC MIN 1 MAX 50

SUBPIXEL ON
DMC MIN 1 MAX 50
... we can clearly see how this is reflected to final image. Image on the right with subpixel mapping on will produce cleaner results, it will render faster, but it will loose some brightness and it will produce not so realistic result.

SUBPIXEL OFF
DMC MIN 1 MAX 1

SUBPIXEL ON
DMC MIN 1 MAX 1
... just by changing DMC Max value to 1, meaning that glossy reflection subdivs won't be reduced for every eye ray sent to pixel, we get same results as when turning subpixel off.
This is the reason why this difference is happening: when DMC is set to one, VRay will send one eye ray through pixel, it will hit that reflective floor and it will take 30 glossy samples for reflection... reflection samples are averaged together, they are merged with diffuse value of surface and tonemapped. Because VRay used those 30 glossy reflections in one reflection calculation we are keeping brightness the same as with subpixel mapping off. Compared to example where I set DMC to 50, which means glossy reflection subdiv will be degraded to 1 sample per eye ray sent through that pixel after which reflection sample is averaged with diffuse component and combined into sample and tonemapped. Because I was using Max DMC of 50, VRay will send a lot more eye rays into the scene to clean up that glossy reflection since for every eye ray sample it will get only couple reflection samples.
This can be compensated by going into material that's loosing its initial color and using higher number of glossy reflection samples. In my case if I had DMC set to 50 I can set reflection subdivs in material to something like 500, which means (remember that table?) that for every eye ray VRay will cast 10 reflection subdiv samples into the scene. This will keep reflection as bright as it was with subpixel mapping off but you will get all the benefits of having subpixel mapping on.

EXAMPLE 04: 10+ AREA LIGHS IN SCENE

For scenes with huge number of area lights, using DMC can help a lot especially if you are using motion blur and DOF in camera. Next two images show this, I'm using about 100 area lights and you can see how DMC sampler outperforms Adaptive Subdivision sampler. Amount of noise in the images is almost the same, some areas in DMC are cleaner some more noisier than with AS sampler, but then keep in mind that I used Max 50 samples for DMC sampler which is quite high. Turning Lightcache on for Glossy Reflection in scenes with so many lights can help a lot, so keep that in mind when rendering these types of scenes.


ADAPTIVE SUBDIVISION SAMPLER
MIN 0 MAX 2 CLR THRESHOLD 0.05


DMC SAMPLER
MIN 1 MAX 50 CLR THRESHOLD 0.02

EXAMPLE 05: IRRADIANCE GI QUALITY IS CONTROLED BY DMC SETUP

One thing to remember when trying to eliminate noise or flickering in Irradiance Map is that IR Map is also controlled by DMC Sampler parameters in Settings tab.
ADAPTIVE AMOUNT 1
NOISE THRESHOLD 0.01
MIN SAMPLES 8
ADAPTIVE AMOUNT 0.5
NOISE THRESHOLD 0.01
MIN SAMPLES 8
ADAPTIVE AMOUNT 1
NOISE THRESHOLD 0.01
MIN SAMPLES 128

The problem usually comes when Adaptive amount is set to 1 and, I assume, IR map is not casting so many initial fixed number of GI samples... so it won't be able to decide efficently if it needs to cast more rays or not. This can be compensated by lowering adaptive amount to some lower value than 1, which in second image is set to 0.5 and you can clearly see the difference in GI, or it can be fixed by raising Min samples to high value like 128.

Conclusion

Hopefully everything I wrote was easy to figure out although it get's confusing sometimes. I saw people confused about DMC sampler because of its unified core, and going back to subdiv sampler because it was more predictable, but believe me once you figure out the power of DMC sampler you will want to stay in that mode of thinking because you'll have complete control of your render engine sampling algorithm and you will be able to bring all the power of unified core to get faster render times and cleaner results. Happy rendering!

No comments:

Post a Comment