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 770, Thu Apr 7 20:42:13 2011 UTC revision 776, Thu Apr 7 21:50:30 2011 UTC
# Line 10  Line 10 
10  real valOpacMin = 0.05;          // highest value with opacity 0.0  real valOpacMin = 0.05;          // highest value with opacity 0.0
11  real valOpacMax = 0.06;          // lowest value with opacity 1.0  real valOpacMax = 0.06;          // lowest value with opacity 1.0
12    
  // HEY: update this camera code when possible, based on eventual  
 // improvements to mip-cam.diderot  
13  real camDist = |camAt - camEye|;  real camDist = |camAt - camEye|;
14  real camVspNear = camDist + camNear;  real camVspNear = camNear + camDist;
15  real camVspFar = camDist + camFar;  real camVspFar = camFar + camDist;
16  vec3 camN = (camAt - camEye)/camDist;  vec3 camN = normalize(camAt - camEye);
17  vec3 tmp0 = cross(camN,camUp);  vec3 camU = normalize(camN × camUp);
18  vec3 camU = tmp0/|tmp0|;  vec3 camV = camN × camU;
 vec3 camV = cross(camN,camU);  
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 = [0.9, -1.0, -2.5];
23  vec3 tmp2 = lightVspDir[0]*camU + lightVspDir[1]*camV + lightVspDir[2]*camN;  vec3 lightDir = normalize(lightVspDir[0]*camU + lightVspDir[1]*camV + lightVspDir[2]*camN);
 vec3 lightDir = tmp2/|tmp2|;  
24    
25  real phongKa = 0.05;  real phongKa = 0.05;
26  real phongKd = 0.80;  real phongKd = 0.80;
# Line 40  Line 36 
36      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);
37      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);
38      vec3 rayVec = (camDist*camN + rayU*camU + rayV*camV)/camDist;      vec3 rayVec = (camDist*camN + rayU*camU + rayV*camV)/camDist;
39      vec3 rayDir = rayVec/|rayVec|;      vec3 rayDir = normalize(rayVec);
40    
41      real rayN = camVspNear;      real rayN = camVspNear;
42      // ########## BEGIN per-ray initialization      // ########## BEGIN per-ray initialization
# Line 67  Line 63 
63               val = Fc1@rayPos;               val = Fc1@rayPos;
64               grad = ∇Fc1@rayPos;               grad = ∇Fc1@rayPos;
65            }            }
66            vec3 norm = -grad/|grad|;            vec3 norm = normalize(-grad);
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 = dot(lightDir,norm);                real ld = lightDir • norm;
70                real mat = (  phongKa                real mat = (  phongKa
71                            + phongKd*(ld if ld > 0.0 else 0.0)                            + phongKd*(ld if ld > 0.0 else 0.0)
72                            + phongKs*(pow(ld, phongSp) if ld > 0.0 else 0.0));                            + phongKs*(pow(ld, phongSp) if ld > 0.0 else 0.0));

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

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