V-Ray Scene Optimisation Script

I’m happy to send you a scene at some point but I’m afraid you’ll facepalm when you see my settings :stuck_out_tongue:

And trust me there are no “trade secrets” in my scenes :stuck_out_tongue:

I’ll find some time to strip down a file, do a test with your script against my settings and if the render times still skyrocket, I’ll send something over to you.

Ah thanks!

In the while, i trained the script a bit more on the scene for which i posted the images, and managed an increase of 20% rendertime for a much, much cleaner image, in both glossies and GI, particularly around the thin geo detail like the rightmost wall, and the lamps nooks and crannies (the former was noisy, the latter had light leaks due to the LC subdivs and sizes not being quite optimal for the shot).
I’ll post a new version of the script with a dedicated preset for when one has such issues tomorrow.

Interestingly I did a test using your LC methodology and saw a 15% decrease in total rendertime. I do however see a tiny bit more noise and slight change towards the green and red tones in my samplerate element along with a very slight brightening of bounced light.

I am assuming that the script is for v.3. I still have v.2.4 and I am getting an error.

Err, yeah, it is named Vray3RenderMate, Bobby :stuck_out_tongue:

James, indeed i edited the post above where i talked about the 1 sample per pixel to include the cases where it is beneficial to have it higher than that (double, or quadruple the subdivs, and maybe do a testrender or two with LC/LC to check how good is its distribution and filtering.).
Notice i prefer the PREfiltering to the rendertime Filtering, chiefly because the former is done once, and not per pixel, so it’s quite a bit faster.
The drawback is that if you have thin-sheet geo, or very very fine geometric detail, you may get light leaks and splotches, which would be absent for the same filtering number if done at rendertime.
Normally, i prefer to fix the geo, and get the LC to look right with prefiltering, but i am not quite current as to the rendertime filtering speed: Vlado may have made it faster (without saying. which would be typical… :P).

So I’m trying to wrap my head around your methodology a bit more and in the process I’ve managed to cut over 60% render time off my hellish 16-hour-to-render-scene (just goes to show how little time I have to even test-render).

Even so I’ve re-read your posts many times over and I think I’m starting to understand it…a bit :stuck_out_tongue: If I’m right in my understanding, you’re able to quite accurately predict render times based on what you call Samples Per Pixel and your script is giving you a readout of this figure pre-render. Are you saying if you know what the SPP is in advance, you can accurately predict render time regardless of a pixel’s content?

Secondly, are you balancing the SPP of each effect or just whatever figure brings about a clean pass for each effect?
When not using a fixed AA (4/4 or 8/8 for example) the SPP figures have a range based on adaptivity obviously, so should I be aiming for 512SPP as a minimum or maximum for each ‘effect’ or is this just all part of the game (as above)?

I’m trying to keep this charade of being learned going but I fear it’s all falling apart at the seams :stuck_out_tongue: I feel like any questions I have can simply be answered by doing lots of my own testing… Like you said before, playing with the script shows rather quickly what is happening under the hood.

One question I would like to ask with the ArchViz preset is about AA min/max. Your default settings of 2/4; why have you chosen these? In particular the minimum of 2? Would you recommend I find the min max AA settings that clean up my Alpha and texture edges and stick with those or do your settings play an integral role in the scripts basic workings?

On a side note: I think the operation you’ve got going with the VFB is sort of dangerous. It seems to be doing some scary things with my VFB history under certain circumstances. Any chance you can include a button in your script to turn that feature off?

Wow, James, you’re as good an interlocutor as i have ever found.
Why the hell did i not have you as artist in the movies i TDed? :stuck_out_tongue:

Are you saying if you know what the SPP is in advance, you can accurately predict render time regardless of a pixel’s content?

I know this sounds VERY counter intuitive, and it’s because your intuition is actually right.
It’s right, in that no, NORMALLY, a pixel could be taking, for a given amount of sampling done to it, anything from a little time to forever or thereabout.
There OUGHT to be no way to accurately predict how long a render will take, when the sampling isn’t fixed, and the scene contents, and shader and light settings, are unknown.

