Samstag, 9. Januar 2010

QMC optimized | Oversampling by material Pt.1

Now let's have a look at the other Oversampling method which is set up via the material manager.


click to enlarge

Remember when it's set to "oversampling" the oversampling is determined by the rendersettings which we dealt with on previous posts. "per-pixel QMC Sampling" is redundant when rendering with QMC-GI.
So we only have the "QMC Sampling" left. The C4D online help recommends to use this Oversampling method for small lightsources so I was especially curious how it works out with the according scenes.
Before improving rendertime/ quality I did a lot of testrenderings to examine how oversampling via materialmanager affects the general outcome.

Here's what I found out along doing these testrenders:
What first struck me is the different result when using Oversampling via Rendersettings versus Oversampling via Materialmanager. The latter will give you a much more defined and contrasty illumination. Pixelsharp shadows are possible. This can result in a more dramatic look:


click to enlarge


click to enlarge
At some spots Materialmanager Oversampling appeals somewhat unrealisitc to me. Take a look at the last pic. The area where the GI portals meet the floor there's a brightly illuminated area (Rendersettings Oversampling) that's missing in the Material Manager Oversampling rendering.

The "QMC Sampling" Oversampling will give you clearer shadow/ light definition (primary bounce) but it can not make up for an overall low samplecount (grain) that shows elsewhere in the picture (secondary and further bounces). Take a look at the following examples:

click to enlarge



click to enlarge


click to enlarge

Note the crisp shadowline at the right! This scenario has a lot of areas that are influenced by first bounce rays thus profiting a lot from the Material Manager Oversampling. Even though the lights are pretty big and the manual recommends to use Material Manager Oversampling for smaller lighsources it was faster to render than with the Rendersettings Oversampling enabled.
More in depth renderspeed/ quality comparisons is what we're going to take a look at next.


Samstag, 2. Januar 2010

QMC optimized | Oversampling in different Scenarios, highly detailed

What happens if some heavy detail is introduced to the existing lighting scenarios?
The GI testscene offers two checkboxes to add intricate detail on the table as well as on the upper right wall.


click to enlarge


With all these nurnies no wonder rendertimes went up (about threefold, therefore I decreased the resolution to keep me sane..)
Also here making use of oversampling did a good job reducing rendertimes while maintaining quality.


The relative speedgain compared to the undetailed scenes was generally maintained or diminished. Only few were a bit faster to render. But nevertheless oversampling was always faster to render than its non-oversampled equivalent with our provided level of detail. I guess there will be a certain amount of detail where oversampling cannot play out its advantage anymore and relying on other optimizations is advisable. But that needs still to be verified.
So far oversampling has been proved to be very beneficial!

Check out the diagrams for a precise comparison of the different scenarios without/ with detailed geometry:










Dienstag, 22. Dezember 2009

QMC optimized | Oversampling in different Scenarios, low detail

Let me give you a summary of the different scenarios comparing rendertimes between a rendering that used no oversampling and an optimized rendering using oversampling. The optimized version was determined earlier by testing out 5 settings that had shown most promise. The ratios between samplecount and oversampling were generated by applying our rule of thumb to achieve a comparable quality to that of the unoptimized rendering.

