SOURCE: opengl code
OpenGL doesn't handle photonics or any other low-level physics - you'll either need a raytracer, such as POVRAY or Blender, or you'll have to write the physics yourself, to emulate light rays of varying colours (I recommend using a HSL colour space for your physics, only translating to RGB when rendering the frame).
The refraction of a ray at the interface of the prism and the "air" can be calculated using Index of Refraction, correction factor to account for different refraction dependent on frequency (Hue) and a random number generator to emulate slight scattering.
545 views
Usually answered in minutes!
×