RE: [Algorithms] Oren Nayar lighting
Brought to you by:
vexxed72
From: Peter-Pike S. <pp...@wi...> - 2005-01-19 03:01:16
|
Any reflectance function should clamp things like you mention below - a = lot of times the BRDF is treated independently which doesn't have the = NdotL term. They also might only be invoking the reflection model when = NdotL is positive... -Peter-Pike Sloan -----Original Message----- From: gda...@li... = [mailto:gda...@li...] On Behalf Of Igor = Kravtchenko Sent: Tuesday, January 18, 2005 3:16 PM To: gda...@li... Subject: [Algorithms] Oren Nayar lighting Hi, I'm currently implementing a Oren Nayar lighting model and I'm = encountering a problem with the original equation. I recall the formula: i =3D base_color * NdotL * [A + B * max(0, cos(tr-ti) * sin(a) * tan(b)] And my problem is about that tan(b). b is either the angle between light and normal or the angle between view = and normal. It's just the smallest of both. For faces that have their normal almost parallel with the view plane it = happens this angle (which is then ~90=B0) is lesser than the angle = between the light and the normal. In such case, since we take the = minimum angle we make a tan(b) with b ~=3D 90=B0. That gives a huge = result that tends to infinity and causes the color to be totally = saturated. In other words, all the meshes are saturated for faces which = tend to be perpendicular to the view plane. The trick I've found is to modulate the result with max(0, NdotL) = instead of NdotL. Indeed if the angle between light and normal is so big that is greater = than 90=B0, the face backfaces the light and we cancel the big tan(b) = result by 0. It seems to solve the problem. However I had a look at 2 implementations. http://www.gamasutra.com/features/20030514/fosner_03.shtml and the one used in RenderMan: http://groups.google.fr/groups?hl=3Dfr&lr=3D&threadm=3D3B090E86.6241AB67%= 40holypixel.com&rnum=3D2&prev=3D/groups%3Fq%3Doren%2Bnayar%2Bshader%26hl%= 3Dfr%26lr%3D%26selm%3D3B090E86.6241AB67%2540holypixel.com%26rnum%3D2 and none of them seem to perform that operation. Am I missing something fundamental here? Also I would be interested to heard about people who implemented an Oren = Nayar lighting model. My implementation uses v/f program and seems coherent. We can reproduce = pretty easily the famous "moon effect" or velvet rendering. However by = comparing with a render made under 3DS MAX, it's not totally the same = thing. MAX seems to have a less soft "intensity range" (I could show better by taking some screenshots). Are yours have identical rendering than MAX? Any hint or remark would be greatly appreciated, Igor. ------------------------------------------------------- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE = limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt _______________________________________________ GDAlgorithms-list mailing list GDA...@li... https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=3D6188 |