basic functions

Exercise Ia write a basic surface shader
using: ambient(), diffuse() and specular()
Tips:

-specular is traditionally not multiplied by the surface color, but have its own tint.
-Ci *= Oi;

img

Exercise Ib

same as above, but with a color texture and a specular map.
if an alpha channel is present in the texture map, use it as opacity map
using: texture(), textureinfo()
Tips:

-Oi is a color!
-You only need one channel (greyscale) in your specular map.

img

Exercise IIa

a facing ratio surface shader
using: dot product, normalize()
Tips:

-dot product of two normalized vectors give the cos of angle.

img

Exercise IIb

a surface that is green if the normal is facing the camera, red otherwise
using: dot product, normalize()
Tips:

-dot product of two normalized vectors give the cos of angle.

img

Exercise IIIa

a surface that outputs P in world space,or N camera space
using: transform(), ntransform()
Tips:

-try to avoid negative values to get into your image. Remapping from [-1-1] to [0-1] can be done with a scale and an offset.

img

Exercise IIIb

a surface that prints the NDC coordinates of the shaded point
using: transform() and printf()
Tips:

-read note on the shading grid

img

Exercise IV

a surface that implements a procedural tile texture, with a bump
using: calculatenormal(), and any mathematical functions you fancy,
(e.g. sin(), abs(), mod(), min(), max(), mix(), etc)
Tips:

-use smoothstep() to reduce aliasing

img

 

 

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

 

 

- home - curriculum - competences - gallery -MEL scripts - shaders - contact - links -