#16263: directional lighting in tachyon
-------------------------------------+-------------------------------------
       Reporter:  niles              |        Owner:
           Type:  enhancement        |       Status:  new
       Priority:  minor              |    Milestone:  sage-6.3
      Component:  graphics           |   Resolution:
       Keywords:  tachyon            |    Merged in:
        Authors:                     |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:  u/niles/16263      |       Commit:
  /tachyon-lights                    |  84d0b894e5f34347220672f465a02350a641b890
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------
Changes (by niles):

 * commit:   => 84d0b894e5f34347220672f465a02350a641b890
 * branch:   => u/niles/16263/tachyon-lights


Comment:

 I've done a little with this and then put it down; I'm attaching what I
 have so it doesn't get lost.  The basic functionality is there, but needs
 to be documented.

 At the moment, it's not clear that directional lights really produce
 something drastically better than the standard trick of just putting a
 light *really* far away.  Here is some code I used for testing:

 {{{
 p = 3
 q = 5
 def K(s):
     """
     a (p,q) torus knot
     """
     var('t')
     r = cos(q*t + s) + 2
     x = fast_callable(r*cos(p*t + s),vars=[t])
     y = fast_callable(r*sin(p*t + s) ,vars=[t])
     z = fast_callable(-sin(q*t + s) ,vars=[t])
     def func(t):
         return (x(t),y(t),z(t))
     return func

 X = Tachyon(camera_center=(4,4,10))
 X.texture('t')
 X.texture('mirror', ambient=0.05, diffuse=0.05, specular=.9, opacity=0.9,
 color=(.8,.8,.8))
 X.texture('grey', color=(.8,.8,.8), texfunc=3)
 X.parametric_plot(K(0),0,2*pi,'t',min_depth=6)
 X.parametric_plot(K(pi/4),0,2*pi,'grey',min_depth=6)
 X.parametric_plot(K(-pi/4),0,2*pi,'mirror',min_depth=6)
 X.light((0,0,20),.5,(1,1,1))     # standard lights
 X.light((-10,0,10),.5,(1,1,1))

 Y = Tachyon(camera_center=(4,4,10))
 Y.texture('t')
 Y.texture('white',ambient=.8,diffuse=.8,specular=.1,color=(1,1,1))
 Y.texture('mirror', ambient=0.05, diffuse=0.05, specular=.9, opacity=0.9,
 color=(.8,.8,.8))
 Y.texture('grey', color=(.8,.8,.8), texfunc=3)
 Y.parametric_plot(K(0),0,2*pi,'t',min_depth=6)
 Y.parametric_plot(K(pi/4),0,2*pi,'grey',min_depth=6)
 Y.parametric_plot(K(-pi/4),0,2*pi,'mirror',min_depth=6)
 Y.plane((0,0,-20),(0,0,1),'white')
 Y.light((0,0,1),.5,(1,1,1),'directional')    # directional lights
 Y.light((-1,1,0),.5,(1,1,1),'directional')
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/16263#comment:2>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to