(sorry for the gif-parade readers..I know it's not very convenient. Embedding quicktime would be nice if apple finally manages to fix the 64bit bug within browsers)


GI Bounces: 3, GI-Gamma 2.2, without/ with Oversampling, Geometry AA
Scenario: External Illumination only, big GI Portals




click to enlarge


GI Bounces: 3, GI-Gamma 2.2, without/ with Oversampling, Geometry AA
Scenario: External illumination, small GI Portals


click to enlarge


GI Bounces: 3, GI-Gamma 2.2, without/ with Oversampling, Geometry AA
Scenario: Internal illumination, small Lights


click to enlarge


GI Bounces: 3, GI-Gamma 2.2, without/ with Oversampling, Geometry AA
Scenario: Internal illumination, large Lights 


click to enlarge

GI Bounces: 3, GI-Gamma 2.2, without/ with Oversampling, Geometry AA
Scenario: Internal illumination, multiple Lights


click to enlarge

GI Bounces: 3, GI-Gamma 2.2, without/ with Oversampling, Geometry AA
Scenario: External illumination, large GI Portals and internal illumination, multiple Lights



click to enlarge

GI Bounces: 3, GI-Gamma 2.2, without/ with Oversampling, Geometry AA
Scenario: External illumination, small GI Portals and internal illumination, multiple Lights



click to enlarge



So what's the bottom line here?
Using oversampling we could achieve a decrease in rendertime down to between 7 and 75%.


The manual suggests the smaller the lights the bigger the oversampling ratio should be. I can only confirm this on some of my scenarios. Values between 2 and 16 seem reasonable which would be less than weak to medium if you'd  pick the rate from the presets. I never had to go above medium on my seven scenarios. If you should come across a suitable scene for high oversampling rates please let me know. :-)


Next we're going to take a look at the same scenarios with and without oversampling only this time with some heavy details in the scene.

Sonntag, 13. Dezember 2009

QMC optimized | Oversampling, Rule of Thumb

So we know that we can achieve clean results with sufficient samplecount and scenes with high contrasting illumination values need more samples.
Sometimes rendertimes can get out of hand so how can we optimize the renderspeed by maintaining the same or even enhanced quality?

Make use of Oversampling if you have GI portals and/ or illuminated objects within the scene!

You can get away with fewer samples and still have less noise. Be aware though that oversampling can also be a speedhit if wrong settings are applied! There are a couple of oversampling options available in the rendersettings as well as in the material settings.
A little explanation is due here:
Oversampling sends out additional rays but the smart thing about it is that these rays will be ignored if they don't target towards an illuminated object (or gi portal). This results in a cleaner pic.
There are three different kinds of oversampling available:

The first one is accessed through the rendersettings, the other two modes are are assigned per material. Again, you can only take advantage of oversampling by having either gi portals or luminant objects in your scene.


click to enlarge
Material-> Illumination -> Sampling Mode
If it is set to oversampling the oversampling value from the rendersettings menu will be applied. The other two modes will overwrite whatever is set in the rendersettings even if the oversampling in the rendesettings is set to none! The last mode Per-Pixel QMC Sampling is redundant when using QMC GI as I gathered.
Let's take a look first at the oversampling enabled by the rendersettings. The strength can be picked either from the presets dropdown menu or entered in numerically. The ratio describes the amount of rays in relation to the samplecount. A useful rule of thumb would be:

Multiply the samplecount with the ratio. That resulting value would be the samplecount you'd have to use to achieve approximately the same quality without oversampling.

There is a specific ratio for every scenario that works best. So this time we keep the quality "constant" (using the rule of thumb) and look which samplecount/ oversampling ratio setting was the fastest to render.
We later come back to the oversampling enabled by the material settings and see how that works for the different lighting scenarios. My renderqueue is stuffed - ROCK'N'ROLL!!

Samstag, 12. Dezember 2009

QMC | Internal + External illumination, differently sized GI portals

Now let's put it all together combining external and internal illumination.
There won't be no big surprises here since both scenarios obey to the same rules in terms of having a wider range of light contrast requires a higher samplecount.

GI Bounces: 3, GI-Gamma 2.2, Geometry AA
Scenario: Internal + External illumination, large GI Portals



click to enlarge
With the additional light from the inside we contribute to an evenly lit situation. Internal and external light intensities are within comparable ranges. This leads to a very clean render at 4096 samples.

GI Bounces: 3, GI-Gamma 2.2, Geometry AA
Scenario: Internal + External illumination, small GI Portals

click to enlarge
Though this is a more evenly lit situation than compared to the same scene without internal lights there's much more grain visible here compared to the upper picture. External and internal lightintensities are not within the same range. The external light is about ten times brighter than the internal light which gives shadingpoints a much wider brightnessrange to sample from. 4096 samples are not sufficient to even the noise out. This looks only a tad bit cleaner than the same scene without internal lights.

Phew, that took aaawfully long. Now it's about time we talk about optimization!

Freitag, 11. Dezember 2009

QMC | Internal illumination Type

Let's compare a scene that was lit by object illumination to a scene that was lit by conventional arealightsources. First one being lit by object illumination:

GI Bounces: 3, GI-Gamma 2.2, Geometry AA
Scenario: Internal illumination only (object illumination)


click to enlarge


The second picture is a scene lit by conventional lightsources. Before you can make a comparable render containing conventional lightsources only you'll have to turn your GI bounces down by 1. So in his case from 3 to 2.

This is because areas that are directly lit by a conventional lightsource will be interpreted by the GI as illuminated.

So which settings do we need to also adjust to make the two concepts comparable?
Area shadows have to be turned on and the lights' falloff have to be inverse square. Also we have to use a lot more samples on the lights' detail attributes in order to to get a nice continuous lightstroke from the ring shaped light on the tablesurface and an even lightdefinition around the bigger Sphere on the wall. I also disabled Speculars for the lightsources.


GI Bounces: 2, GI-Gamma 2.2, Geometry AA
Scenario: Internal illumination only (conventional area lightsources)



click to enlarge 
Even with one bounce less the conventional lightsources were a lot slower to render, that's why I only took it up to 1024.

You could gain some speed if you turn down the settings of the lightsources e.g. area shadow quality but I just went for the default for the rest of the values.
We have a problem here with these conspicious bright pixels that are scattered around.
As you see they get fewer but more prominent when using higher settings. When does this occur?
It happens when you render a QMC GI scene with conventional lightsources (as area light) that have the natural inverse square falloff and are very near, on or overlapping with geometry. Best antialiasing can soften it to a certain extend but it's faster to either change to Irradiance Cache GI or move the lights further away from geometry or set it to another falloff type.
I did the latter and set it to inverse square clamped for rerendering:


GI Bounces: 2, GI-Gamma 2.2, Geometry AA
Scenario: Internal illumination only (conventional area lightsources)



click to enlarge

Now (with the highest lightvalues clipped off) the overblown areas and sampleblips were surpressed resulting also in a slightly darker picture.

Note how low amounts of samples can give us already a pretty nice result!
Quality/ time wise it can now even outperform the (still yet unoptimized!) rendertimes of object illuminated lighting.

BUT:
Even if you can achieve comparable quality in less time, be aware that you need to set up the lightsources properly. The freedom of having
different falloffs, shadowtypes, samplesettings etc. can lead to some inconsistencies within the picture like different levels of grain in certain spots or unrealistic decay for some lights in the scene.
Lighting with illuminated objects in QMC GI appeals more like a monolithic system.

Besides there is a big speed advantage to come for object illumination, we're going to talk about that when we get to optimization. Yepp, there's hope - even for brute force. ;-)


