Star scene generator - a future pixel shader

Subscribers:
12,200
Published on ● Video Link: https://www.youtube.com/watch?v=yoIUbBtBiiA



Duration: 6:00
1,364 views
117


https://www.patreon.com/ulillillia --- I'm an astronomy aficianado, having my greatest interest in astronomy. Physics is a close second. Originally intended for the 2.5D remaster of Baricanna that I'm mainly working design document stuff for, and, consequently, Platform Masters, I intended on this being a pixel shader for potential real time generation. Then came some initial thoughts of Galaxy Destroyers, my puzzle genre game where the stars of each constellation serve as level hubs and a way to organize the several thousand (short) levels. Before making a pixel shader, the bulk of the debugging and checking can be done on the CPU as it's easier to track down and fix the bugs.
As this task is very heavy in floating point and trigonometric computations, the CPU is inefficient with this kind of task, being optimized for integers, rendering 2.5 scenes per second with my 32 cores. GPUs have thousands of cores (pixel pipelines) and are optimized for floating point math. Theoretically, with quick boost, this should easily get 200+ fps on the GPU.
There are 8 total sections. The first introduces time control, flowing at different rates. It also showcases that I can go to any time. The second shows panning the camera around. As both Baricanna 2.5D and Platform Masters never have looking up or down, only exactly level, only panning on the azimuth is possible, not altitude. The third section showcases latitude adjustment. Longitude changes simply shift the right ascension.
Section 4 covers field of view adjusting, where I start out going ultra wide at 151.9275° instead of the original 53.1301° (35 mm equivalent) then zoom in to just 7.1527°. The last paragraph explains the distortions and how "Pixels×Scaling = CU" really is true to 3D. Throughout this, I display the azimuth/altitude grid to better gauge the angles. When the field of view is less than 30°, the grid adjusts to using 1° increments instead of 10°.
Section 5 showcases texture size effects. The size used throughout this video is 16,384x8192. I use 8192x4096, 4096x2048, and, the biggest I can use, 24,576x12,288 (much bigger and 32-bit programs risk crashing due to the 1.7 GB limit). Texture size does not affect performance.
Section 6 covers quality settings. There are to be a quick blend method and subpixilization antialiasing. If running on a very slow system with an inferior GPU, there is another quality setting that uses up more VRAM but slows the draw rate down enough. 3.5 GB of VRAM is the target.
Section 7 covers precession and nutation effects. 2000 years in either direction from today's date is off by 2° and is borderline. 6000 years out is off by 10° and 613 3/4 years, used with Baricanna, is only off by 1/4°. I need a longer range precession/nutation algorithm to fix that.
Section 8 is the conclusion where I get rid of everything except the stars only, then I apply my contrast-boosting algorithm to really show the detail nicely.
So, what's this about the distortions with a super wide field of view? Consider a house at 16 SU distance, which would be 800 meters in this case. Move 28,800 pixels (450 meters) to the right and the house shifts left exactly 1800 pixels. The angular change is atan(Width÷Depth) or 29.3577535428°. The secant of this angle, for a multiplier on how much more distant it has become, is 1.1473474844. By applying the 2D distance formula, of 800 meters out and 450 meters to the side, which is sqrt(800^2+450^2), that yields 917.8779875343 for the actual distance. Divide this by the 800 original distance (still at 16 SU) and that gives a very familiar 1.1473474844 for the distance ratio. Both methods exactly produce the same results. Extending this by jumping up some platforms to gain 16,000 pixels (250 meters) in elevation makes this house now 1000 pixels lower. Applying the 3D distance formula, sqrt(800^2+450^2+250^2), gives a distance of 951.314879522 meters, which is 1.1891435994 times as far but is still exactly the same apparent size. A 2D distance formula on the angle calculation yields atan(sqrt(450^2+250^2)÷800) or 32.7603443667° where the secant of that is a very familiar 1.1891435994. This is why my infamous "Pixels×Scaling = CU" formula is so good at replicating 3D. That's because it really is true to real 3D! When field of view is super wide, distortions occur due to the way perspective is. The next time you play any 3D game, take a distant object that's in the center of the screen and pan the camera so that the object in the corner. By comparing these 2, you can see "corner magnification", and this routine exactly explains the amount of magnification. You could even reverse the process and calculate the field of view that the game uses!
Credits: the base star textures (stars, grids, and constellation borders and shapes) come from NASA's Scientific Visualization Studio. The video, scene generation program, and commentary are my own.







Tags:
ulillillia