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

SCM Repository

[diderot] Diff of /branches/charisee_dev/examples/moe/moe-byhand.diderot
ViewVC logotype

Diff of /branches/charisee_dev/examples/moe/moe-byhand.diderot

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

revision 3312, Fri Oct 16 20:11:52 2015 UTC revision 3313, Sat Oct 17 00:33:40 2015 UTC
# Line 19  Line 19 
19  field#0(3)[3] g= ∇V;  field#0(3)[3] g= ∇V;
20  field#0(3)[3,3] H =  ∇⊗∇V;  field#0(3)[3,3] H =  ∇⊗∇V;
21  field#0(3)[3,3,3] T =  ∇⊗∇⊗∇V;  field#0(3)[3,3,3] T =  ∇⊗∇⊗∇V;
   
 //tmp  
22  field#0(3)[] M = |g|;  field#0(3)[] M = |g|;
23  field#0(3)[3] N = g/M;  field#0(3)[3] N = g/M;
24  field#0(3)[3] t0 = g•H+ H•g;  field#0(3)[3] t0 = g•H+ H•g;
25  field#0(3)[3] t2 = (1/2)*t0/M;  field#0(3)[3] t2 = (1/2)*t0/M;
26  field#0(3)[3,3] t3 = H•H+ g•T+ T•g+H•H;  field#0(3)[3,3] t3 = H•H+ g•T+ T•g+H•H;
 field#0(3)[3,3] t5 =(1/2)*(t3*M-t0⊗t2)/(M*M);  
   
   
 field#0(3)[3,3] t4 = (H*M- g⊗t2)/M*M;   // ∇N  
 field#0(3)[] S = N•t5•N;                // ∇V/|∇V| • ∇⊗∇(|∇V|) • ∇V/|∇V|  
 field#0(3)[] F = -t2•N;                 //-∇(|∇V|) • ∇V/|∇V|;  
 field#0(3)[3] dF =(-1/2)*(((t0/M)•t4)+N•t3);  
   
27  input real smax = -10;  input real smax = -10;
28    
29  function real alpha(real v, real g) = clamp(0, 1, 1.3*(1 - |v|/(g*thickness)));  function real alpha(real v, real g) = clamp(0, 1, 1.3*(1 - |v|/(g*thickness)));
30    
31  field#0(1)[3] cmap = tent ⊛ image("moe-isobow.nrrd");  field#0(1)[3] cmap = tent ⊛ image("moe-isobow.nrrd");
32  function vec3 color(vec3 x) = cmap(clamp(-1200,3300,V(x)));  function vec3 color(vec3 x) = cmap(clamp(-1200,3300,V(x)));
33  function real mask(vec3 x) = 1.0 if (S(x) < smax) else 0.0; // NOTISO  function real mask(vec3 x) = 1.0 if (N(x)•((1/2)*(t3(x)*M(x)-t0(x)⊗t2(x))/(M(x)*M(x)))•N(x) < smax) else 0.0; // NOTISO
34    
35  // (boilerplate) computation of camera and light info  // (boilerplate) computation of camera and light info
36  real camDist = |camAt - camEye|;  real camDist = |camAt - camEye|;
# Line 64  Line 55 
55    update {    update {
56      vec3 x = camEye + rayN*rayVec;      vec3 x = camEye + rayN*rayVec;
57      if (inside(x,V)) {      if (inside(x,V)) {
58        real val = F(x);        real val =  -t2(x)•N(x);
59        vec3 grad = -dF(x);        tensor[3,3] t4 = (H(x)*M(x)- g(x)⊗t2(x))/M(x)*M(x);   // ∇N
60          vec3 grad = -(-1/2)*(((t0(x)/M(x))•t4)+N(x)•t3(x));
61        real a = alpha(val, |grad|)*mask(x);        real a = alpha(val, |grad|)*mask(x);
62        if (a > 0) {  // we have some opacity        if (a > 0) {  // we have some opacity
63          a = 1 - pow(1-a, rayStep*|rayVec|/refStep);          a = 1 - pow(1-a, rayStep*|rayVec|/refStep);

Legend:
Removed from v.3312  
changed lines
  Added in v.3313

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