Forum: DAZ|Studio


Subject: Q: When is √(N*N)≠N ? A: In Shader Mixer when you play with normals!

3dcheapskate opened this issue on Oct 30, 2012 · 13 posts


millighost posted Thu, 01 November 2012 at 8:47 PM

Quote - Zv = Zc ...renders correctly

Zv = √(Zc*Zc) … renders completely black

Zv = -Zc ...renders mostly black

Zv = -√(Zc*Zc) … renders correctly

(Zv is the input to the Point brick, and Zc the ouput of the XYZ Components brick)

Only the first one renders correctly. The other three statements are not always true (but they are probably in your case); the normals might point in any direction, away from or towards the camera. But of course the shader does not really care in which direction the camera is located (at least the diffuse shader does not). The shaders care where the light sources are located relative to the normal. When rendering without a light source, the renderer creates a default light at the same location where the camera is, so it might look like a normal with a positive z value resulting in a black pixel, but this is actually only the case for the default light. If you have not already done, add a distant light to your scene and things will render very different from different angles, most of them neither correct nor black.

Quote - ....

Yet more hmmmms....

I'd assumed that if I had a 'flat' Normal Map (i.e. solid colour 128,128,255) plugged into my XYZ Components brick, then the X,Y,Z Component outputs would be the same for every point on my sphere primitive (i.e. I'd assumed I was working in the same UVW space as the normals map).

The kind of normal map you use is a "tangent-space" normal map. As the name says, it does not use the same coordinate system as all the other coordinates of the scene use but the tangent space. The tangent space is different for every point on the surface, and there is no transform brick to convert from or to tangent space. That transformation happens inside the normal-map brick, which does a lot more than just a simple image-map. The normal-map brick outputs camera space normals, and because the tangent space is different for every surface point the result is different, even if the map is the same for two points.

Quote - It's looking increasingly likely that I've been barking up the wrong tree!*  I'm getting the feeling that they're actually the values of the normals, after being applied to the sphere primitive, and after being transformed to camera-space - which sort-of makes more sense... Can anybody confirm or refute this?

confirmed

Quote - *'a tree in the wrong forest' might be more approriate!