CIFilter_Stylize_ShadedMaterial - linhay/Stem GitHub Wiki

CIFilter.Stylize.ShadedMaterial

Discussion The height field is defined to have greater heights with lighter shades, and lesser heights (lower areas) with darker shades. You can combine this filter with the CIHeightFieldFromMask filter to produce quick shadings of masks, such as text. This filter sets the input image as a height-field (multiplied by the scale parameter), and computes a normal vector for each pixel. It then uses that normal vector to look up the reflected color for that direction in the input shading image. The input shading image contains the picture of a hemisphere, which defines the way the surface is shaded. The look-up coordinate for a normal vector is: (normal.xy + 1.0) * 0.5 * vec2(shadingImageWidth, shadingImageHeight)

public struct ShadedMaterial: CIFilterContainerProtocol

and later and in iOS 9 and later.

Inheritance

CIFilterContainerProtocol

Initializers

init()

init()

Properties

filter

var filter: CIFilter

image

A CIImage object whose display name is Image.

var image: CIImage?

shadingImage

A CIImage object whose display name is Shading Image.

var shadingImage: CIImage?

scale

An NSNumber object whose attribute type is CIAttributeTypeDistance and whose display name is Scale. Default value: 10.00

var scale: NSNumber