1

I have got a scene with an object and a cubemap in OpenGL.

My atmosphere shader(rayleigh scattering) renders to a quad which is right infront of the camera. This of course obstructs vision on my object and cubemap.

I now want to combine these elements, so that I can have:

  • an object in the front
  • the atmosphere in "the middle"
  • another object outside of the atmosphere
  • the cubemap (milky way) in the background

Thing(s) I thought of:

  • Drawing the atmosphere to a texture and projecting it onto the cubemap. This sounds way more complicated than it needs to be (and wrong because an object between the cubemap and the sky cannot exist with this method), though.

I must be missing the obvious. Thanks in advance.

kurito
  • 43
  • 2
  • 4
  • 1
    Draw the skybox and geometry, sample and blend it with the atmosphere texture sample, then draw the geometry outside of the atmosphere. – jackw11111 Jul 16 '21 at 03:40
  • 1
    yes use blending ... you can combine this [OpenGL - How to create Order Independent transparency?](https://stackoverflow.com/a/37783085/2521214) with this [VEEERRRYYY Simplified version of Atmospheric scattering](https://stackoverflow.com/a/19659648/2521214) to achieve what you describing. Also take a look at this [Is it possible to make realistic n-body solar system simulation in matter of size and mass?](https://stackoverflow.com/a/28020934/2521214) – Spektre Jul 16 '21 at 06:34

0 Answers0