But let's keep the area lights in the back of our mind for later when we deal with Irradiance Cache.

Area shadows might help us later to maintain detail for the interpolated, blurred world of IR...

QMC | Internal illumination only (object Illumination)

GI Bounces: 3, GI-Gamma 2.2, Geometry AA
Scenario: Internal illumination only (object illum.) large lights



click to enlarge
Actually this one already looks quite nice with 1024 samples, 4096 is a bit overkill, except (again due to the gamma2.2 setting) the darker areas.

Scenario: Internal illumination only (object illum.) small lights  
 
click to enlarge
So yes, same rule applies for internal lights concerning the samplecount:
You need higher settings if you have smaller but (to compensate the overall brightness) stronger lightsources.
Consider this if you render out for example an archvis with day- and nightshot.

Donnerstag, 10. Dezember 2009

QMC | External Illumination Type

GI Bounces: 3, GI-Gamma 2.2, Geometry AA
Scenario: External Illumination only (illum. color, Physky, HDRI) large GI portals


There is difference in rendertime depending on which source of external illumination you choose. In this case (!)
HDRI being the fastest,
illumination color almost identical and
Physky being the slowest which makes sense since it contains a sky and a sun.

click to enlarge

Reducing the GI portals' size increases rendertime slightly when using the same amount of samples. But you would need higher settings with the small portals anyway as we already discovered and see again here.
Most likely the results can vary depending on the sun angle when choosing Physky or the type of HDRI for image based lighting. 



Scenario: External Illumination only (illum. color, Physky, HDRI) small GI portals



click to enlarge

To give you a better overview of this situation take a look at the diagram:



click to enlarge

Mittwoch, 9. Dezember 2009

QMC | External illumination only, small GI portals

GI Bounces: 3, GI-Gamma 2.2, Geometry AA
Scenario: External illumination only, small GI portals

The illumination of the sky material had to be 10 times higher to compensate the brightness for the small amount of light coming in.















click to enlarge

