1

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?

enter image description here

0

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 -

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.