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 827, Sat Apr 16 00:40:34 2011 UTC revision 1114, Thu May 5 04:39:15 2011 UTC
# Line 1  Line 1 
1    // process output with:
2    // unu reshape -i mip.txt -s 4 200 200 | overrgb -i - -b 0.1 0.15 0.2 -o - | unu quantize -b 8 -min 0 -max 255  -o vr-kcomp.png
3    
4  vec3 camEye = [25.0, 10.0, 8.0];  vec3 camEye = [25.0, 10.0, 8.0];
5  vec3 camAt = [0.0, 0.0, 0.0];  vec3 camAt = [0.0, 0.0, 0.0];
6  vec3 camUp = [0.0, 0.0, 1.0];  vec3 camUp = [0.0, 0.0, 1.0];
# Line 16  Line 19 
19  vec3 camN = normalize(camAt - camEye);  vec3 camN = normalize(camAt - camEye);
20  vec3 camU = normalize(camN × camUp);  vec3 camU = normalize(camN × camUp);
21  vec3 camV = camN × camU;  vec3 camV = camN × camU;
22  real camVmax = tan(camFOV*3.1415926536/360.0)*camDist;  real camVmax = tan(camFOV*π/360.0)*camDist;
23  real camUmax = camVmax*real(imgResU)/real(imgResV);  real camUmax = camVmax*real(imgResU)/real(imgResV);
24    
25  vec3 lightVspDir = [-1.0, -1.0, -3.5];  vec3 lightVspDir = [-1.0, -1.0, -3.5];
# Line 36  Line 39 
39      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);
40      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);
41      vec3 rayVec = (camDist*camN + rayU*camU + rayV*camV)/camDist;      vec3 rayVec = (camDist*camN + rayU*camU + rayV*camV)/camDist;
42      vec3 rayDir = normalize(rayVec);      vec3 vv = normalize(-rayVec);
43    
44      real rayN = camVspNear;      real rayN = camVspNear;
45      // ########## BEGIN per-ray initialization      // ########## BEGIN per-ray initialization
46      real transp = 1.0;      real transp = 1.0;
47      real gray = 0.0;      real gray = 0.0;
     int myui = ui;  
     int myvi = vi;  
     field#1(3)[] myFc0 = Fc0;  
     field#1(3)[] myFc1 = Fc1;  
48      output vec4 rgba = [0.0, 0.0, 0.0, 0.0];      output vec4 rgba = [0.0, 0.0, 0.0, 0.0];
49      // ##########  END  per-ray initialization      // ##########  END  per-ray initialization
50    
# Line 56  Line 55 
55            // ########## BEGIN per-sample code            // ########## BEGIN per-sample code
56            real val = 0.0;            real val = 0.0;
57            vec3 norm = [0.0,0.0,0.0];            vec3 norm = [0.0,0.0,0.0];
58            // HEY (scoping BUG): the strand parameters (e.g. ui, vi) can't            if (ui + vi < imgResU) {
59            // appear in conditionals               val = Fc0@rayPos;
60            if (myui + myvi < imgResU) {               norm = normalize(-∇Fc0@rayPos);
              val = myFc0@rayPos;  
              norm = normalize(-∇myFc0@rayPos);  
61            } else {            } else {
62               val = myFc1@rayPos;               val = Fc1@rayPos;
63               norm = normalize(-∇myFc1@rayPos);               norm = normalize(-∇Fc1@rayPos);
64            }            }
65            if (val > valOpacMin) {  // we have some opacity            if (val > valOpacMin) {  // we have some opacity
66                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));
67                real ld = lightDir • norm;                real ld = lightDir • norm;
68                real hd = norm • normalize(lightDir + normalize(camEye - rayPos));                real hd = norm • normalize(lightDir + vv);
69                real mat = (  phongKa                real mat = (  phongKa
70                            + phongKd*(ld if ld > 0.0 else 0.0)                            + phongKd*(ld if ld > 0.0 else 0.0)
71                            + phongKs*(hd^phongSp if hd > 0.0 else 0.0));                            + phongKs*(hd^phongSp if hd > 0.0 else 0.0));

Legend:
Removed from v.827  
changed lines
  Added in v.1114

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