cosine term in rendering equation

Started by
12 comments, last by Bummel 9 years, 10 months ago

Samith, in the ideal mirror case, I am certain that you had the right idea when you said it should be a delta function. That is the only way that your BRDF will integrate to 1. I suppose in code, this can only be approximated by having your BRDF equal 1/?? where ?? is whatever step size you're using in your integration.

Yep, the BRDF is a delta function (in two dimensions), usually though in code it is handled specially, i.e. the (unique) reflected ray is calculated analytically rather than integrating the BRDF (sampling techniques tend to break down when confronted with a delta distribution) or, alternatively, define "ideal mirror" == "extremely shiny surface" so that it's not quite a delta function but is close enough, without requiring special handling. Depends on your needs. But yeah you don't sample a BRDF at uniform intervals in general, it's too expensive.

As for the cosine term confusion, remember that the BRDF essentially says "hey, such and such amount of energy is falling on my differential surface from direction L, how much of that is reflected into direction V?" and so (thinking of it as a function) converts irradiance from L to radiance into V. Now you're not given the irradiance from L, you're only given radiance from L. But you know the angle L makes with the surface normal (theta) and irradiance is equal to radiance multiplied by the cosine of the angle (e.g. grazing angle = zero irradiance, no matter how much energy is being beamed parallel to the surface, and normal incidence = maximum irradiance). That's what the cosine term in the rendering equation is doing! The Li * cos(theta) term is actually your irradiance from L, you multiply this by the BRDF to obtain radiance into V, and integrating this over the unit sphere or hemisphere gives you the total radiance into V taking into account every light source or reflector in the world. By reciprocity you can also do it backwards, etc...

So you only need a single cosine term, because that's how the BRDF is defined, now since the BRDF converts irradiance into radiance it probably has to take into account dot(N, V), and many do in some way, e.g. Cook-Torrance, by dividing by dot(N, V) since radiance is defined as watts/square meter/steradian, so the smaller the solid angle into which the light is emitted (the smaller dot(N, V)) the larger the radiance becomes (the energy is "concentrated" into a small solid angle). But the ideal diffuser doesn't have to, because that's what an ideal diffuser is: it reflects with constant radiance, so its BRDF should be constant... for radiance to be constant. The viewer's position is irrelevant.

When the light finally hits the sensor, you don't want to use irradiance as a final "pixel color" or anything, because, of course, irradiance is the amount of energy falling onto a differential cell of the sensor, and this amount of energy is proportional to the incident angle of the light falling onto that cell. So you actually want to use radiance, and so there is no need to consider the angle made by the light with the surface normal of the sensor or screen or whatever. Yeah, it's quite confusing with all the different terms and units being thrown around (sometimes in conflicting ways by different people) and there are various interpretations that are equally valid but seem quite different, but I think it makes sense.

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

Advertisement


So you only need a single cosine term, because that's how the BRDF is defined, now since the BRDF converts irradiance into radiance it probably has to take into account dot(N, V), and many do in some way, e.g. Cook-Torrance, by dividing by dot(N, V) since radiance is defined as watts/square meter/steradian, so the smaller the solid angle into which the light is emitted (the smaller dot(N, V)) the larger the radiance becomes (the energy is "concentrated" into a small solid angle). But the ideal diffuser doesn't have to, because that's what an ideal diffuser is: it reflects with constant radiance, so its BRDF should be constant... for radiance to be constant. The viewer's position is irrelevant.

Yeah. I think what's confusing about the BRDF is that a BRDF of 1 steradian^-1 means that the RADIANCE is distributed equally in all directions. The radiant intensity (watts / steradian) is not even in all directions, but the smaller projected area at angles cancels out the change in radiant intensity and the radiance stays the same. In the ideal mirror case, the radiant intensity doesn't go down at angles, it stays the same, and you need the BRDF to reflect that with the 1 / dot(N, V) term.

Hi,

This paper addresses the problem of dark reflections at grazing angles for metals and suggests an improved BRDF to fix it:

http://sirkan.iit.bme.hu/~szirmay/brdf6.pdf

The correction term mentioned in that paper allows the simulation of ideal mirrors and in general boosts the specular reflections of all metallic surfaces. It is trivial to add it to your pipeline (either to shaders or pre-convolved cubemaps) so give it a try!

I'm trying to reconcile that with the ideal diffuser (Lambert) case now... The lambert BRDF is just "k" (diffuse colour), so for a white surface we typically just use dot(N,L) in our per pixel calculations.
If we incorporate the view angle through, we get dot(N,L)/dot(N,V)... which results in a very flat and unrealistic looking surface.

There are actually three cosine terms: dot(incident light dir, surface normal), dot(emitted light dir, normal), dot(viewer dir, normal) -> the last two cancel out (the differential area over which the emitted light is distributed grows proportionally to the observed differential area).

This topic is closed to new replies.

Advertisement