Quote:Original post by remigius
No need to EMPHASIZE THAT DRAMATICALLY, I'd say the lack of other replies do indicate your problem wasn't too clear [wink]
Can't you just use your current diffuse intensity (normalFromNormalMap (dot) light) and multiply that with the specular intensity? Provided your tangent space transformation is set up correctly, this should take the surface normal into account and it would produce a more detailed falloff. Modulating the specular with the diffuse intensity this way works for me.
If I understand you correctly this time, I think you could also tweak the falloff some more by messing around with the surfaceNormal (dot) light term. You know the dotproduct gets close to 0 as the light/surface angle approaches 90 degrees, so you could remap it to a quadratic function (dotProduct * dotProduct) to 'ease' it in and out gradually.
Hope this DOES help :) |
Sorry, I didn't mean to offend. I guess I haven't been active on forums in a while, and I am not used to using bold.
The problem I have found with that approach is that it dulls sharp-angle specular highlights which are brought out by the fresnel term used in my lighting. To adjust for this, I tried scaling your extra term by adding an exponent to it (pow(TERM,X)), and thus took its n'th root. The problem with this is that, while it preserves fesnel reflections, it tends to add specular highlights to already-lit portions of the surface, giving an "overbright" effect where diffuse light is still seen.
As you can see here, dimly lit surfaces are brightened by specular highlights, while darker surfaces remain untouched:
However, I have found an alternate solution! :)
In this solution, you can scale the falloff exponent using FALLOFF
vTotalLightDiffuse += g_LightDiffuse[i] * max(0,dot(Normal, LightVec[i]));
float Scale = 1;
float temp = dot(In.Normal,g_LightDir[i])-0.1;
if (temp < 0)
Scale = pow(1+temp,FALLOFF);
Reflection = reflect(-LightVec[i],Normal);
vTotalSpec+= pow(max(0,dot(Reflection,ViewVec)),Power)*SpotAt*g_LightDiffuse[i]*Scale;
What I do is allow it to fade by a factor of (VertexNormal (DOT) LightVec). This means that specular highlights from light sources facing the local surface will remain entirely unaffected, while lighting sources perpendicular to and beyond will be gradually effected, in an easily scalable manner!
[Edited by - generaleskimo on August 8, 2007 1:09:18 AM]