Current Satellites Orbiting Earth

I wanted to start learning GLSL. In part because I’m not sure which mechanism would be best (points, sprites, GPU Particles, meshes). And if I continue to use spheres, then implementing a custom points-only thinInstance might be fun. Also pointcloud on WebGPU is not responsive to point size, so that would likely be custom WGSL (though there may be a workaround explained here).

1 Like

There are still some bugs, and not yet tying in all the features and UI, but I think it’s calculating inside a custom shader most or all the satellelites based on simple elliptic propagation. Regularly pegged at maximum fps (119/120) and dipping down to 110 fps occasionally. This is with “all” 11000+ satellites and only updating a single uniform float time per frame.

.

Took me a while to work out how to initialize the RawTexture containing the matrix array and how to access it within the vertex shader (texelFetch()).

const texture = new BABYLON.RawTexture(satmat,texwidth*2,texheight*2,
BABYLON.Engine.TEXTUREFORMAT_RGBA,//TEXTUREFORMAT_DEPTH32_FLOAT,
scene,false,false,
BABYLON.Texture.NEAREST_SAMPLINGMODE,
BABYLON.Engine.TEXTURETYPE_FLOAT,
0,//BABYLON.Constants.TEXTURE_CREATIONFLAG_STORAGE,
false,true);

and within the shader:

int rgbaIndex = gl_VertexID*4;
int col = rgbaIndex % 512;
int row = 1+(rgbaIndex-col)/512;
vec4 col0 = texelFetch(satmat,ivec2(col,row),0);
vec4 col1 = texelFetch(satmat,ivec2(col+1,row),0);
vec4 col2 = texelFetch(satmat,ivec2(col+2,row),0);
vec4 col3 = texelFetch(satmat,ivec2(col+3,row),0);

mat4 toEciWorld = mat4(col0,col1,col2,col3);