~ubuntu-branches/ubuntu/warty/aqsis/warty

« back to all changes in this revision

Viewing changes to shaders/borg_metal.sl

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2004-08-24 07:25:04 UTC
  • Revision ID: james.westby@ubuntu.com-20040824072504-zf993vnevvisdsvb
Tags: upstream-0.9.1
ImportĀ upstreamĀ versionĀ 0.9.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
 
 
3
/*
 
4
 *      Displacement Shader "borg_metal" -- adds a Borg-like metal appearance
 
5
 *      to object.
 
6
 *
 
7
 *      by Matt Brandt 
 
8
 * (off-campus student from NASA Goddard Space Flight Center)
 
9
 *
 
10
 *      (This is a variation on the "dented" shader from 
 
11
 *      _The_RenderMan_Companion_ by Steve Upstill.)
 
12
 */
 
13
 
 
14
displacement
 
15
borg_metal(float Km = 0.5)
 
16
{
 
17
        float   size =  1.0;
 
18
        float   mag = 0.0;
 
19
        float   freq = 5;
 
20
        float   smod = mod(s * freq, 1);
 
21
        float   tmod = mod(t * freq, 1);
 
22
/*      float   Km = 0.5;*/
 
23
        float   cut = 0.25;
 
24
        float   delta = 0;
 
25
        float   i;
 
26
        point   P2;
 
27
 
 
28
        P2 = transform("shader", P);
 
29
 
 
30
        for(i = 0; i < 6.0; i += 1.0)
 
31
        {
 
32
 
 
33
                mag += abs(.5 - noise(P2 * size)) / size;
 
34
                size *= 2.0;
 
35
        }
 
36
 
 
37
 
 
38
        P = P2 + normalize(N) * (mag * mag * mag) * Km; 
 
39
 
 
40
        N = calculatenormal(P);
 
41
}