# Fade edges of a cube material - Dot product doesn't work

**URL:** <https://forums.unrealengine.com/t/fade-edges-of-a-cube-material-dot-product-doesnt-work/386107>\
**Category:** Rendering\
**Tags:** edge, unreal-engine, fade, cube, question\
**Created:** [February 24, 2017, 11:31pm UTC](https://forums.unrealengine.com/t/fade-edges-of-a-cube-material-dot-product-doesnt-work/386107 "2017-02-24T23:31:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TorQueMoD](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/torquemod/32/710746_2.png) [@TorQueMoD](https://forums.unrealengine.com/u/TorQueMoD)\
**Post date:** [February 24, 2017, 11:31pm UTC](https://forums.unrealengine.com/t/fade-edges-of-a-cube-material-dot-product-doesnt-work/386107/1 "2017-02-24T23:31:30Z")

</div>

Just wondering if it’s possible to mathematically fade out the edges of a cube - not at an intersection point (I’m aware of depth fade) but permanently. Dot product or Fresnel works for a sphere but not on a cube. Is this possible to do with math in a material or would I need to set it up with a unique unwrap and alpha texture?

---

<div class="post-metadata">

**Author:** ![Oskar\_Swierad](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/oskar_swierad/32/465778_2.png) [@Oskar\_Swierad](https://forums.unrealengine.com/u/Oskar_Swierad)\
**Post date:** [March 31, 2017, 8:04pm UTC](https://forums.unrealengine.com/t/fade-edges-of-a-cube-material-dot-product-doesnt-work/386107/2 "2017-03-31T20:04:16Z")

</div>

Dot and Fresnel work on the angle between viewing vector and pixel’s normal. Which in case of a flat surface is identical. You’re looking for a difference in position. For plane it could be distance from center in X, and in Y, remapped to 0-1 range and multiplied one by another (to combine those masks). For a cube… well, that’s probably a matter of screen-space detection of distance to closest space outside of the cube. I have no idea how to approach the last one 🙂

---

<div class="post-metadata">

**Author:** ![TorQueMoD](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/torquemod/32/710746_2.png) [@TorQueMoD](https://forums.unrealengine.com/u/TorQueMoD)\
**Post date:** [March 31, 2017, 8:15pm UTC](https://forums.unrealengine.com/t/fade-edges-of-a-cube-material-dot-product-doesnt-work/386107/3 "2017-03-31T20:15:55Z")

</div>

Hmm… well, thanks for the explanation anyway 🙂
