Dark edge around glossy material

Component:YafaRay Core
Category:bug report
Assigned:David Bluecame

The yafaray glossy material shows a dark edge around it that gives a feeling that it's "drawn" and slightly like a "cartoon", reducing its realism.

For example, comparing this scene in yafaray with luxrender, in yafaray. Notice the dark edge around the ball, specially in the right hand side.

Yafaray glossy - dark edgeYafaray glossy - dark edge














When rendering with LuxRender, it shows no dark edge, which makes it more realistic in my opinion.

luxrender glossy correctluxrender glossy correct













I'm not sure if the problem is in the code of the material or in the algorithm itself. For example, I've been digging in Internet and it seems that Luxrender had, in the past, problems with the rendering of glossy materials:


They even had the hypothesis that the problem could come from the Ashikhmin and Shirley method. I don't know how they fixed that problem, or if it was really or not the algorithm.


Also VRay seems to suffer from this problem, for example in the next link, one of the parameters seem to be a "cheat" for the dark edges in glossy:


"Fix dark glossy edges - enabling this option will fix dark edges that some times appear on objects with glossy materials"


In any case, I believe that fixing this issue would improve the realism of scenes with glossy materials.

Best regards. David.



David, Thanks for your fantastic work on yafaray!

We really need you!


I agree with the issue you posted!

I haven't seen the issue on your post and I posted the same problem reporting the same issue.


I must only add to your text that it's not just a matter of edges. It influences a plane material too.

The issue relies on the angle of the surface of the material in relarion to the camera.

If the angle between the camera and the surface is reduced the surface becames more grey and darker.

It's wrong because if this angle is smaller, the reflectance should increase. We should have a ior for glossy materials.

Therefore, the color of the edge of the sphere should be darker or brighter according to the environment.

If it's a cube the side faces should reflect more and shouldn't be just greyer.

Arquitecto can be contacted here:


i think yafaray ior and specular value are related (from luxrender manual)

"The IOR and specular color are related via the formula IOR = (sqrt(Ks)+1)/(1-sqrt(Ks)) (Ks is the proper term for specular color). This translates a specular color of .25 to an index of refraction of ~3. A specular color of .05 results in an IOR of approximately 1.6."

  apart frm darkedge of glossy one more issue is the diffuse value of glossy shader is reduced from the value you set,so that energy conservation (diffuse+spec = 1) is maintained.i.e. if you want white glossy(0.8,0.8,0.8), you have to set (1.0,1.0,1.0).

my old test "http://www.yafaray.org/community/forum/viewtopic.php?f=22&t=4341"


Assigned to:Anonymous» David Bluecame
Status:active» needs review



I've implemented an extended Texture Mapping system. Already included in Experimental v0.1.99-beta3.


For links and example images see:



For now it's so experimental that I have not yet created a pull request against official YafaRay.


I will mark this as Needs Review because perhaps we can make a more realistic glossy using Coated Glossy with the new Mirror Reflectivity Strength and the Mirror Color, Strength and IOR fresnel texture mappings. If we can make good glossy materials this way I will mark it as fixed.


I hope you like it!


The specific issue in the original post was addressed with a fix that was included in the 0.1.5 release, so I am not sure what problem you are referring to that "needs review."

Could you possibly update this thread with new screenshots and perhaps a test blend?



I've used the last git version of Master v0.1.5 and the glossy material still does not look right in my opinion, maybe even worse? (dark edge around it). It's clearly more unrealistic than the Luxrender example.

I've attached an example blend.


yafaray-glossy-photonmapping-v0.1.5 git 2015-05-02yafaray-glossy-photonmapping-v0.1.5 git 2015-05-02














yafaray-glossy-bidirectional-v0.1.5 git 2015-05-02yafaray-glossy-bidirectional-v0.1.5 git 2015-05-02




Not sure why, the blend example file did not appear in my previous reply. I hope it appears here now.

yafaray-glossy.blend 586.25 KB


Status:needs review» postponed

Postponed to future YafaRay-E v3.0.0, where I will make changes to the materials system.


Status:postponed» active


Version:» <none>
Component:Code» YafaRay Core
Status:active» needs work



Just to let you know about my progress with materials. I'm struggling with the math involved and the complexity of the code but I think I found something about glossy that's not quite right, although I don't know exactly why yet.

