ashikmin-shirley brdf back
(L) [2007/03/23] [playmesumch00ns] [ashikmin-shirley brdf] Wayback!I've had the same problem implementing the ward brdf before, and I've never got to the bottom of what's going on, so I thought I'd chuck it at you guys to see if you can help.
This is a prman implementation. The shader code for the brdf looks like so:
(L) [2007/03/23] [Michael77] [ashikmin-shirley brdf] Wayback!Well, I had many, many discussions about this topic and no one could really give me a good answer. Anyway, here is what I think:
Basics first: The BRDF should be physically plausible, that is why the results get so high.
Think about how it works in monte carlo integration: It samples the upper hemisphere (we don´t consider the lower hemisphere here since it is a BRDF) and collects the radiance L each ray hits. Summing up all the samples and dividing by the number of samples gives you the total irradiance E ariving at the surface.
But now consider what you are doing with a single point light: Monte Carlo sampling will NEVER hit the lightsource since it has no area so it comes to the conclusion that no light arrives at the surface.
Therefore, the intensity of a point light doesn´t specify the radiance L leaving a surface but the radiant flux Phi. The radiance of a pointlight is therefore Phi/(Area of the point light) = Phi / 0 = infinity. Of course, infinity is not very helpfull here, so we use the dirac delta function (http://en.wikipedia.org/wiki/Dirac_delta) so we can compute anything.
The physically plausible brdf does strange things now and give you a mathematically correct result. But honestly, I never understood what exactly happens (and no one could ever explain it to me) and I don´t thing, physically plausible brdfs look anything like the real thing when using point lights. They are needed for monte carlo integration and certainly have their mathematical explaination, but they are useless in normal renderings (maybe that´s why no one is using them). Furthermore, when you try to use them you get the feeling of controlling a property of the light source when tweaking the parameters of the material.
Long story, short summary: Values over 50 are fine since you will also have values around 0 when doing monte carlo integration. You just need to make shure, you don´t weight the rays two times (so if you create rays with the pdf you shouldn´t weight a second time them since they are already weighted). If you evaluate lightsources directly: Just don´t use the brdf ( or just skip the sqrt(nu+1 * nv+1)/8pi term).
Just my 2cents
Michael
(L) [2007/03/23] [playmesumch00ns] [ashikmin-shirley brdf] Wayback!I understand what you're saying about the difficulties of using point light sources. I'm in fact using an area light. Not sure what you're saying about the pdf though. Surely if I sample according to the pdf I have to divide each sample's result by the corresponding pdf for that direction?
On a slightly different train of thought: fresnel and microfacet theory. The ashikmin brdf includes a HK fresnel term. Surely that's only really valid for a specular mirror layer though, as if the surface gets rougher, the fresnel effect should become less and less, since more microfacets will be at glancing angles to the light and will hence reflect more. Is this correct, and is there any way of quantifying it?
(L) [2007/03/23] [beason] [ashikmin-shirley brdf] Wayback!By definition, brdf = reflected_radiance / irradiance.
By definition, radiance = flux/(area *cos(theta) * solid angle).
By definition, irradiance = flux/area.
Rearranging terms, irradiance = incident_radiance * cos(theta) * solid_angle.
Now, if you plug this equation into formula for brdf,
for a mirror where incoming radiance and  outgoing radiance are equal and solid angle is 0, you would have:
brdf =  reflected_radiance / irradiance
= reflected_radiance / (incoming_radiance * cos(theta) * solid_angle)
= 1  / (cos(theta) * 0)
= infinity
(In practice, we sample this direction explicitly, thus p ~ dirac delta = inf, so things balance out  [SMILEY Smile]
(L) [2007/03/25] [Michael77] [ashikmin-shirley brdf] Wayback!Yes, that is the mathematical explaination. But take your time and think about it: Consider a lightsources with value 1,1,1: What does this value mean?  Radiance? Flux? Or some magical value that changes its meaning when using point lights instead of area lights?
(L) [2007/03/25] [petershirley] [ashikmin-shirley brdf] Wayback!Note that the Ward and AS BRDFs are physcially inspired hacks.  So don't think too deeply about their motivation.
As a debugging strategy, I suggest you start with a pdf of p = (1/pi) cosine.  This will not be fast, but when you switch to another more sophisticated sampling strategy you will have a working test case to compare too.
(L) [2007/03/26] [playmesumch00ns] [ashikmin-shirley brdf] Wayback![quote="beason"]
(L) [2007/03/27] [playmesumch00ns] [ashikmin-shirley brdf] Wayback!Aaaahh that's interesting. I'm at MPC in London. Doing look-development for narnia right now... [SMILEY Smile]
The preferred one over here was always Blinn, which I hate because of the ugly-as-hell fresnel hack. It's taken me years to stop people painting 'rolloff' maps... now i just use a cook-torrance on everything.
What I've come to realise over the (few) years I've been doing this, is that it really doesn't matter very much what brdf you use: what's much, much more important is the quality of your textures, and the accuracy of your lighting. So yeah, just sticking a phong on there will get you 90% of the way there if your source material's good enough.
I've been toying with the idea recently of expressing shaders more in terms of something like maxwell's layered bsdf system, and accounting for proper weighting and transmission between those layers, and with proper importance sampling for environment maps etc: hence i'm playing with the A-S brdf since it neatly encompasses everything including anisotropy. I'm also taking a look at Schlick's brdf model since it does basically the same, but has a nice continuum from diffuse to specular which would be neat for a 'one-size fits all' brdf.
Back on topic, I *think* I've got the AS thing fixed: probably wasn't weighting something properly somewhere. At least I'm importance-sampling an environment map and an area light and it's not changing brightness in any odd ways when I change nu and nv
(L) [2007/03/28] [petershirley] [ashikmin-shirley brdf] Wayback!I'd say that any phong-like BRDF will work pretty well as long as it has three things:
1. energy conservation (or near conservation)
2. based on a half angle (like Blinn's Phong formulation or Cook-torrance)
3. has a reasonable Fresnel term
If you are doing a "from the eye" method, I like this non-reciprical form:
(1-fresnel(angle))*(R_d/pi) + fresnel(angle)*(pick your favorite phong lobe)
Try it-- you'll like it!
Pete
(L) [2007/03/28] [playmesumch00ns] [ashikmin-shirley brdf] Wayback!that's pretty much what i do already, just with a lot more 'stuff' built around it.
Any thoughts on the fresnel/roughness issue i mentioned above though?
back