2
\$\begingroup\$

How would one proceduraly generate a star in a compute shader that looks like one of thes two at any size needed. Also any way transfer this into a spherical map, would be appreciated. Goal is to create a spherical skybox of stars, (stars a pre generated, and not just decoration).

Also I have searched about everywhere for such equations, and or tutorials but have not found anything so far.

So far got accurate positioning of the stars on the spherical skybox but lack the equations to get it looking like I want.

Preferably the one on the right.

enter image description here enter image description here

This below is what I currently have, ~~5 to 15ms processing time, little over 30k stars

enter image description here

Using Unity2019.3.1f1, needs to be compute shader compatible. (if not I will convert it somehow) Render Texture output.

\$\endgroup\$
4
  • \$\begingroup\$ What kind of output do you want? A cubemap, equirectangular projection, dual paraboloid, etc...? Also, why a compute shader? This might be well-suited to vertex-fragment shader or even particle-based solutions. \$\endgroup\$
    – DMGregory
    Sep 12 '20 at 1:45
  • \$\begingroup\$ Wanting the output to be equirectangular projection. Also thot a compute shader was the faster way? particle based may not work as the positions are relative to the actual stars continents in the game world. \$\endgroup\$
    – chief65
    Sep 12 '20 at 16:44
  • \$\begingroup\$ You might want to mention that position constraint in your question then. How do you pass those positions to your shader at present? Also, note that equirectangular mapping has terrible texel uniformity, with the poles packed densely and the equator left sparse. You'll often need to use a higher-resolution texture to get decent detail at the equator, sacrificing memory and bandwidth you could have saved with a more uniform projection. \$\endgroup\$
    – DMGregory
    Sep 12 '20 at 17:02
  • \$\begingroup\$ Positions are passed threw a structured buffer, alongside distance from player, luminosity, and its color. Also the skybox only updates when the player moves more then 150 light days, which basically only ever happens when FTL is used. If equirectangular is not recommended then anything that will allow me to apply this to a sphere and not have the poles detail lost would work just fine. \$\endgroup\$
    – chief65
    Sep 12 '20 at 17:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.