-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change internal color representation to SRGBA #149
Conversation
From IRC:
|
ProposalBy using Data.Colour the way we do, that is using
Here are the reasons I think this makes more sense than what we do currently:
|
I don't know much about all of this color stuff, but this proposal sounds sensible to me (modulo seeing the details of how it works out in practice). One worry re: practice is that we would no longer be able to use all the color names from |
Yes, I believe there are sensible ways around it, I think we should make |
True, duplicating the names in a module of our own is not really that bad (since we can just do it once using search & replace and then be done with it). |
This proposal seems to be that Diagrams should sacrifice correctly modeling color in favor of a small performance boost. I don't think this is a good tradeoff. My understanding is that I think it does leak a little, in that I am looking forward to using the linear space output in a future OpenGL 3D backend, per recommendations in |
Neither sRGB or Linear 709 is more "accurate" they are just different choices. Each one has it's advantages and disadvantages. Linear is what you need for correct blending and non-linear is what you need for correct rendering (at least in the current backends). In a linear space there is not enough definition in the darker shades and too much in the lighter (i.e. more than the eye can detect). If we never converted to non-linear, that is never made a gamma correction we would need about 11 bits per channel as opposed to 8 to get the quality we now have. Since we don't do any blending there is no need to convert all of our color values to linear, which is how they are stored in Data.Colour. I don't see why the first patch would avoid the matrix inversion and multiplication, it shouldn't. It should the same as before. If it is than I'm misunderstanding something about Data.Colour. Did you profile it after the patch? That being said I'm not seeing a tremendous speed increase by using the version in this branch. And @fryguybob's Mandelbrot example only takes him 7 seconds to run on his hardware. So perhaps the whole impetus for faster color is not necessary. I'll test both versions on Factorisaton tomorrow and see how much speed up we get. |
I didn't mean to suggest that Linear 709 was more accurate. I meant to say that I think Clearly this isn't important to the majority of users who will use named colors from
|
diagrams-lib master, note the cost centers for
Now with the patch d7b3ecc applied, using
I should really have run these several times to make comparing the wall clock legitimate. But I think the absence of expensive cost centers in Data.Colour after the patch is convincing. I haven't profiled 20b2af0 because it requires further patches to diagrams-contrib. |
Ah that's great, so I guess the first patch was enough after all. Which means, we should probably revert back that point and merge. One thing I'm not clear on is that the documentation for Data.Colour says that the internal representation is Linear 709, which has the same gamut as sRGB, but I haven''t look at his CIE module so I'm not sure how he handles this bigger space. Anyway it's not important since my first patch seems to have done the trick and openGL will likely use a lot of blending. |
As I was discussing with luite on IRC, I think what's going on is that the internal representation isn't actually clipped to the 709 gamut. So 709 provides the basis vectors, but they're a basis for a larger space. But I could easily be misunderstanding. |
That would make sense. It would be interesting to talk to Russ O'Connor and find out what's really going on. Either way I'll roll back the changes and then we just have to decide whether or not to keep and export |
Back to first pathc This reverts commit 20b2af0.
You make a good point about |
I'll go ahead and merge, we can always make changes down the road. On Mon, Jan 27, 2014 at 8:42 AM, Daniel Bergey notifications@github.comwrote:
|
Improved `colorToSRGBA` - avoids calls to matrix inverse and multiply.
Please do not merge. This is a preliminary implementation of the proposal below.