1
$\begingroup$

Is there a way to obtain the "facing" of individual pixels on a rendered image by using the normals pass? IE: if a surface's angle points away from the camera, it becomes darker, and when a surface's angle points towards the camera, it will become brighter.

Edit: The reason I'm asking is because I'm trying to develop a custom glare node in the compositor. Bright areas will get weak fog glow, but I also want to produce a star-like glare over bright points which are facing the camera. I don't know whether this is accurate to reality or not, though. If there is a better method for doing so, or to realistically accomplish the effect, I'm all ears.

$\endgroup$
  • $\begingroup$ Is it necessary to do this in the compositor? I think it would be possible, but it's easier with material nodes. $\endgroup$ – gandalf3 May 26 '14 at 23:05
  • $\begingroup$ To do this in the compositor you'll need to get the camera rotation, which is not as trivial as it might seem. See blender.stackexchange.com/q/10560/599 $\endgroup$ – gandalf3 May 26 '14 at 23:14
  • $\begingroup$ You can also approximate this effect by taking the screen-space x and y derivatives of the z-pass, although this will introduce artifacts if you make it too strong. I uploaded an example file here. $\endgroup$ – maddin45 May 27 '14 at 21:58
  • $\begingroup$ I'm not sure how you'd calculate the dot product of the camera vector against the normal using nodes but you could do a pass that has only one light at the same position as the camera. $\endgroup$ – MarcClintDion May 27 '14 at 23:06
  • $\begingroup$ Considering how convoluted this apparently is to do, I think I'll revise my question. $\endgroup$ – Zauber Paracelsus May 28 '14 at 1:30
1
$\begingroup$

This works like a dream. ridiculously simple too. the normal node can be found under vector in the add node menu(shift-a). Magic Nodes

$\endgroup$
  • $\begingroup$ This won't work if the camera is at a different angle. The tricky thing with this is getting the normal of the camera (easy in material nodes, but I don't know of a way to do this in composite nodes without using drivers). Drivers should work, but the only way I've thought of involves converting the rotation of the camera (in radians) to a vector where everything stays inside -1 to 1. Then using that to drive the ball widget (since there are no vector math nodes in compositing). $\endgroup$ – gandalf3 May 30 '14 at 6:37
  • $\begingroup$ Yeah, I tried this. It mostly works, but the normals aren't based off of the camera. Rather, they are based off of how much they're pointing towards the corresponding pixels on the rendered image. $\endgroup$ – Zauber Paracelsus May 30 '14 at 19:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.