Visual Effect (vfx graph) renders as a different color from what I set


The circles in this image are from a Visual Effect object. It’s set to unlit.
The line is a SpriteRenderer. Also using an unlit Sprite material.

Visual Effects don’t seem to render the color that matches what I set in the graph.
Why is this? And how can I make the colors match?

expected:
The color should match the SpriteRenderer, and the color I picked in the graph.

Things I’ve checked:

  • they’re both unlit
  • there’s no post-processing in this scene
  • no lights in this 2D scene
  • Unity 6000.0.26 (I haven’t updated because there’s something broken with SpriteShapes in the latest version)

Solved

  1. According to the Visual Effect Graph docs, “In URP, the Visual Effect Graph doesn’t support gamma color space.”
  2. 2D/URP projects created in Unity 2022 (and before) default to using the gamma color space. This doesn’t change (for good reason) when you update your project to a new version of Unity.

This makes it so VFX Graph’s color picker doesn’t work correctly by default in a Unity 2022 2D project even if you update or open it in Unity 6. Or if you use the gamma color space in any new project. If you rely on accurate colors, you will have find a way to do the color conversion some other way.

If your project is in linear color space, or you convert your project to linear color space, this part will work correctly. But this is not recommended for projects that are pretty far along because it will mess with all sorts of things, especially your 2D lights and post-processing settings. Also, despite the linear color space’s benfits, there are currently a host of inconveniences that you’ll have in Unity, including difficulty doing fine adjustments on the colors-- for example, because visual differences the linear color space are more squeezed in the color sliders and Unity’s color picker window can’t be resized.

What kind of blending you have? Alpha? Premultiply? Is opaque with cliping the same?
If I had to wild guess it’s caused by different gamma correction.

This is my first time using VFX graph. I didn’t change the render settings.

It just uses the wrong color out of the box for me. I have never gotten it to use the right color, even in other projects or a blank project.

This is also a 2D URP project.

The reason is that one color field is HDR and the other one is default.
To be honest I don’t know how to convert those colors via script to make them the same visually, but you can use color picker and probe the color from the other color picker - it will convert color to look the same in HDR mode.

you can use color picker and probe the color from the other color picker - it will convert color to look the same in HDR mode.

What does that mean?

To be honest I wish someone from unity explained what exactly happens there.

I mean when you press color property inspector and color picker pops out, if you get color from screen, then this color will not be the same as the actual values, it will be adjusted by HDR color picker.


Oh yeah. You did mean the eyedropper.
I did that and nothing special happened. No HDR adjustment or anything. It’s still the same problem. It looks like the correct color in the inspector but what the inspector shows is not what’s rendered.

That is strange, this is mine:
GIF 16.02.2025 02-47-36
What possibly is wrong… do you have any kind of post processing enabled for scene view? I know you said there is none, but maybe there is or some renderer feature? I assume you sampled from scene.
Maybe you have project set to different gamma mode than me or there is something in rendering pipeline settings.
Is your sprite using default shader or custom one?

To be clear, the color field might look the same as the other color, but when you open the color picker it will show different RGB values. Also my unity version is 6000.0.35 just in case.

Hi,

I was just browsing this after doing a search for something else. I am assuming your ‘Solved’ area came after the other posts…but yes, this is your issue, Linear vs Gamma Color Spaces.

Best to use a ‘Linear’ Color Space moving forward if you can with this project, or at least for future projects. Working in Linear keeps everything ‘accurate’ while you are working and also displays correctly at the end. In the past, Gamma was usually applied during development (usually values of 1.8 for PC and 2.2 for Mac (or vise-versa, cannot remember right now)). As time went by, Linear came about, which negates the Gamma in the pre-render processes allowing the creator to work in a correct color space. If Gamma was applied ahead of time, while working in that colorspace, one would get “washed out” colors in renders/final pic. Working in Linear, allows for accurate colors, which then works correctly with other maps (bump/height, etc.) all before the final render/pic.

What you do then in post, is you would adjust/add the Gamme after to get the look/brightness you need - this keeps everything working as ‘one’ and not breaking the color workflow ahead of time, as Gamma can. It all comes down to the look you want at the end result, but you want to keep all workflows in the same colorspace - typically ‘Linear’ now and moving forward.

HDR, is just for colors that have a luminance/brightness of greater than 1 (in a rbg 0-1) range and above 255 ( in a rgb 0-255). Using the Intensity Slider in the Color multiplies that color to get above the color range. You will see in the actual value boxes for x,y,z (Vector3) and x,y,z,w (Vector4 or Color) these numbers will be what you need for HDR access outside the Color Picker/Intensity Slider panel, if need be.

HDR allows for a greater color range as well, while using Color Profiles other than sRBG. sRGB is pretty limited (a lot people use this), and more are moving to Display P3, which I think is Default on Apple (DCI-P3 w/D65 White Point). Color Management is a big deal and moving forward with monitors (10bit+) that can display these profiles (accessible color gamut) will make your games look richer. There are other profiles that reach beyond DCI-P3, but most people will not have that setup. :slight_smile:

