Mobile app version of vmapp.org
Login or Join
Ravi4787994

: How to get a color scale representing reflected light I got this wonderful image below from the Wikipedia page on Dodecahedrons. It shows a Tetroid rotating slowly. If you look carefully, it

@Ravi4787994

Posted in: #Color #Gradient #LightingEffects #Reflection #Rgb

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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Ravi4787994

1 Comments

Sorted by latest first Latest Oldest Best

 

@Ravi4787994

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 -

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme