GLSL: sphere galaxy

by despero   Last Updated January 14, 2018 11:13 AM

I'm trying to draw sphere galaxy mentioned in this tutorial: http://martindevans.me/game-development/2016/01/14/Procedural-Generation-For-Dummies-Galaxies/

Here is an image for reference:

enter image description here

Basically, it is just a (3D normally-distributed) set of small (few pixels) spheres.

I believe if I draw it using some primitives (like circle) it would be very slow (drawing thousand of circles every frame would be too expensive even in pure opengl). So I've decided to write a small shader for that purpose. It should be pretty simple, but I don't even know where to start.

I'm completely new to shader programming. I know how to run shader program, the basic terms, etc, so, for example, I can draw a circle on a screen with given radius, nothing more.

Can you, please, tell me where to start? I've searched shadertoy, but can't find any suitable example. I believe it should be pretty easy to write this, may be I'm just missing some conceptions.

Thanks in advance.

Tags : shaders


Related Questions


Pixel Shaders To Create Predator Effect

Updated April 11, 2015 01:05 AM

Unity Shader, what is Float3.xy?

Updated January 30, 2018 14:13 PM

How to make Rim Light better?

Updated February 02, 2018 17:13 PM