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

SCM Repository

[diderot] Diff of /branches/vis12/test/vr-curv-quad.diderot
ViewVC logotype

Diff of /branches/vis12/test/vr-curv-quad.diderot

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

revision 2676, Wed Jul 23 02:43:37 2014 UTC revision 2677, Mon Jul 28 16:40:33 2014 UTC
# Line 3  Line 3 
3  // Demonstration of curvature-based transfer functions in volume rendering  // Demonstration of curvature-based transfer functions in volume rendering
4  //  //
5  // process output with:  // process output with:
6  // unu reshape -i vr-curv-quad.txt -s 4 480 345 | overrgb -i - -b 0.1 0.15 0.2 -g 1.2 -o - | unu quantize -b 8 -min 0 -max 255  -o vr-curv-quad.png  // overrgb -i outRGBA.nrrd -b 0.1 0.15 0.2 -g 1.2 -o - | unu quantize -b 8 -min 0 -max 255 -o vr-curv-quad.png
7    
8  // volume dataset  // volume dataset
9  field#2(3)[] F = c4hexic ⊛ image("../data/quad-patches-pad.nrrd");  field#2(3)[] F = bspln3 ⊛ image("../data/quad-patches-pad.nrrd");
10    
11  // RGB colormap of (kappa1,kapp2)  // RGB colormap of (kappa1,kapp2)
12  field#0(2)[3] RGB = tent ⊛ image("../data/txf/2d-bow.nrrd");  field#0(2)[3] RGB = tent ⊛ image("../data/txf/2d-bow.nrrd");
13    
14  // set camera, image, and rendering parameters  // set camera, image, and rendering parameters
15  vec3 camEye = [183.021, -411.857, 686.458];  vec3 camEye = [183.021, -411.857, 686.458];
16  vec3 camAt = [55.4037, 40.2407, 4.32732];  input bool camOrtho = false;
17    vec3 camAt = [55.4037, 40.2407, 0];
18  vec3 camUp = [0.0, 0.0, 1.0];  vec3 camUp = [0.0, 0.0, 1.0];
19  real camNear = -42.0;  real camNear = -42.0;
20  real camFar = 42.0;  real camFar = 42.0;
# Line 47  Line 48 
48  strand RayCast (int ui, int vi) {  strand RayCast (int ui, int vi) {
49      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);
50      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);
51      vec3 rayVec = (camDist*camN + rayU*camU + rayV*camV)/camDist;      vec3 rayVec = camN if camOrtho else (camDist*camN + rayU*camU + rayV*camV)/camDist;
52        vec3 rayEye = (rayU*camU + rayV*camV if camOrtho else [0,0,0]) + camEye;
53      vec3 vv = normalize(-rayVec);      vec3 vv = normalize(-rayVec);
54    
55      real rayN = camVspNear;      real rayN = camVspNear;
# Line 56  Line 58 
58      output vec4 outRGBA = [0.0, 0.0, 0.0, 0.0];      output vec4 outRGBA = [0.0, 0.0, 0.0, 0.0];
59    
60      update {      update {
61         vec3 pos = camEye + rayN*rayVec;         vec3 pos = rayEye + rayN*rayVec;
62         if (inside (pos,F)) {         if (inside (pos,F)) {
63            real val = F(pos);            real val = F(pos);
64            if (val > valOpacMin) {  // we have some opacity            if (val > valOpacMin) {  // we have some opacity

Legend:
Removed from v.2676  
changed lines
  Added in v.2677

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