// 400-700 nm RGB equivalent, at 1nm spacing, based on
// http://scottburns.us/fast-rgb-to-spectrum-conversion-for-reflectances/
const vec3 WAVELENGTH_RGB[] = {
    vec3(0.028818291, 0.011877002, 0.959304707),
    vec3(0.028811021, 0.011877002, 0.959311977),
    vec3(0.028802781, 0.011877002, 0.959320217),
    vec3(0.028793521, 0.011877002, 0.959329477),
    vec3(0.02878296, 0.011877002, 0.959340038),
    vec3(0.028770917, 0.011877002, 0.95935208),
    vec3(0.028757342, 0.011877002, 0.959365656),
    vec3(0.028741827, 0.011877002, 0.959381171),
    vec3(0.02872419, 0.011877002, 0.959398808),
    vec3(0.028704048, 0.011877002, 0.95941895),
    vec3(0.028681031, 0.011886657, 0.959432313),
    vec3(0.02865476, 0.011897721, 0.959447519),
    vec3(0.028624766, 0.011910316, 0.959464919),
    vec3(0.028590487, 0.0119247, 0.959484814),
    vec3(0.028551637, 0.011941085, 0.959507279),
    vec3(0.028507641, 0.011959757, 0.959532602),
    vec3(0.028457679, 0.011980956, 0.959561366),
    vec3(0.028401308, 0.012005032, 0.959593661),
    vec3(0.028337507, 0.012032367, 0.959630128),
    vec3(0.028265518, 0.012063369, 0.959671114),
    vec3(0.028184712, 0.012098436, 0.959716853),
    vec3(0.028093938, 0.012138183, 0.959767881),
    vec3(0.027992225, 0.01218309, 0.959824687),
    vec3(0.027878758, 0.012233713, 0.959887532),
    vec3(0.027752728, 0.012290715, 0.95995656),
    vec3(0.027613202, 0.012354682, 0.960032118),
    vec3(0.027459639, 0.012426334, 0.96011403),
    vec3(0.027291406, 0.012506237, 0.96020236),
    vec3(0.027108029, 0.012595103, 0.960296871),
    vec3(0.026909351, 0.01269359, 0.960397062),
    vec3(0.026695068, 0.012802303, 0.960502632),
    vec3(0.026465327, 0.012922024, 0.960612653),
    vec3(0.02621978, 0.013053697, 0.960726528),
    vec3(0.02595819, 0.013198476, 0.960843339),
    vec3(0.025680593, 0.013357408, 0.960962004),
    vec3(0.025387006, 0.013531737, 0.961081261),
    vec3(0.02507752, 0.013722843, 0.961199642),
    vec3(0.024752635, 0.013932033, 0.961315337),
    vec3(0.024412905, 0.014160874, 0.961426226),
    vec3(0.02405883, 0.014411037, 0.961530138),
    vec3(0.023691176, 0.014684282, 0.961624548),
    vec3(0.02331084, 0.014982637, 0.961706529),
    vec3(0.022918745, 0.015308115, 0.961773146),
    vec3(0.02251608, 0.015663026, 0.9618209),
    vec3(0.022103926, 0.016049824, 0.961846257),
    vec3(0.021683511, 0.016471404, 0.961845091),
    vec3(0.021256027, 0.016930724, 0.961813257),
    vec3(0.020822729, 0.017431474, 0.961745804),
    vec3(0.020384772, 0.017977408, 0.961637827),
    vec3(0.019943276, 0.01857313, 0.961483602),
    vec3(0.019499471, 0.019223505, 0.961277031),
    vec3(0.019054471, 0.019934375, 0.961011161),
    vec3(0.018609424, 0.020711793, 0.960678791),
    vec3(0.018165471, 0.021562842, 0.960271695),
    vec3(0.017723519, 0.022495442, 0.959781047),
    vec3(0.017284601, 0.02351872, 0.959196687),
    vec3(0.016849621, 0.024643089, 0.958507298),
    vec3(0.016419409, 0.025880449, 0.957700149),
    vec3(0.015994666, 0.027244468, 0.956760874),
    vec3(0.015576139, 0.028750929, 0.95567294),
    vec3(0.015164369, 0.030417962, 0.954417677),
    vec3(0.014759893, 0.03226665, 0.952973465),
    vec3(0.01436327, 0.034321187, 0.951315551),
    vec3(0.013974834, 0.036609597, 0.949415576),
    vec3(0.013594951, 0.039164589, 0.947240469),
    vec3(0.01322398, 0.042024179, 0.944751849),
    vec3(0.012862081, 0.045232687, 0.94190524),
    vec3(0.012509509, 0.048841513, 0.938648986),
    vec3(0.012166415, 0.052910539, 0.934923054),
    vec3(0.011832836, 0.05750968, 0.930657491),
    vec3(0.011508938, 0.062721079, 0.925769991),
    vec3(0.011194664, 0.068641244, 0.9201641),
    vec3(0.010890006, 0.075385301, 0.913724701),
    vec3(0.010594921, 0.083088729, 0.906316358),
    vec3(0.010309243, 0.091912392, 0.897778373),
    vec3(0.010032852, 0.102044876, 0.887922279),
    vec3(0.00976562, 0.113708114, 0.876526273),
    vec3(0.009507356, 0.127159828, 0.863332823),
    vec3(0.009257866, 0.14269643, 0.848045711),
    vec3(0.0090169, 0.160651591, 0.830331517),
    vec3(0.008784129, 0.181390517, 0.809825361),
    vec3(0.008559389, 0.205290227, 0.786150391),
    vec3(0.008342333, 0.232698734, 0.75895894),
    vec3(0.008132602, 0.263880897, 0.727986508),
    vec3(0.007929888, 0.298929894, 0.693140225),
    vec3(0.007733877, 0.337660526, 0.654605604),
    vec3(0.007544324, 0.379519416, 0.612936267),
    vec3(0.007361023, 0.423563429, 0.569075555),
    vec3(0.007183855, 0.468553426, 0.524262725),
    vec3(0.007012745, 0.513160591, 0.479826671),
    vec3(0.006847712, 0.556197975, 0.436954319),
    vec3(0.006688746, 0.596774501, 0.39653676),
    vec3(0.006535881, 0.634336924, 0.359127201),
    vec3(0.006389133, 0.668637252, 0.324973622),
    vec3(0.006248471, 0.699655061, 0.294096474),
    vec3(0.006113831, 0.727519207, 0.266366969),
    vec3(0.00598516, 0.752443966, 0.24157088),
    vec3(0.005862418, 0.774683948, 0.219453641),
    vec3(0.005745439, 0.794504131, 0.199750437),
    vec3(0.005634161, 0.812162229, 0.182203618),
    vec3(0.005528477, 0.827899667, 0.166571863),
    vec3(0.005428285, 0.841936088, 0.152635634),
    vec3(0.0053335, 0.854469313, 0.140197194),
    vec3(0.005244008, 0.865675487, 0.129080512),
    vec3(0.005159746, 0.875710212, 0.11913005),
    vec3(0.00508063, 0.88471046, 0.110208918),
    vec3(0.005006586, 0.892796076, 0.102197347),
    vec3(0.004937545, 0.900072521, 0.094989942),
    vec3(0.00487342, 0.906632179, 0.08849441),
    vec3(0.004814165, 0.912555819, 0.082630025),
    vec3(0.004759755, 0.917913767, 0.077326487),
    vec3(0.004710142, 0.922768547, 0.07252132),
    vec3(0.004665292, 0.92717411, 0.068160607),
    vec3(0.004625163, 0.931178591, 0.064196255),
    vec3(0.004589756, 0.934823889, 0.060586364),
    vec3(0.004559076, 0.938146992, 0.057293941),
    vec3(0.004533115, 0.941180584, 0.05428631),
    vec3(0.004511878, 0.943953492, 0.05153464),
    vec3(0.004495412, 0.9464914, 0.049013197),
    vec3(0.004483749, 0.948816965, 0.046699295),
    vec3(0.004476933, 0.950950467, 0.044572609),
    vec3(0.004475011, 0.952909752, 0.042615247),
    vec3(0.004478088, 0.954710433, 0.040811489),
    vec3(0.004486263, 0.956366386, 0.039147361),
    vec3(0.00449967, 0.957890048, 0.037610292),
    vec3(0.004518465, 0.959292655, 0.036188889),
    vec3(0.004542805, 0.960584215, 0.03487299),
    vec3(0.00457288, 0.961773573, 0.033653556),
    vec3(0.004608895, 0.962868623, 0.032522492),
    vec3(0.00465109, 0.963876448, 0.031472471),
    vec3(0.004699746, 0.96480335, 0.030496912),
    vec3(0.004755186, 0.965655044, 0.029589778),
    vec3(0.004817721, 0.966436842, 0.028745446),
    vec3(0.004887673, 0.967153428, 0.027958907),
    vec3(0.004965447, 0.967808972, 0.02722559),
    vec3(0.005051466, 0.968407165, 0.026541377),
    vec3(0.005146221, 0.968951191, 0.025902595),
    vec3(0.005250261, 0.969443961, 0.025305785),
    vec3(0.005364196, 0.969887939, 0.024747872),
    vec3(0.005488688, 0.970285274, 0.024226044),
    vec3(0.005624523, 0.970637837, 0.023737647),
    vec3(0.005772524, 0.970947128, 0.023280354),
    vec3(0.005933641, 0.971214249, 0.022852116),
    vec3(0.006108994, 0.971440082, 0.02245093),
    vec3(0.006299756, 0.971625195, 0.022075054),
    vec3(0.006507247, 0.971769994, 0.021722764),
    vec3(0.006733051, 0.971874423, 0.021392531),
    vec3(0.006978854, 0.9719382, 0.02108295),
    vec3(0.007246538, 0.971960799, 0.020792667),
    vec3(0.00753827, 0.971941249, 0.020520485),
    vec3(0.007856514, 0.971878264, 0.020265225),
    vec3(0.008204064, 0.971770126, 0.020025813),
    vec3(0.008583947, 0.971614816, 0.019801239),
    vec3(0.008999675, 0.971409878, 0.019590449),
    vec3(0.009455237, 0.971152241, 0.019392523),
    vec3(0.009955215, 0.970838189, 0.019206597),
    vec3(0.010504749, 0.970463452, 0.0190318),
    vec3(0.011109803, 0.970022766, 0.018867431),
    vec3(0.011777308, 0.969510027, 0.018712665),
    vec3(0.012515126, 0.968918048, 0.018566825),
    vec3(0.013332373, 0.96823842, 0.018429206),
    vec3(0.014239681, 0.967461152, 0.018299166),
    vec3(0.015249411, 0.966574582, 0.018176005),
    vec3(0.016375927, 0.965564859, 0.018059211),
    vec3(0.017636162, 0.96441567, 0.017948165),
    vec3(0.019050053, 0.963107683, 0.017842261),
    vec3(0.02064098, 0.961618056, 0.01774096),
    vec3(0.022436706, 0.959919497, 0.017643792),
    vec3(0.024470247, 0.957979541, 0.017550207),
    vec3(0.026781156, 0.955759173, 0.017459665),
    vec3(0.029416764, 0.953211636, 0.017371594),
    vec3(0.032434165, 0.95028025, 0.017285579),
    vec3(0.03590266, 0.946896161, 0.017201171),
    vec3(0.03990671, 0.942975375, 0.017117908),
    vec3(0.044549637, 0.938415042, 0.017035312),
    vec3(0.049957946, 0.9330891, 0.016952945),
    vec3(0.056288019, 0.926841641, 0.016870331),
    vec3(0.063732852, 0.919480119, 0.01678702),
    vec3(0.072532236, 0.910765162, 0.016702592),
    vec3(0.08298439, 0.900398982, 0.016616618),
    vec3(0.09546049, 0.888010848, 0.016528651),
    vec3(0.11042104, 0.873140755, 0.016438193),
    vec3(0.128430384, 0.855224817, 0.016344788),
    vec3(0.150174712, 0.833577319, 0.016247957),
    vec3(0.17646848, 0.807384293, 0.016147214),
    vec3(0.208235667, 0.775722345, 0.016041975),
    vec3(0.246440024, 0.737628435, 0.015931528),
    vec3(0.291908018, 0.692276903, 0.015815065),
    vec3(0.344984668, 0.639323614, 0.015691704),
    vec3(0.405003302, 0.579436097, 0.015560587),
    vec3(0.469770292, 0.51480865, 0.015421044),
    vec3(0.535622243, 0.44910473, 0.015273012),
    vec3(0.598446474, 0.386436255, 0.015117256),
    vec3(0.655118405, 0.329926299, 0.014955281),
    vec3(0.704188549, 0.281022574, 0.014788861),
    vec3(0.745606932, 0.239773366, 0.014619686),
    vec3(0.780098645, 0.205452132, 0.014449208),
    vec3(0.808669226, 0.177052183, 0.014278574),
    vec3(0.832329195, 0.153562082, 0.014108706),
    vec3(0.85197346, 0.134086206, 0.013940317),
    vec3(0.868355627, 0.117870335, 0.013774022),
    vec3(0.882088371, 0.104301317, 0.013610295),
    vec3(0.893665842, 0.092884622, 0.013449518),
    vec3(0.903484049, 0.083223919, 0.013292015),
    vec3(0.911858005, 0.075003924, 0.013138054),
    vec3(0.91904131, 0.067970837, 0.012987836),
    vec3(0.925236892, 0.061921566, 0.012841525),
    vec3(0.930609071, 0.056691665, 0.012699247),
    vec3(0.935290842, 0.052148021, 0.01256112),
    vec3(0.939390513, 0.048182279, 0.012427191),
    vec3(0.942996767, 0.044705727, 0.012297489),
    vec3(0.946182355, 0.041645556, 0.012172072),
    vec3(0.949008025, 0.038941093, 0.012050866),
    vec3(0.951523919, 0.036542201, 0.011933864),
    vec3(0.953772082, 0.034406857, 0.011821045),
    vec3(0.955787697, 0.032499914, 0.011712372),
    vec3(0.957600446, 0.030791764, 0.011607774),
    vec3(0.959235683, 0.029257157, 0.011507144),
    vec3(0.960714776, 0.02787477, 0.011410438),
    vec3(0.962055945, 0.026626454, 0.011317586),
    vec3(0.963275107, 0.02549641, 0.011228468),
    vec3(0.964300437, 0.02447108, 0.011228468),
    vec3(0.9652328, 0.023538717, 0.011228468),
    vec3(0.966082492, 0.022689026, 0.011228468),
    vec3(0.966858432, 0.021913087, 0.011228468),
    vec3(0.967568415, 0.021203103, 0.011228468),
    vec3(0.968219303, 0.020552216, 0.011228468),
    vec3(0.968817046, 0.019954474, 0.011228468),
    vec3(0.969366905, 0.019404615, 0.011228468),
    vec3(0.969873478, 0.018898043, 0.011228468),
    vec3(0.970340909, 0.018430612, 0.011228468),
    vec3(0.970772869, 0.017998652, 0.011228468),
    vec3(0.971172383, 0.017599138, 0.011228468),
    vec3(0.97154218, 0.017229342, 0.011228468),
    vec3(0.971884776, 0.016886746, 0.011228468),
    vec3(0.972202337, 0.016569185, 0.011228468),
    vec3(0.97249689, 0.016274633, 0.011228468),
    vec3(0.972770257, 0.016001266, 0.011228468),
    vec3(0.973023999, 0.015747524, 0.011228468),
    vec3(0.973259632, 0.015511892, 0.011228468),
    vec3(0.973478536, 0.015292988, 0.011228468),
    vec3(0.973681941, 0.015089583, 0.011228468),
    vec3(0.973870951, 0.014900573, 0.011228468),
    vec3(0.974046776, 0.014724748, 0.011228468),
    vec3(0.974210313, 0.014561212, 0.011228468),
    vec3(0.974362517, 0.014409008, 0.011228468),
    vec3(0.974504245, 0.014267281, 0.011228468),
    vec3(0.974636162, 0.014135364, 0.011228468),
    vec3(0.97475915, 0.014012377, 0.011228468),
    vec3(0.97487371, 0.013897817, 0.011228468),
    vec3(0.974980528, 0.013790999, 0.011228468),
    vec3(0.975080171, 0.013691356, 0.011228468),
    vec3(0.975173072, 0.013598455, 0.011228468),
    vec3(0.975259696, 0.013511832, 0.011228468),
    vec3(0.97534048, 0.013431048, 0.011228468),
    vec3(0.975415806, 0.013355721, 0.011228468),
    vec3(0.975486006, 0.013285522, 0.011228468),
    vec3(0.975551437, 0.013220092, 0.011228468),
    vec3(0.975612438, 0.01315909, 0.011228468),
    vec3(0.975669295, 0.013102234, 0.011228468),
    vec3(0.975722246, 0.013049283, 0.011228468),
    vec3(0.97577158, 0.012999949, 0.011228468),
    vec3(0.97581754, 0.012953989, 0.011228468),
    vec3(0.97586035, 0.012911179, 0.011228468),
    vec3(0.97590022, 0.01287131, 0.011228468),
    vec3(0.975937277, 0.012834253, 0.011228468),
    vec3(0.975971818, 0.012799711, 0.011228468),
    vec3(0.976003931, 0.012767598, 0.011228468),
    vec3(0.976033845, 0.012737685, 0.011228468),
    vec3(0.976061665, 0.012709865, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
    vec3(0.976087481, 0.01268405, 0.011228468),
};

// If you sample uniformly across the full spectrum, multiplying by this bias
// will make white come out as vec3(1).
const vec3 WAVELENGTH_RGB_BIAS = vec3(2.74738275, 2.97417918, 3.33566826);
