Object Identifier

Hi,
I’d like to modify rtrace so it prints a unique identifier for each surface that a ray hits (possibly just the first one). Where can I find this unique identifier (assuming it exists)?

Thanks

Hi,

It is possible that for your use case you do not need to modify rtrace. You can use the -o flag to get this information:

   -ospec    Produce output fields according to spec.  Characters are interpreted as follows:

             o    origin (input)

             d    direction (normalized)

             v    value (radiance)

             V    contribution (radiance)

             w    weight

             W    color coefficient

             l    effective length of ray

             L    first intersection distance

             c    local (u,v) coordinates

             p    point of intersection

             n    normal at intersection (perturbed)

             N    normal at intersection (unperturbed)

             s    surface name

             m    modifier name

             M    material name

             r    mirrored value contribution

             x    unmirrored value contribution

             R    mirrored ray length

             X    unmirrored ray length

             ~    tilde (end of trace marker)

             If the letter 't' appears in spec, then the fields following will be printed for every ray traced, not just the final
             result.  If the capital letter 'T' is given instead of 't', then all rays will be reported, including shadow testing rays
             to light sources.  Spawned rays are indented one tab for each level.  The tilde marker ('~') is a handy way of
             differentiating the final ray value from daughter values in a traced ray tree, and usually appears right before the 't'
             or 'T' output flags.  E.g., -ov~TmW will emit a tilde followed by a tab at the end of each trace, which can be easily
             distinguished even in binary output.

             Note that there is no space between this option and its argument.

It sounds like you want to specify -on. This value is however not guaranteed to be unique, so you can edit your scene files as you need to determine the format of the surface name and ensure uniqueness.

If you are looking to access the unique ID issued by radiance, look in common/modobject.c:objndx() and consider calling this function as a replacement to fputs(r->ro->oname, stdout); in rt/rtrace.c:oputs() this is the function called when “n” is included as one of the output flags as specified above. I wouldn’t expect this number to be so useful though, as I don’t think it can be traced back to anything in your scene files after run time.

I think you mean “-os”. Otherwise correct. Uniqueness depends on how the scene was created.

-Greg

whoops… must be because n and s are so close on the keyboard :male_detective: