Tutorial
to create etched glass
Tutorial
by Arjo Rozendaal joly@xs4all.nl:
Testscene
Create a simple testscene like the
one on the right or download
it. (textures included)
Note: the plane that will be made
of etched glass has to be shadow
invisible. |
|
Next create a "float
channel" named mg_on. |
|
The
material
The basic material is very simple.
Create an empty VSL material, check
the advanced box and add a "surface
finishing" shader
Add a "raytracer" object in this shader.
Open the In/Out tab and change "Input
1" from reflected ray to refracted
ray. Open the Trace Rays tab and set
raycount 10 and randomness 40.
Because the operation of the Raytracer
object is "+" by default the checkers
seen through the glass will be brighter
then the ones seen directly. To
avoid this the operation could be
changed to "=".
But to mimic the effect that the
glassplate reflects a certain amount
of the light falling onto it because
of the rough surface we can also
dim the brightness.
To achieve that add a "surface properties
shader".
Add a "constant" object and set
it's value to 0,7 0,7 0,7.
Select the "General" tab and set
the operation to "*".
|
|
Create a "blur post
effect" named mg_blur.
The threshold must be controlled by
the "mg_on" channel. Set the threshold
to 0.90.
This way we can selectively blur certain
objects.
Choose the etched glass object and
in the color tab of the properties
window set the mg_on attribute to
1.000.
|
|
Select the plane that
will be etched and add a default mapping
to the newly created material.
Now we're ready to render the
scene. In the view options under
rendersettings choose "default effects"
as image post effect.
Two variables take care of the smoothness
of the result. The settings of the
"raytracer" object and the "blur"
post effect.
The lower the raycount the faster
the rendering. So one has to find
a balance between the blur setting
and the raycount setting to get
an accaptable result.
A raycount of 10 and a low blur
level like 4 gives a nice result
already. |
|
Logo
on a glass door
The setup is a bit different. Selective
blur post effect won't work, because
not only the logo, but the whole glassplate
will be blurred. So we need a new
channel that only contains the logo.
Create a new "color channel" named
mg_diffuse. Create a new blur post
effect named mg_logo_blur and set
the channel to "mg_diffuse". Create
a new VSL post effect named mg_blend.
Check the advanced box and add a
"copy object". Select the General
tab and set operation to "+". Select
the In/Out tab and select mg_diffuse
as source.
|
|
In the SelectWindow
select "Default effects" and add the
blur and blend effects. |
|
Now
it's time to create the material.
Create a new empty VSL material.
Check the advanced box and add a
glass wizard. this glass material
is used for the main glass window.
Add a new color variable named "mask".
This variable is used to store the
logo image.
Under the surface properties shader
add a texture object. Create a logo
image and select it. Set the destination
of this object to "mask".
Create an "If object". Select "mask"
as input. Select the If tab, set
sub 1 "if less" and move the slider
to 0,50.
Drag and drop all the objects (except
for the texture object) under the
if object. This way the glass is
only created in the dark areas of
the logo image.
Create a new mask related "if object".
But this time make it's control
greater than 0,50, so that objects
uder it will only cover the bright
areas in the logo image.
Add a constant object and set the
color box to 0,7 0,7 0,7. Select
the general tab and select "*" as
the operation.
Create a "surface finishing" object.
Add an if object like the second
one.
Add a ray tracer object. Select
the In/Out tab and change input
1 from "reflected ray" to "refracted
ray".
Select the mg_diffuse channel as
output.
Open the Trace Rays tab and set
raycount 10 and randomness 40.
|
|
Create a parallel
mapping for the glassplate object.
Make sure that the default post effects
are selected in the render preferences
and render the image.
Notice that the blur post effect
creates an edge around the logo.
If you want to get rid of it, turn
of the post effect and change the
raytracer output back to illumination.
Now the softness of the glass can
only be controlled by the raycount.
But as the logo might cover just
a small part of the glass the higher
rendering times might not be a big
problem.
|
|
Logo
on a solid glass object
The two examples above only work with
plane objects. In most cases like
a window in a door one doesn't need
cuboid glass objects but planes are
good enough. However it's not too
difficult to change the material to
let the logo cover one side of cuboid
glass objects.
Just add a new if object in the surface
properties shader (under the second
if statement).
The source must be "Recursion" and
the value must be "if greater than
1,01".
Copy all the glass atributes under
this new if object. This way the ray
tracer object only controls the first
visible side of the object. The backside
remains plain glass.
There's one disadvantage: The logo
will always be on the side towards
the view camera.
One improvement of this material
is not just copying the glass attributes
but create one control object for
the recursion. Otherwise we must
remember to set the same variable
in two places. |
|
This image is rendered
without post blur effect and raycount
40. |
|
|