# TSL update uniform

**URL:** <https://discourse.threejs.org/t/tsl-update-uniform/74523>\
**Category:** Questions\
**Tags:** tsl\
**Created:** [November 28, 2024, 10:21am UTC](https://discourse.threejs.org/t/tsl-update-uniform/74523 "2024-11-28T10:21:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![blackInk](https://avatars.discourse-cdn.com/v4/letter/b/c2a13f/32.png) [@blackInk](https://discourse.threejs.org/u/blackInk)\
**Post date:** [November 28, 2024, 10:21am UTC](https://discourse.threejs.org/t/tsl-update-uniform/74523/1 "2024-11-28T10:21:42Z")

</div>

Hi,

when writing a shader and using uniforms, how to update the uniform´s value so the shader gets the updated value.

```javascript
        const blue = uniform( 0.0 );

        const paintSome= Fn(() => {

          const attenuation = vec4(1.0, 1.0, blue.value, 1.0).toVar();          
          const finalColor = vec4(1.0).toVar();
          return finalColor.mulAssign(attenuation);   

        })()

        this.material.colorNode = paintSome;

```

The problem is - that when I initialize the program, attenuation gets the correct blue.value from const blue. If I later update blue´s value - the shader does not recognize the uniform´s update.

---

<div class="post-metadata">

**Author:** ![prisoner849](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/prisoner849/32/535_2.png) [@prisoner849](https://discourse.threejs.org/u/prisoner849)\
**Post date:** [November 28, 2024, 10:25am UTC](https://discourse.threejs.org/t/tsl-update-uniform/74523/2 "2024-11-28T10:25:19Z")

</div>

> [@blackInk](#):
>
> `blue.value`

Try to use `blue` (without `.value`).

---

<div class="post-metadata">

**Author:** ![blackInk](https://avatars.discourse-cdn.com/v4/letter/b/c2a13f/32.png) [@blackInk](https://discourse.threejs.org/u/blackInk)\
**Post date:** [November 28, 2024, 10:28am UTC](https://discourse.threejs.org/t/tsl-update-uniform/74523/3 "2024-11-28T10:28:03Z")

</div>

_banging my head_ …it works