And this is why i am severely limiting stuff like glossy bounces, for instance.
A bit of VERY SIMPLE math may help.
Let’s say that a glossy reflection has 8 subdivisions, or 64 SPP.
If the glossy was allowed to bounce off itself (ie. double mirror scenario) five times, without adaptivity at all, the pixel which sees the fifth bounce would have to trace 64^5 rays.
That’d be around one BILLION rays for that pixel alone.
That’s why we ought to thank Vlado twice a day for the adaptive engine, by the way.

My approach, however, TRIES to do without the adaptivity wherever possible, but of course the risk of hitting infinte rendertimes is very high, that way.
Hence the limiting of glossies: regardless of the amount of glossiness, of what is reflected into it, a 2 bounce, 8 subdivs shader will only ever trace 4096 rays (8^2)^2.
So, in the worst case scenario, if you had a fully covered image with a 2 glossies bounce shader, the render (of the glossy effect) will ALWAYS take as much as the image size requires, regardless of anything else.

Of course, a real scene is often a LOT more complex than that, and that is why, even in the best of cases, it’s a seriously, seriously bad idea to do without adaptivity at all (well, some OTHER renderer does precisely that. and the results do speak for themselves, lol.).
The example above holds for pretty much all the effects (maybe not for raytraced, physical SSS, due to the nature of the beast, but it may soon. err, i never wrote this!).

Secondly, are you balancing the SPP of each effect or just whatever figure brings about a clean pass for each effect?
When not using a fixed AA (4/4 or 8/8 for example) the SPP figures have a range based on adaptivity obviously, so should I be aiming for 512SPP as a minimum or maximum for each ‘effect’ or is this just all part of the game (as above)?
Now, as to which exact value of subdivs for a given glossy amount (let’s stick with the one example) will give you clear results is practically impossible to know BEFORE the rendering starts: it’s down to the glossiness amount, of course, but also to the chance of multiple glossy bounces (glossy shader reflecting another glossy shader, reflecting another glossy shader, for a 3 bounce max), and to the distance of reflected objects (in that if an object is close, for a given gloss amount, it will be sharper and require less samples to clean up than a farther object will).
Same applies to lights, GI (interior versus exterior is the most glaring case), and so on.
However, i have never seen any scene needing more than 2048 SPP to clean ANY solid-surface or shadow effect.
Feel free to find out which balance of SPP versus noise amount is good for you.

I am actually working with someone else to develop a few ideas i have had in mind for a year, now, to implement pre-render heuristics that would take care of just that: automagic sampling for lights, glossies and such, but there is absolutely no guarantee it will ever work, in principle or practice.
I’ll know when we’ll start laying down the prototype (the math, taking care of worst-case scenarios, seems sound, but hey, i’m NOT a Vlado which speaks Italian, so take all this with two pinches of salt).

Ultimately, the script tends to err on the safe side, letting adaptivity decide when it’s right to stop tracing, with values based on extensive testing (of which i’ll need a wee bit more, as you’ve seen with the script updates) and empirical results.

So, how, you asked, can i know in advance if how long a render will take?
If you got the bolded sentence above right, you’ll understand by now that rendering a quick preview with a given (lowish) sampling amount will provide for the correlation you need to know how long the final render will take.
If one which had 128 SPP to begin with and two glossy bounces took 1 hour, one with 256SPP will take roughly twice (with an adaptivity of 0.5, counting on the second bounce being sampled a bit less as less “important”) or exactly four times with an adaptivity of 0 (as then it’s 128*128 vs. 256*256 for the second bounce).

I suppose this is just about the lay of the land, as far as my reasoning behind the script.

On a side note: I think the operation you’ve got going with the VFB is sort of dangerous. It seems to be doing some scary things with my VFB history under certain circumstances. Any chance you can include a button in your script to turn that feature off?
For what regards the VFB, if you could be more specific as to which odd behaviour it shows with your history (which HAS to be enabled and with enough disk space to save the current VFB image in vrimg format), i may try and correct it.
Of course, the checkbox will be coming with the next script update regardless(i’m currently busy testing some other stuff, but will get to it this evening, i hope).

One question I would like to ask with the ArchViz preset is about AA min/max. Your default settings of 2/4; why have you chosen these? In particular the minimum of 2? Would you recommend I find the min max AA settings that clean up my Alpha and texture edges and stick with those or do your settings play an integral role in the scripts basic workings?
The archviz preset with a 2-4 may well be an error on my part. i thought i left it at 4-4, as you can very well tell 4 rays per pixel will NOT give you nice, clean alpha edges.
I’ll look into it as well, and update it.
On the other hand, i hold no truth whatsoever: you are not only free, but very much encouraged to find what combination of values floats your boat for a particular scenario.
And maybe then to let me know, eheh XD

