I’m a recent Unity refugee and I’m running into issues porting a Sky shader over from Unity Shader Graph. The long and short of it is I’m trying to rotate a star map with an equirectangular projection. I can project this onto my sky no problem using the sky_coords node’s UVs plugged into a Texture2D node:
However, I’m unsure how to rotate this to allow for accurate positioning of stars in the night sky. In Unity there was a Rotate About Axis mode, but that doesn’t appear to be available in the Godot Sky shader nodes.
I know I can rotate the whole sky in the World Environment node, but that rotates the sun and moon as well, which is not what I want.
I feel like I’m missing something obvious. Am I just going about this the completely wrong way? Any help or pointers would be appreciated!
After trying out the RotationByAxis node which is intended for spatial shaders I can’t really make it work either. Can you tell a bit more how you would expect it to work in Unity and what you shader consisted of there?
Alright after some more testing I think the best way for you to have a “rotating” star effect would be to just add a time variable to the sky_coords input which then just transforms the image like this:
Essentially the goal is to calculate the altitude and azimuth of the celestial sphere for a given time and location, plug that result in to the shader, and rotate the stars accordingly.
I’ll keep playing around with it and see if I stumble into a solution, but I’d love to hear any more thoughts or insight you might have.
Interesting… I believe that should be doable. I just tried to use a cubemap parameter with the given equirectengular texture and the EYEDIR input as the uvw coordinates which seems to work fine (except for the obvious seams but that is because it is not a cubemap yet).
As a custom node for the RotationByAxis node you can use this script I quickly created from the already built-in node (it is currently only exposed to Spatial shaders) and you can then try to put it all together like you had in Unity.
After some trial and error (mostly on the cubemap side of things—I think Godot’s documentation is a little unclear on what its expectations are), I think I’ve gotten this to a working state.
Nope, pretty much exactly as you described. I copied the script and added it as a custom node and it works a charm! Here’s the final structure in case it helps anyone else:
Oh, gotcha! No, I ended up just using this online one and assembling them in Photoshop. That one you linked to was helpful in terms of showing me what layout Godot expected. I used a 2x3 layout: