Announcement

Collapse
No announcement yet.

Min Shading Rate

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Min Shading Rate

    Hi everyone,

    I read various threads and also the help file, but still don't completely understand what the Min Shading Rate exactely does under the hood. I know this has been asked a couple of times before, but bear with me please. Here are my questions:

    1) What's the difference between Adaptive Min Samples and Min Shading rate? From my understanding they both should act as a floor for the number of secondary rays cast. If that is the case, why do we have this parameter twice and how do they differ? A simple example with some values would be nice to understand it best.

    2) Does the value that's being typed into the MRS field need to be squared to get the number of sample rays it will cast?


    EDIT: 3) The help file mentions some kind of balancing being done by MSR between AA and secondary effects. Does this mean that with high MSR values, AA samples can potentially be taken away? For example if I set my Min subdivs to 1 and Max to 10 and then set a high MSR value, will I end up with less than 10 Max subdivs?

    Thanks a lot!

    Capture_MM
    Last edited by CAPTURE_MM; 14-04-2015, 05:31 AM.

  • #2
    Originally posted by CAPTURE_MM View Post
    1) What's the difference between Adaptive Min Samples and Min Shading rate? From my understanding they both should act as a floor for the number of secondary rays cast. If that is the case, why do we have this parameter twice and how do they differ? A simple example with some values would be nice to understand it best.
    The new build has a mini-DMC calculator for the various subdivs values in lights and materials that allow you to study the effect of those two parameters. The "adaptive min samples" parameter tells V-Ray how many samples are needed before V-Ray can start doing any kind of adaptive sampling (adaptive sampling needs to have some information about the value being sampled before it can make any meaningful decisions). It doesn't force V-Ray to take that many samples though. The "min shading rate" parameter on the other hand forces V-Ray to take at least that many samples.

    2) Does the value that's being typed into the MRS field need to be squared to get the number of sample rays it will cast?
    No. Again, look at the DMC values that V-Ray shows for materials, lights, and GI to see what's going on.

    Best regards,
    Vlado


    Capture_MM[/QUOTE]
    I only act like I know everything, Rogers.

    Comment


    • #3
      Hi vlado,

      and thanks a lot for your instant response. I accidentally posted in the 3ds Max Forum, but I'm a Maya user and thus don't have the mini-DMC calculator. At least not in the version I am currently using.

      I might be able to play with Akin Bilgic's DMC calculator though. Have you checked if his math is correct?

      Best regards,

      Capture_MM

      Comment


      • #4
        Ah ok. Yes, Akin's calculator is correct.

        Best regards,
        Vlado
        I only act like I know everything, Rogers.

        Comment


        • #5
          So, here's what all the options do. This is not correct maths in terms of the sampling numbers being done, it's just about the ideas.

          You have your normal anti aliasing or camera rays. Let's say we have these at min 1, max 10.
          You then have your secondary rays - when a camera ray hits an object, it works out it's material shading, direct light shading and also gi shading so that's three types of secondary rays. Lets say we have our light, reflection and brute force GI subdivs all set to 50. So you have secondary rays / sampling being done for every camera ray fired.
          Vray understands that sometimes you might want to increase or decrease the anti aliasing, and if it used the full amount of secondary rays each time (we've got 50 for our reflection, light and gi in this example) then you'd end up adding on a huge amount of extra sampling rays every time you increased your max anti aliasing. In our case you'd end up with another 150 secondary rays for every extra 1 aa ray shot and it'd build up into a lot of sampling very quickly. To combat this, the vray developers decided that when you type in a subdiv number for any secondary samples, like your light, material or GI, that this will be the total number used for the sampling. How they achieve this is by dividing any secondary sampling number you choose by whatever your max AA number is and using that amount of secondary samples each time we take an anti aliasing / camera sample. So in our case we've chosen 50 samples for our lights, gi and materials. We've got our anti aliasing at min 1 max 10, so what vray does is divide our lights, gi and material samples by that max 10 aa number. So instead of firing off 50 secondary samples for every camera ray from min 1 up to max 10 and ending up with a huge amount, it divides the 50 secondary samples by the max aa number to give us 5 secondary samples, and then for every camera ray shot, just uses 5 secondary samples instead of the full 50. If something in your scene ends up needing the 10 max aa samples, it'll also end up getting 5 secondary samples for each of the 10 aa rays and add up to our 50 at the start. The idea with the division thing is to stop people hurting themselves and causing huge increases in the number of rays!

          So on to your questions:

          1. Adaptive minimum samples are indeed a floor for the secondary rays. What they're used for is to stop vray from making bad decisions. With any adaptive rendering, the renderer has to decide if the quality is good enough before moving on the next bucket or pixels. Every time vray takes samples for a pixel, all of the samples are added together and averaged out to get the final result. If you have a very small number of samples, then the average might not be all that accurate. Lets say we have a pixel that we're rendering and the pixel has half of a black object and half of a white object in it. A pixel can only store a single colour value in the end, so if it's half white and half black, you should get a 50% grey pixel. Lets say in this case though, we only take a single sample, lets say we get black. Is black the correct average? Not at all but it's the danger of not having enough samples. If we take another sample, lets say we get white this time. If the two get averaged together, we now get our 50% grey. This is correct this time, but a clever renderer might think to itself "hang on, I took one sample and got one value, then took a second sample and now the average has change 50 percent from black to mid grey. I'm not sure if this is right so lets take another sample and see what we get". So lets say we take a third sample and get black again, this time our average goes from a mid grey to a 66% dark grey. Again the renderer will notice that this is a 16% change in the value from last time, probably get suspicious and take another sample. If we get white again, the average is back to 50% grey again but again a big change. From now on, if you keep evenly taking samples, the amount it'll change each time will get smaller and smaller until the renderer will be able to confidently say that the pixel is 50% grey.

          So what adaptive min samples here is doing, is preventing vray from only shooting off one sample and getting black or white instead of grey. If it takes a guaranteed amount of samples at the very start, it'll either be able to tell that it's got a "stable" average, or it'll be able to tell that each time it takes a new sample and adds it to the average that the average changes quite a bit and it's not guaranteed that it's correct. Adaptive min samples is a safety net, and the main reason is because of our Secondary samples being divided by our max anti aliasing value. Say for example we have our lights or materials set to use 10 samples, and our anti aliasing is set to min 1, max 100. Our 10 material samples getting divided by 100 leaves us with only 1 light or material sample, and as in the white / black / grey example above, one sample isn't good enough to make a good decision.

          Min shading rate is a slightly different thing on the other hand, it's kind of a convenient way of setting up your secondary rays amount. Say for example you have a seen that has 100 unique materials in it, a hdri. You're rendering with motion blur for the final shots but not for tests. You start out with 1 / 10 as your AA and then 50 for your materials and 100 for your hdri light. Everything is working nice and cleanly. Now lets say you turn on motion blur and get all your final animation in. You find out that 1 / 10 aa isn't good enough for the final result and have to go to 1 / 25 instead. Because of all the division stuff, instead of you getting 50 / 10 = 5 samples per aa ray on your materials and 100 / 10 = 10 samples on your light, you're now getting 50/25 = 2 on the materials and 100 / 25 = 4 on the light. This means that you'd have to find some way of going through all your material settings in your scene and setting the materials to 125 samples (as 125 / 25 gives you your 5 samples per aa ray back) and 250 on the hdri light to get it's 10 per aa sample. This is kind of a pain in the ass for large scenes.

          What the lovely people of chaos group have done instead, is rather than you having to constantly change your sample settings up and down each time you change your max AA, is put in the min shading rate control. This tells vray, for every camera / aa ray I shoot, take this number of secondary samples for lights, gi and materials every time. It's a convenience thing so you can just set AA to the quality you need for your scene and the gradually raise the min shading rate to up the quality of your secondary sampling.

          2. Shading rate is the number of rays in total. I think the pattern in vray is anywhere it says samples, that's the total number of rays, anywhere it says subdivs, that number needs to be squared to get the total number of rays.

          Comment


          • #6
            joconnell, thank you very much for your thorough and detailed response! VERY much appreciated! Finally, I understood it all!

            All the best,

            Capture_MM

            Comment


            • #7
              Glad it helped!

              Comment


              • #8
                Hi,
                I dont know if its okay replying on old threads like this, but I have a question and I hope someone answers me

                Does the Divide shading subdivs checkbox have any effect when using the Min shading rate, or that is only valid when Use local subdivs is checked.
                Because joconnell in his explanation above says that material/light subdivs get divided by the max AA subdivs so I guess if using Min shading rate then there is no reason for dividing, but if I want to use Use local subdivs then it would make sense the local subdivs to be divided by max AA.

                Thanks

                Comment


                • #9
                  Min shading rate is a floor level setting so kind of a safety net - if vray has too few samples it'll make crap decisions (like if you have skinny geometry like hairs / grass, if you only give it 1 aa ray, it might miss and vray thinks the bucket is empty so it stops early and you get missing buckets).

                  If you turn on "use local subdivs" then min shading rate is still a factor - If everything is left at default then the min shading rate of 8 enforces more rays than what a light / material subdiv setting of 8 is asking for. If I'm on 1/8 aa and min shade rate of 8, I have to turn up the subdivs on a light to 24 to even start having any effect that's higher than what the min shade rate is asking for so you're looking at using much larger numbers to get any visible effect. The way I'd look at this type of thing is use local subdivs and only adjust a single cause of noise - say something like a really complex hdri in a dome light and let min shake rate take care of the rest.

                  Likewise if you turn off divide shading subdivs then every single material and light in the scene with the default 8 setting is waaaaaaaay higher than it'd normally so you'll get hurt on render time. It's a bit more like older arnold builds where your render times would get exponentially worse for a small increase in settings.

                  Usual Chaos disclaimer applies, the defaults are based on data from tonnes of different scenarios and vray (through info it gets from light cache as a pre-pass) is doing some smart things to tune settings in the background so it'll keep getting better and better per release. There's a risk reward that tweaking a scene might save some time but there's also the chance you'll hurt yourself. Are you going to cut down enough render time to cover the amount of hours you spent tweaking? It makes sense if you're doing a thousand frame animation and can shave off 10% render time but if it's only stills and you spend an hour to get a 30 minute reduction then you're best off letting the machine do it!

                  Comment


                  • #10
                    Thanks joconnell

                    I kinda find it confusing with the samples vs subdivs, why there cant be only one measure but I think I understood most of the things.

                    So i guess the "Divide shading subdivs" does not affect the "min shading rate" directly right?
                    Because that number is a sample (even though it says rate?), and divide only works on subdivs?
                    Last edited by jovcem; 09-01-2020, 01:45 PM.

                    Comment


                    • #11
                      Originally posted by jovcem View Post
                      I kinda find it confusing with the samples vs subdivs, why there cant be only one measure but I think I understood most of the things.
                      We will probably be removing most of those settings for future releases anyways... haven't seen anyone using the local sampling controls in a while.

                      Best regards,
                      Vlado

                      I only act like I know everything, Rogers.

                      Comment


                      • #12
                        Originally posted by vlado View Post
                        We will probably be removing most of those settings for future releases anyways... haven't seen anyone using the local sampling controls in a while.

                        Best regards,
                        Vlado
                        We are doing vray rendering on a huge scale (thousands frames every day) and I thought that some optimization might be good, and I also find it fun to optimize render times (weird hobby)

                        Comment


                        • #13
                          I have one more question joconnell
                          How are the "min shading rate" and "Min samples" in the DMC options related, are they the same type of rays? Because if they are then it will always do the min samples of 16 and 6 becomes irrelevant.

                          I was reading this https://www.interstation3d.com/tutor...yfing_dmc.html
                          Its a bit older version of vray and min shading rate is not mentioned but it says that if a material has 10 subdivs / 100 samples then the DMC will do the min samples of 16 (if adaptivity is set to 1) and then will continue till noise or max 100 samples are reached.
                          So if the msr of 6 is the same type of ray as min samples then it will always do 16 instead of 6?

                          Comment


                          • #14
                            Originally posted by vlado View Post
                            We will probably be removing most of those settings for future releases anyways... haven't seen anyone using the local sampling controls in a while.
                            Yes, please!
                            What I found out with people trying to optimize render time: Often the render time is indeed shorter, but in some way or another, the render quality was compromised (ie. slightly noisier, worse AA etc.) I have yet to find a scene that actually got any benefit from manual settings tweaking, especially since V-Ray 3.

                            https://www.behance.net/Oliver_Kossatz

                            Comment


                            • #15
                              Originally posted by jovcem View Post
                              We are doing vray rendering on a huge scale (thousands frames every day) and I thought that some optimization might be good, and I also find it fun to optimize render times (weird hobby)
                              The whole point of adaptive sampling (i.e. the strictest of defaults) is to be as effective as possible across the frame, and across animations.
                              Optimisation by shader, light and so on will *always* produce uneven noise levels, and *nearly always* produce oversampling and undersampling (shading and AA, respectively.).
                              Further, each animation frame is different, and so would be the noise level, which only the adaptive method guarantees not higher than the threshold set (provided max AA is high enough to converge the scene, ofc.)

                              Having a vastly superior method, specifically developed and thoroughly battle-tested, to allow fire-and-forget delivery of renders, we'd be remiss to promote anything else.

                              Min shading rate is per camera ray, DMC min samples is total: i.e. with an MSR of 6, it'll have enough samples to start doing adaptive math by cam ray 3.
                              Then again, nowadays things are *very* complicated, so the mileage there may vary: lights may be shooting more or less rays per evaluation and so on and so forth.
                              It really is best to not deviate from the defaults, numbers in hand (meaning not just rendertimes, but measured noise and sampling levels.).
                              Last edited by ^Lele^; 01-02-2020, 03:58 AM.
                              Lele
                              Trouble Stirrer in RnD @ Chaos
                              ----------------------
                              emanuele.lecchi@chaos.com

                              Disclaimer:
                              The views and opinions expressed here are my own and do not represent those of Chaos Group, unless otherwise stated.

                              Comment

                              Working...
                              X