Filter shader (GMS)

Decription

The filtershader works on the refraction and reflection. With this shader you can choose not to reflect/refract lightrays with low intesity or reflect/refract them with a lower factor than the rest of the rays. 
 

Tutorial

In this tutorial we will use the reflection-filter to make the reflection in a monitior look a bit better. At first load in the scene “Filter_Tut” from the GMS_Tutorial database and render it. You will now get the following picture: 
 
 
 
  • Now select the screen (its called “screen”), enter the material dialoge and set the reflection to 0.5. Now we have a normal fifty-fifty reflection. Enter the render dialoge, name the picture “normal_reflect” and render the scene. You will get a picture that looks like this:

This picture is made so we can compare a normal reflection with the reflection we get by using the filter shader. 

  • Now its time to start using the filter. First enter the material-dialoge and select the “GMS”-shader form the NF-shader database as the material shader. While still in the material-dialoge set the reflection to 0.9 - This is the reflectionfactor we want the bright lightrays to be reflected with. Now enter the shaderparameters by pressing edit. The shaderparameters is devided in 3 sections: reflection, refraction and translucency. In the filter-parameters of the reflection-section enter the parameters 0.5,  0.0 and 0.9 so the text says:  Light below 0.5 is reflected at 0.0. Light above 0.9 is reflected normaly" and select the linear reflection type.
We will look at the meaning of these parameters later. Now enter the render-dialog, name the rendered picture: “filter_reflect” and render the scene (remeber it has to be done with mental-ray): 
 

Compare it to the previous picture “normal_refection” (Fx by using the pictureshower in the tools menu. You will find the pictures in the GMS_Tutorial-database in the directory: ”Render pictures”). Notice how only the brightest parts of  the floor and the ball is reflected in the filter-reflection and the two top-softimagewindows is much sharper. (You can probably see some similar reflectons in your own monitor - it all depends on how the lights are in your office. Hint: To see it more clearly turn off you monitor and notice the reflections) 
 
Now lets take a look at the meaning of the parameters you gave to the shader  The value 0.0  is the reflectionfactor we want the weak lightrays to be reflected with. The 0.5 and 0.9 values is refering to lightintensities from the incomming light. The intensity is mesured on a scale from 0 to 1 where black rays is 0 and white rays i 1. If the incomming lightintesity its below 0.5 (a weak lightray) its reflected at 0.0 and if its above 0.9 (a bright lightray) its reflected at 0.9 (the value you entered in the material dialog). If the lightintesity from the incomming light lies between  0.5 and 0.9 the light is reflected at a interpolated factor between 0.0 og 0.9. This interpolation can either be linear or a soft cosine curve. 
 

Now experiment a bit with the values to get an intuitive understanding of whats happening: 

  • Try enter values closer to 0.9 intead of 0.5 and notice how less of the ball gets reflected. If you want more of the ball to be reflected enter smaller values instead of 0.9. (in the: “light above 0.9 is reflected normaly”-dialog) . Afterwards restore the values to 0.5 and 0.9.
  • Lower the normal reflection-value and see that the reflection of the ball gets weaker. When you are done return it to 0.9. Enter diffrent values instead of 0.0 in “the Light below 0.5 is reflected at 0.0”-dialog. The areas of the screen thats previously had no reflection (for examples the top-windows of the screen) now reflects the suroundings with the given factor. Return the value to 0.0 when you are done.
  • First render the standard scene as frame 1. Then select cosine-interpolation instead of linear and render frame 2 . Now enter flipbook (Tools/flipbook)  use it to flip between the two frames to see the diffrence between linear and cosine interpolation.
  •  Make a new scene where you are using the refrationfilter. You can for example make a glass with liquid that has the proberty that only bright objects can be seen in it.