#Unity Skybox Moon UV coordinates
42 messages · Page 1 of 1 (latest)
maybe, download the skybox you wanna use , get it into 6-side split of images in photshop , then add a moon texture and use 6-side skybox material
That wouldn't work
I also realize I failed to provide the code that makes this all work- Apologies
OK, I did manage to do it, but there's something wrong. Whenever I go towards the edge of the image, it does stretches the projection, see right. How can I fix this? Here's how I calculated the UVs
half2 _moonUV = (((_WorldSpaceLightPos0.xyz - ray) / _MoonSize) * float2(-0.5, 0.5)) - float2(0.5, 0.5);
This is from the built-procedural skybox
if your attempt is to make the moon move why dont you rotate the skybox
Because that would make everything else move and I'd prefer to not do that?
I think this will be complicated
At certain positions, the moon will span three faces (at corners)
Yeah
I tried to use that method where it would wrap around instead but I have no idea how to make the offsets work for it
It either didn't work or was off one way or another
Do you need to use a skybox
Yes, I do
Why
Because I've tried before with quads and it didn't work how I wanted it too
Yeah, but this is an issue that can't not be fixed if I want to use the texture
Elaborate I don't understand
The outline of the moon is fine but the texture gets stretched. I have no idea how to fix it
So you want to keep using a skybox but fix the stretching
Yes
That's still going to require projecting/transforming the moon texture onto a cube
Possibly across multiple edges
Oh
I mean, if it works it works but I have no idea how to do that...
I have no idea how to do it either
Hmm can I get back to you in this
Which is why I suggested not using a skybox. But I think we could figure it out if we read up on projections and stuff
I already have a projection for the cloud and moon textures
I tried using it for the moon but didn't work as I said
Maybe I need to develop a formula that will provide the right offset
The moon on the left also isn't a perfect circle btw
It uses the same code as the sun, it's probably the angle and my 120 fov
fov also shouldn't stretch it like that, if we're talking realism
I think
Not at this distance
This is with the editor camera