Encode-normals: transfer normals from emitter to hair strands

(there is no v1)

as seen on tv! or at least in a furry artist’s gallery

this is a little python add-on i wrote to enable a stylized fur shader. the shader works by copying the normals of the underlying emitter mesh to the fur strands, giving them a stylized, flat-shaded look. blender doesn’t have any built-in mechanism to copy normals from the emitter to the strand (the way that it does for mesh color). this feature may be present in the upcoming blender 3.3 LTS release if the new hair curve system is implemented. in the meantime, this add-on works by encoding the normals of the mesh into a vertex color layer, then extracting it within the shader for use as a custom normal input. it does this every frame automatically on render.

this is not a complete fur shader; it won’t make you instantly look like a top tier artist! you’ll still need to make a shader, create a hair system, groom the fur to look realistic, have a good base texture and base mesh, etc.

you can find the addon .py source at https://github.com/sentharn/encode-normals along with documentation and instructions on how to hook the normals to your shader. pull requests are welcome.

this addon is gpl2 licensed so go wild. no credit necessary although i’d love to see anything cool you make with it.

this addon is free, but if you end up finding it really useful, please consider buying me a coffee or two! link is on the github page


image courtesy of ruaidri

LATEST RELEASE: 2022-7-11 v2.1 https://github.com/sentharn/encode-normals/releases/tag/v2.1.0

changelog:
v2.1. fixes an issue where normals were encoded in scene linear color space instead of sRGB. this made the unpacking in the shader completely incorrect.

9 Likes

this project would not have been possible without steve miller’s mesh tension add-on. i studied it extensively to figure out how to work with the depsgraph and blender UI.

mesh tension is a great script for making shaders react to mesh squeeze and stretch (i.e., tension maps). it has its own thread at Revised mesh tension add-on

i use it often in my own works, it’s a great time saver since the tension maps feature was removed along with blender internal in ages past.

1 Like

and because i’m dumb, a bugfix release already. i’m not sure how it was working in the first place before this.

fixes issue where normal unpacking was completely wrong, by converting the normals to sRGB for the shader editor before packing them.

1 Like

amazing stuff! will probably use at one point

1 Like

thank you! good luck and would love to see anything neat you make with it

Hi! This looks like a really cool addon, and I am in need of something similar at the moment. Do you think that with the current geometry nodes status in blender it is possible to achieve the same result without the addon?