W3C home > Mailing lists > Public > www-svg@w3.org > May 2006

Re: Calculating Normal Map

From: Chris Lilley <chris@w3.org>
Date: Wed, 3 May 2006 23:45:41 +0200
Message-ID: <815833144.20060503234541@w3.org>
To: Mark McKay <mark@kitfox.com>
Cc: www-svg@w3.org

On Wednesday, May 3, 2006, 10:07:12 PM, Mark wrote:

MM> I'm trying to write a function that calculates a normal map from a bump 
MM> map, and am using 
MM> http://www.w3.org/TR/SVG/filters.html#feDiffuseLighting as a guide.  
MM> Unfortunately, the normal calculation requires me to multiply by the 
MM> function I(x, y), and nowhere defines what function I is.

Its the identity matrix. Although this is a standard notation, you are
right that we should document it.

MM>   Any ideas?  
MM> How can I perform the Sobel gradient?  Also, why does the SVG Sobel 
MM> calculation appear so much more complicated than other versions I google?

Two reasons.

Firstly, because many versions will make the simplifying assumption that
the image is of infinite extent, and thus only give you the equation for
pixels that are not on the edge.

Thinking of a 3x3 grid being panned over an image, where the center of
the 3x3 grid is the active pixel, then for all the pixels on the edge of
the image, the 3x3 grid will overhang the edge, reading 'empty' pixels.

The edge cases (literally) are left as an exercise for the reader.
Ignoring them (assuming black) gives nasty artefacts, and filling them
gives variability depending on whether the edges are padded (one method
to fill the empty pixels) or edge wrapped (another method) or reflected
(yet another).

The SVG spec gives all nine cases : 

top left corner,top edge, top right corner, 
left edge, middle, right edge
bottom left corner,bottom edge, bottom right corner
 
Secondly, because of the resampling resulting from filterRes and
kernelUnitLength.

-- 
 Chris Lilley                    mailto:chris@w3.org
 Interaction Domain Leader
 Chair, W3C SVG Working Group
 W3C Graphics Activity Lead
 Co-Chair, W3C Hypertext CG
Received on Wednesday, 3 May 2006 21:45:44 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:34 GMT