Quick test on a new job with the Arch Viz setup has given me very nice results. Almost 100% clean render, using HDRI & BF/LC. (in excellent time I should add)
It has introduced some wierd fireflies into the GI pass that werent there before.

I dont quite understand whats going on and *why* the render is cleaner with subds still @ 8 and MSR @ 2. Is the AA doing all the work?

edit: It cant be with a clr threshold of 0.1 so definitely baffled over here :slight_smile:

Ahah it’s BLACK MAGIC! :smile:

I turn off “divide shading subdivs”, so each AA step MULTIPLIES the base subdivisions.
In the case of the Archviz preset, the math is as follow (well, for how it shows up now. not user is identical to what i released, but the math is correct regardless):

8 subdivisions = 64 SPP.
(64 SPP * (4*4) (min AA squared) ) * 1.334 GSM * 0.75 (as adaptivity is 0.25, so 75% of the rays are cast regardless.) = 1024 SPP (and change).
Should the adaptive routines think more rays are needed, at the min AA level of 4 you’d get 1366 SPP.

Same applies for the Max AA, only in the forumla above 4*4 becomes 6*6, which leads to 2304 to 3073 SPP.

Let me know if i managed to get you more confused. ^^

Ah, and if you could show me what you mean (a crop is fine) about the fireflies in the GI, i may be able to understand where they come from: i definitely turn OFF max ray intensity, so that could be the case, if the HDRI is extremely bright in some areas. feel free to turn it back on by hand.

Ok that makes sense.

Obv all scenes are different, but I dont understand why this way of sampling is faster than say, just upping subdivs on lights & materials or upping MSR.

Additionally I dont understand why 4/6 AA isnt much slower. Also, I dont understand why the egdes are clean with clr thresh @ 0.1

Black magic indeed.

You’re right about the fireflies, it was the max ray intensity, if I turn that back on they go away.

Obv all scenes are different, but I dont understand why this way of sampling is faster than say, just upping subdivs on lights & materials or upping MSR.
Well, you surely could do that, however, without turning “divide shading subdivs” off, the max AA value will divide the subdivs you set by itself (ie. 8 subdivs on a light, and 8 max AA will result in 1 subdiv times the min AA subdivs.)
If the min AA subdivs are 1, then you get the first “pass” to have only one subdiv for the light, hence it becomes noisy, hence the AA is forced to step up (which as per my posted test above is slow-ish).
Same goes for the MSR: say you want to counter the division of shading subdivs, then your MSR ought to be 8 (GSM being 1.0).
However, that leaves you with a bit less control over what happens at the MIN AA subdiv level, so you have to rely more on the noise threshold for the AA to do the right thing.

Additionally I dont understand why 4/6 AA isnt much slower. Also, I dont understand why the egdes are clean with clr thresh @ 0.1
Much slower than what else? :stuck_out_tongue:
The Alpha edges are clean because the MIN AA subdivs is set to 4, so i force VRay to trace 16 camera rays for the heck of it, however, given the “underlying” scene is clean (through decoupling the AA and the global DMC thresholds, with the latter MUCH lower than the former), those camera rays do not “mutate” into the specialsed ones, but work purely for the Geo, and little else.
That’s why they are quicker.

I suppose the same results could ideally be achieved by the decoupling of the thresholds, a fixed (or near fixed) AA sampling, and the use of the MSR spinner, but hey, when i started this script, very early on in the beta of 3, there was no MSR :stuck_out_tongue:
Also, it’s a method that i brought over from vray 2.x, where i had to resort to the adaptive subdivision AA and the GSM to achieve similarly quick results (although now it’s a wee bit quicker, this way).
Feel free to try out the other approach, i’d be curious to see a benchmark!

Everytime I think Ive got a good understanding of rendering with Vray, something else comes up.

Will do some tests with different setups a bit more scientifically, but on first look using the *arch viz* preset has given me exactly what I want (other than turning on MRI)