This is a good proof that scenes with small but intense lights (the GI portal in this case) need way higher settings which is why 4096 samples worked good for the previous pic but not sufficiently for this one.
By making the GI Portals smaller on one hand and increasing the brightness from outside on the other hand this scene carries a much larger contrast in it. Thus chances of a shadingpoint sampling very different brightness values increases giving an overall grainier look. To smoothen it out even more samples would be necessary. (Rendertimes getting out of hand now but we'll get to the optimization later)
Also the Gamma2.2 setting comes more into play here in darker corners in terms of more grain since this scene is generally darker.

QMC | External Illumination only, big GI Portals

GI Bounces: 3, GI-Gamma 2.2, Geometry AA
Scenario: External Illumination only, big GI Portals















click pic to enlarge




So with the insane amount of 4096 samples per shadingpoint (which is every pixel in QMC, that's why it's called brute force method) this scene looks almost perfect, a little bit of grain is still noticeable especially in darker areas. Why don't we get an even noise distribution throughout the whole picture? That is because of the GI gamma of 2.2. If you use a Gamma of 1 you'll get an evenly  distributed noise but the light decay wouldn't look as realistic. Best thing would be to adapt a linear workflow but that is another huge topic. If you're interested check out http://cgpov.com/?p=103 and http://www.thirdpartyplugins.com/degamma/DeGammaDoc.pdf . For now just be aware that raising the GI gamma will give you more grain in darker areas, so you should definetely testrender those spots!
But back to sampling:
How will 4096 samples do in other scenarios, will that be a universal valid samplecount for an almost grainfree render? We're about to find out in the following examples....

Dienstag, 8. Dezember 2009

Bring the Noise!! Let's have a look at QMC

Having a closer look at QMC to start with makes perfect sense. Why?
Because it's a no-brainer to set up and gives very accurate results.
Of course the title should say "getting rid of the noise"...I just wanted to quote an old Public Enemy song ;-)
Given enough samples (time) we'll obtain a clean enough GI render on which every following renderoutput will be compared to.

The downside of course because of its accuracy are the long rendertimes.
But since we don't have to stick to a deadline we are blessed with enough time to experiment..

We're going to take a look now on samplecount in different scenarios until we obtain a nice result.
After that we'll see what we can do to optimize renderspeed.

Sonntag, 6. Dezember 2009

Helpful links

Here are some excellent sources that should get you prepared:

http://aimediaserver4.com/studiodaily/videoplayer/?src=ai4/Maxonflv/NewGlobalIllumination.swf&width=800&height=640
http://www.c4dcafe.com/reviews/r11/ar.html
http://mvpny.com/R11GITutorial/R11GITutorial_Part1.html

I'll assume you know these before we continue just so we share a common level of knowledge and will be able to concentrate on rendering. This won't be as much of explaining how certain settings work but rather show you how it effects the renderings practically.

Samstag, 5. Dezember 2009

Getting Started

Hi everyone and welcome to my nerdy little blog,
nutriman here - some might know me from the C4D Forums.

Here you'll find an in depth look at Cinema4D's Global Illumination Rendersettings and their optimization (Currently R11.5).
We're going to focus on QMC, IR and QMC in combination with IR. The Skysampler might be touched but not covered in depth as the other methods.
Prepare for some thorough research, we're going to cover all settings that influence the GI Calculation:
Rendersettings, lights, geometry, tags etc.
Later we're also going to have a look at materials and GI in Animation.
Usually you would need a lot of different scenes to gather experience and to have some sort of knowledge how to optimize quality/ rendertime.
This is where my nifty little testscene comes into play:


The scene controller enables you to quickly change the scenario.
Different scenarios require different settings and I tried to cover everything critical to GI calculation within this one scene.

If you want to follow along practically or tweak settings for yourself you can download my GI-Testscene here
Attention, this scene is 11.5 format and makes use of Mograph as well as Mocca so make sure you have those in order to have the controllers fully working!

Feel free to make suggestions but remember it's not about aesthetics this time but about GI critical elements (like shadow definition).
Also note that most of the values can be turned up more than the slider reveals.

Spare yourself days of testrendering and still get a feeling for the settings beyond the presets.
Hopefully this will enable you to make the most out of the renderengine in terms of speed/ quality.
It's all about finding the right balance ;-)

If the conclusions made here will be applicable for "real" scenes will be examined later.

Before we start I'll post some useful Links...