This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
I am implementing the lighting filters at the moment and struck a confusing point in the spec. Both <feSpecularLighting> and <feSpotLight> have a specularExponent attribute. But the spec makes no effort to distinguish when each should be used. The confusion applies especially when using feSpecularLighting with an feSpotLight. At the moment I am assuming that the spotlight one is to be used when calculating the spot light colour as per the formula in section 8.10 (feDiffuseLighting). And the one from feSpecularLighting is to be used when calculating the final pixel colour as per the formula in 8.19 (feSpecularLighting). Have I got that correct? Either way, I believe the spec should be clarified. From my testing, it appears some browsers have bugs related to this issue.
(In reply to Paul LeBeau from comment #0) > I am implementing the lighting filters at the moment and struck a confusing > point in the spec. > > Both <feSpecularLighting> and <feSpotLight> have a specularExponent > attribute. But the spec makes no effort to distinguish when each should be > used. > > The confusion applies especially when using feSpecularLighting with an > feSpotLight. > > At the moment I am assuming that the spotlight one is to be used when > calculating the spot light colour as per the formula in section 8.10 > (feDiffuseLighting). And the one from feSpecularLighting is to be used when > calculating the final pixel colour as per the formula in 8.19 > (feSpecularLighting). > > Have I got that correct? Either way, I believe the spec should be clarified. > > From my testing, it appears some browsers have bugs related to this issue. Could you upload your example please? How do SVG viewers differ? Which viewers did you test?
The 'specularExponent' attribute in 'feSpecularLighting' and in 'feSpotLight' describe two different phenomena: 'feSpecularLighting' Here, the 'specularExponent' represents how light is scattered by a surface. A low value represents a surface that scatters light in all directions while a high value is more mirror like. The value is used as described in 8.19 (feSpecularLighting). 'feSpotLight' Here, the 'specularExponent' represents how focused is the beam of light. A low value represents a spotlight that is diffuse while a high value represents a spotlight that is highly focused. The value is used as described in 8.10 (feDiffuseLighting) A sentence should be added in section 10.4 (feSpotLight) to direct the reader to 8.10 for how the value of 'specularExponent' in feSpotLight is used. An additional sentence might be useful to warn the reader of the two different uses of 'specularExponent'.
Created attachment 1536 [details] Test combinations of specular exponent
Created attachment 1537 [details] Test SVG for different light sources. This is a test SVG file for different light sources used by <feDiffuseLighting>. In all cases, a white light source is centered directly above the square. Top left: No light source (e.g. no filter). Top center: Distant light (washes out rectangle). Top right: Point light. Bottom left: Spot light, specularExponent = 1. Note that light falls off quicker than for point light source. Bottom center: Spot light, specularExponent = 5. Bottom right: Spot light, specularExponent = 50. Note narrower beam. Firefox (33) seems to render this file correctly.
Created attachment 1538 [details] Specular lighting of a raised ring shape
Created attachment 1539 [details] Test SVG for different values of specularConstant in feSpecularLighting Test SVG file for different values of specularExponent in feSpecularLighting. A blurred circle (top left) is used to create a bump map to which an feSpecularLighting primitive is applied. Each image (from left to right, top to bottom) has a larger value of specularExponent (1,4,16,64,128). Firefox (33) seems to render the file correctly.
I've added a couple of test files. The one labelled "Test combinations of specular exponent" has four squares lit by the four different combinations of the two vales of specularExponent. My recollection was that there were significant different between the three browsers Chrome, FF and IE when I originally reported this bug. Now the renderings still vary but are quite close. Perhaps bugs have been fixed. With the second file "Specular lighting of a raised ring shape ", Chrome is significantly different from the other two. FF and IE11 are similar, but not exactly the same. My experience is that almost any test file involving the lighting primitives will show up significant differences between the browsers. Perhaps the descriptions of these primitives need expansion or clarification to remove these differences. Or perhaps there needs to be more tests for these. IIRC there are only about half a dozen lighting tests in the test suite.
(In reply to Paul LeBeau from comment #7) > I've added a couple of test files. > > The one labelled "Test combinations of specular exponent" has four squares > lit by the four different combinations of the two vales of specularExponent. > > My recollection was that there were significant different between the three > browsers Chrome, FF and IE when I originally reported this bug. Now the > renderings still vary but are quite close. Perhaps bugs have been fixed. > > With the second file "Specular lighting of a raised ring shape ", Chrome is > significantly different from the other two. FF and IE11 are similar, but > not exactly the same. > > My experience is that almost any test file involving the lighting primitives > will show up significant differences between the browsers. Perhaps the > descriptions of these primitives need expansion or clarification to remove > these differences. Or perhaps there needs to be more tests for these. IIRC > there are only about half a dozen lighting tests in the test suite. This was discussed and we added notes to make sure that authors see where the differences are.