Advice on how to approach building background glow for 3d galaxy?

I've got a proceduraly generated 3d galaxy galaxy, very large. Milky Way scale. It is broken up into sectors, where I can relatively quickly get the star density and average star color of any given sector with a simple call:

Color GetColorAt(x,y,z); //where hue represents star color and intensity is density


I am already pulling in the sectors around the player's location, so that the player can fly through the stars. Works great, performance is fine. Now what I want to do is add in the collective glow from stars in the galaxy that are very far away. Just like when you look at the night sky (in a rural area) you can see the glow of the milky way. So one approach is to build a skybox. For each pixel of the skybox, cast a ray through the volume of the galaxy, and check at some # of points along the ray for the star density/color there, and add it all up, then use that to set the pixel of the skybox. However this is computationally extremely expensive. ~6x1024x1024x10 operations or thereabouts at a minimum. Another idea was do to a much sparser sampling of the galaxy density around the player, and use that data to create a particle system. Where each particle will take up way more than just 1 pixel. The effect might even look pretty good. Any other ideas? Is there a data structure that would let me do this quickly?

Well... very large is an pretty elastic term. I would suggest these 2 ways.

Generation&Preparation stage

• Arrange your sectors into a tree like spatial data structure (e.g. an octree-like structure) with lod support, so that you can get the spatially neighbourhood of sectors fast. You will need the lod technique to filter to filter 'invisible stars' in the distance.

Rendering stage

• Get the minimum amount of this tree's nodes within the player's view frustum. This results in O( log( |Nodes within tree| ) ).
• For each star in your node selection, cast a ray from the star to the camera (!) resulting in O( |Stars in Selection| ).

If this is not enough, performance-wise, you could try this:

Generation&Preparation stage

• Arrange your sectors into spatial data structure (e.g. an octree), so that you can get the spatially neighbourhood of sectors fast.
• For each sector generate a skysphere.

Rendering stage

• Take the current sector's skysphere and the skyspheres from the adjacent sectors.

• Combine these displaced and weighted to use the resulting skysphere for the actual rendering of the 'sky' in the next step.