Get face normal data in respect to camera

Okay, this one is a little abstract.
I’m basically trying to find a way to render a scene, and for each pixel get the normal data of the face that collides with the camera ray. Whether it is the normal as a vector, or a dotproduct from the normal and the camera’s view-angle doesn’t matter to me. Ideally I render an object and its colored in a gradient representing the dotproduct in ranges from -1 (i.e. in red) - meaning the face is precisely facing towards the camera - to <0 (going towards green) - meaning it doesn’t face the camera at all.
I’m flexible in the way that it doesn’t matter to me if it is done through a materialnode-setup and comes as a rendering output, or if it is a python script (regardless of its complexity).

If my question is somewhat unclear (it’s a weird request, kind of), feel free to ask questions so I can clear them up!

Thank you in advance for any ideas on how to accomplish this.

Could this be what you are looking for ? Otherwise my apology for not understanding your question.
stc=1

you can get the normal image but it would be bluish

may be using the other normal type it might work with red and green

happy cl

Attachments


@@robwesseling:
Yes, precisely! Thank you!

Is there a blender internal way to do this or will I have to use cycles for this?

Eh, I am not familiar with BI, but managed it to figure it out while playing with it:
stc=1

Thank you! I played around with a few things (the normal output in the geometry node, the ramp, the mixing) but I couldn’t figure it out. Thank you so much!