# Shader question!

**URL:** <https://discourse.processing.org/t/shader-question/28164>\
**Category:** Coding Questions\
**Created:** [March 1, 2021, 2:46pm UTC](https://discourse.processing.org/t/shader-question/28164 "2021-03-01T14:46:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![carfreesun](https://avatars.discourse-cdn.com/v4/letter/c/ecb155/32.png) [@carfreesun](https://discourse.processing.org/u/carfreesun)\
**Post date:** [March 1, 2021, 2:46pm UTC](https://discourse.processing.org/t/shader-question/28164/1 "2021-03-01T14:46:48Z")

</div>

hello everyone, i’m curious about shader language. so i write this question!

When I want to use the ‘ease’ function, why do I have to use another function instead of just putting a variable in parameter t?

for example,

```auto
float backInOut(float t) {
  float f = t < 0.5
    ? 2.0 * t
    : 1.0 - (2.0 * t - 1.0);

  float g = pow(f, 3.0) - f * sin(f * PI);

  return t < 0.5
    ? 0.5 * g
    : 0.5 * (1.0 - g) + 0.5;
}

void main() {
  float pct = backInOut(abs(fract(t) * 2.0 -1.0));
...
}

```

why use abs function, and fract function?  
Is it related to resolution?

---

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [March 1, 2021, 4:43pm UTC](https://discourse.processing.org/t/shader-question/28164/2 "2021-03-01T16:43:55Z")

</div>

Not sure this forum might be a better help. They deal specifically with shaders.

> **[Khronos Forums](https://community.khronos.org)**
>
> Khronos Standards community discussions
