How would i be able to use a texture as the moon in a sky shader that uses a directional light to get the moons direction
Moon Texture in Sky Shader
- Edited
- construct an orthonormal basis with light direction (
LIGHTX_DIRECTION
) as z axis and two other orthogonal unit vectors as x and y axes - subtract the light direction (
LIGHTX_DIRECTION
) from view ray direction (EYEDIR
) and transform the resulting vector into the above basis by multiplying it with the basis inverse matrix. - use x and y components of the transformed vector as your uv when reading the texture. You may want to scale this to adjust moon's size.