I'm currently trying to build an Anime style shader in blender and edit the normals to get better shading. But i also want a fresnel effect thats not effected by the edited normals. i know there is this true normal output on the geometry-node, but it gives me just the flat shaded normals. So, does anyone know a way to smooth the normals with vector nodes or something else that gives me smooth shaded normals for the fresnel effect?
I hope there is a better way to do this, but here is a workaround I used:
I copied 'normal' normals to a uv layer via script. Two layers to be exact. While I could have compacted them into a single layer, it would have increased shader complexity
import bpy ob = bpy.context.object for loop in ob.data.loops : normal = ob.data.vertices[loop.vertex_index].normal ob.data.uv_layers["XY"].data[loop.index].uv = (normal.x, normal.y) ob.data.uv_layers["ZW"].data[loop.index].uv = (normal.z, 0)
Then in shaders I plug the combined value into fresnel normals input.
Here are sample results form left to right:
- Default monkey with default fresnel
normals editand custom normals plugged to fresnel
normals editand default fresnel
The artefacts (sharp white areas) are due to lousy normal edit, which I bet you will not have in your model. Otherwise the normals carried over from UVs appear to be near identical to original smoothed normals
EDIT: As noted by Heinrich Tester, the normal from UV must also be transformed from object to world space before use