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

SCM Repository

[diderot] Diff of /tests/vis15-bugs/dvrMIPbug.diderot
ViewVC logotype

Diff of /tests/vis15-bugs/dvrMIPbug.diderot

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

revision 4826, Wed Nov 2 11:39:10 2016 UTC revision 4828, Wed Nov 2 12:46:19 2016 UTC
# Line 1  Line 1 
1  input image(3)[] vol ("volume dataset to render") = image("dvrESbug-vol.nrrd");  input image(3)[] vol ("volume dataset to render") = image("dvrESbug-vol.nrrd");
 input bool doIso ("do isosurface instead of ridge line") = false;  
2  /* see ../mip/mip.diderot for everything about camera set-up */  /* see ../mip/mip.diderot for everything about camera set-up */
3  input vec3 camEye ("camera look-from point") = [6, 9, 2];  input vec3 camEye ("camera look-from point") = [6, 9, 2];
4  input vec3 camAt ("camera look-at point") = [0, 0, 0];  input vec3 camAt ("camera look-at point") = [0, 0, 0];
# Line 14  Line 13 
13    
14  input real refStep ("reference (unit) step length, for normalizing opacities") = 0.1;  input real refStep ("reference (unit) step length, for normalizing opacities") = 0.1;
15  input real transp0 ("transparency close enough to 0 to terminate ray") = 0.005;  input real transp0 ("transparency close enough to 0 to terminate ray") = 0.005;
 input real isoval ("isovalue at which to render soft isosurface") = 0;  
16  input real thick ("approximate thickness (in world-space) of soft isosurface") = 0.1;  input real thick ("approximate thickness (in world-space) of soft isosurface") = 0.1;
17  input real maxAlpha ("maximum opacity on rendered surface") = 1;  input real maxAlpha ("maximum opacity on rendered surface") = 1;
18  input real phongKa ("Blinn-Phong ambient component") = 0.1;  input real phongKa ("Blinn-Phong ambient component") = 0.1;
# Line 108  Line 106 
106     vec3 rgb = [0,0,0];     vec3 rgb = [0,0,0];
107     // ... and current tranparency     // ... and current tranparency
108     real transp = 1;     real transp = 1;
    /* example of turning on debuging for one strand (pixel);  
       can can then have "if (verb) { print(...); }" */  
    bool verb = 200==ui && 220==vi;  
109     real maxval = -∞;     real maxval = -∞;
110     update {     update {
111        rayN += rayStep;          // increment ray position        rayN += rayStep;          // increment ray position
# Line 123  Line 118 
118        }        }
119        // compute data contribution        // compute data contribution
120        real val = F(pos);        real val = F(pos);
121        maxval = max(maxval, val); continue;        maxval = max(maxval, val);
122        vec3 grad = ∇F(pos);  continue;  /* This continue causes a compiler crash */
       real aa = 0;  
       if (doIso) {  
          aa = alpha(val-isoval, |grad|);  
       } else {  
123           tensor[3,3] hess = ∇⊗∇F(pos);           tensor[3,3] hess = ∇⊗∇F(pos);
124           real{3} eval = evals(hess);           real{3} eval = evals(hess);
125           vec3 delta = ridgeStep(pos);           vec3 delta = ridgeStep(pos);
126           aa = alpha(|delta|, 1) if eval{1} < -2.5 else 0;        real aa = alpha(|delta|, 1) if eval{1} < -2.5 else 0;
127           if (aa == 0) {           if (aa == 0) {
128              continue;              continue;
129           }           }
130           grad = -delta;        vec3 grad = -delta;
       }  
131        aa = 1 - (1 - aa)^alphaFix;        aa = 1 - (1 - aa)^alphaFix;
132        // Note: not standard Phong diffuse (no dark hemisphere)        // Note: not standard Phong diffuse (no dark hemisphere)
133        real dcomp = lerp(0, 1, -1, normalize(-grad)•litwsp, 1)^3;        real dcomp = lerp(0, 1, -1, normalize(-grad)•litwsp, 1)^3;
# Line 148  Line 138 
138        vec3 dcol = lerp(mcnear, mcfar, camNearVsp, rayN, camFarVsp);        vec3 dcol = lerp(mcnear, mcfar, camNearVsp, rayN, camFarVsp);
139        vec3 mcol = [1,1,1];        vec3 mcol = [1,1,1];
140        // light color is currently [1,1,1]        // light color is currently [1,1,1]
       if (verb) {  
          print("(", rayN, "|", pos, "): val=", val, "; dcol=", dcol, "; mcol=", mcol, "\n");  
       }  
141        rgb += transp*aa*((phongKa + phongKd*dcomp)*modulate(dcol,mcol)        rgb += transp*aa*((phongKa + phongKd*dcomp)*modulate(dcol,mcol)
142                          + phongKs*scomp*[1,1,1]);                          + phongKs*scomp*[1,1,1]);
143        transp *= 1 - aa;        transp *= 1 - aa;
# Line 159  Line 146 
146           stabilize;           stabilize;
147        }        }
148     }     }
    stabilize {  
       if (transp < 1) {  // un-pre-multiply opacities  
          real aa = 1-transp;  
          rgba = [rgb[0]/aa, rgb[1]/aa, rgb[2]/aa, aa];  
       } else {  
          rgba = [rgb[0], rgb[1], rgb[2], 0];  
       }  
       rgba = [maxval, 0, 0, 1];  
    }  
149  }  }
150    
151  initially [ raycast(ui, vi)  initially [ raycast(ui, vi)

Legend:
Removed from v.4826  
changed lines
  Added in v.4828

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