Hey to all,
I was wondering what would be the best way to put up a Specular-Fresnel term.
For example, I currently have my Fresnel term mutiplied with the Blinn/Phong term, before being fed into the Exponent and etc. which is lastly being added to the final output, so that at glancing angles, the fresnel kicks in, but only parts being hit by the light (specular term).
I have read at the same time some documentation which say Fresnel should just be standard added to the Specular term, which strikes me as odd.
Anyone have hints in that area? Would much appreciate it.
Replies
Think of a shiny car, at maybe 4pm. Looking across the (flat roof), away from the lights, you're likely to get a similar effect from the surface.
Fresnel just plain added to spec could be interesting, maybe a bit overblown as well in some circumstances I can think of.
The only thing I can think of is multiplying something (cavity map?) over the fresnel so you don't get bright areas where they should be 'reflecting' a dark area.
The fresnel value is usually extremely low (most non-metal surfaces are between 0.01 and 0.04 - metals can go up to about 0.5).
This means that the specular result is strongest at glancing angles between the camera vector and the light vector but is very low when the camera and light are in close alignment.
Based on: http://filmicgames.com/archives/557 and http://seblagarde.wordpress.com/2011/08/17/feeding-a-physical-based-lighting-mode/
Multiplying a reflected cubemap with the fresnel term (after you've adjusted it's falloff etc) is pretty common for shiny materials, but if you look around, just about every material has a 'glancing angle specular response' (most diffuse materials actually have it more prominently than they have the directly reflected specular 'dot' seen with Blinn/Phong).
I think of the fresnel as a way to describe the reflectance of the material in a similar way that lambert describes the diffuse falloff, to say the light that could potentially bounce off of the microsurface as specular given the angle (typically stronger with more of a glancing angle).
So I think of the direct specular 'dot' as appearing due to some amount of overall reflectance, and rather than thinking of it as something that is always tagged on (Blinn/Phong), I think of it as a bias in the fresnel term (toward 1). The fact that the light's direct reflection is more apparent than the other reflectance here being due to the fact that the light itself has greater intensity than the indirect light sources (ideally cubemaps would capture values greater than 1 and the ratio of specular vs diffuse reflectance, conservation of energy, absorption, etc would be taken into account before adding them).
As for multiplying the fresnel with the lambert (or whatever you use), I see this as a way of avoiding lighting/haloing in the shadows, but If you are using a cubemap it seems like that reflection info should still be applicable in those areas as well (just with less intensity than the direct light source).
You still need to calculate the traditional specular term, but the fresnel value acts as a mask in order to ensure that the specular highlights are most prominent at glancing angles.
There's a whole other thing with energy conservation, too... which further complicates things.
http://advances.realtimerendering.com/s2011/
or more stuff on the topic
http://renderwonk.com/publications/s2010-shading-course/
It features many similar things to the black ops slides you mention CrazyButcher. It has an energy conserving specularity which you control with a roughness texture along with a fresnel term based on a substance texture. Utilizes the roughness texture to determine which cube mip to use for reflections and a few other features.
The only ones that seems to work for my case is either a Lerp or an Add, controlling the spec by itself and the fresnel on it's own, but in both cases, feeding the Spec Map and color into my fresnel unless I'm misunderstanding something.
Please, do bare with me since most common things do fly over my head sometimes.
Do you have any way to debug? As in visualize the fresnel just as color?
As far as I can remember it should just be a matter of multiplying the spec with the fresnel, same for reflections.
What I mentioned above would ideally have hdr values for the environment map and the material using the fresnel in this way (as a measurement of specular reflectance based on incidence angle).
Cheers guys and thanks.