• entries
422
1540
• views
490899

# Third of the lighting models

484 views

First off a brief service announcement: >10000 hits on my journal. Yay! Many thanks to all of you who deemed my ramblings worth reading..

Oren-Nayar

Another lighting model similar to Cook-Torrance in that it attempts to modify the lambertian model to compensate for a rough surface. The key difference to Cook-Torrance is that Oren-Nayar's doesn't include a specular component. Most implementations attach a standard Blinn-Phong specular term if it's needed.

So, the equation I'm using (which has been the hardest to comprehend so far [headshake]) is as follows:

Inputs:
• Diffuse Texture
• Roughness Texture
• Normal Map Texture
• Sin()Tan() Lookup Texture

• Ambient Constant
• Light Position
• Light Range
• Light Falloff

• World Matrix
• World * View * Proj Matrix

Vertex Data:
• Position
• Normal
• Tangent
• TexCoord

With regards to the generic base that I'm trying to derive, the following is noteworthy:
• No specular texture. Implementation might add this via a Blinn-Phong component though.
• Sin()Tan() lookup texture needs to be generated and provided
• Uses a roughness texture, same as Cook-Torrance
• No equation-specific constants

And, as you should be expecting, a visio diagram to encapsulate the above steps:

The 10000th read was me :)

I know because the counter was at 9999 when i clicked on your journal. I wanted to leave a comment stating "victory", but a collegue distracted me with a question, and when i was back 10 minutes later, i forgot to do it :)

Hi, I like your posts about the lighting models and hope you make more of them (anisotropic stuff!), oh and some pretty pictures showing off each one :)

I'm ending up with a different formula for Alpha/Beta though. You had
Quote:
 Original post by jollyjeffers alpha = min( dot(Normal, Light), dot(Normal, View) ) beta = max( dot(Normal, Light), dot(Normal, View) )

and I'v got (I hope, in accordance with the original paper (p.22))
theta_r = acos( dot(Normal, Light) )
theta_i = acos( dot(Normal, View) ) )
alpha = max( theta_r, theta_i )
beta = min( theta_r, theta_i )


So the difference is that you are using the cosine of the angles instead of the angles when you feed them into Sin/Tan. I guess you could probably skip the acos if your Sin/Tan are tweaked lookup tables though.

Sorry about posting so far down you journal, hope you notice it :)

## Create an account

Register a new account