What I would expect from a glossy material is a higher reflected intensity at grazing angles. I'm not sure if I'm right or wrong here, but it's what I would expect.

However, our current glossy gets darker at grazing angles, even when having reflectivity=1.0!

I've (experimentally) tweaked the glossy material in my testing code to try to achieve a higher reflected values at grazing angles. I don't yet understand the math involved but I got interesting results. There are some new artifacts in the image with the modified glossy but I'm more interested now in seeing whether the changes make the material and scenes more realistic or not.

For example this is with the current glossy material:

room1 - 001 old glossy.pngroom1 - 001 old glossy.png


Exact same scene with the modified glossy (don't pay attention to the new artifact / dark spots) this is not yet finished:

room1 - 001 new glossy.pngroom1 - 001 new glossy.png


I could be mistaken, but the second example seems more realistic to me (except for the artifacts/dark spots)


Also, if combined with a glossy floor, I get very interesting results. For example with the old glossy:

room1 - 002 old glossy.pngroom1 - 002 old glossy.png


And *exact same scene* with the modified glossy. Again, please don't mind the dark spots...

room1 - 002 new glossy.pngroom1 - 002 new glossy.png


Please keep in mind these are just tests. There is still a long way until I get this done. I need to do many tests, get rid of the new artifacts and most important, I have to understand a lot better the underlying math involved to make sure the new material is physically correct (or at the very least energy conserving, etc).

In any case, it's starting to look promising :-)  At least I've achieved to remove the horrible dark edge around the material...


Good! But, why is duller than the old?



The problem here is this question: should it be duller than the old or not?

I'm still trying to understand the math to find out if what I've done makes sense or not.. :-/


Perhaps the best I can do is to create comparison scenes with LuxRender (which is an excellent physically based renderer, but slow). The problem is that it's not possible to match exactly the same lighting and material in a scene with different renderers, but I can try to make it as similar as possible.


Another test, this time with a different set of tweaks.

I don't know yet what am I doing, but sure it's fun to see different ways of making light bounce off materials. Of course, there should be only one (or a few) correct solutions for this, but it's still very interesting.

room1 - 002 new glossy (version 1.1).png 245.17 KB


I think I found a way to check whether the new glossy is correct or not.

For example, I can render the same scene but changing the "gold" glossy by the standard shiny diffuse (unmodified) with 100% reflectivity and the same reflection color than the glossy color. This is the example with shiny diffuse:


I think this looks *very* similar to the latest modified "new glossy v1.1", and really different compared with the standard glossy.

room1c - 001 (standard shiny diffuse 100pct reflective).png 246.64 KB


Now a comparison with a more typical glossy (diffuse component + glossy with exponent 500)

Old standard glossy:

room1c old glossy.pngroom1c old glossy.png


And now the "new" glossy v1.1

room1c new glossy v1.1.pngroom1c new glossy v1.1.png


I think the second looks better. In fact, it looks like in the standard glossy there is less light reflecting from the surface at grazing angles than it should be... which makes sense and could be the cause for the dark edges.

Still studying and investigating...


Definitely looks better. Also, I think an hdr scene is the best solution to make the comparison.


Now that you're with this, do you think shiny diffuse should have exponent? It has IOR but does not have exponent.

In that case, why to have a shiny diffuse and a glossy material with similar results?

The same applies to glass, and rough glass.

Also, the coated layer can be an addition to every material, so we can remove the coated glossy one (like on luxrender).



Hi guys

Maybe we can look around Mitsuba render or AppleSeed render, both are open source. Mitsuba get good shaders model but quite difficult to configure and too much shaders in each case ( dielectric, diffuse, conductor, phong, ward,...). I still really think that we must have one unique shader for every case, like Corona has. For Appleseed, I didn't test it yet, but look promising.

Olivier Boscournu __ riofranco design  Montpellier _ France   http://www.olivier-boscournu.com/



We cannot use Mitsuba code as its license is incompatible with YafaRay, but I can take a look at Appleseed. It looks very interesting.


I thik Appleseed has a lot of types of materials.

I prefer one material "to rule them all" :) Look at Maxwell, although they have introduced some specialized ones also.



Status:needs work» postponed