<p>First off you want the start of each line to have the color of an already faded line, ie rgb_color*0.95. You already figured out how to do this so I stop there.</p>

<p>For the HSV you are interested in the Value component only when fading towards black. Basically you should do hsv_color.value*0.95.</p>

<p>I typed this on phone. Please edit if you get it and may explain better.</p>

CC BY-SA 3.0
2016-05-30T16:47:25.703Z
2016-05-30T16:47:25.703Z
Andreas
<p>The opacity acts linearly through the colors, i.e. it affects R G B similarily, so it should affects the value V the same way.
You just want to have an intensity factor decay as $0.95^n$.</p>

CC BY-SA 3.0
2016-05-25T21:31:44.270Z
What does n mean? Why 0.95?
J.Doe
CC BY-SA 3.0
2016-05-26T15:52:19.933Z
opacity 0.05 means transparency 0.95, i.e. the intensity scaling. n is the number of passes (i.e. number of times you apply a 0.05 opacity).
Fabrice NEYRET
CC BY-SA 3.0
2016-05-25T20:55:50.740Z
2016-05-25T20:55:50.740Z
Fabrice NEYRET
<p>This is hard to explain but I am going to try, then I will explain it as pure mathematics.</p>

<p>Look at this image.
<a href="https://i.sstatic.net/jBASF.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/jBASF.jpg" alt="enter image description here"></a>
So basically this is a moving line, each frame a new segment is added and the previous frame is faded by an amount decided by fps. (There are dots to make things neat but I'm not showing them for simplicity).</p>

<p>So based on the FPS a number is calculated (0.05 if perfect FPS ) and as a result the previous frame gets a black plane drawn over it with an opacity of 0.05.</p>

<p>As you can see this causes an issue because of the segments. My solution is to give each vertex a color, however I don't know how to calculate that color.  The line color is defined by HSV, and the fading is decided by RGB.  Furthermore I am pretty sure fading with the transparent plane creates an exponential effect, however HSV.V works linearly.</p>

<p>My question is if I know on a given frame that the fading plane will have an opacity of 0.05 how can I calculate an equivalent HSV color to what the previous frame will be after fading? That way the bottom two vertices can be a darker color and interpolation can fix it.</p>

<p>The formula that decides the opacity of the black is as follows. </p>

<pre><code>(dt / (1 / 60)) * 0.5
</code></pre>

CC BY-SA 3.0
2016-05-25T21:28:56.693Z
"As you can see this causes an issue because of the segments.". Could you describe what problem you are seeing? What about the picture should be different?
trichoplax is on Codidact now
CC BY-SA 3.0
2016-05-25T21:30:22.467Z
@Trichoplax the line has clear segments inside of it. The line should be smooth.
J.Doe
CC BY-SA 3.0
2016-05-25T21:50:14.087Z
Do you mean that there should be no visible colour difference between the segments?
trichoplax is on Codidact now
CC BY-SA 3.0
2016-05-25T22:22:25.927Z
@trichoplax I just want the color to be smooth. I want the new segment to math nicely with the previous faded one.  Just so that everything looks continuous in both shape and color.
J.Doe
<opengl><color><color-science>
Matching an HSV color with a blended color
J.Doe
# Matching an HSV color with a blended color

(Asked by: username_0 on 2016-05-25)

This is hard to explain but I am going to try, then I will explain it as pure mathematics.

Look at this image.
[![enter image description here](https://i.sstatic.net/jBASF.jpg)](https://i.sstatic.net/jBASF.jpg)
So basically this is a moving line, each frame a new segment is added and the previous frame is faded by an amount decided by fps. (There are dots to make things neat but I'm not showing them for simplicity).

So based on the FPS a number is calculated (0.05 if perfect FPS ) and as a result the previous frame gets a black plane drawn over it with an opacity of 0.05.

As you can see this causes an issue because of the segments. My solution is to give each vertex a color, however I don't know how to calculate that color. The line color is defined by HSV, and the fading is decided by RGB. Furthermore I am pretty sure fading with the transparent plane creates an exponential effect, however HSV.V works linearly.

My question is if I know on a given frame that the fading plane will have an opacity of 0.05 how can I calculate an equivalent HSV color to what the previous frame will be after fading? That way the bottom two vertices can be a darker color and interpolation can fix it.

The formula that decides the opacity of the black is as follows.

```
(dt / (1 / 60)) * 0.5

```

**Tags:** opengl, color, color-science

> **Comments:**
> **username_1**: "As you can see this causes an issue because of the segments.". Could you describe what problem you are seeing? What about the picture should be different?  
> **username_0**: @username_1 the line has clear segments inside of it. The line should be smooth.  
> **username_1**: Do you mean that there should be no visible colour difference between the segments?  
> **username_0**: @username_1 I just want the color to be smooth. I want the new segment to math nicely with the previous faded one.  Just so that everything looks continuous in both shape and color.  

---

## 2 answers

### Answer by username_2 on 2016-05-30. Score: 1

First off you want the start of each line to have the color of an already faded line, ie rgb\_color\*0.95. You already figured out how to do this so I stop there.

For the HSV you are interested in the Value component only when fading towards black. Basically you should do hsv\_color.value\*0.95.

I typed this on phone. Please edit if you get it and may explain better.


---

### Answer by username_3 on 2016-05-25. Score: 1

The opacity acts linearly through the colors, i.e. it affects R G B similarily, so it should affects the value V the same way.
You just want to have an intensity factor decay as $0.95^n$.

> **Comments:**
> **username_0**: What does n mean? Why 0.95?  
> **username_3**: opacity 0.05 means transparency 0.95, i.e. the intensity scaling. n is the number of passes (i.e. number of times you apply a 0.05 opacity).  

---

