pablomayobre/material-love

[Issue][drawicons][shadows] No sRGB support

Closed this issue · 10 comments

I poked at the demo and it didn't need too much to get most things working. The shadows didn't quite want to behave, might need an alternate version of the images for sRGB?

Gamma correct blending makes fonts look significantly better, for what it's worth.

I have never played with sRGB, so I dont really know what it takes to turn an image from standard RGB to sRGB, have you got some info?

I'll try to look it up, currently the shadows are generated with an SVG file with inkscape and it is pretty customizable, I'll try to find a way to save it in sRGB.

as far as love is concerned, you can check if the current window is sRGB using select(3, love.window.getMode()).srgb

then load the image using love.graphics.newImage(path, srgb and "srgb" or nil)

I don't know if Inkscape has proper sRGB support, but in PS there's an option to set the blending gamma, maybe see if you can find something like it?

the thing with the shadows is that the alpha values are too low, and with gamma correct blending they almost vanish.

I'll try to find something like that (Maybe GIMP?)

If I can find it, I will make it a separate patch, I'll leave the option to the user, I cannot add it directly to the patch because that depends on the final game. If you change from RGB to sRGB and then back to RGB the patch would need to reload every time, if I load all the images then that is quite much, so it will depend on the final user whether to load the RGB patch or the sRGB

Nobody changes to/from sRGB after the initial window creation, so there's really not much need to worry about reloading.

Anyway I need to provide both, so doing it separately is not bad either, just change require "shadow" for require "shadow-srgb". The problem is the init.lua but it'll probably be a function, and if you pass "srgb" it will load shadow-srgb instead of shadow.

Is that fine?

This also applies to the icons ! They also fade when gamma correction is enabled.
love_2016-06-29_13-56-58
(The window on the left has gammacorrection enabled, and the one on the right not.)

I see the problem.

For the images of the shadows, they are not loaded as sRGB images, and they weren't saved as such either.

For all the other stuff, gamacorrect rendering is not taken into account by the color.lua library which in turn is used by drawicons.lua which is what you use to draw the icons in place

This are easily fix, but I want support on saving the shadows as sRGB images, currently I'm using inkscape, I can give you the .svg if needed. The other stuff I can fix them tonight most provably

EDIT: The fab.lua library introduced in the last commit also has problem with sRGB

This shadows should be generated again with sRGB support but I've no idea how to do this as stated above

This is the first time for me to set t.gammacorrect to true, I had fixed the drawicon problem by using love.math.linearToGamma() on the alpha value of the color.

For the shadow image thing, In gimp, there is a check box in the png export menu called save gamma, this may solve the problem, give me the svg file to give it a try.

Didn't intend to close, Github interpreted a commit message as this being a fix, it's a start, two commits to go. shadow.lua should already be fixed

Well that should do it! Please check it out and report back if you find any other issues.

PS: If this doesn't actually fix it feel free to reopen the issue