I got this wonderful image below from the Wikipedia page on Dodecahedrons. It shows a Tetroid rotating slowly. If you look carefully, it is clear that the assumption is that there is a light source somewhere outside the screen. If a face reflects more light back to the observer, it appears brighter and if it reflects less light back, it appears darker. I have an idea about how I might get a metric for the amount of light a face is reflecting back at a certain rotation. I can also scale the metric to a value between 0 and 255 (which most color scales assume). However, how do I get the actual rgb values that look like a bright, reflective blue when the metric is high and the darkish blue when the metric is low?
-
1Take a look at this post: graphicdesign.stackexchange.com/questions/75417/… and this: graphicdesign.stackexchange.com/questions/83866/…– RafaelCommented Dec 30, 2017 at 10:07
-
1And this one too: graphicdesign.stackexchange.com/questions/90470/…– RafaelCommented Dec 30, 2017 at 10:18
Add a comment
|
1 Answer
Okay, I found that the HSL color scale is meant exactly for this (with the 'L' standing for luminosity). So, I just make the L scale linearly with my face angle keeping H and S constant. Here is the Python code for doing this conversion -
def colorFromAngle2(angle):
h = 136
s = 118
l = 96+64*angle/450
r, g, b = colorsys.hls_to_rgb(h/255.0, l/255.0, s/255.0)
r, g, b = [x*255.0 for x in r, g, b]
return (int(r),int(g),int(b))
This leads to something like this -