I’ve got 3d coordinates for a bunch of stars, and I want to turn that into a skybox. So I need to programatically create the 6 skybox textures. At a high level I think I need to draw a line from the origin, through each star, to a point on whichever face of the skybox ‘cube’ it hits. Then draw on that portion of the skybox texture.
Anyone have any code or know of asset store libraries that do this?
Thanks for the tips guys. These star coordinates will be dynamic, depending on where you are in the galaxy, so using a 3rd party tool to generate the skybox textures won’t work. I need to do it in code. So, manually generate the pixels of each cubemap face is what I am after, just need pointers on the math to do that.
Got it working, not sure if it is the most efficient method, but it goes pretty quick.
Basically create a ray from the origin through each star coordiate.
Create 6 planes (front, back, left,right,up,down)
See which plane the ray intersects
Use that intersection point to compute the texture coordinate