ps. Would it be possible to add an option to leave DR on? I keep forgetting and then send renders to BB with DR turned off. Or can I remove that part from the script? (I haven’t looked)

Everytime I think Ive got a good understanding of rendering with Vray, something else comes up.
Eh, tell me about it.
I meant to write a sampling guide for the best part of six months, now, and every time i start, i run into more questions.
Vlado very kindly answers those, and as a result, i am thrown into the arms of a dozen more…
Then again, i wouldn’t want it any way else.
It’s the salt which gives true flavour to what i do for a living, i guess :slight_smile:
Will do some tests with different setups a bit more scientifically, but on first look using the *arch viz* preset has given me exactly what I want (other than turning on MRI)
Was it only cleaner, or also faster than your previous setup?
Or you just had no previous setup to begin with?

Would it be possible to add an option to leave DR on? I keep forgetting and then send renders to BB with DR turned off. Or can I remove that part from the script? (I haven’t looked)
I guess i may just leave the DR part alone.
Never having used it in production, the function in the struct file which reads and writes the render settings didn’t have a specialised part for it.
Will do so as i get the new version rolled out.

Thank you ever so much for the feedback: it’s gold to me! :smile:

Lele,
A DR on/off switch would be handy.
Is 2 BF GI subdivs “normal” for VFX scenes?

sorry for having disappeared, all of a sudden.
will be fully operative this evening, or tomorrow at the latest…

yeah Chris, in vfx, noise is THE next thing, eheh
jokes aside, it’s 2 subdivs, times the GSM, times the adaptive fraction, times the AA subdivs.
i think it’s 768 SPP.
check the lower info tab for the exact number (I’m trying to remember, and you know how that works -not- for me…)

EDIT: i was typing from an asus tablet. Worst typing experience ever.

i’m not getting great results with this.

I lowered my res to 800x800 and did some tests.
Top one is my settings - I always start my renders with default, change AA to 2,8, start with all subdivisions at 8 and increase as required.
second one is your clean preset, one after that is 2stops.

Cubicle? Did you get a new name?

yeah, I was a child 10 years ago when I signed up, time to use my real name :slight_smile:

clean and 2-stops are the oldest ones, as i stated in the first post.

The various pre-made presets were tests, really. I’d recommend using the “StdGeo” and “FineGeo” ones for best results, and in case save yourself a couple more presets with the global subdivs multiplier halved, should you have scenes which tend to clean up quicker (ie. aim for 512 SPP on all effects).
Besides this, it’d be interesting to see where the noise is coming from ( i have a feeling it’s from GI).
What types of GI you were using for your original render (if you can get 17 minutes of clean BF GI for an interior, while a 24 subdivs takes three times longer, and a 30 subdivs takes six times longer, you have some tricks up your sleeve)?
Also, as stated above, the current version of the script is turning off max ray intensity, normally on by default, which WILL produce uncleanable noise if you’re lighting with extremely bright sources.
Further, your settings seem to have an area filter, which masks low-intensity noise a bit more (but makes a hellish job for compers in a number of scenarios), while filtering of the render is something my settings turn off.

Any info you can provide me with in terms of scene setup would help figuring out why some are getting 60% speeds increases, and in your case there’s a 600% slowdown.

It was all IR/LC - there’s no noise in the GI. and this is the first render i’ve done in ages where i forgot to turn off the filter. whoops!
There are 2 light sources - a sun, which just about burns out (intensity of 0.075, ends up with values slightly over 1 in the render) and a vraysky at 0.3.

Your settings drop the material subdivisions a lot - my glossy surfaces range between 32-64. I always leave the noise threshold at 0.01 and yours goes crazy low, which accounts for the rendertimes but somehow doesn’t clean up the image. I had .8 on my reinhard burn (calculation only) which made a huge difference rendering the transparent curtains hit from behind by the sun.
I cant see how the IR/LC changed at all between them, but those passes were much slower too with no visible change in quality.
There’s about the same level of noise in the reflection pass between the first 2, the third is cleaner (although needlessly so) and it’s mostly the AA and the edges. If i run your preset and turn it up to 2,8 it barely gets started though.
I think the increase in render time is coming from the super low noise threshold, but there aren’t enough AA or material samples anywhere for it to actually clean it up.

I’d wager the reason everyone else is getting speed increases is because they’re coming from universal settings.