/*Evan Pon cs184-ej Jenny Huang cs184-bd M 3-4 */ /* This is our displacement shader. To make the letter looked raised, we dent the surface around it, leaving a border along the edges. This is done for all the letters. The amount that the surrounding area is indented is controlled by the magnitude variable. However, the displacement mapping does not really show up on the bmrt, for reasons unknown. It does appear when using renderman. */ displacement displacementP( float magnitude = .03; ) { float height = magnitude; if (s < .05 || t < .05 || s > .35 || t > .35) { height = 0; } else if (s < .3 && s > .26 && t > .1 && t < .3) { height = 0; } else if (s > .1 && s < .14 && t < .3 && t > .18) { height = 0; } else if (s > .1 && s < .3) { if (t < .3 && t > .26) { height = 0; } else if (t < .22 && t > .18) { height = 0; } } P -= normalize(N) * height; N = calculatenormal(P); }