# Gradient outer glow

**URL:** <https://discourse.threejs.org/t/gradient-outer-glow/17902>\
**Category:** Questions\
**Tags:** shaders\
**Created:** [August 14, 2020, 5:41pm UTC](https://discourse.threejs.org/t/gradient-outer-glow/17902 "2020-08-14T17:41:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hrahimi270](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/hrahimi270/32/5719_2.png) [@hrahimi270](https://discourse.threejs.org/u/hrahimi270)\
**Post date:** [August 14, 2020, 5:41pm UTC](https://discourse.threejs.org/t/gradient-outer-glow/17902/1 "2020-08-14T17:41:08Z")

</div>

Hi members!  
I need a glow for my object. I was trying to do it based on [this example](https://stemkoski.github.io/Three.js/Shader-Glow.html).  
But there is a problem here! My glow is solid black.  
I reproduced a codepen example to debug it.  
https://codepen.io/hrahimi270/embed/preview/yLOeWxm?height=300&slug-hash=yLOeWxm&default-tabs=js,result&host=https://codepen.io

Please take a look to see you can find the problem.  
Note: I tried it without gradient color just like the main example. But the same result!

---

<div class="post-metadata">

**Author:** ![seanwasere](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/seanwasere/32/20864_2.png) [@seanwasere](https://discourse.threejs.org/u/seanwasere)\
**Post date:** [August 14, 2020, 6:33pm UTC](https://discourse.threejs.org/t/gradient-outer-glow/17902/2 "2020-08-14T18:33:03Z")

</div>

I think, (I haven’t checked your code), but, Its probably all dark because of your background

---

<div class="post-metadata">

**Author:** ![marquizzo](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/marquizzo/32/25192_2.png) [@marquizzo](https://discourse.threejs.org/u/marquizzo)\
**Post date:** [August 14, 2020, 7:37pm UTC](https://discourse.threejs.org/t/gradient-outer-glow/17902/3 "2020-08-14T19:37:02Z")

</div>

The problem is in your Vertex shader’s intensity calculation:

`intensity = pow( c - dot(vNormal, vNormel), p );`

If you change the fragment shader to `vec3 glow = color * 1.0;`, instead of using `intensity` then you’ll see the glow, so the problem is how you’re calculating intensity. Might be setting it to 0.0, since color \* 0 = black.

---

<div class="post-metadata">

**Author:** ![hrahimi270](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/hrahimi270/32/5719_2.png) [@hrahimi270](https://discourse.threejs.org/u/hrahimi270)\
**Post date:** [August 15, 2020, 6:24am UTC](https://discourse.threejs.org/t/gradient-outer-glow/17902/4 "2020-08-15T06:24:52Z")

</div>

Hmm. Right. Maybe I should give up on using intensity. Because in my case, I don’t move and change camera’s position. Maybe a constant value works fine.  
I’ll give it a try.
