The "Geometry" shader node provides normal information for the geometry being shaded. This can be useful, for example, to mix a snow shader with a rock shader depending on how "flat" the geometry is (angle relative to Z axis). This normal information seems to be calculated after any displacement is applied by the shader (Cycles). In my case, I would like to get the normal information before displacement is applied. Is this possible?
Assuming we're not using custom normals or sharp edges-- which would be weird with true displacement-- we can capture the vertex normal in geometry nodes and use it in the shader:
The geometry nodes are evaluated before any shader based displacement. Our output will be in object space, giving us interpolated values, so we need to normalize the vectors and transform into world space in order to use them the same way we'd typically use a normal in the shader.