EmuMan / npr-face-shader

A Blender addon to easily build custom smooth lighting for use on NPR faces using grease pencil.
GNU General Public License v3.0
41 stars 4 forks source link

NPR Face Shader

A Blender addon to easily build custom smooth lighting for use on NPR faces using grease pencil.

demo of NPR Face Shader features

Features:

Note: As of now, this style of face shading only works for horizontal lighting shifts. It can be modified to work for vertical lighting, but you still can't readily blend between both. I am working to see if I can come up with a solution for this and will update this addon with any progress. For now, it at least supports the most common use case.

Installation

To install the addon, click on the green Code dropdown to the top right, and then click Download ZIP. This will download a file named npr-face-shader-main.zip, and you can move that wherever you want. There is no need to unzip this file; all you have to do is open Blender, navigate to Edit > Preferences > Add-ons > Install and select the ZIP file. It may take a moment to load. Once it does, click the check box on the entry that has just appeared and the addon should be good to go.

Usage

One important aspect of the face mesh is the UV map. Otherwise, any topology should work. The UV map should be laid out similarly to the below example:

UV map of face projected horizontally from the front

If you already have a UV map for other textures, then you can simply create another one by selecting the object, navigating to the Data tab on the right side (click the green triangle in the Properties panel), opening the UV Maps dropdown, and clicking the plus button on the side. You may have to play around with which one is active while you are unwrapping, but it should not conflict with any of your preexisting maps. You can tell the addon to use this new map in the options.

When you're done unwrapping, you can start drawing the grease pencil lines. There should be three grease pencil objects in total: one for the vertical face lines, one for shadow shapes, and one for highlight shapes. Refer to the demo clip at the top of this page for how these should be drawn, and make sure they are drawn directly onto the face (stroke placement set to Surface with an offset of 0.0).

After everything is drawn, select the objects you created in the Face Shader tab on the 3D View window. You should also create a new image file for the addon to write to with whatever dimensions you'd like. Only the top options here are required. You can also leave the UV Map Name field blank; it will just select the active one if so. More information on the different parameters can be found below.

As a last step, click the Generate Face Shading button to set everything in motion. This is a fairly computationally heavy process, so even with some performance optimizations it may take a while to complete. Blender almost definitely hasn't crashed though, so just give it some time to work through everything. When it does finish, a new material should be created and assigned to the target object, with custom face shadows following the drawn guidelines. Changes to the light and dark textures (as well as whatever else) can be made in the created material.

Parameters

Operators

Issues

Any issues you have can be sent as requests to emuman on Discord if they are clarifications, or created as actual Issues if they are relevant as such.