• entries
    422
  • comments
    1540
  • views
    488796

The 5th Lighting Model

Sign in to follow this  
jollyjeffers

180 views

I got a new book yesterday... decided that Programming Vertex and Pixel Shaders by Wolfgang Engel just didn't cut it. I went for this one:



So far I've only read 5 chapters (all theory) and I'm really liking it. I shall see about posting some more thoughts on it once I've read a bit more [smile]

Also, if you've got time and have any interest in Managed Direct3D programming, you might want to take a look at MH's sticky in the DX forums: [MDX] C# port of jollyjeffers' HDR demo. Can't be a bad thing to have another decent sample for MDX!

Ashikhmin-Shirley Reflection Model

This is the last lighting model that I'm planning on covering for now. Makes for a total of 5 to work with. I really need to begin doing a proper write-up of this project - it's due in about 18 days.



Beautiful isn't it [smile]

Inputs:
  • Ambient Colour
  • Light Properties
  • Viewer Position

  • World Matrix
  • Inverse Transpose World
  • World * View * Proj

  • Diffuse
  • Normal
  • Specular
  • ?X?Y Coefficients

    Vertex Data:
  • Position
  • Normal
  • Tangent
  • TexCoord

    And, as per usual, a nice Visio diagram:

  • Sign in to follow this  


    7 Comments


    Recommended Comments

    I really wonder how it'll look like.

    Things that are non-intuitive in that formula:
    - the constants (man, how do they find these constants ? For example the 28/23 at the beginning ? Why not 27/23 ? :) ).
    - the Normal dot View in the diffuse equation,
    - the use of tangent and binormal vectors in the specular equation (i've always used them to transform a vector from one coordinate space to another - never directly like that).

    Share this comment


    Link to comment
    thanks for the comment [smile]

    Quote:
    I really wonder how it'll look like.

    A couple of images I pulled out:

    There are some more in the research paper, but they're a little difficult to post!

    Quote:
    the constants (man, how do they find these constants ? For example the 28/23 at the beginning ? Why not 27/23 ? :) ).

    From what I've been reading, the physics of light-transport (etc..) is fairly well understood.. such that most of these BRDF's are just models on realistic data. Many of the research papers start with capturing real-world reflection/diffuse values and then plotting them in graphs. I suppose in some respects they could just be a form of data analysis.

    Quote:
    the use of tangent and binormal vectors in the specular equation (i've always used them to transform a vector from one coordinate space to another - never directly like that).

    The Ward model does the same as well... its a characteristic of anisotropic reflection it seems...

    The TBN coordinate space is then scaled by the Mx and My coefficients to describe what direction the specular highlights go...

    Share this comment


    Link to comment
    Guest Anonymous Poster

    Posted

    mmm, that book looks good. I'v been pondering weather I should buy it, or the ShaderX3 book as a christmas present for myself.

    Quote:
    The Ward model does the same as well... its a characteristic of anisotropic reflection it seems...


    I like to think of it as simulating in what directions there are grooves on the surface. Having equal alpha_x/alpha_y values means the surface behaves uniformly. Like clay for example. having them differ gives the impression that the material was created with tools (i.e a lathe), also the magnitude of the alpha values also affect the size of the groves.

    I'v been coding up most of these lighting models (and some other ones) over the last few days in RenderMonkey, so if anyone wants to play around with the parameters go snag the project file here.

    They are not optimized at all, and some wont compile on anything below SM 2.0a/b since they are pretty long (no lookup tables used and plenty of trig functions). Let me know if you find any errors too :S

    Share this comment


    Link to comment
    Quote:
    mmm, that book looks good. I'v been pondering weather I should buy it, or the ShaderX3 book as a christmas present for myself.

    Yup, the book is definitely good. The problem I have with the ShaderX books (4 is out soon) is that there are, well, 4 of them... I own 3 of the Game Programming Gems series, and I like all 3 - but I realised that as useful as they are, I don't use each of them enough to justify their continual investment. Hence why I'm skeptical of the ShaderX series... I'll invest money now, but as soon as ShaderX 5...6...7... comes out, it's possible it's just not worth it [oh]

    Quote:
    I like to think of it as simulating in what directions there are grooves on the surface. Having equal alpha_x/alpha_y values means the surface behaves uniformly. Like clay for example. having them differ gives the impression that the material was created with tools (i.e a lathe)

    That has to be one of the better descriptions I've heard [smile]

    Cheers,
    Jack

    Share this comment


    Link to comment
    yeah, too bad books are so freakishly expensive. "Advanced Lighting and Materials with Shaders" costs roughly 45 USD in sweden and that is probably one of the cheaper graphics books I'v ever seen. Eberly's Game Engine Architecture was about 80 USD at the local bookstore in town (arrgh!). Most of these books are almost half price in the US :(

    Share this comment


    Link to comment
    Jollyjeffers, i think next equation isn't correct:
    Fresnel(f) = f + (1-f)x(1-(Normal.View))^5
    it may confuse somebody

    Fresnel(f) = Rs + (1-Rs)x(1-f)^5
    it would be more correct:)
    [equation (11) from http://www.cs.utah.edu/~michael/brdfs/simple.pdf]

    Anyway, thank you for article, it's cool.

    Share this comment


    Link to comment

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now