---
title: "init(byGeneratingNormalMapWith:name:smoothness:contrast:)"
framework: modelio
role: symbol
role_heading: Initializer
path: "modelio/mdlnormalmaptexture/init(bygeneratingnormalmapwith:name:smoothness:contrast:)"
---

# init(byGeneratingNormalMapWith:name:smoothness:contrast:)

Initializes a normal map to be generated from the specified texture.

## Declaration

```swift
init(byGeneratingNormalMapWith sourceTexture: MDLTexture, name: String?, smoothness: Float, contrast: Float)
```

## Parameters

- `sourceTexture`: The texture from which to generate a normal map.
- `name`: The doc://com.apple.modelio/documentation/ModelIO/MDLNamed/name property for the new texture object.
- `smoothness`: A number between 0.0 and 1.0 indicating how much the texture should be smoothed before the normal map is generated. A value of 0.0 means that the texture is not smoothed at all before being processed.
- `contrast`: A value used to magnify the effect of the generated normal map. A value of 1.0 indicates no magnification is applied.

## Return Value

Return Value A new normal map texture object.

## Discussion

Discussion This initializer does not generate texel data; the MDLNormalMapTexture class automatically generates data when you use one of the MDLTexture methods listed in Accessing Texture Data. The generated texture uses the same dimensions and other properties as the source texture.
