SCM Repository
[diderot] / trunk / doc / report / vr-lite.tex |
View of /trunk/doc/report/vr-lite.tex
Parent Directory
|
Revision Log
Revision 371 -
(download)
(as text)
(annotate)
Sat Oct 2 17:20:27 2010 UTC (10 years, 5 months ago) by jhr
File size: 1557 byte(s)
Sat Oct 2 17:20:27 2010 UTC (10 years, 5 months ago) by jhr
File size: 1557 byte(s)
Update example
\begin{lstlisting}[mathescape=true] input string dataFile; // name of dataset input real stepSz = 0.1; // size of steps input vec3 eye; // location of eye point input vec3 orig; // location of pixel (0,0) input vec3 cVec; // vector between pixels horizontally input vec3 rVec; // vector between pixels vertically input real opacMin; // highest value with opacity 0.0 input real opacMax; // lowest value with opacity 1.0 image(3)[] img = load (dataFile); field#1(3)[] F = img $\circledast$ bspln3; actor RayCast (int row, int col) { vec3 pos = orig + real(row)*rVec + real(col)*cVec; vec3 dir = (pos - eye)/|pos - eye|; real t = 0.0; real transp = 1.0; real gray = 0.0; output vec4 rgba = [0.0, 0.0, 0.0, 0.0]; update { pos = pos + stepSz*dir; if (inside (pos,F)) { real val = F@pos; vec3 grad = ($\nabla$ F)@pos; vec3 norm = -grad/|grad|; if (val > opacMin) { // we have some opacity real opac = 1.0 if (val > opacMax) else (val - opacMin)/(opacMax - opacMin); gray = gray + transp*opac*max(0.0, -dir $\cdot$ norm); transp = transp*(1.0 - opac); } } if (transp < 0.01) { // early ray termination transp = 0.0; stabilize; } else if (t > 40.0) stabilize; t = t + stepSz; } stabilize { rgba = [gray, gray, gray, 1.0-transp]; } } initially [ RayCast(r, c) | r in 0..199, c in 0..199 ]; \end{lstlisting}%
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |