This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 25411 - Confusion over the specularExponent attribute
Summary: Confusion over the specularExponent attribute
Status: RESOLVED FIXED
Alias: None
Product: CSS
Classification: Unclassified
Component: Filter Effects (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Dean Jackson
QA Contact: public-css-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-22 15:20 UTC by Paul LeBeau
Modified: 2015-02-11 04:45 UTC (History)
5 users (show)

See Also:


Attachments
Test combinations of specular exponent (3.46 KB, image/svg+xml)
2014-11-07 14:35 UTC, Paul LeBeau
Details
Test SVG for different light sources. (2.73 KB, image/svg+xml)
2014-11-07 14:37 UTC, tavmjong
Details
Specular lighting of a raised ring shape (11.64 KB, image/svg+xml)
2014-11-07 14:37 UTC, Paul LeBeau
Details
Test SVG for different values of specularConstant in feSpecularLighting (3.22 KB, image/svg+xml)
2014-11-07 14:43 UTC, tavmjong
Details

Description Paul LeBeau 2014-04-22 15:20:54 UTC
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.
Comment 1 Dirk Schulze 2014-11-07 07:52:00 UTC
(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?
Comment 2 tavmjong 2014-11-07 14:26:46 UTC
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'.
Comment 3 Paul LeBeau 2014-11-07 14:35:48 UTC
Created attachment 1536 [details]
Test combinations of specular exponent
Comment 4 tavmjong 2014-11-07 14:37:13 UTC
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.
Comment 5 Paul LeBeau 2014-11-07 14:37:48 UTC
Created attachment 1538 [details]
Specular lighting of a raised ring shape
Comment 6 tavmjong 2014-11-07 14:43:35 UTC
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.
Comment 7 Paul LeBeau 2014-11-07 14:52:14 UTC
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.
Comment 8 Dirk Schulze 2015-02-11 04:36:40 UTC
(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.