Shader graph: how to treat color as vector4?
I have a texture that represents vertex positions, i want to modify it to bring values to needed range, but when i multiply it i don't get the values i expect. Input gray color is 128, but after multiplication by 2 i get 176 instead of 255.
After some playing around i found out that color is treated differently compared to regular float inputs, however no matter what i try i cannot make it treat color as vector4.
How do i multiply color (128, 128, 128) by 2 to get color (255, 255, 255) in URP Lit Shader Graph?
Answer by SerGreen · May 25 at 03:48 PM
Ok, i found the solution. It's not because it treats color differently, it's because internally color uses logarithmic scale, so color (128, 128, 128) is in fact not (0.5, 0.5, 0.5) but (0.22, 0.22, 0.22) instead. There's the Colorspace Conversion node to convert it from logarithmic RGB to linear.
And in order to have a texture not use this logarithmic scale i had to untick "sRGB (Color Texture)" checkbox in texture Inspector tab.
Your answer
Follow this Question
Related Questions
Shader error when updating shader. 0 Answers
Apply inner stroke with fragment shader 0 Answers
Help with Base Color + Outline shader! 0 Answers
How to make a shader run at a certain point in time? 0 Answers