|
|
|
|
|
|
V a s
e S h a d e r
|
|
Surface
and displacement shading techniques can make the
geometry that represents a real world object appear
far more complex than its true underlying form. This
page shows the development of a shader(s) that
exhibits a non-uniform response to light. The
shader(s) also provide a viewer with the illusion
that the surface of an object - in this instance a
vase - has a rich sub-surface texture.
|
|
|
|
|
 |
For this assignment, a shader needed to be created
that gave the appearance of metal-oxide directly
under a glass surface.
So of course, I started off with a simple
vase model in Maya, and then imported into a
rib-file via the Read Archive command. My
first attempt at this shader was coded with a
different structure, that ended up being more
complex than necessary to complete the task.
|
|
 |
To the left is an image
of my first attempt at this shader, where all
appears well at first until a turntable is rendered
out, showing the flaws clearly.
| color fakeLightColor =(ambientcolor
+ (((spline((1-abs(Nnorm.Inorm)),c1,c2,c3))*diffusecolor
)+speccolor ) ); |
Here is the line
of code for the color on the shader, where I used a
spline to mix a purple, a blue, and a teal together
to create the coloring effect based on the camera's
angle. The Full Source can be read here.
(Shader Source)
|
|
Click
Here to View the Turn-Table of the Vase.
If you look at the vase I re-modeled, you
may notice a dent purposely placed on the rim.
This was to show that even though the vase was
rotating, the re-mapped normals inside were not.
|
|
|
|
|
|
This is the
part where it all gets exciting. (click on
any image to the right to reveal their full size) |
|
|
The first
step, after modeling the vase and importing it into
cutter, was to create that sort of bumpy look the
metal oxide made under the glass.
Conveniently, this was already done in the code
provided by Malcolm Kesson, all I did was tweek the
numbers a bit.
| float hump = noise(s * 125, t
* 200); |
|
|
|
Next, the use
of an HDR file, to help give the vase that more
'believable' feel that it was in an actual
environment. The HDR from the original vase is
shown to the far left. That simply would not look as
snazzy as the one of Montgomery Hall provided by Max
Bickley, as shown to the right. A picture of
the HDR is also provided here. |
|
|
After combining the
HDR and a simple plastic shader together, the
"top" glass layer looks something like
this. |
|
 |
The Next step
was to create a mix between blue and purple on the
bumpy layer based on the camera's viewing angle.
This is show in the code below.
color c1 = (0,0,1),
c3 = (1,0,1);
.......
color subCs =(mix(c1, c3,
(1-abs(Nnorm.Inorm)))) ;
color sublight = plastic(N, I, subKa, subKd,
subKs, 0.1, locolor) * Ksub;
color subcolor = sublight * subCs; |
Full
Shader Source Available Here
Full
.h source Here
The Final step was to combine all the layers
together, as shown below.
|
|
To
the bottom left, you'll see the original shader
attempt, and to the bottom right, you'll see the
most recent end-result.
I'd say the second one looks a lot better, wouldn't
you?
(Quicktime
of Vase Turntable) |
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Copyright
Jennifer Kate Green © 2008 |
|