SCM Repository
[diderot] / branches / pure-cfg / test / mip-cam.diderot |
View of /branches/pure-cfg/test/mip-cam.diderot
Parent Directory
|
Revision Log
Revision 776 -
(download)
(annotate)
Thu Apr 7 21:50:30 2011 UTC (11 years, 2 months ago) by glk
File size: 2305 byte(s)
Thu Apr 7 21:50:30 2011 UTC (11 years, 2 months ago) by glk
File size: 2305 byte(s)
camera tweaks, and more consistent use of normalize
// mip-cam // // initial demo of what could be boilerplate camera code, // for maximum intensity projection //string dataFile = "../data/txs-pad3.nrrd"; //vec3 camEye = [25.0, 15.0, 10.0]; //vec3 camAt = [3.0, 3.0, 3.0]; //vec3 camUp = [0.0, 0.0, 1.0]; //real camNear = -5.0; //real camFar = 5.0; //real camFOV = 18.0; //int imgResU = 320; //int imgResV = 240; //real rayStep = 0.1; string dataFile = "../data/vfrhand-nohip.nhdr"; vec3 camEye = [127.331, -1322.05, 272.53]; vec3 camAt = [63.0, 82.6536, 101.999]; vec3 camUp = [0.9987, 0.0459166, -0.0221267]; real camNear = -78.0; real camFar = 78.0; real camFOV = 5.0; int imgResU = 320; int imgResV = 240; real rayStep = 1.0; // HEY (want) it would be nice if we could have initializing statements... // (though motivation for this here has been resolved) real camDist = |camAt - camEye|; real camVspNear = camNear + camDist; real camVspFar = camFar + camDist; vec3 camN = normalize(camAt - camEye); vec3 camU = normalize(camN × camUp); vec3 camV = camN × camU; real camVmax = tan(camFOV*3.1415926536/360.0)*camDist; real camUmax = camVmax*real(imgResU)/real(imgResV); image(3)[] img = load (dataFile); //field#2(3)[] F = img ⊛ bspln3; field#0(3)[] F = img ⊛ tent; strand RayCast (int ui, int vi) { real rayU = lerp(-camUmax, camUmax, -0.5, real(ui), real(imgResU)-0.5); real rayV = lerp(-camVmax, camVmax, -0.5, real(vi), real(imgResV)-0.5); // HEY (BUG) C syntax error; // generated C code looks like "(float)p_ui_0--0.5e0f" //real rayU = 2.0*camUmax*(real(ui) - -0.5)/real(imgResU) - camUmax; //real rayV = 2.0*camVmax*(real(vi) - -0.5)/real(imgResV) - camVmax; vec3 rayVec = (camDist*camN + rayU*camU + rayV*camV)/camDist; real rayN = camVspNear; // ########## BEGIN per-ray initialization output real maxval = 0.0; // ########## END per-ray initialization update { vec3 rayPos = camEye + rayN*rayVec; if (inside (rayPos,F)) { // ########## BEGIN per-sample code maxval = max(maxval, F@rayPos); // ########## END per-sample code } if (rayN > camVspFar) stabilize; rayN = rayN + rayStep; } /* render: output maxval */ } initially [ RayCast(ui, vi) | vi in 0..(imgResV-1), ui in 0..(imgResU-1) ];
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |