kensonuken Posted August 13, 2008 Share Posted August 13, 2008 I found a Bent normal shader but when I render using this I get an output as if that its reflecting the object near to it? Can anybdody tell me what might have went wrong with this.. or is this the right approach to render World Space Bent Normals ? ////////////////////////////////////////////////////////////////////////////////////////////// color vector2color(vector v) { return ((color v) + 1) / 2; } surface occlusion_dmap (float doBendNormal = 1; output varying color outOcc = 0;) { normal Nn = faceforward( normalize(N), I ); float occlSum = 0; vector dirSum = 0; float dotSum = 0; illuminance( P, Nn, PI/2 ) { vector Ln = normalize( L ); float NdotL = Nn . Ln; float shad = 0; lightsource( "__inShadow", shad ); float occl = NdotL * (1 - shad); occlSum += occl; dirSum += Ln * occl; dotSum += NdotL; } if ( dotSum > 0 ) { occlSum /= dotSum; dirSum /= dotSum; } if (doBendNormal != 0) { vector bend = dirSum - Nn; Ci = vector2color(bend); } else { Ci = occlSum; } Oi = 1; outOcc = occlSum; } //////////////////////////////////////////////////////////////////////////////////// Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.