Search code examples
3dwavefront

Wavefront Obj Materials, .rfl Files


I have been working a bit on creating a fully featured Wavefront object materials parser, and while reading the specification I came across references to a ".rfl" file. However, I am unable to find any more information about this file.

Supposedly, there should be more information about in 'chapter 8, "Spectral Curve File (.rfl)"' of the "File Formats: Version 4.2", by Alias|Wavefront inc, but I'm not able to locate that either.

Does anyone know anything more about this file? I'm aware that the lack of information on it likely means it is unused and unnecessary, but I'm interested in knowing about it nonetheless.


Solution

  • I'm still yet to get my hands on the documentation, but I can at least describe the format at this point.

    I have documented the format here but I will also embed an edited copy here just in case.

    Aside: I will also note that I have discovered that this format is inadequate for representing real materials in ray tracing and am working at making my own ray tracer deal better with modern data. Search for "complex refractive index" and read the Wikipedia article and other sources if you're interested in that.

    Overall format

    RFL files are plain-text, ASCII-encoded files.

    Blank lines, and lines starting with # or ! are ignored.

    Data point entries

    Each entry in an RFL file consists of two numbers, separated by whitespace and terminated by a new line:

    • A wavelength of light, in nanometres, usually seen as an integer but quite possibly accepting any decimal number.
    • A floating point number indicating the relative response to that kind of light. For RFL files used for materials, this value seems to be constrained to the range 0.0 to 1.0. For RFL files used for light sources, the value can exceed 1.0.

    Example:

    450 .470
    

    450nm light bounces off this surface retaining 47% of its brightness.

    If you have a wavelength of light which doesn't have its own entry, you could interpolate the nearby entries to find a suitable value. (Simple linear interpolation is probably good enough?)

    Unknown entries

    A couple of files contain the following extra entries:

    n .44
    k 3.2
    

    Because they are named n and k it is almost certainly relating to the refractive index, but the problem is, the refractive index differs at different wavelengths, so it is impossible to make good use of the data.