You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an issue related to the new normal map from 20902e3 . I'm expecting the color white to fall around #dada80 which is (45 degrees theta, 0 degrees phi) in spherical coordinates or (0.7071, 0.7071, 0.0) in Cartesian coordinates.
Not sure what to suggest for the current approach because I 1. try to use fewer trigonometric functions and 2. allow the normal sphere to be flipped on the z axis. Below is a snippet of some simplified Lua code.
Not sure, but some users may expect a color like white to be normalized in advance, making white into #c9c9c9, (45 degrees theta, 35 degrees phi) or (0.577, 0.577, 0.577). For a color picker, though, I prefer clamping so that the reticule doesn't bounce around on the wheel.
The text was updated successfully, but these errors were encountered:
I guess in ColorWheel::onPaintMainArea(), before we call paintColorIndicator() when can just clamp the distance when we use red/green values only:
diff --git a/src/app/ui/color_wheel.cpp b/src/app/ui/color_wheel.cpp
index 6f0b0ea2b..187b9e2c9 100644
--- a/src/app/ui/color_wheel.cpp+++ b/src/app/ui/color_wheel.cpp@@ -344,9 +344,14 @@ void ColorWheel::onPaintMainArea(ui::Graphics* g, const gfx::Rect& rc)
double x, y;
double approximationThreshold = (246.0 / 255.0) * 2.0 - 1.0;
- if (normalizedBlue > approximationThreshold) { // If blue is too high, we use red and green only as approximation- x = normalizedRed * m_wheelRadius;- y = -normalizedGreen * m_wheelRadius;+ if (normalizedBlue > approximationThreshold) {+ // If blue is too high, we use red and green only as approximation+ double angle = std::atan2(normalizedGreen, normalizedRed);+ double dist = std::sqrt(normalizedRed*normalizedRed + normalizedGreen*normalizedGreen);+ dist = std::clamp(dist, 0.0, 1.0);++ x = std::cos(angle) * m_wheelRadius * dist;+ y = -std::sin(angle) * m_wheelRadius * dist;
}
else {
double normalizedDistance = std::cos(std::asin(normalizedBlue));
This is an issue related to the new normal map from 20902e3 . I'm expecting the color white to fall around
#dada80
which is (45 degrees theta, 0 degrees phi) in spherical coordinates or (0.7071, 0.7071, 0.0) in Cartesian coordinates.Not sure what to suggest for the current approach because I 1. try to use fewer trigonometric functions and 2. allow the normal sphere to be flipped on the z axis. Below is a snippet of some simplified Lua code.
Not sure, but some users may expect a color like white to be normalized in advance, making white into
#c9c9c9
, (45 degrees theta, 35 degrees phi) or (0.577, 0.577, 0.577). For a color picker, though, I prefer clamping so that the reticule doesn't bounce around on the wheel.The text was updated successfully, but these errors were encountered: