Page Loading... please wait!

This message not going away?
Ensure Javascript is on and click the box
Oct 22, 2017 - 01:11 PM  

Articles: Chrome and Global Illumination

Posted by: realsoft on Monday, October 25, 2004 - 03:00 PM Print article Printer-friendly page  Email to a friend

Chrome and Global Illumination in Realsoft 3D V4.5

Tutorial by Garry Curtis

The Gi in RSV4.5 relies on a noisey surface sampling of where spec's of light "should" be , approximately . This noisey sampling is then sent to post-processing once the actual render has finished tracing . Once inside "Post" a blurring filter is used to take the noisey hard bits and smooth them out , by distributing them across the image , with each little "spec" being spread around a little bit to it's nearest neighbour pixels.

RS allows for exact sampling and accurate application of this concept though the inclusion of many , many user controls in the vsl shaders , and post filters , and it seems to do quite a good job of presenting what a scene would or should look like when lit in a natural manner.

Gi Shader Interface
The purpose of this page is to draw attention to the secondary part of that concept , the Gi_specular channel , which is responsible for reflections or reflecting light on certain scene objects that will be either reflecting light , or reflecting parts of the actual scene . This study is of one such surface shader , Chrome , that will be applied to a scene object (A sphere) and should reflect certain parts of the scene on it's surface.
Chrome Shader Advanced Panel
Chrome , or silver , should reflect the surrounding scene in a very accurate , clean and noise-free manner , and it does via simple vsl shader controls ; Reflection amount (usually 100%) , color (usually black) and in the case where that chrome shader will be used in a scene where Global Illumination is also used , Gi_Specularity (usually 100%) . Enough talk , let's see.

OK , where to start ? How about a look at that chrome sphere after it's been rendered and run through Post to get a rough idea of what I'm yammering about ?

Normal Smeared Chrome Sphere - 5 minute render
As you can see , what very little of the scene we can observe looks OK , but this is a zoom-in of the sphere in Gi , and so the actual scene lighting is not really of much consequence to us . What we are actually very interested in , is the chrome's reflections . How do they look to you ? Perhaps not that good.

As we can plainly see , zoomed in at this level , the post system appears to have blurred the reflected scene a bit too much , but unfortunately , if we did not blur it this much , we get this:

Noisey Chrome
Noise ! Hmmm , now what ? Well , first of all , let's have a little look at what was going on before it hit post.
Disabled Post System Render
This is the scene in all it's noisey glory just after it was rendered , and just before it was automatically sent to post-processing for noise-removal . Obviously , post had it's work cut out for it.

Now , I know what you're thinking ; you're saying "hey , why not just increase the sampling and send post a less noisey render to filter . That way you can cut back on the amount of blur being added , and perhaps a more realistic representation of your scene will be the result ? " . Good thinking !

Randomness & Raycount Added - 20 minute render
Very nice 20 minute render , and this hasn't even had a blur applied in post to the sphere ! ... but how did we get here ? If we look at the VSL Gi shader's user interface , there aren't too many controls for adjusting secondary ray sampling , except Raycount2 , which in my opinion , is simply not fine enough to allow us to really dial-in the smoothness , and loose the noise.
Gi Shader Interface
Enter David Coombes :

David , being the VSL Ray-Man that he is , had a look at the stock VSL Gi shader and found something very interesting , burried deep within . A "Randomness" control ! This control was laying there dormant until Dave poked a flashlight in it's direction and discovered that by changing the default 0.5 to something much smaller (0.01) RS would very happily sample us a much nicer , not so noisey render via much more concentrated Raycount2 sampling .

David also rightfully advises us to turn off the Gi shader's 'Gi_Reflection' control either by disabling it's code , or by setting it to 0,0,0 . Here's the same image with Gi_Reflection still enabled . This 'white-noise' is there for a reason ; to add Gi specularity to the image via noise that will be smoothed and distributed in post.

Render with Gi_reflection Enabled
We'll give post the day off and disable this control (if only the code was there to allow it to sample much higher also) .
High Quality No Post Blur - 160 Minute Render (Overkill and just for Comparison) .
This image looks very clean and hasn't even been to post yet for smoothing (the floors and walls etc have, but not the sphere) . It took longer to render , but that's understandable since much more data had to be piplelined to get this kind of quality . In fact , we will skip the post blurring all together , or could add just a tiny amount to get a certain "look" that one might feel a chrome sphere should have.
2 x2 Post Blur_Specular Added to 31 Minute Render
Just a tiny bit of blur is added here , and there is a little "softening" of the reflections . The amount of sampling was cut back as well , since we knew this image was going to be blurred in post . Hmmm ... OK , let's have a look at how a non-Gi chrome shader might reflect the scene , as a way of taking the Gi out of the equation , just for evaluation purpose's.
Non-Gi Chrome - 5 Minute Render
We can see this is non-Gi because of how the ceiling is black due to a lack of secondary rays in this shader which would normally do their best at trying to illuminate the ceiling in the reflection , in order to look as closey as possible to the actual ceiling in the render (we can't see it from this camera angle) .

Anyway , we can see that the reflections are very crisp and clean and completely noiseless , and so this is what we should be aiming for in the Gi_chrome as well , in my opinion . So how do we get there ?

Well , for close-ups we should probably avoid post-processing altogether , but this means higher sampling and higher render times . As a trade-off , or for scene's where we aren't zoomed in so darn tight to chrome objects , a lower sampling , or even some small amounts of blur will do it , and will allow us to drop render times in the process.

Time to get our hands dirty !

Zoomed-out to Reveal 'Cornell Box'
Above is another (personal) attempt at the Cornell Box ; an industry standard , of sorts , a kind of measuring stick for gauging a S/W's ability to portray a scene in a near-photographic manner . Ordinarily we might not , necessarily , have to apply a high-quality sampling to a zoomed out chrome object , but for the C-Box ... we do !

The above image has these "starting" settings :
Chrome Shader:
refection .5,.5,.5
color 0,0,0
gi_specularity 1.25,1.25,1.25

VSL Gi shader :
Raycount1 is 3
Raycount2 is 5
Raycount3 is 3
Contrast is 0.000
Gi Bounces 3.1
Gi Reflection ... ? Disabled via a 0,0,0 setting (remember?)

Gi_Brightness Control Post filter :<
Specular is .75,.75,.75

Gi_Brightness Control Post Process Filter
OK , so now , in order to apply extra-high quality settings to our C-Box Chrome sphere , we must take a short trip into the mysterious bowels of the giant beast that is the VSL Gi shader (David , light the way).
Gi Control Panel with 'Advanced' Checked
Click the Advanced Box on this shader and the GUI controls disappear and in their place are the actual lines of VSL code . Open all the compressed boxes by clicking on the + or plus signs to see the complete shader coding . Anyway , find the line of code that is 22 lines down ; "spec_illum+=Raytrace(Coordinates,dray,GI_specularity,Normal)" , and select it . Now you will see a GUI control interface with 3 tabs ; Trace Rays , General and IN/out . Low and behold , David's Randomness control ! Change the 0.5 to 0.0100 and the Raycount control from the very low '3' to 100 . And there you have it .

Make sure that your Post-Processing 'Gi_Blur_Specular' is removed from your list of 'Gi_effects' or all this work you just did will have been in vain.

Now , you are probably noticing that the chrome shaders 'Reflection' control is not 1,1,1 (100%) , but there is a good reason for that setting . If we did set it to 1,1,1 it would overpower the secondary Gi sampling results , and reflect a scene that was more non-Gi than Gi , somewhat , so we have to tone it down a bit . I don't think this is a big problem as far as achieving realistic results go , as the secondary sampling and the Primary sampling that is the result of the chrome shaders 'Reflection' setting seem to work well together.
If this statement doesn't make complete sense , just set the chromes reflection to 1.5,1.5,1.5 , and watch the sphere being rendered . You will see the promary rays being traced onto the sphere . This reflection will be added to the secondary tracing , and the ratio of 'blend' will depend on what your chrome's reflection setting is . A setting of 150% will mean too much primary and little secondary , and a setting of 0 will mean the opposite . Change 'Reflection to 0,0,0 and render to see what I mean .

We can see some obvious flaws in this highly sampled chrome . The glass sphere is too bright . The top of the sphere is reflecting the wall behind it and appears to be too bright as well . Another drawback seems to be the escalation of render times once shadows are added . Try as we might , the ceiling is still a bit too dark . It should be hovering around RGB 95,95,95 - 100,100,100 , but it is sitting at around 80,80,80 , just not quite enough.

Your next question might be : " but man , that non-Gi chrome is the mutt's nut's ! How do we get our Gi chrome to look that good , and still have a a Gi lit scene in the sphere's reflection ? " . Good question.

Well , if you really need to have deadly looking noise-free chrome for close-up renders or photographic quality results , there is the Raycount2 control to turn to once the Randomness Raycount has been maxed out (at 100) . Start with Raycount2 set to 1 , then slowly increase until you obtain the quality you think is suitable , keeping in mind that you have a Post Process blurring tool to do some clever smoothing too.

Raycount2 was previously limited and is back in the drivers seat with the increased Randomness sampling . Increasing Raycount2 will directly scale sampling and render times . If you use Raycount2 settings around 10 (and 100 randomness raycounts) R-times are high , but the chrome is pretty clean (though still slightly flawed).

This VSL Gi shader has many burried controls and has ton's of room for even more elaborate coding , as far as I can see . I think we will just have to wait for V5 and what Realsoft inc has in store for us . In the meantime , we have David's sluething , as well as the combined knowledge of all those who have contributed along the way with their Gi findings . There may even be more discoveries to come in V4.5 .

Special "Thanks" to Mark Heuymans for his precise observations and concise conclusions !

Realsoft Graphics
Copyright © 1989 ... 2012
Realsoft Graphics