Page MenuHome

Freestyle lines in Cycles are in an unexpected color space
Closed, ResolvedPublic


Version: 2.73 (but also 2.74 rc2) linux 64

How to reproduce:

  • Open the attached file and inspect the simple blue cube material and freestyle settings.
  • Notice that the line color and emission color values are identical.
  • Render the scene and notice that the emission shader emits exactly the same color as set in the properties, but the freestyle line is much darker than expected.
  • Try the same thing in BI and notice that the freestyle color space is not affected in this way when rendered with BI.

If this is an intentional aspect of Freestyle in Cycles, I cannot figure out why.

Event Timeline

Sam Brubaker (rocketman) raised the priority of this task from to Needs Triage by Developer.
Sam Brubaker (rocketman) updated the task description. (Show Details)
Sam Brubaker (rocketman) set Type to Bug.
Julian Eisel (Severin) lowered the priority of this task from Needs Triage by Developer to Normal.Mar 19 2015, 8:55 PM

Thanks for the problem report. The issue looks like related to color management. I will look into it and come back to you with updates.

Freestyle generates a temporary scene to render strokes using Cycles. The temporary scene is populated by mesh objects representing the strokes. The upper half of the screen capture below shows the (slightly simplified) shader setttings used for the stroke meshes. Stroke colors are taken from a vertex color layer ('Color') and fed to an Emission node. As shown in the Python console at the left bottom of the screen capture, the color in the vertex color layer matches with the Freestyle Line color in question. The same screen capture confirms that the line color in the rendering result is darker than it should be.

Now if the Freestyle Line color is specified directly by the Emission node (without relying on the vertex color layer) as shown in the lower half of the image below, then the rendered line color becomes correct.

So the problem comes from the color sources from which the diffuse color of stroke meshes is taken.

@Sergey Sharybin (sergey), @Thomas Dinges (dingto), do you guys have any insight about the documented color differences between an Emission color and a vertex color layer in Cycles?

I don't think it's something cycles-specific. All the light (including Emission) in render engines is in linear space. And vertex color in blender is in sRGB space i would think.

So what you can do is to linearize the color when creating emission shader by calling srgb_to_linearrgb_v3_v3. It's not totally correct from the CM pipeline, but it's as good as we can do now.

The fix is very much appreciated, thanks Brecht.