The problem is that those numbers are different for HDR picker and standard one. My project is in linear space and I would kind of expect that HDR picker is as you described colors, but with possibility to go beyond 1, and standard picker with 0-255 values (but in code it’s just float anyway). Some color pickers in unity are standard and some are HDR, but they produce different numbers, so for example I can set light color and use the same color as ambient and those are completely two different colors, because ambient picker is HDR, does it make any sense? Am I missing something here?

I think you might be on to something. I just setup (last night) a Visual Script that set my Colors in a VFX Graph to be used - a Vector4…the numbers match exactly that are given in my Test Color within the VFX Graph. However, when I use those exact numbers in Visual Script and send it via a Vector4 to be used within the VFX Graph - the Colors are different…? Even though, those exact numbers match both within the Test Color and my piped-in Colors via Visual Script. (I can literally see those same numbers present for both in VFX Graph - I flip between the two to test.)

I think this might be a bug when Unity transferred over to the new default color setup? I am using Unity 6 Preview. They should be identical as the numbers are the exact same…something is not matching right and makes it very difficult to match via a script/visual script.

I understand how it works but thanks for explaining it for anyone else who might come along and not know.

I’m all for using Linear color space for color calculations. As long as you have the right settings, things look a lot better and it’s a lot easier to get natural and pleasing looking lighting.

The real downside right now in Unity is really Unity’s color picker. I attempted to switch the project to Linear but you can’t resize the color picker window, which means fine adjustments to colors are a huge pain. A 1/256 difference on the lower end of the 0-1.0 linear range makes a huge difference. A gamma-like slider for color picking would have made usability sense even if the way colors are stored and calculated are linear.

Did you try report this as bug? Because from my, user perspective I would expect color picker to output correctly converted number (as you said) and only UI to be in “different” color space.
Even if this is not a bug, then question remains - what is the reason?

Hello,

I was just able to look into this again (my end of things). This one was my mistake in what I was setting with the Visual Script. I have so much going on, I accidently was setting this color twice without knowing (dropdowns in Visual Scripting do not always show the full name.)

I adjusted this, and it works fine on my end. I tested using raw values (floats only and not via Color Pickers) I can create a Vector3 and Vector4 in Visual Scripting. Sending these Raw Values into my VFX Graph and having them trigger a Vector3, Vector4 or a Color Property works and does indeed match my Test Color created within the VFX Graph. (The reason why I had identical numbers prior, is that VFX Graph took the first numbers given to it via Visual Script and not the resetting of those Values immediately after, which is how I missed it and found it today in my Code.)

So, using Raw Values does work on my end now after I found the issue. I hope some of this might help.

Hi Pharan,

When switching to Linear, did the colors match any better? I see what you mean with the size of the color picker - little moves do make a big difference in HDR. Whenever, I do my 3D work, I tend to work in HSV (Hue, Saturation, Value). I find it easier, and I use those sliders in there, but then again I am not really matching as you are trying to do.

Update*** 03/10/2025

I filed a Bug with Unity. I took Screenshots of the Color Picker (Normal - within Visual Scripting) and of the HDR Color Picker (within VFX Graph) with identical Values, which are not even pushing beyond the normal clamp and into HDR range…simple color. I also created a Swatch that shows the Color Chip for reference, that produces these Values. These two are decently off and I have everything in Linear. The Color Swatches are way off too and those are in Editor.

Sorry, I probably should have done this first rather than posting all of my info above which runs off of my values I needed alone. I tried a different setup just now using Swatches, and ran into the same problem. Eye-balling it seems to be the way around for now. I have everything in Linear space, with HDR settings, but regardless Swatches are off a decent amount in Editor.

I’ll keep you posted.

Update*** 03/16/2025

With the material that I sent - Bug has been logged and confirmed by Unity.

Thanks for logging a bug. Could you share the link of the Unity Issue Tracker? I’m curious and would like to follow up on this. Thanks

Hello Orson,

Here is the info:

UUM-100075
Issue Tracker (HDR Color Picker)

Allright so I’ve looked at your issue. Thanks again for this as the topic is quite large and was going in different directions.
The issue, has already suspected/mentionned in this thread is coming from Linear / Gamma workflow.

HDR Color picker (use by VFXG) is in Linear space while regular Color picker (ex: URP Lights) is in Gamma space. The same difference applies to Gradient and HDR gradient picker.

The underlying system that use the color picker needs to know in which space the color is to handle the necessary conversion accordingly. In the end, the Color Wheel and values reflect this and is consistent. The EyeDropper from one Color Picker to another should performing the correct conversion.

Now, this is a topic that comes pretty frequently and confuse a lot the users. We cleary have a usability issue that requires some UI/UX changes so that it’s less confusing and easier to use. Maybe some dropdown could be added so that user could choose in which space the Color Wheel is visualized?

Now this usability issue is Editor Wide and not specific to Visual Effect Graph. I have upvoted the issue as I do think that we should provide a better and less confusing workflow for artist when it comes to color.
I would advise to upvote the issue so that it get prioritize.

I know that it’s certainly not the answer that you wanted to hear. I wish you a great day and hope that this issue will be worked on.