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 746, Wed Apr 6 18:19:21 2011 UTC revision 770, Thu Apr 7 20:42:13 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 = 4.0;  real camFOV = 5.0;
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.15;          // highest value with opacity 0.0  real valOpacMin = 0.05;          // highest value with opacity 0.0
11  real valOpacMax = 0.16;          // lowest value with opacity 1.0  real valOpacMax = 0.06;          // lowest value with opacity 1.0
12    
13   // HEY: update this camera code when possible, based on eventual   // HEY: update this camera code when possible, based on eventual
14  // improvements to mip-cam.diderot  // improvements to mip-cam.diderot
# Line 37  Line 37 
37    
38  strand RayCast (int ui, int vi)  strand RayCast (int ui, int vi)
39  {  {
40      real rayU = 2.0*camUmax*(real(ui) + 0.5)/real(imgResU) - camUmax;      real rayU = lerp(-camUmax, camUmax, -0.5, real(ui), real(imgResU)-0.5);
41      real rayV = 2.0*camVmax*(real(vi) + 0.5)/real(imgResV) - camVmax;      real rayV = lerp(-camVmax, camVmax, -0.5, real(vi), real(imgResV)-0.5);
42      vec3 rayVec = (camDist*camN + rayU*camU + rayV*camV)/camDist;      vec3 rayVec = (camDist*camN + rayU*camU + rayV*camV)/camDist;
43      vec3 rayDir = rayVec/|rayVec|;      vec3 rayDir = rayVec/|rayVec|;
44    
# Line 46  Line 46 
46      // ########## BEGIN per-ray initialization      // ########## BEGIN per-ray initialization
47      real transp = 1.0;      real transp = 1.0;
48      real gray = 0.0;      real gray = 0.0;
49        int myui = ui;
50        int myvi = vi;
51      output vec4 rgba = [0.0, 0.0, 0.0, 0.0];      output vec4 rgba = [0.0, 0.0, 0.0, 0.0];
52      // ##########  END  per-ray initialization      // ##########  END  per-ray initialization
53    
# Line 56  Line 58 
58            // ########## BEGIN per-sample code            // ########## BEGIN per-sample code
59            real val = 0.0;            real val = 0.0;
60            vec3 grad = [0.0,0.0,0.0];            vec3 grad = [0.0,0.0,0.0];
61            // HEY (BUG): looks like the strand parameters (e.g. ui, vi) can't            // HEY (scoping BUG): the strand parameters (e.g. ui, vi) can't
62            // appear in conditionals            // appear in conditionals
63            if (ui < 100) {            if (myui + myvi < imgResU) {
64               val = Fc0@rayPos;               val = Fc0@rayPos;
65               grad = ∇Fc0@rayPos;               grad = ∇Fc0@rayPos;
66            } else {            } else {
# Line 67  Line 69 
69            }            }
70            vec3 norm = -grad/|grad|;            vec3 norm = -grad/|grad|;
71            if (val > valOpacMin) {  // we have some opacity            if (val > valOpacMin) {  // we have some opacity
72                real opac =                real opac = min(1.0, lerp(0.0, 1.0, valOpacMin, val, valOpacMax));
                  1.0 if (val > valOpacMax)  
                  else (val - valOpacMin)/(valOpacMax - valOpacMin);  
73                real ld = dot(lightDir,norm);                real ld = dot(lightDir,norm);
74                real mat = (  phongKa                real mat = (  phongKa
75                            + phongKd*(ld if ld > 0.0 else 0.0)                            + phongKd*(ld if ld > 0.0 else 0.0)

Legend:
Removed from v.746  
changed lines
  Added in v.770

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