How to export normal map from orthographic view?


I am trying to export a normal map in “tangent-space” from an orthographic view.
My first idea was to use a “matcap”/environment map for a custom material like this:

Than just save a screenshot/viewToFile.

I think it should work, but only in orthographic view, since with perspective, rays on the edge of the screen have different angles to the surface than those in the middle:

but with an orthographic view mode I get even more color shift:

how can i solve this problem? maybe a different way is easier,
1.I could render it with vray and the normals renderelement – but depending on the resolution could take a while
2.maybe theres a way with grasshopper: mesh > demesh> normals2color>construct mesh (but this would be worldspace)
3. some opengl shadermagic?

thanksfor any input !

I made this grasshopper-script:

“normal map generator”

it takes any mesh, distributes it on a 1000mmx1000m square,
rotates them randomly and colors the single meshes according to the applied rotation.

Then one can easily export a screencapture.

normal maps are useful for simulating scratches or flakes in some materials (35.7 KB)

wip features:
tileable maps/ it only works partly
output for anisotropic map/ still have to figure out the right values

now the tiling works,
also now there is size jitter
this script is very usefull for creating a brushed metall effect, which doesn’t look like just a streched noise map (40.7 KB)

well just to finish this once and for all: here is a normal map created with the script and the corresponding render