Grease Pencil doesn't treat color like the rest of Blender
Closed, ArchivedPublic

Description

System Information
linux mint

Blender Version
Broken: 2.78 05b181f

Short description of error
Grease Pencil doesn't treat color like the rest of blender

Exact steps for others to reproduce the error

The attached blend file grease_pencil_color_bug.blend has a material color and a grease pencil palette with a stroke color. Both are the same color:
the grease pencil color was copied from the material color.

The bug is that grease pencil displays (both in the viewport and in the color picker) a different color value from what the material does.
In the file, the stroke's blue component is 0.094, whilst it is 0.009 for the material. The same issue occurs when copying the freestyle stroke color to grease pencil stroke color, which suggests the bug is in how grease pencil represents color.

Details

Type
Bug

This is not a bug. Currently, grease pencil color is not affected by scene lights or any other scene attribute.

If you add a plane and set golor to R=1 G=0 B=0 and a palette color with the same color (pure red) and render an opengl, you get something like this:

As you can see in the top, the color of the plane is not pure red RGB= 0.7176, 0.0078, 0.0078, but the grease pencil color is RGB=1, 0, 0. You can get these values moving the mouse over the render image.

This color management is something we could investigate in future 2.8 Blender version using the new opengl functions, but today this is how works for several technical reasons.


(grease pencil color on the left, material color on the right)

My problem is that the above colors are the same to python, but obviously differ in the g component (and are displayed differently). They have the same
hex, they have the same hsv components, but the g component is off. That just seems strange.

In the meantime, how can I convert between the two? For context, I'm working on the freestyle to grease pencil addon and trying to replicate a freestyle render as much as possible. Being slightly off in the colors isn't great.

IIRC, on last check we weren't doing any of the fancy color management stuff yet. Previously, as a UI tool, this didn't matter so much, but now that GP is being used for art, we'll have to tackle this I think.

I'm guessing that what's happening is:

  • The color properties in RNA use "PROP_COLOR_GAMMA" (or something like that; basically, they use the "color managed" property type)
  • Due to the RNA settings, the color swatches both show the color managed versions. This affects both the color shown, and the sliders.
  • When accessed via Python, the colors returned are the raw values stored, without any of the remapping (?)
  • When drawing colors, GP just uses the colors directly without performing any color management on the values (i.e. we just do a glColor3fv(stroke->color)). However, the materials stuff does go through color management first before being rendered via OpenGL
  • As Antonio said, it's likely that lighting also comes into it a bit. The OpenGL solid/viewport lights are applied to materials but not geometry - with the default setup though, that's only likely to lead to a purple-blue cast. and maybe some specular funkiness too.

@Joshua Leung (aligorith) Yes, the color gamma is the trick. I was doing some test and changing this value you can get the same color, but this is not a solution.

I agree, we need to include any type of color management as a request for Grease Pencil.

As noted by @Antonio Vazquez (antoniov) already, this is not a bug, but rather a todo. So archiving this report. I also added a note in the wiki todo list about this.

Add Comment