What's wavelenght of laser
3 posts • Page 1 of 1
What's wavelenght of laser
Hello,
Could you say me, what's the wavelenght of the laser associate to color,
and can i modify or add new wavelenght by scripting?
thank you
Could you say me, what's the wavelenght of the laser associate to color,
and can i modify or add new wavelenght by scripting?
thank you
- Fastpulse91
- Posts: 3
- Joined: Sun Jan 14, 2018 1:29 am
Re: What's wavelenght of laser
Here it is an example how to convert wavelength to RGB color:
- Code: Select all
scene.my.gamma = 1.0;
scene.my.wave2RGB := (wavelength) => {
wave := math.toFloat(wavelength);
attenuation := 0; R := 0; G := 0; B := 0;
(wave >= 380 && wave < 440) ? {
attenuation = 0.3 + 0.7 * (wave - 380) / (440 - 380);
R = ((-(wave - 440) / (440 - 380)) * attenuation) ^ scene.my.gamma;
G = 0.0;
B = (1.0 * attenuation) ^ scene.my.gamma;
} : {};
(wave >= 440 && wave < 490) ? {
R = 0.0;
G = ((wave - 440) / (490 - 440)) ^ scene.my.gamma;
B = 1.0;
} : {};
(wave >= 490 && wave < 510) ? {
R = 0.0;
G = 1.0;
B = (-(wave - 510) / (510 - 490)) ^ scene.my.gamma;
} : {};
(wave >= 510 && wave < 580) ? {
R = ((wave - 510) / (580 - 510)) ^ scene.my.gamma;
G = 1.0;
B = 0.0;
} : {};
(wave >= 580 && wave < 645) ? {
R = 1.0;
G = (-(wave - 645) / (645 - 580)) ^ scene.my.gamma;
B = 0.0;
} : {};
(wave >= 645 && wave < 750) ? {
attenuation = 0.3 + 0.7 * (750 - wave) / (750 - 645);
R = (1.0 * attenuation) ^ scene.my.gamma;
G = 0.0;
B = 0.0;
} : {};
(wave >= 750 || wave < 380 ) ? {
R = 0.0;
G = 0.0;
B = 0.0;
} : {};
[R,G,B,1]
}
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: What's wavelenght of laser
..or you could use just hue value from colorHSVA(0) and convert it to wave length.
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
3 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 9 guests