I’m currently working on a game. The UI artist send me the game title image, exported from photoshop. However, after I imported it. A problem occurred, the color looks different between unity and photoshop. My project is using linear color space. However, the image from photoshop is in gamma space. I think that caused this inconsistency.
My question is, how to use gamma texture is linear color space? (or, how to export linear texture from photoshop)
Followings are some effects from a brand new unity project, 2019.4.25f1c1.
Gamma space: image looked the same, however I used HDR in my project. So too bad, that’s not an solution.
I believe the same issue must be asked over and over again. And I have done some research, including Unity - Manual: Linear or gamma workflow. And still didn’t find solution.
Thanks for time reading, any comment is appreciated.
I think the color is still different. I created an empty unity project to test gamma and linear settings. The camera was untouched. Render pipeline was default. I have tried URP, and the behavior was the same.
That’s because alpha blend is different between gamma work flow and linear work flow. Usually two ways to solve this problem ,while neither are not perfect:
Change PS color profile to linear color space or blend color with gamma 1.0 but the artist may not like it.
Split Scene-Rendering and UI-Rendering, do gamma encode after scene-rendering, then render UI in gamma color space, while this method can bring some extra performance cost and other issuses such as the color picker’s value is not so “precise”.
If your game is not a realistic-style, perhaps gamma work-flow is more suitable for you.(HDR should not be a problem)
Checking your original image here. back into photoshop, the “glow” is apparent in the actual image.
so this is a glow/blow/overlay layer your artist has likely created in their layer stack in photoshop, not something that unity is creating.
you can see this going back into PS and selecting the object with an inverted black fill.
control click thumbnail in the layer stack, to select it
shift control N, to create a new layer
set your foreground fill to black
G, for fill bucket
Control shift i, to invert the selection
left click to fill
you should see the same results as below.
You can also see the Alpha channel has this in unity by checking the inspector A channel.
My recommendation for you is to inform your artist to remove the glow/blur on the problematic layer.
or use image > threshold to remove it.
I have gone ahead and made a Power of 2 version of all the above for you. the results are the “-fix” versions below
linear in HDRP example
import this as you would with the sRGB check ‘on’ in the importer and linear colour space for your project
What a great answer. I was about to say that the original author could at least have left a like but then I noticed that he posted it already in April.
Hi, i have the same problem in URP/linear.
From what i get, the issue is Photoshop using alpha blending in gamma space.
To me, alpha created in photoshop should be also gamma corrected in the shader.
Or edit textures in 32bpc, which switches Photoshop in linear mode but has a lot of constraints
Also UI might be rendered with a gamma cam, but that’s not the solution for scene objects.
I know it won’t be 100% accurate but i guess it’s a decent workaround.
Can anyone confirm ?
Thanks !
Shouldn’t be an issue for UI.
you could straight up convert a photoshop .png with transparency to sprite (2D and UI) in unity with no issues.
If you’re working linear in your project, for sRGB textures you just need to check the SRGB option and unity will convert it to linear colour space, for linear textures leave it unchecked.
in this instance
this will pack a DXT5|BC3 sRGB texture that is converted to linear colour space.
However, if you’re using shader work for data feeding, then you would want a Linear-Based texture, these are also called “data maps” and they’re almost always linear-based ( HDRP mask map and detail maps for example should have sRGB ( colour Texture) checked off and the source texture be linear colour space already.
If you’re familiar with colour management then you could make your own linear ICC profile in photoshop and load it as a colour workspace, that way if you really wish to view the linear colours for side-by-side comparison in photoshop and unity editors then you can, be aware you’d still have to convert to linear in unity or elsewhere still, but for viewing purposes, you can do the following.
-ctrl shift(cmd) k
-working space > RGB > custom RGB
-change gamma to 1.0 ( aka linear)
-back on the RGB drop-down list click save
-save the ICC profile
you should now be able to load it whenever you want to
Thanks for commenting.
I tried first method, didn’t go very far. From what I can recall, there were some problem when merging layers after changed color settings.
I followed second method. I then realized the problem can be fixed in rendering stage. Following are the steps.
Also for anything with color picker involved, I added a script to convert the colorspace.
I thought this thread was dead, so I didn’t post the solution I have found. In case anyone met this issue, hope the link above can help.