Skip to content

Instantly share code, notes, and snippets.

@hakanai
Last active September 21, 2021 02:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hakanai/9baa46101488f5b857bc7a823a7231fd to your computer and use it in GitHub Desktop.
Save hakanai/9baa46101488f5b857bc7a823a7231fd to your computer and use it in GitHub Desktop.
RFL File Format Notes

RFL File Format Notes

The RFL file format was used by Wavefront's Advanced Visualizer software to store "spectral curve data", which is essentially a way to encode the response of a material to different wavelengths of light.

The docs for the MTL file format frequently refer to this format, but never seem to include the documentation for the format.

To that end, I have acquired some sample files in this format and will attempt to document the format based on what I see in the samples.

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.

!
! material information for copper
! Source: TPM, v.7, p.158, analyzed curve
! Condition: electropolished
! Temperature: 298 K
! Incident Angle: 0
! Solid Angle: 2pi
!
n .44
k 3.2
350 .330
400 .400
450 .470
500 .610
550 .780
600 .920
650 .960
700 .970
850 .970
!
! Standard CIE D6500 illuminant
! from:
! Judd and Wyszecki
! Color in Business, Science, and Industry
! table 2.1 pp.108-109
! normalized to approx 1.00 at 560nm
!
300 0.0003
310 0.0330
320 0.2020
330 0.3710
340 0.3990
350 0.4490
360 0.4660
370 0.5210
380 0.5000
390 0.5460
400 0.8280
410 0.9150
420 0.9340
430 0.8670
440 1.0490
450 1.1700
460 1.1780
470 1.1490
480 1.1590
490 1.0880
500 1.0940
510 1.0780
520 1.0480
530 1.0770
540 1.0440
550 1.0400
560 1.0000
570 0.9630
580 0.9580
590 0.8870
600 0.9000
610 0.8960
620 0.8770
630 0.8330
640 0.8370
650 0.8000
660 0.8020
670 0.8230
680 0.7830
690 0.6970
700 0.7160
710 0.7430
720 0.6160
730 0.6990
740 0.7510
750 0.6360
760 0.4640
770 0.6680
780 0.6340
790 0.6430
800 0.5950
810 0.5200
820 0.5740
830 0.6030
!
! Identity material - 100% reflection at all wavelengths.
! This material has been created for convenience and
! does not represent a real material.
!
300 1.000
830 1.000
# Tin ( TPM 7-716, from absorptance curve 1)
346 .340
397 .525
525 .707
745 .744
835 .760
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment