-
-
Notifications
You must be signed in to change notification settings - Fork 369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(labelOutline): Add outlineOpacity to labelOutline #2093
Conversation
@@ -465,7 +466,7 @@ vec4 getColorForValue(vec4 tValue, vec3 posIS, vec3 tstep) | |||
|
|||
// If I am on the border, I am displayed at full opacity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
technically this comment is not 100% correct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this because it is not the final place opacity is calculated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I only meant that this comment should be updated because it used to be true "full opacity", but with your change, it may not be "full opacity", it depends on outlineOpacity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, I will change it.
I was wondering if you have any feedback on the non-linear behaviour of the opacity?
Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opacity of a volume is nonlinear. Specifically in volume rendering opacity is interpreted in terms of opacity per unit distance. When you need to take an interval of a volume (say 3mm of a ray) and convert that to opacity you use a power function to accumulate the opacity over the interval.
For example if your opacity is 0.5/mm and the interval is 3mm long then the opacity is 1.0 - pow(1.0 - 0.5, 3) or 0.875
You shouldn't use that pow function for your opacity. Mixing apples and oranges.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@martinken Thanks for your explanation. So based on my understanding there is no way to have the outlineThickness (in the above images) act linearly to the opacity. Correct me please if I'm wrong.
What's the status on this PR? @martinken @sedghi |
@floryst @martinken Hey guys, can we revisit this for merge? thanks! |
Does the opacity parameter have the final desired behavior? I presume it still acts nonlinearly as shown in your screenshots. |
Yeah it is nonlinear in the current composite blend mode (as Ken mentioned), this PR only adds the API for setting the opacity, the blend mode implementation in the shader decides on how the opacity behave. In near future, I'll add another PR to add a new Blend mode maybe for Labelmap which don't go through the normal composite volume rendering route which applies the non linear formula and we just use that for the Labelmap Update: the current opacity function for the labelmap is also non-linear so this PR is not adding any unexpected behaviour regarding labelmaps |
LGTM. @finetjul if you want to do a last check |
LGTM |
🎉 This PR is included in version 25.9.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 26.0.0-beta.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
That's my bad. I ended up pushing a master->beta merge. It doesn't cause any actual issues, apart from email spam. |
@floryst Oh no worries, just wanted to let you know |
PR and Code Checklist
npm run reformat
to have correctly formatted codeContext
This PR adds outline opacity for the labelOutline property of the volumeMapper
Changes
outlineOpacity with default value of 1.0 is added to the volumeMapper for labelOutline usage
Results
without
outlineOpacity
with
outlineOpacity = 0.9
However, I observed a non-linear relationship between opacity levels. For example, any opacity below 0.8 is nearly transparent, and the difference between 0.9 and 0.99 is considerable.
I think the behaviour is as a result of here when alpha is subtracted by a
pow
function (which makes it non-linear).tColor.a = 1.0 - pow(1.0 - tColor.a, jitter);
Any thoughts on this?
Testing