Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/charisee/test/vr-lite-cam.diderot
ViewVC logotype

Diff of /branches/charisee/test/vr-lite-cam.diderot

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1115, Thu May 5 04:42:18 2011 UTC revision 1383, Thu Jun 23 20:24:04 2011 UTC
# Line 8  Line 8 
8  // process output with:  // process output with:
9  // unu reshape -i mip.txt -s 4 480 345 | overrgb -i - -b 0.1 0.15 0.2 -g 1.2 -o - | unu quantize -b 8 -min 0 -max 255  -o vr-lite-cam.png  // unu reshape -i mip.txt -s 4 480 345 | overrgb -i - -b 0.1 0.15 0.2 -g 1.2 -o - | unu quantize -b 8 -min 0 -max 255  -o vr-lite-cam.png
10    
11  string dataFile = "../data/txs-pad3.nrrd";  //string dataFile = "../data/txs-pad3.nrrd";
12  vec3 camEye = [25.0, 15.0, 10.0];  //vec3 camEye = [25.0, 15.0, 10.0];
13  vec3 camAt = [3.0, 3.0, 3.0];  //vec3 camAt = [3.0, 3.0, 3.0];
14  vec3 camUp = [0.0, 0.0, 1.0];  //vec3 camUp = [0.0, 0.0, 1.0];
15  real camNear = -5.0;  //real camNear = -5.0;
16  real camFar = 5.0;  //real camFar = 5.0;
17  real camFOV = 16.0;  //real camFOV = 16.0;
 int imgResU = 480;  
 int imgResV = 345;  
 real rayStep = 0.1;  
 real valOpacMin = 0.15;          // highest value with opacity 0.0  
 real valOpacMax = 0.20;          // lowest value with opacity 1.0  
   
 //string dataFile = "../data/vfrhand-nohip.nhdr";  
 //vec3 camEye = [127.331, -1322.05, 272.53];  
 //vec3 camAt = [63.0, 82.6536, 98.0];  
 //vec3 camUp = [0.9987, 0.0459166, -0.0221267];  
 //real camNear = -78.0;  
 //real camFar = 78.0;  
 //real camFOV = 5.0;  
