New rtcontrib program

Hi All,

Somewhat related to the light pipe discussion, I have just completed work on a new utility called "rtcontrib," for computing arbitrary light contributions. This is a culmination of earlier work I did on rtrace to allow for the correct reporting of ray weights in trace output (the new -oTW option), which I mentioned on radiance-dev a little over a month ago. The benefits of this facility will not really be felt or known until a third (C-shell script) layer is added for calculating daylight coefficients and the like. Right now, the simplest thing you can do with rtcontrib is arrive at a set of images corresponding to the different light sources in your scene, such that you can recombine them with dimming multipliers to simulate lighting controls. An example of this is given in the man page, attached.

Rtcontrib can also be used by the more adventurous among you to compute input/output relations for devices such as light pipes and shading systems, although I have yet to test such an approach, myself. I expect we'll be learning more about what one can do with this in the coming months, and I hope to work with Christoph Reinhart and John Mardaljevic on standardizing daylight coefficient calculations for starters.

-Greg

···

---------

RTCONTRIB(1) RTCONTRIB(1)

NAME
        rtcontrib - compute contributions in a RADIANCE scene

SYNOPSIS
        rtcontrib [ -n nprocs ][ -e expr ][ -f source ][ -o fspec ][ -b binv ]
        -m mod .. [ $EVAR ] [ @file ] [ rtrace options ] octree

DESCRIPTION
        Rtcontrib computes ray contributions (i.e., color coefficients) for
        objects whose modifiers are named in one or more -m settings. These
        modifiers are usually materials associated with light sources or sky
        domes, and must directly modify some geometric primitives to be consid-
        ered in the output. The output of rtcontrib has many potential uses.
        Source contributions can be used as components in linear combination to
        reproduce any desired variation, e.g., simulating lighting controls or
        changing sky conditions via daylight coefficients. More generally,
        rtcontrib can be used to compute arbitrary input-output relationships
        in optical systems, such as luminaires, light pipes, and shading
        devices.

        Rtcontrib calls rtrace(1) to calculate the contributions for each input
        ray, and the output tallies are sent to one or more files according to
        the -o specification. If an output specification contains a "%s" for-
        mat, this will be replaced by the modifier name. The -b option may be
        used to further define a "bin number" within each object if finer reso-
        lution is needed, and this will be applied to a "%d" format in the out-
        put file specification if present. The actual bin number is computed
        at run time based on ray direction and surface intersection, as
        described below. The most recent -b and -o options to the left of each
        -m setting affect only that modifier. (The ordering of other options
        is unimportant.)

        If a -b expression is defined for a particular modifier, the bin number
        will be evaluated at run time for each ray contribution from rtrace.
        Specifically, each ray's world intersection point will be assigned to
        the variables Px, Py, and Pz, and the normalized ray direction will be
        assigned to Dx, Dy, and Dz. These parameters may be combined with def-
        initions given in -e arguments and files read using the -f option. The
        computed bin value will be rounded to the nearest whole number. This
        mechanism allows the user to define precise regions or directions they
        wish to accumulate, such as the Tregenza sky discretization, which
        would be otherwise impossible to specify as a set of RADIANCE primi-
        tives. The rules and predefined functions available for these expres-
        sions are described in the rcalc(1) man page.

        If no -o specification is given, results are written on the standard
        output in order of modifier (as given on the command line) then bin
        number. Concatenated data is also sent to a lone output file (i.e., an
        initial -o specification without formatting strings). If a "%s" format
        appears but no "%d" in the -o specification, then each modifier will
        have its own output file, with multiple values per record in the case
        of a non-zero -b definition. If a "%d" format appears but no "%s",
        then each bin will get its own output file, with modifiers output in
        order in each record. For text output, each RGB coefficient triple is
        separated by a tab, with a newline at the end of each ray record. For
        binary output formats, there is no such delimiter to mark the end of
        each record.

        Input and output format defaults to plain text, where each ray's origin
        and direction (6 real values) are given on input, and one line is pro-
        duced per output file per ray. Alternative data representations may be
        specified by the -f[io] option, which is described in the rtrace man
        page along with the associated -x and -y resolution settings. In par-
        ticular, the color ('c') output data representation together with posi-
        tive dimensions for -x and -y will produce an uncompressed RADIANCE
        picture, suitable for manipulation with pcomb(1) and related tools.

        If the -n option is specified with a value greater than 1, multiple
        rtrace processes will be used to accelerate computation on a shared
        memory machine. Note that there is no benefit to using more processes
        than there are local CPUs available to do the work, and the rtcontrib
        process itself may use a considerable amount of CPU time.

        Options may be given on the command line and/or read from the environ-
        ment and/or read from a file. A command argument beginning with a dol-
        lar sign ('$') is immediately replaced by the contents of the given
        environment variable. A command argument beginning with an at sign
        ('@') is immediately replaced by the contents of the given file.

EXAMPLES
        To compute the proportional contributions from sources modified by
        "light1" vs. "light2" on a set of illuminance values:

          rtcontrib -I+ @render.opt -o c_%s.dat -m light1 -m light2 \
         scene.oct < test.dat

        To generate a pair of images corresponding to these two lights' contri-
        butions:

          vwrays -ff -x 1024 -y 1024 -vf best.vf | rtcontrib -ffc \
         `vwrays -d -x 1024 -y 1024 -vf best.vf` @render.opt \
          -o c_%s.pic -m light1 -m light2 scene.oct

        These images may then be recombined using the desired outputs of light1
        and light2:

          pcomb -c 100 90 75 c_light1.pic -c 50 55 57 c_light2.pic \
         > combined.pic

        To compute an array of illuminance contributions according to a Tre-
        genza sky:

          rtcontrib -b tbin -o sky.dat -m skyglow -b 0 -o ground.dat \
          -m groundglow @render.opt -f tregenza.cal scene.oct < test.dat

AUTHOR
        Greg Ward

SEE ALSO
        cnt(1), getinfo(1), pcomb(1), pfilt(1), ra_rgbe(1), rcalc(1), rpict(1),
        rtrace(1), vwrays(1), ximage(1)

RADIANCE 5/25/05 RTCONTRIB(1)