# Add a custom uniform

**URL:** https://forum.deepar.ai/t/add-a-custom-uniform/294
**Category:** Studio
**Created:** [May 11, 2023, 9:13pm UTC](https://forum.deepar.ai/t/add-a-custom-uniform/294 "2023-05-11T21:13:40Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Randy\_Chapman](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.deepar.ai/randy_chapman/32/387_2.png) [@Randy\_Chapman](https://forum.deepar.ai/u/Randy_Chapman)
#### Post date: [May 11, 2023, 9:13pm UTC](https://forum.deepar.ai/t/add-a-custom-uniform/294/1 "2023-05-11T21:13:40Z")

</div>

Folks,

I’d like to add a custom uniform to my custom shader (call it radius, type float), with a slider for adjusting the value (much like the LUT slider). As well – in fact, the primary reason – is that I need to be able to adjust this as a parameter through the websdk as I do with “lutAmount”.

Is this possible? I’m perfectly content hacking text/json files to make it happen, if needed!

thanks!  
–randy

---

<div class="post-metadata">

### Author: ![jelena](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.deepar.ai/jelena/32/14_2.png) [@jelena](https://forum.deepar.ai/u/jelena)
#### Post date: [May 12, 2023, 6:14pm UTC](https://forum.deepar.ai/t/add-a-custom-uniform/294/2 "2023-05-12T18:14:22Z")

</div>

Yes. You would need to select your Fragment shader and edit it in an external tool

 ![Screenshot 2023-05-12 at 20.08.23](https://europe1.discourse-cdn.com/flex017/uploads/deepar/original/1X/2f4525a29b984364f16066f6a093373b40906ab2.png)

and add a new uniform like:

> uniform vec4 lutAmount;

You can use this uniform as a parameter to the mix function

> vec4 outputColor = mix(inputColor, anotherColor, lutAmount.x);

To display it as a slider select your shader file (parent of Fragment and Vertex) and select Edit  
 ![Screenshot 2023-05-12 at 20.11.22](https://europe1.discourse-cdn.com/flex017/uploads/deepar/original/1X/2cefa9290989e9542fc6cde3af9cecdd3c09222d.png)

In the shader builder you should be able to find your new uniform, select the slider from the dropdown and set min and max values

 ![Screenshot 2023-05-12 at 20.12.57](https://europe1.discourse-cdn.com/flex017/uploads/deepar/original/1X/7880c144d1cb922fb049f07f92db2bb1ed97d522.png)

If you have issues you can send us the project with your custom shader and we can see how we can help

---

<div class="post-metadata">

### Author: ![Abdelhamid\_3wais](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.deepar.ai/abdelhamid_3wais/32/73_2.png) [@Abdelhamid\_3wais](https://forum.deepar.ai/u/Abdelhamid_3wais)
#### Post date: [May 14, 2023, 1:42pm UTC](https://forum.deepar.ai/t/add-a-custom-uniform/294/3 "2023-05-14T13:42:35Z")

</div>

@jelena  
Is it possible design custom ui for the app to control specific stuff in the effect  
For example a slider as user can adjust the LUT intensity  
Picker options to enable/disable specific objects in the scene  
To make the experience more interactive

---

<div class="post-metadata">

### Author: ![Randy\_Chapman](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.deepar.ai/randy_chapman/32/387_2.png) [@Randy\_Chapman](https://forum.deepar.ai/u/Randy_Chapman)
#### Post date: [May 15, 2023, 3:34am UTC](https://forum.deepar.ai/t/add-a-custom-uniform/294/4 "2023-05-15T03:34:13Z")

</div>

Thank you! I got this working finally with the right magic of using a vec4 (not a float) and restarting the Studio. Not sure why it didn’t work the first time I tried it that way.

---

<div class="post-metadata">

### Author: ![jelena](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.deepar.ai/jelena/32/14_2.png) [@jelena](https://forum.deepar.ai/u/jelena)
#### Post date: [May 15, 2023, 10:57am UTC](https://forum.deepar.ai/t/add-a-custom-uniform/294/5 "2023-05-15T10:57:18Z")

</div>

@Randy_Chapman I’m glad to hear ther  
@Abdelhamid_3wais Yes, but the is a different topic. You can find info on how to hande uniforms form the app here

> **[Changing filter parameters from code | DeepAR](https://docs.deepar.ai/guides-and-tutorials/changing-filter-parameters-from-code/)**
>
> Control your filters dynamically from the code

But you can use info from this thread to find the uniform names

---

<div class="post-metadata">

### Author: ![Abdelhamid\_3wais](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.deepar.ai/abdelhamid_3wais/32/73_2.png) [@Abdelhamid\_3wais](https://forum.deepar.ai/u/Abdelhamid_3wais)
#### Post date: [May 16, 2023, 5:04am UTC](https://forum.deepar.ai/t/add-a-custom-uniform/294/6 "2023-05-16T05:04:59Z")

</div>

Awesome 😊  
Is that possible with deep ar flutter package for building easier for both ios and android ?!  
@jelena

---

<div class="post-metadata">

### Author: ![jelena](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.deepar.ai/jelena/32/14_2.png) [@jelena](https://forum.deepar.ai/u/jelena)
#### Post date: [May 16, 2023, 3:51pm UTC](https://forum.deepar.ai/t/add-a-custom-uniform/294/7 "2023-05-16T15:51:00Z")

</div>

It should be, yes

Future changeParameter(Map\<String, dynamic\> arguments) {  
return \_channel.invokeMethod(“changeParameter”, arguments);  
}
