3dcheapskate opened this issue on Oct 30, 2012 · 13 posts
millighost posted Wed, 31 October 2012 at 2:28 PM
Quote - This one works!
So it does appear to be a sign issue. Thanks Richard!
But I'm now even more puzzled - why did the original faulty network in the first post render completely black, and not just mostly black like the one a few posts above this?
When rendering your scene, 3delight (DS's renderer) converts all your geometry to camera space. The camera space's origin is where your camera is located in the 3d scene. It has x pointing right, y pointing up, and z pointing away from the camera (which, btw is a left-handed coordinate system). As a result, faces that are visible by the camera have their normals point in the general direction of the camera, and because those faces are in front of the camera they point in the direction of the negative z-axis, hence they have usually a negative z value.
You have to be careful when manipulating normals in your shader in the way you did, like negation of a single component, because after that in general the resulting vector will not be a normal anymore; e.g. negating the z-component of a vector does not make it point into the opposite direction, for that you would have to negate all its components - so negating one component only does not necessarily make your render totally black.
Note that the normals in the render depend on the s/t-parameters of the object (i.e. the UV-map). The little spheres you see in the preview windows of the shader mixer are of course mapped differently than the object you want to render, so do not rely on them to determine if everything works correctly.