At the moment I'm creating a texture baker using COPs. Inspired by the GameDevs Maps Baker because it is so fast and a lot more straightforward than using Mantra/BakeTexture Rop and a shader that uses renderstate()
In a VOP COP I'm reading an 8bit PNG file and I want to read the pixel values untransformed and “untouched”.
There is the scrcolorspace argument but it seems it doesn't really matter which option you use.
If set to “auto” it assumes values are sRGB and transforms the values to linear.
If set to “linear” it treats the values as sRGB and transforms the values to linear.
The manual states the following:
“srccolorspace”, string
Specifies the color space in which the texture is stored. When texture values are accessed, they will be translated from this space into linear space for rendering if needed.
auto
(default) Determine the source color space based on the file. Currently, this will assume sRGB color space for 8-bit textures and linear for all other textures.
linear
Transform to linear space. This currently only affects 8-bit textures, since all others are assumed to be already in linear space. Use this option to force linear interpretation of textures used for bump or displacement maps.
The VEX colormap's scrcolormap “linear” option only does things correctly according the how this option is described in the manual.
But! The option is called Source Color Space so this should be the same as Image Color Space from the File Cop.
The manual for the VEX colormap's scrcolormap argument also describes the options as “from this space into linear space”
If the source colorspace is set to “linear” it should not do a transform if the target colorspace is linear.
The File Cop has some more features.
First I can disable Linearize Non-Linear Images parameter which gives me the desired untransformed and “untouched” values.
If I enable the Linearize Non-Linear Images parameter then I have 3 options for the Image Color Space parameter.
If set to Detect From File it assumes values are sRGB and transforms the values to linear.
If set to Linear it treats values as linear already and gives me the desired untransformed and “untouched” values.
If set to sRGB it treats the values as sRGB and transforms the values to linear.
If you ask me then the File Cop does things correctly.
I can't believe I'm the first one to use colormap() with an 8 bit image and bump into this issue.
Please tell me it's a human error on my side because I doubt Side Effects is going to change (fix) the behavior of such an essential function. Although adding an option for “Linearize Non-Linear Images” and setting its default to ON it would stay backwards compatible.
As work around I could just not use the colormap() and use the File COP, as a second input to my VEX COP, instead.
But I like to use the area sampling features that the colormap has. I don't want to write my own code for that.
Anyone?
Cheers,
benS