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

SCM Repository

[diderot] Diff of /benchmarks/programs/illust-vr/bmark-diderot.diderot
ViewVC logotype

Diff of /benchmarks/programs/illust-vr/bmark-diderot.diderot

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

revision 1581, Mon Oct 31 03:07:04 2011 UTC revision 1610, Fri Nov 4 14:31:56 2011 UTC
# Line 6  Line 6 
6  // unu reshape -i illust-vr.txt -s 4 640 480 | overrgb -i - -b 0.1 0.15 0.2 -g 1.2 -o - | unu quantize -b 8 -min 0 -max 255  -o illust-vr.png  // unu reshape -i illust-vr.txt -s 4 640 480 | overrgb -i - -b 0.1 0.15 0.2 -g 1.2 -o - | unu quantize -b 8 -min 0 -max 255  -o illust-vr.png
7    
8  //field#2(3)[] F = bspln3 ⊛ load("../data/vfrhand-nohip.nhdr");  //field#2(3)[] F = bspln3 ⊛ load("../data/vfrhand-nohip.nhdr");
9  field#2(3)[] F = bspln3 ⊛ load("../data/vfrhand-nohip-smooth.nrrd");  field#2(3)[] F = bspln3 ⊛ load("../../data/vfrhand-nohip-smooth.nrrd");
10    
11  field#0(1)[] silho = tent ⊛ load("../data/txf/silho.nrrd");  field#0(1)[] silho = tent ⊛ load("../../data/txf/silho.nrrd");
12  field#0(1)[] shade = tent ⊛ load("../data/txf/shade.nrrd");  field#0(1)[] shade = tent ⊛ load("../../data/txf/shade.nrrd");
13  field#0(2)[] rival = tent ⊛ load("../data/txf/ridgvall.nrrd");  field#0(2)[] rival = tent ⊛ load("../../data/txf/ridgvall.nrrd");
14  field#0(2)[] alpha = tent ⊛ load("../data/txf/alpha-bone.nrrd"); // load("../data/txf/alpha-skin.nrrd");  field#0(2)[] alpha = tent ⊛ load("../../data/txf/alpha-bone.nrrd"); // load("../data/txf/alpha-skin.nrrd");
15  field#0(1)[3] depth = tent ⊛ load("../data/txf/depth.nrrd");  field#0(1)[3] depth = tent ⊛ load("../../data/txf/depth.nrrd");
16    
17  bool useShade = true; // simple shading  bool useShade = true; // simple shading
18  bool useDepth = true; // depth-cue with warm-to-cool colormap  bool useDepth = true; // depth-cue with warm-to-cool colormap
# Line 26  Line 26 
26  real camNear = -78.0;  real camNear = -78.0;
27  real camFar = 78.0;  real camFar = 78.0;
28  real camFOV = 5.0;  real camFOV = 5.0;
29    
30  int imgResU = 640;  int imgResU = 640;
31  int imgResV = 480;  int imgResV = 480;
32  real rayStep = 0.15;  real rayStep = 0.15;
33    /*
34    int imgResU = 480;
35    int imgResV = 360;
36    real rayStep = 1.0;
37    */
38  vec3 lightVspDir = [-2.0, -3.0, -2.0];  vec3 lightVspDir = [-2.0, -3.0, -2.0];
39  real sthick = 0.4;  real sthick = 0.4;
40  real refStep = 1.5;  real refStep = 1.5;
# Line 71  Line 76 
76                aa = 1.0 - pow(1.0-aa, rayStep/refStep);                aa = 1.0 - pow(1.0-aa, rayStep/refStep);
77                real gray = 1.0;                real gray = 1.0;
78                if (useShade) {                if (useShade) {
79                   gray = gray * shade(norm • lightDir);                   gray *= shade(norm • lightDir);
80                }                }
81                tensor[3,3] Proj = identity[3];                tensor[3,3] Proj = identity[3];
82                tensor[3,3] Gten = identity[3];                tensor[3,3] Gten = identity[3];
# Line 84  Line 89 
89                   real kv = max(0.0, min(1.0/sthick, (vv•Gten•vv)/(vv•Proj•vv)));                   real kv = max(0.0, min(1.0/sthick, (vv•Gten•vv)/(vv•Proj•vv)));
90                   real vdn = vv•norm;                   real vdn = vv•norm;
91                   vdn = vdn*(1.0 + 2.0*vdn*vdn); // limit silhouette on front-facing surfaces                   vdn = vdn*(1.0 + 2.0*vdn*vdn); // limit silhouette on front-facing surfaces
92                   gray = gray*silho(max(0.0, min(2.0,                   gray *= silho(max(0.0, min(2.0,
93                                     vdn^2 + (sthick*(kv - 1.0/sthick))^2  )));                                     vdn^2 + (sthick*(kv - 1.0/sthick))^2  )));
94                }                }
95                if (useRival) {                if (useRival) {
96                   real disc = max(0.0, sqrt(2.0*|Gten|^2 - trace(Gten)^2));                   real disc = max(0.0, sqrt(2.0*|Gten|^2 - trace(Gten)^2));
97                   real k1 = (trace(Gten) + disc)/2.0;                   real k1 = (trace(Gten) + disc)/2.0;
98                   real k2 = (trace(Gten) - disc)/2.0;                   real k2 = (trace(Gten) - disc)/2.0;
99                   gray = gray*rival([min(0.55, |Gten|)/0.55, atan2(k2,k1)]);                   gray *= rival([min(0.55, |Gten|)/0.55, atan2(k2,k1)]);
100                }                }
101                vec3 matRGB = depth(lerp(0.0, 1.0, camVspNear, rayN, camVspFar))                vec3 matRGB = depth(lerp(0.0, 1.0, camVspNear, rayN, camVspFar))
102                              if useDepth else [1.0,1.0,1.0];                              if useDepth else [1.0,1.0,1.0];
# Line 101  Line 106 
106         }         }
107         if (rayTransp < 0.01) {  // early ray termination         if (rayTransp < 0.01) {  // early ray termination
108             rayTransp = 0.0;             rayTransp = 0.0;
            rayRGB = 0.9*rayRGB;  
            outRGBA = [rayRGB[0], rayRGB[1], rayRGB[2], 1.0-rayTransp]; /* FIXME */  
109             stabilize;             stabilize;
110         }         }
111         if (rayN > camVspFar) {         if (rayN > camVspFar) {
            rayRGB = 0.9*rayRGB;  
            outRGBA = [rayRGB[0], rayRGB[1], rayRGB[2], 1.0-rayTransp]; /* FIXME */  
112             stabilize;             stabilize;
113         }         }
114         rayN = rayN + rayStep;         rayN = rayN + rayStep;
115      }      }
116    
117        stabilize {
118            rayRGB = 0.9*rayRGB;
119            outRGBA = [rayRGB[0], rayRGB[1], rayRGB[2], 1.0-rayTransp];
120        }
121  }  }
122    
123  initially [ RayCast(ui, vi) | vi in 0..(imgResV-1), ui in 0..(imgResU-1) ];  initially [ RayCast(ui, vi) | vi in 0..(imgResV-1), ui in 0..(imgResU-1) ];

Legend:
Removed from v.1581  
changed lines
  Added in v.1610

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