Skip to main content
gamedev.net
🔒 Locked

the rainbow

Started by walkingcarcass Jan 7, 2003 at 9:14 AM 2 replies 250+ views
Original Post
walkingcarcass
walkingcarcass
i have a number N between 0.0 (red) and 1.0 (violet). the values inbetween represent a linear transition through the frequencies and colours of visible light (eg 0.5 is green) i have an rgb vector where each component ranges from 0.0 to 1.0 given N, what are the values of r, g and b? as a trivial curious sidenote : suppose there is an altered spectrum measurement where infa-red is red but tending to transparent black and ultra-violet is violet but tending to transparent black. perhaps (i''m not sure if this is true) the rainbow is more densely packed towards the middle (ie the distance between yellow and green is smaller than the distance between red and orange). this is the rainbow that appears to be reflected of certain surfaces (at the moment i get a great one on my minidisk display ). obviously the colour depends on the reflection angle, so is there a way to calculate the colour at any point given a light vector, normal and eye position? ******** A Problem Worthy of Attack Proves It''s Worth by Fighting Back
spraff.net: don't laugh, I'm still just starting...
S1CA
S1CA
For your first question, since you''re only talking about the frequency and not the amplitude or multiple light waves, then N is the "hue".

Get the code for a bog standard HSV/HSL to RGB conversion (tons on Google, I think you''ll find one on Charles Poynton''s colour site). Set H to N and the saturation and luminance to constants.

For the second one, google for "Descartes ray" (BTW: CD/minidisk type surfaces give off rainbow patterns for different reasons that liquids (oil & water particles in clouds etc) do - i.e. extremely small facets (pits on a CD) rather than refraction/prism type effects *)

[It''s been a long time since I did physics at school though so I''m a tad rusty ]

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com
Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site
alvaro
alvaro
You are looking for data on spectral sensitivity of the human eye. For each wavelength, you want to know how much red, blue and green is perceived. There is a table in "Realistic ray-tracing" by Peter Shirley.

I also found this:
http://cvision.ucsd.edu/database/data/cones/linss2_10e_1.txt
but I am not sure if it''s the same data.
bishop_pass
bishop_pass
Rainbows are always the same size with respect to your field of view. There is no notion of distance. They form a halo around the antisolar point, the place directly opposite the sun. The primary arc of a rainbow is a 42 degree radius around that point.
_______________________________
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.