2
$\begingroup$

I'm trying to color freestyle lines using the underlying material. It looks like it should be able to pick up the RGBAa diffuse and specular channels, and the documentation agrees. But I can't make it work, it seems to only pick up the workbench-related "viewport color".

Is this supposed to work on 2.90?

https://docs.blender.org/manual/en/latest/render/freestyle/parameter_editor/line_style/modifiers/color/material.html

setup

colors

$\endgroup$

1 Answer 1

0
$\begingroup$

The material object has a property diffuse_color which is the viewport color. The color you want to link is the Base Color of the Principled BSDF node inside the node tree of that material. Sadly I don't know of a way to access it from the modifier, but you could use a script like this to automatically update the diffusion colors of all objects based on that node:

import bpy

for material in bpy.data.materials:
    if material.node_tree is None:
        continue
    principled = material.node_tree.nodes.get('Principled BSDF')
    if principled:
        material.diffuse_color = principled.inputs['Base Color'].default_value

It will consider the value inserted manually to the Base Color field, not one connected from some texture etc. And it makes sense to replace diffuse_color to line_color both in the code above and in the freestyle color modifier.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .