ericstoneking / 42

Simulation for spacecraft attitude control system analysis and design
255 stars 83 forks source link

Simulating electromagnetic radiation outside the visible spectrum #98

Closed Seifalla closed 2 years ago

Seifalla commented 2 years ago

Hi Eric,

I notice that you use GLSL and texture maps to simulate planet surfaces. What if I want to simulate electromagnetic radiation outside the visible spectrum (cosmic background radiation or infrared-surface interactions for example)? Can this be done with GLSL? If not, what area(s) of expertise would such a work effort require? For more context, I am thinking about developing a scientific instrument (a sensor) simulator for 42. This is for a capstone project. And, I am trying to determine the feasibility of such an idea. My background is in computer science; I know programming and computer graphics fairly well.

ericstoneking commented 2 years ago

Hi Seifalla,

This is totally doable. You'll just be using the "false color" idea, that astronomers use all the time to shift non-visible light into the visible spectrum so that we all can interpret and appreciate it. (For an example, run 42 with the graphics active, and click the "Fermi Sky" entry in the "Show" menu. That's the gamma ray sky according to the first-year survey from the Fermi Gamma-ray Space Telescope, with intensity expressed in visible colors.)

In GLSL, you can interpret the RGB channels as any wavelength of EM radiation you want. And you can have multiple light sources, so you can have more than three "colors" at the same time. When your light interacts with a surface, you have to manage how the light gets transmitted, absorbed, or reflected. You'll probably tailor the blending functions in GLSL to suit your particular needs. Like CO2 transmits visible light, but reflects in the infrared. And of course, at the end you have to tell the viewer what the RGB they see corresponds to. But yes, all EM follows the same rules as RGB, so you can handle it in GLSL.

Sounds like a fun project.

Regards, -Eric (he/him)