# Shadow map generation

Easy AR gives you a new scene for shadow map generation of 3d objects in unity editor. We can use default shadows projection by directional light. But sometimes shadow took hard & random patterns. But after research we found a better way to implement a contact shadow map similar to IOS usdz shadow. So you can create your own smooth shadow map for 3d models using Easy AR. You are guided in this section, how to build this contact shadow.

* First you move to the ShadowBake <mark style="color:yellow;">scene</mark> in the <mark style="color:yellow;">EasyAR->Utilities</mark> folder.
* Hope you added your 3d model to the <mark style="color:yellow;">EasyAR->Meshes</mark> folder. For example we take our chair model to generate contact shadow.

![](https://1413926957-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgATWbsXiFJ9V1pG3RP0K%2Fuploads%2FeJYuXkorxlgSKKzf6ewI%2Fimage-059.png?alt=media\&token=421e5b6b-ff40-4346-a2f1-780bcb6d380c)

* Drag & drop 3d model (chair) to child of <mark style="color:yellow;">DragTheObjectAsChild</mark> game object in hierarchy.

![](https://1413926957-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgATWbsXiFJ9V1pG3RP0K%2Fuploads%2F7mXYX6zgMIHzwe3y3M1H%2Fimage-060.png?alt=media\&token=ab93b173-c877-4ca0-96d3-a14551ebb1c6)

* Then click the 3D model(chair) & go to the inspector. Check the static block of the 3D model.

![](https://1413926957-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgATWbsXiFJ9V1pG3RP0K%2Fuploads%2FaBppqCVDUGeBhApU09Yd%2FScreen%20Shot%202022-04-07%20at%2011.54.05.png?alt=media\&token=b252cbd2-9621-4cb3-ae07-3f23c3767de2)

* Select BackShadows gameobject & go to inspector. Under General Lighting Script there is a button called Generate shadow. Click that button.

![](https://1413926957-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgATWbsXiFJ9V1pG3RP0K%2Fuploads%2FCd1J7Bc5ADqnqgjLbFzO%2Fimage-063.png?alt=media\&token=01d1bbef-5850-4158-ad3a-8d562f81b9dc)

* You can see the process will generate a smooth contact shadow after a few seconds.
* Now you can collect this contact shadow prefab in the <mark style="color:yellow;">EasyAR->Prefabs->ShadowPlanes</mark> folder. Here **Chair142157\_Shadow** is our newly created shadow map.

![](https://1413926957-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgATWbsXiFJ9V1pG3RP0K%2Fuploads%2FGAWD2ArEm2IkW4kwBP6o%2Fimage-064.png?alt=media\&token=b633dac2-5bd7-4a03-a496-6af4600563bd)

* In the **Materials** folder you can find that contact shadow’s material & Textures folder texture of contact shadow with the same name as prefab saved.

![](https://1413926957-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgATWbsXiFJ9V1pG3RP0K%2Fuploads%2F73UaNRXAuSPZBO4V2L0W%2Fimage-065.png?alt=media\&token=b44174c4-b011-42ca-b489-7925f5e9c151)

![](https://1413926957-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgATWbsXiFJ9V1pG3RP0K%2Fuploads%2F54dRieaTp4XGojoU5pXM%2Fimage-066.png?alt=media\&token=cffc7f3b-f0ca-408d-8afa-48c0d994d9fa)

* Now you can add this contact shadow to your gameobject prefab. Select the 3d model prefab (chair prefab) & put it as a child of the 3D model prefab. Then adjust the shadow as you wish.

![](https://1413926957-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgATWbsXiFJ9V1pG3RP0K%2Fuploads%2FSG6k3lmFSJghEmtnaW6y%2Fimage-067.png?alt=media\&token=df48ce98-8767-4e4a-b058-b66aebceee80)

* Now you can see the smooth contact shadow\....

### Enjoy the Easy AR.. Thank you!
