# Material pixel depth offset and shadows.

**URL:** <https://forums.unrealengine.com/t/material-pixel-depth-offset-and-shadows/321548>\
**Category:** Rendering\
**Tags:** Shadows, cast-shadow, unreal-engine, question\
**Created:** [June 12, 2015, 2:14pm UTC](https://forums.unrealengine.com/t/material-pixel-depth-offset-and-shadows/321548 "2015-06-12T14:14:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![douglaslassance](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/douglaslassance/32/1210436_2.png) [@douglaslassance](https://forums.unrealengine.com/u/douglaslassance)\
**Post date:** [June 12, 2015, 2:14pm UTC](https://forums.unrealengine.com/t/material-pixel-depth-offset-and-shadows/321548/1 "2015-06-12T14:14:06Z")

</div>

In the material editor there is a handy “Pixel Depth Offset” parameter. I want to use it to re-create what is shown in the following picture.

 ![46129-screen+shot+2015-06-12+at+12.45.24+pm.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/6/4/e64bb17eafa1be0461c5ee389f10ff8129bc4b8c.png)

Currently I can push stuff back using positive values and it pretty much does what is shown above. There is a problem though. It messes up all shadows. My intuition tells me that shadows are calculated using the depth buffer **after** alteration, and because of that you end-up with shadows that are offset and therefore do not match the geometry of the scene.

It seems to me that a solution would be to implement a flag for ignoring the Pixel Depth Offset in the shadow calculation. But maybe these is already some existing solution that I don’t know about. Thanks for your help.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a6ad17d5](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a6ad17d5](https://forums.unrealengine.com/u/anonymous_user_a6ad17d5)\
**Post date:** [July 13, 2015, 11:07am UTC](https://forums.unrealengine.com/t/material-pixel-depth-offset-and-shadows/321548/2 "2015-07-13T11:07:23Z")

</div>

I am experiencing the same problem here. Tried to add a SHADOW\_DEPTH\_SHADER preprocessor check in the MaterialTemplate.usf, but doesn’t seem to solve the problem. Some help here would be great!

---

<div class="post-metadata">

**Author:** ![Dmaw](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dmaw](https://forums.unrealengine.com/u/Dmaw)\
**Post date:** [December 27, 2020, 12:52pm UTC](https://forums.unrealengine.com/t/material-pixel-depth-offset-and-shadows/321548/3 "2020-12-27T12:52:38Z")

</div>

Hey did you ever solve this?
