09-21-2018, 06:11 PM
We are all pretty used to the way asteroids work in Freelancer and we took for granted how smooth they are!
I haven't realized what a challenge it is to make an asteroid field that spreads out long distances without stuffing GPU's memory with millions of objects. I had to figure out a way to dynamically place asteroids around the player as the player moves around in the field, and also to ease out the eye sore when asteroid pop out of nowhere, I had to write a shader that makes the asteroid transparent when they are far away and solidify as player gets closer.
On top of that, if the asteroid field is foggy, the sun has to look more gloomy, and lighting has to adjust along with it. It was truly a lot of work to do simple asteroids. But I finally achieved something that looks half decent:
https://www.youtube.com/watch?v=IbnHG7XO...e=youtu.be
You may occasionally see distant asteroids popping out, but usually it doesn't bother my eyes that much.
Actually the real challenge was how to render the asteroid field when the player is some distance away from it. I made a very stupid algorithm to line the asteroid "cells" (each cell is pre-loaded with randomly placed asteroid objects) along the edge of the field, increased the transparency threshold in the shader, and actually it didn't look too bad from a distance.
I haven't realized what a challenge it is to make an asteroid field that spreads out long distances without stuffing GPU's memory with millions of objects. I had to figure out a way to dynamically place asteroids around the player as the player moves around in the field, and also to ease out the eye sore when asteroid pop out of nowhere, I had to write a shader that makes the asteroid transparent when they are far away and solidify as player gets closer.
On top of that, if the asteroid field is foggy, the sun has to look more gloomy, and lighting has to adjust along with it. It was truly a lot of work to do simple asteroids. But I finally achieved something that looks half decent:
https://www.youtube.com/watch?v=IbnHG7XO...e=youtu.be
You may occasionally see distant asteroids popping out, but usually it doesn't bother my eyes that much.
Actually the real challenge was how to render the asteroid field when the player is some distance away from it. I made a very stupid algorithm to line the asteroid "cells" (each cell is pre-loaded with randomly placed asteroid objects) along the edge of the field, increased the transparency threshold in the shader, and actually it didn't look too bad from a distance.