# Material graph power node doesn't allow negative base?

**URL:** <https://forums.unrealengine.com/t/material-graph-power-node-doesnt-allow-negative-base/504061>\
**Category:** Rendering\
**Tags:** unreal-engine, UE4-27\
**Created:** [March 4, 2022, 4:00pm UTC](https://forums.unrealengine.com/t/material-graph-power-node-doesnt-allow-negative-base/504061 "2022-03-04T16:00:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ken.Brueck](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ken.Brueck](https://forums.unrealengine.com/u/Ken.Brueck)\
**Post date:** [March 4, 2022, 4:00pm UTC](https://forums.unrealengine.com/t/material-graph-power-node-doesnt-allow-negative-base/504061/1 "2022-03-04T16:00:28Z")

</div>

I’m using the power node and hoping to get alternating values, e.g. f(x)=-1^x.

I’ve found if I enter a negative value as the base for the power node the output is always zero. Here are the results of a few tests using the debug scalar values node:

-1^2 = 0  
0^2 = 0  
1^2 = 1  
2^2 = 4

Is this expected behavior of the power node? If so, is there any other way around this limitation? I really need to be able to do x^n… was not expecting to be stuck on this today, lol.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [March 4, 2022, 4:08pm UTC](https://forums.unrealengine.com/t/material-graph-power-node-doesnt-allow-negative-base/504061/2 "2022-03-04T16:08:55Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/1/4/114c22dcc43606b4e448c50d923134f244dc9212.png)

It’s to do with the fact that shaders can’t show you negative values:

> [@\[bug\] power don't work with negative values in Decals](https://forums.unrealengine.com/t/bug-power-dont-work-with-negative-values-in-decals/420095/5):
>
> But power doesn’t work like that - so it is a bug. If you want to add such node which works like that then add another one - don’t mess with basic math please. I fount this only in one place right now - obvious to fix, but it can cause a lot more bugs, and why? this change is totally illogical and counter-intuitive.

---

<div class="post-metadata">

**Author:** ![MillhouseOne](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MillhouseOne](https://forums.unrealengine.com/u/MillhouseOne)\
**Post date:** [March 4, 2022, 4:25pm UTC](https://forums.unrealengine.com/t/material-graph-power-node-doesnt-allow-negative-base/504061/3 "2022-03-04T16:25:23Z")

</div>

Well… don’t I feel dumb for not reading the tooltip. Thanks!

---

<div class="post-metadata">

**Author:** ![Andrej730](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/andrej730/32/1194692_2.png) [@Andrej730](https://forums.unrealengine.com/u/Andrej730)\
**Post date:** [April 14, 2022, 7:25pm UTC](https://forums.unrealengine.com/t/material-graph-power-node-doesnt-allow-negative-base/504061/4 "2022-04-14T19:25:02Z")

</div>

By the way - is there any particular reason for Power node to clamp negative values in base?  
It’s seems counterintuitive and limiting since it’s not allowing us to power negative values.

Is there any alternative?  
I guess the only way to workaround around this is to do something like `pow(abs(base), exp)` and somehow add the correct sign to it.
