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

SCM Repository

[diderot] Diff of /branches/pure-cfg/test/vr-kcomp.diderot
ViewVC logotype

Diff of /branches/pure-cfg/test/vr-kcomp.diderot

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

revision 776, Thu Apr 7 21:50:30 2011 UTC revision 778, Thu Apr 7 22:09:34 2011 UTC
# Line 3  Line 3 
3  vec3 camUp = [0.0, 0.0, 1.0];  vec3 camUp = [0.0, 0.0, 1.0];
4  real camNear = -1.0;  real camNear = -1.0;
5  real camFar = 1.0;  real camFar = 1.0;
6  real camFOV = 5.0;  real camFOV = 4.5;
7  int imgResU = 200;  int imgResU = 200;
8  int imgResV = 200;  int imgResV = 200;
9  real rayStep = 0.01;  real rayStep = 0.01;
10  real valOpacMin = 0.05;          // highest value with opacity 0.0  real valOpacMin = 0.08;          // highest value with opacity 0.0
11  real valOpacMax = 0.06;          // lowest value with opacity 1.0  real valOpacMax = 0.09;          // lowest value with opacity 1.0
12    
13  real camDist = |camAt - camEye|;  real camDist = |camAt - camEye|;
14  real camVspNear = camNear + camDist;  real camVspNear = camNear + camDist;
# Line 19  Line 19 
19  real camVmax = tan(camFOV*3.1415926536/360.0)*camDist;  real camVmax = tan(camFOV*3.1415926536/360.0)*camDist;
20  real camUmax = camVmax*real(imgResU)/real(imgResV);  real camUmax = camVmax*real(imgResU)/real(imgResV);
21    
22  vec3 lightVspDir = [0.9, -1.0, -2.5];  vec3 lightVspDir = [-1.0, -1.0, -3.5];
23  vec3 lightDir = normalize(lightVspDir[0]*camU + lightVspDir[1]*camV + lightVspDir[2]*camN);  vec3 lightDir = normalize(lightVspDir[0]*camU + lightVspDir[1]*camV + lightVspDir[2]*camN);
24    
25  real phongKa = 0.05;  real phongKa = 0.02;
26  real phongKd = 0.80;  real phongKd = 0.60;
27  real phongKs = 0.20;  real phongKs = 0.40;
28  real phongSp = 30.0;  real phongSp = 30.0;
29    
30  image(3)[] img = load ("../data/vox1-9.nrrd");  image(3)[] img = load ("../data/vox1-9.nrrd");
# Line 67  Line 67 
67            if (val > valOpacMin) {  // we have some opacity            if (val > valOpacMin) {  // we have some opacity
68                real opac = min(1.0, lerp(0.0, 1.0, valOpacMin, val, valOpacMax));                real opac = min(1.0, lerp(0.0, 1.0, valOpacMin, val, valOpacMax));
69                real ld = lightDir • norm;                real ld = lightDir • norm;
70                  real hd = norm • normalize(lightDir + normalize(camEye - rayPos));
71                real mat = (  phongKa                real mat = (  phongKa
72                            + phongKd*(ld if ld > 0.0 else 0.0)                            + phongKd*(ld if ld > 0.0 else 0.0)
73                            + phongKs*(pow(ld, phongSp) if ld > 0.0 else 0.0));                            + phongKs*(pow(hd, phongSp) if hd > 0.0 else 0.0));
74                gray = gray + transp*opac*mat;                gray = gray + transp*opac*mat;
75                transp = transp*(1.0 - opac);                transp = transp*(1.0 - opac);
76            }            }

Legend:
Removed from v.776  
changed lines
  Added in v.778

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