Go back to Efl.Gfx.Filter.

Bump mapping

The bump effect is based on the concept of bump mapping. It basically consists in casting a light source onto the object, and using a bump map as a relief information.

Syntax
bump ({ map, azimuth = 135.0, elevation = 45.0, depth = 8.0, specular = 0.0,
        color = 'white', compensate = false, src = input, dst = output,
        black = 'black', white = 'white', fillmode = 'repeat' })
Parameters
map An alpha buffer treated like a Z map for the light effect (bump map). Must be specified.
azimuth The angle in degrees between the light vector and the X axis in the XY plane (Z = 0). 135.0 means 45 degrees from the top-left. Counter-clockwise notation.
elevation The angle between the light vector and the Z axis. 45.0 means 45 degrees to the screen's plane. Ranges from 0 to 90 only.
depth The depth of the object in an arbitrary unit. More depth means the shadows will be stronger. Default is 8.0.
specular An arbitrary unit for the specular light effect. Default is 0.0 (i.e. disabled), but a common value would be 40.0.
color The main color of the object if src is an alpha buffer. This represents the light's normal color. See Colors.
compensate If set to true, compensate for whitening or darkening on flat surfaces.
Default is false but it is recommended to set it to true if specular light is wanted.
src Source buffer. This should be an alpha buffer.
dst Destination buffer. This should be an RGBA buffer (although alpha is supported). Must be of the same size as src.
black The shadows' color. Usually this will be black (“#000”).
white The specular light's color. Usually this will be white (“#FFF”).
fillmode This specifies how to handle map when its dimensions don't match those of src and dst. Default is to “repeat”. See Fill modes.
Example

In the following example, the bump map is constructed from the input image. For text, this means we can create 3d looks on the characters by casting specular light and shadows.

bump.lua
a = buffer { 'alpha' }            -- this will be our bump map
grow { 5, dst = a }
blur { 6, src = a , dst = a }
bump { map = a, color = '#f60', specular = 1, compensate = true }
Input Bump map Output