Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
A Nuke like colorspace node for Mental Ray to take care of the conversion to linear. You can choose between 4 different colorspaces as inputs (sRGB, rec709, gamma 2.2 and gamma 1.8) and let it make all the math for you, giving back a linear texture/color as output.
I also added a gain and an offset if you are converting existing shading networks and you need to map a different gain or offset on the file node.
The shader is really simple and fast, it has been used in production for more than 8 months without any problem and can be used to convert textures, colorswatches or whatever you need. It also work with Maya embedded pass system
The shader have been compiled for linux64 with Maya2011 and for win64 and mac64 with maya2013. If anyone could compile it for other versions and platforms I would be really happy to add it to the archive and give credit.
A big thanks goes to Pixero (https://www.pixero.com/) for all the cool shaders he did and for releasing the source code. It was a very good starting point.
Another big thanks goes to Andrew Hazelden (https://www.andrewhazelden.com/), for helping me with the compilers. It was a huge help from you.