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 1610, Fri Nov 4 14:31:56 2011 UTC revision 1613, Sun Nov 6 18:10:31 2011 UTC
# Line 14  Line 14 
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    
 bool useShade = true; // simple shading  
 bool useDepth = true; // depth-cue with warm-to-cool colormap  
 bool useSilho = true; // curvature-based silhouettes  
 bool useRival = true; // curvature-based ridge & valley emphasis  
   
17  // set camera, image, and rendering parameters  // set camera, image, and rendering parameters
18  vec3 camEye = [127.331, -1322.05, 272.53];  vec3 camEye = [127.331, -1322.05, 272.53];
19  vec3 camAt = [63.0, 82.6536, 98.0];  vec3 camAt = [63.0, 82.6536, 98.0];
# Line 52  Line 47 
47                            lightVspDir[1]*camV +                            lightVspDir[1]*camV +
48                            lightVspDir[2]*camN);                            lightVspDir[2]*camN);
49    
   
50  strand RayCast (int ui, int vi) {  strand RayCast (int ui, int vi) {
51      real rayU = lerp(-camUmax, camUmax, -0.5, real(ui), real(imgResU)-0.5);      real rayU = lerp(-camUmax, camUmax, -0.5, real(ui), real(imgResU)-0.5);
52      real rayV = lerp(-camVmax, camVmax, -0.5, real(vi), real(imgResV)-0.5);      real rayV = lerp(-camVmax, camVmax, -0.5, real(vi), real(imgResV)-0.5);
# Line 75  Line 69 
69                vec3 norm = grad/gmag;                vec3 norm = grad/gmag;
70                aa = 1.0 - pow(1.0-aa, rayStep/refStep);                aa = 1.0 - pow(1.0-aa, rayStep/refStep);
71                real gray = 1.0;                real gray = 1.0;
               if (useShade) {  
72                   gray *= shade(norm • lightDir);                   gray *= shade(norm • lightDir);
               }  
73                tensor[3,3] Proj = identity[3];                tensor[3,3] Proj = identity[3];
74                tensor[3,3] Gten = identity[3];                tensor[3,3] Gten = identity[3];
               if (useSilho || useRival) {  
75                   tensor[3,3] Hess = ∇⊗∇F(pos);                   tensor[3,3] Hess = ∇⊗∇F(pos);
76                   Proj = identity[3] - norm⊗norm;                   Proj = identity[3] - norm⊗norm;
77                   Gten = -(Proj•Hess•Proj)/gmag;                   Gten = -(Proj•Hess•Proj)/gmag;
               }  
               if (useSilho) {  
78                   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)));
79                   real vdn = vv•norm;                   real vdn = vv•norm;
80                   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
81                   gray *= silho(max(0.0, min(2.0,                gray *= silho(max(0.0, min(2.0, vdn^2 + (sthick*(kv - 1.0/sthick))^2)));
                                vdn^2 + (sthick*(kv - 1.0/sthick))^2  )));  
               }  
               if (useRival) {  
82                   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));
83                   real k1 = (trace(Gten) + disc)/2.0;                   real k1 = (trace(Gten) + disc)/2.0;
84                   real k2 = (trace(Gten) - disc)/2.0;                   real k2 = (trace(Gten) - disc)/2.0;
85                   gray *= rival([min(0.55, |Gten|)/0.55, atan2(k2,k1)]);                   gray *= rival([min(0.55, |Gten|)/0.55, atan2(k2,k1)]);
               }  
86                vec3 matRGB = depth(lerp(0.0, 1.0, camVspNear, rayN, camVspFar))                vec3 matRGB = depth(lerp(0.0, 1.0, camVspNear, rayN, camVspFar))
87                              if useDepth else [1.0,1.0,1.0];                              if useDepth else [1.0,1.0,1.0];
88                rayRGB = rayRGB + rayTransp*aa*gray*matRGB;                rayRGB = rayRGB + rayTransp*aa*gray*matRGB;

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

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