Welcome to
Planetside Software Forums
.
Log in
Sign up
Search Forums
Search
Home
Search
Planetside Software Forums
►
General
►
Terragen Discussion
►
Off-axis rotation of spheres and planets
Off-axis rotation of spheres and planets
Started by rca06d, March 03, 2022, 07:26:46 PM
Previous topic
-
Next topic
Print
Go Down
Pages
1
User actions
rca06d
Member+
Posts: 22
Logged
Off-axis rotation of spheres and planets
March 03, 2022, 07:26:46 PM
I would like to animate the sun and stars moving realistically together across the sky. This apparently isn't easy to do if you want the axis of rotation to be different than one of the coordinate axes in terragen. Any tips on how to pull this off? If my sun is at heading 330 for example, how do I get a star field image-mapped on the background to rotate with it correctly?
WAS
1k+ Member
Posts: 8,436
Logged
Re: Off-axis rotation of spheres and planets
#1
March 04, 2022, 12:46:14 AM
I think this relies on a conversion of coordinate systems. I'm really tired and about to pass out and I can't think of what the coordinate system is that elevation/heading is based upon, or how you would convert it, but I am pretty sure that's what you'll need to do. Otherwise you could play with a light source that's super bright and act as your sun and move it in XYZ with your background map.
NWDA
|
My Terragen Gumroad
|
Donate
Dune
Fluent in Terragen
Posts: 20,058
Location: Netherlands
Logged
Re: Off-axis rotation of spheres and planets
#2
March 04, 2022, 04:35:07 AM
Simply said I would make a starry background in the background shader (either by image map or power fractal), attach to luminosity of a surface shader (use that instead of the default background shader inside), and put a transform shader between them. Use rotate X and Y to make some sort of trajecory over time.
Gallery
WAS
1k+ Member
Posts: 8,436
Logged
Re: Off-axis rotation of spheres and planets
#3
March 04, 2022, 11:20:07 AM
I think the issue is he wants to lock in the rotation of the background sphere with the sun. The sun works on Elevation and Heading which requires some mathing to match up the sun to the stars. The sun and stars are fixed in our sky pretty much. Maybe slight variance. The planet is rotating and orbiting the sun.
NWDA
|
My Terragen Gumroad
|
Donate
Dune
Fluent in Terragen
Posts: 20,058
Location: Netherlands
Logged
Re: Off-axis rotation of spheres and planets
#4
March 04, 2022, 12:03:03 PM
If you animate the sun position, with a bit of experimentation you can probably rotate starfield with them, or any way needed.
Gallery
rca06d
Member+
Posts: 22
Logged
Re: Off-axis rotation of spheres and planets
#5
March 05, 2022, 02:50:47 PM
Yeah WAS has it. If there isn't a nice easy checkbox or trick I can do with transform shaders, this appears to be a rather complicated trig problem that I have yet to figure out. Starting to wonder if its actually easier to turn the planet and compute the camera motion and tilt so its locked with the planet. Both seem hard.
Dune
Fluent in Terragen
Posts: 20,058
Location: Netherlands
Logged
Re: Off-axis rotation of spheres and planets
#6
March 06, 2022, 01:26:37 AM
No there isn't, it has to be some sort of mix between Y rotation for heading and x/z rotation for elevation. If you're only looking north, it might not be that hard though (just X and Y), but as you turn Z comes into play. Good luck anyway.
Gallery
rca06d
Member+
Posts: 22
Logged
Re: Off-axis rotation of spheres and planets
#7
March 10, 2022, 01:07:50 AM
Specifically rotating with x and y seems to be the key, together they actually behave like azimuth/elevation. I was trying to use y and z before and apparently the y transformation is applied before z, which is wrong for an off axis rotation. Here's what I'm working on. Still tweaking...
1 person
likes this.
Dune
Fluent in Terragen
Posts: 20,058
Location: Netherlands
Logged
Re: Off-axis rotation of spheres and planets
#8
March 10, 2022, 01:21:30 AM
That looks very convincing already.
Gallery
Print
Go Up
Pages
1
User actions
Planetside Software Forums
►
General
►
Terragen Discussion
►
Off-axis rotation of spheres and planets
User actions
Print