18  //int imgResU = 480;  //int imgResU = 480;
19  //int imgResV = 345;  //int imgResV = 345;
20  //real rayStep = 0.1;  //real rayStep = 0.1;
21  //real valOpacMin = 400.0;        // 400.0 for skin, 1150.0 for bone  //real valOpacMin = 0.15;          // highest value with opacity 0.0
22  //real valOpacMax = 700.0;        // 700.0 for skin, 1450.0 for bone  //real valOpacMax = 0.20;          // lowest value with opacity 1.0
23    
24    string dataFile = "../data/vfrhand-nohip.nhdr";
25    vec3 camEye = [127.331, -1322.05, 272.53];
26    vec3 camAt = [63.0, 82.6536, 98.0];
27    vec3 camUp = [0.9987, 0.0459166, -0.0221267];
28    real camNear = -78.0;
29    real camFar = 78.0;
30    real camFOV = 5.0;
31    int imgResU = 480;
32    int imgResV = 345;
33    real rayStep = 0.1;
34    real valOpacMin = 400.0;        // 400.0 for skin, 1150.0 for bone
35    real valOpacMax = 700.0;        // 700.0 for skin, 1450.0 for bone
36    
37  real camDist = |camAt - camEye|;  real camDist = |camAt - camEye|;
38  real camVspNear = camDist + camNear;  real camVspNear = camDist + camNear;
# Line 45  Line 45 
45    
46  vec3 lightVspDir = [0.9, -1.0, -2.5];  vec3 lightVspDir = [0.9, -1.0, -2.5];
47  vec3 lightDir = normalize(lightVspDir[0]*camU + lightVspDir[1]*camV + lightVspDir[2]*camN);  vec3 lightDir = normalize(lightVspDir[0]*camU + lightVspDir[1]*camV + lightVspDir[2]*camN);
48  vec3 lightRGB = [1.0, 1.0, 1.0];  //vec3 lightRGB = [1.0, 1.0, 1.0];
49    
50  real phongKa = 0.05;  real phongKa = 0.05;
51  real phongKd = 0.65;  real phongKd = 0.65;
# Line 67  Line 67 
67      real rayN = camVspNear;      real rayN = camVspNear;
68      // ########## BEGIN per-ray initialization      // ########## BEGIN per-ray initialization
69      real rayTransp = 1.0;      real rayTransp = 1.0;
70      vec3 rayRGB = [0.0, 0.0, 0.0];  //    vec3 rayRGB = [0.0, 0.0, 0.0];
71        real rayGrey = 0.0;
72      output vec4 outRGBA = [0.0, 0.0, 0.0, 0.0];      output vec4 outRGBA = [0.0, 0.0, 0.0, 0.0];
73      // ##########  END  per-ray initialization      // ##########  END  per-ray initialization
74    
# Line 85  Line 86 
86                real hd = max(0.0, norm • normalize(lightDir + toEye));                real hd = max(0.0, norm • normalize(lightDir + toEye));
87                // contrived assignment of RGB from XYZ, only sensible                // contrived assignment of RGB from XYZ, only sensible
88                // for txs-pad3.nrrd, not for vfrhand-nohip.nhdr!!                // for txs-pad3.nrrd, not for vfrhand-nohip.nhdr!!
89                vec3 matRGB = [lerp(0.2, 1.0, 1.0, rayPos[0], 8.0),  //              vec3 matRGB = [lerp(0.2, 1.0, 1.0, rayPos[0], 8.0),
90                               lerp(0.2, 1.0, 1.0, rayPos[1], 8.0),  //                             lerp(0.2, 1.0, 1.0, rayPos[1], 8.0),
91                               lerp(0.2, 1.0, 1.0, rayPos[2], 8.0)];  //                             lerp(0.2, 1.0, 1.0, rayPos[2], 8.0)];
92                vec3 pntRGB = (phongKa*matRGB  //              vec3 pntRGB = (phongKa*matRGB
93                               + phongKd*ld*modulate(matRGB, lightRGB)  //                             + phongKd*ld*modulate(matRGB, lightRGB)
94                               + phongKs*hd^phongSp*lightRGB);  //                             + phongKs*hd^phongSp*lightRGB);
95                rayRGB = rayRGB + rayTransp*alpha*pntRGB;  //              rayRGB += rayTransp*alpha*pntRGB;
96                    real mat = lerp(0.2, 1.0, 1.0, rayPos[0], 8.0);
97                    real pnt = phongKa * mat
98                             + phongKd * ld * mat
99                             + phongKs * hd^phongSp;
100                    rayGrey += rayTransp*alpha*pnt;
101                rayTransp = rayTransp*(1.0 - alpha);                rayTransp = rayTransp*(1.0 - alpha);
102            }            }
103            // ##########  END  per-sample code            // ##########  END  per-sample code
104         }         }
105         if (rayTransp < 0.01) {  // early ray termination         if (rayTransp < 0.01) {  // early ray termination
106             rayTransp = 0.0;             rayTransp = 0.0;
107             outRGBA = [rayRGB[0], rayRGB[1], rayRGB[2], 1.0-rayTransp]; /* FIXME */  //           outRGBA = [rayRGB[0], rayRGB[1], rayRGB[2], 1.0-rayTransp]; /* FIXME */
108               outRGBA = [rayGrey, rayGrey, rayGrey, 1.0-rayTransp]; /* FIXME */
109             stabilize;             stabilize;
110         }         }
111         if (rayN > camVspFar) {         if (rayN > camVspFar) {
112             outRGBA = [rayRGB[0], rayRGB[1], rayRGB[2], 1.0-rayTransp]; /* FIXME */  //           outRGBA = [rayRGB[0], rayRGB[1], rayRGB[2], 1.0-rayTransp]; /* FIXME */
113               outRGBA = [rayGrey, rayGrey, rayGrey, 1.0-rayTransp]; /* FIXME */
114             stabilize;             stabilize;
115         }         }
116         rayN = rayN + rayStep;         rayN += rayStep;
117      }      }
118    
119      stabilize {      stabilize {

Legend:
Removed from v.1115  
changed lines
  Added in v.1383

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0