Opened 15 years ago

Closed 15 years ago

#799 closed defect (fixed)

[with patch, with positive review] tachyon bug

Reported by: was Owned by: was
Priority: major Milestone: sage-2.8.15
Component: packages: standard Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges


I think I may have found a bug.

When using Tachyon and defining a texture, the seventh parameter you
can set is texfunc.
If that value is set to anything but zero, then no picture is

As an example:

t = Tachyon(xres=800, yres=600, camera_center=(2,7,4),
look_at=(2,0,0), raydepth=24)
t.light((10,3,4), 1, (1,1,1))
t.light((10,-3,4), 1, (1,1,1))
t.texture('black', color=(0,0,0))
t.texture('mirror', ambient=0.05, diffuse=0.05, specular=.9,
opacity=1.0, color=(.9,.9,.9))
t.texture('grey', color=(.8,.8,.8), texfunc=0)
t.sphere((4,-1,1), 1, 'mirror')

The above produces a nice picture.  If you change to "texfunc=2" in
line 6, then there is no output.

Texfunc should have the following allowed values

Value for TEXFUNC    Mapping and Texture Description
     0              No special texture, plain shading
     1              3D checkerboard function, like a rubik's cube
     2              Grit Texture, randomized surface color
     3              3D marble texture, uses object's base color
     4              3D wood texture, light and dark brown, not very
good yet
     5              3D gradient noise function (can't remember what
it look like
     6              Don't remember
     7              Cylindrical Image Map, requires ppm filename
     8              Spherical Image Map, requires ppm filename
     9              Planar Image Map, requires ppm filename

I'm sorry if this is really a bug in Tachyon and not a problem with
how Sage talks with Tachyon.  I am just not (yet) skilled enough to
tell the difference.  I need to figure out how to run Tachyon stand-
alone and see if the bug still exists.  But, I don't know how yet.
So, my apologies if this should be reported to the Tachyon developers.

Many thanks for your bug report.

By the way, even if it is a Tachyon bug, we really want to know about it, so we can program around it and/or fix it.


Attachments (2)

trac799-part1.patch (4.0 KB) - added by was 15 years ago.
trac799-part2.patch (813 bytes) - added by was 15 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 15 years ago by was

From Leif Hille 

I dunno if this is the right way to comment on bugs however, I ran into the same problem as the ticket's author. This "bug" ticket is part bug, part user error (or poor documentation).  

(1) The user error part: In order to create a texture using a number other than zero, you have to pass in a .texfunc() object.  

(2) The bug part: There is a problem with the plot/ function that prevents additional key parameters from being passed in.  

    t.texture('grey', color=(.5,.5,.5), texfunc=0)  --> this works
    t.texture('dk_grey', color=(0.8,0.8,0.8),textfunc=1) --> this causes subsequent command to fail.  

(1) While the t.texture(...) function allows for 'texfunc=0' as an argument, for any number greater than 0, it expects a texfunc object.

t.texture('grey', color=(.5,.5,.5), texfunc=r)

This is not evident from the inline help & the interface doesn't complain when it's passed bad input - it just fails when is called (verbose mode reveals the tachyon parser's complaints).

(2) The bug is that some of the predefined numbered textures require additional string input (eg. a file name for a texture map image/data) immediately after the texture number.  The texture number is passed in as a number.  I've made a workaround, making the "type" parameter into a string(see changes below), allowing for filenames to be specified when the texture number calls for it.  This is still a little troublesome in that because it's not obvious to me how to reference filenames of graphics created within Sage (maybe there should there be a toplevel "fileref" method to get a filesystem path reference to existing graphic image or dataset).  The same filereference problem presents if the user wants to use another graphic or datafile as a texture map.  

##from : .../plot/
 class Texfunc:
  def __init__(self, type=0,center=(0,0,0), rotate=(0,0,0), scale=(1,1,1)):
     self._type = type
     self._center = center
     self._rotate = rotate
     self._scale = scale

  def str(self):
     if type == 0:
          return "0"
#  Old Code
#     return """%d center %s rotate %s scale %s"""%(self._type,          # <-- number
#                                                   >tostr(self._center),
#                                                   >tostr(self._rotate),
#                                                    tostr(self._scale))
# new code:
     return """%s center %s rotate %s scale %s"""%(tostr(self._type),          # <-- string

Changed 15 years ago by was

Changed 15 years ago by was

comment:2 Changed 15 years ago by was

  • Milestone changed from sage-2.10 to sage-2.8.15
  • Summary changed from tachyon bug to [with patch] tachyon bug

comment:3 Changed 15 years ago by cwitty

  • Summary changed from [with patch] tachyon bug to [with patch, with positive review] tachyon bug

These patches are definitely an improvement, and should go in.

There's still some more work to be done (documentation at least, perhaps some code too) to be able to use the full power of tachyon (like texture maps); but that can wait for later.

comment:4 Changed 15 years ago by mabshoff

  • Resolution set to fixed
  • Status changed from new to closed

Merged in 2.8.15.alpha2.

Note: See TracTickets for help on using tickets.