2
$\begingroup$

This is my blend file. It has 2 GP objects. In object mode everything is colored correctly. If I switch from solid mode to Material preview or display render preview mode The GP Objects turn greenscreen green.

I've tried each of the 3 render engines. I've tried three versions on blender. I created a new file with a new GP object, which worked, then copied the green GP object into it... still green. What am I missing?

$\endgroup$

2 Answers 2

6
$\begingroup$

This is a fairly common and troublesome problem when working with grease pencil objects.

The issue is that, at some point while you had the GP objects selected, you entered Vertex Paint mode. Blender, assuming you were going to paint your grease pencil objects, created vertex paint data for them that now overwrites your material data for in material preview and renders.

Unfortunately (and in many cases problematically), there is no way to undo this with the default Blender interface (at least as of 2.83, and I don't believe recent versions have fixed that.)


You can, however, use a short python script to reset all your grease pencil objects.

  1. Go to the text editor and click the + New button at the top to create a new Text datablock.

  2. Use the following script, including a short function remove_vertex_paint() that removes vertex paint data from a grease pencil object. The two lines at the end will iterate through all grease pencil objects in your blend file and remove vertex paint data from them.

    import bpy
    
    def remove_vertex_paint(gpencil: bpy.types.GreasePencil):
        for layer in gpencil.layers:
            for frame in layer.frames:
                for stroke in frame.strokes:
                    stroke.vertex_color_fill = [0.0, 0.0, 0.0, 0.0]
                    for point in stroke.points:
                        point.vertex_color = [0.0, 0.0, 0.0, 0.0]
    
    
    for gp in bpy.data.grease_pencils:
        remove_vertex_paint(gp)
    

script

  1. Press the play button at the top of the text editor to run the script. Afterwards, you should be able to see your grease pencil materials in material preview and rendered mode again.

material preview


It's important to note that this will reset all grease pencil objects in your entire blend file, not just the one(s) you have selected, and not just the ones in the current scene. If you want to keep vertex paint data on some of the grease pencil objects, you need to replace the last two lines of the script and only call reset_vertex_paint() on the objects you want to:

remove_vertex_paint(bpy.data.grease_pencils['GPencil'])
remove_vertex_paint(bpy.data.grease_pencils['GPencil.001'])

And note that the names used here are the names of the grease pencil datablocks, not the names of the objects themselves:

gpencil data blocks

$\endgroup$
3
  • $\begingroup$ At the time of writing, the first code block doesn't seem to want to format correctly, so I had to use a blockquote of a code block instead. $\endgroup$ Commented Dec 10, 2020 at 8:24
  • 1
    $\begingroup$ double indent for code blocks in list. (or break list prior with 0 indent with  ) $\endgroup$
    – batFINGER
    Commented Dec 10, 2020 at 10:41
  • $\begingroup$ thank you so much that helped alot! $\endgroup$ Commented Jan 31, 2023 at 14:06
8
$\begingroup$

I'll expand on the other answer and suggest another solution.

In version 2.92 and beyond the vertex paint operators are available for grease pencil objects. It was not the case before because it was inadvertently removed in a previous version.

If you are able to work with version 2.92 or above, go to vertex paint mode, then choose Paint > Reset Vertex Colors while the GP object is selected.

enter image description here

$\endgroup$
1
  • 2
    $\begingroup$ Thank you! this saved me alot of work redoing everything. $\endgroup$
    – jitone1
    Commented Dec 12, 2020 at 21:15

You must log in to answer this question.

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