Knabbelhimself Posted February 20, 2020 Share Posted February 20, 2020 (edited) Hi everybody, I have already posted this question on the SideFX Technical Discussion forum but had no luck so far. Maybe someone here could help me? I am trying to get raw color values from an RGBA .png file with the vex function rawcolormap() but it appears that I can only get pre-multiplied values. When using .tif, color values appear to be correct. I am loading the the image as linear even though it is in gamma 2.2 to prevent gamma conversion. Here is my vex code: vector4 rgba = rawcolormap(chs("texture_map"), U, V, "srccolorspace", "linear"); v@Cd.x = rgba.r; v@Cd.y = rgba.g; v@Cd.z = rgba.b; @Alpha = rgba.a; For testing I have created a simple test image where all color channels have a value of 1.0 and the alpha channel has a gradient from 0 to 1. Please see attached image. Opening the image in Photoshop and Gimp shows unpremultiplied color channels. When using above VEX code, color channels are premultiplied against the alpha channel. And opening the image in Mplay, results are even more confusing. Pixel inspection here shows values that I can only recreate by opening the image (which is in gamma 2.2) defined as linear and then applying a second gamma conversion from linear to sRGB. Does anybody know why this is and how to work around this problem? Thanks to anyone taking an interest. Cheers Edited February 20, 2020 by Knabbelhimself Quote Link to comment Share on other sites More sharing options...
Knabbelhimself Posted February 24, 2020 Author Share Posted February 24, 2020 After some further testing I am still struggling with this. I have found a workaround by first loading the texture in a cop network with the file cop which has a “leave unpremultiplied” option and then referencing the file cop as texture in the attrib wrangle. Is there no such option available in VEX to avoid the detour through a cop network? Also with a function named “rawcolormap” would the expectation not be to receive unpremultiplied values by default as it is less destructive? Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.