|
Post by trejkaz on Jul 6, 2021 10:43:05 GMT
I started writing an MTL parser. I hit the lines about RFL files and found the giant hole in the documentation - everything refers to another chapter in the documentation and nobody has archived that chapter. But I did somehow manage to get my hands on some sample files and they contain exactly what I expected: an ASCII encoding of a spectral response curve. So I documented that file format here in case anyone else is ever looking for it.Light sources can of course also have spectral curves, and there is much data about that for standard light sources. But all textures of course are RGB. The docs for the MTL format say that if you have a material with both Ka and map_Ka, you have to multiply them together. But you can't just multiply together RGB and a spectral curve. So while digging for hints on converting between the two, I found this paper.So what I think I have to do is, make Color abstract, and have RgbColor as one implementation and SpectralColor as the other. Then, to multiply RgbColor with SpectralColor, convert the RgbColor to SpectralColor first, and then multiply those. I just have to figure out how to invert the algotithm in that paper. (I think it's just taking the individual curves for R, G and B and multiplying them by the RGB values?)
|
|
|
Post by Jamis on Jul 6, 2021 16:03:27 GMT
I wish I had some advice for you, but an MTL parser is something that's never gotten farther than "gee, I should totally try that sometime".
It sounds like you're on the right path, though! I very much look forward to reading about what you discover here.
|
|
|
Post by trejkaz on Jul 6, 2021 21:07:35 GMT
MTL format of course supports specifying colour in CIE XYZ as well. So there's two levels to what I wonder: - If I do all the maths in XYZ instead of RGB, do I get the same result? (Intuition says yes - you convert between the two using a matrix, and all the other maths in the renderer is linear, so it seems like it may not matter which space the maths is done in, as long as it's linear.)
- If I do all the maths with spectra instead of linear colour, but the inputs are just RGB, do I get the same result? (No big intuition on this. Maybe? But if true, I could just convert everything to spectra, do all the maths with spectra regardless of how color is specified, and then convert back to RGB for the last step.)
|
|