Rotate/translate textures with planet?

Started by Mahnmut, August 31, 2012, 06:38:27 PM

Previous topic - Next topic

Mahnmut

Hello there,
in expectation of my deep version I dug out my neverending green mars project.
The heart of it is a 16k mars-bumpmap from the celestia motherlode, I feed that as a spherically projected imagemap into the displacement input of a surface layer before the compute terrain. after that follows a blend of different image-map layers and procedural shaders.
Now the question: how can I rotate my planet with all its surfaces? I thought the option in the planets settings "rotate textures with planet" might help. but if I turn it on, my terrain simply vanishes.
Any suggestions?
Best Regards,
Jan

TheBadger

Hey jan. I have never done this, but have read several threads where people ask something similar, if not exactly. I don't think those threads had titles that make them easy to find. I cant remember.
I do remember that the people had their questions answered, and if I remember right they were able to do it.

But its friday! Everyone who can answer is having fun some place and not reading this.

Anyway, the point is at least there is a solution! ;D
Not much help am I? ::)
It has been eaten.

Mahnmut


bigben

I discovered this playing with the moon textures.

1. In the planet node, check translate and rotate texture with planet boxes.
2. In the image map node, set the projection to spherical and position centre at 0,0,0 (because it will be translated with the planet!)

Mahnmut

Hi Bigben,
Didn´t try it yet, but i am sure your second point will be the solution, thanks!
J

Dune

Quote2. In the image map node, set the projection to spherical and position centre at 0,0,0 (because it will be translated with the planet!)
Assuming that your extra planet's start location is 0/0/0 I suppose? Will the moved location be added tot the initial location? Never tried this actually.

bigben

Quote from: Dune on September 02, 2012, 03:03:46 AM
Assuming that your extra planet's start location is 0/0/0 I suppose? Will the moved location be added tot the initial location? Never tried this actually.

A planet rarely is at 0,0,0 since the default position allows you to render close to 0,0,0.  Normally with spherical projection you need to position the image at the center of the planet but in this case the image must be 0,0,0. Haven't tested it but I'm guessing it adds the planet's position to that of the image. If the image is not at the origin it won't display correctly. I hadn't used it either until recently, but it's definitely the simplest way to apply an equirectangular image to a planet with the added bonus that it can be rotated.

Mahnmut

Quote from: Dune on September 02, 2012, 03:03:46 AM
Quote2. In the image map node, set the projection to spherical and position centre at 0,0,0 (because it will be translated with the planet!)
Assuming that your extra planet's start location is 0/0/0 I suppose? Will the moved location be added tot the initial location? Never tried this actually.

There is no extra Planet, only one. But it sounded convincing, I thought that could be how the translation would work.
But there must be more to it. It seems that it works for nodes before the compute terrain, or only for a special kind of node,  or do I have to check an option in the shader also?
Maybe it´s  like with multiple cloud layers that don´t move around with the planet until you plug them into it again.
Although I dont want to translate my planet, I just want to rotate it.
Problem is,  I use 24 different layers, some of them image maps, others depending on y-coordinates.
So what is the best way to fix them onto my Planet? I heard something about a transform shader?
Thanks and regards,
J

Dune

Perhaps use the transform shader at the very end and rotate all previous.

bigben

#9
Quote from: Mahnmut on September 02, 2012, 08:50:41 AM
There is no extra Planet, only one. But it sounded convincing, I thought that could be how the translation would work.
But there must be more to it. It seems that it works for nodes before the compute terrain, or only for a special kind of node,  or do I have to check an option in the shader also?
Maybe it´s  like with multiple cloud layers that don´t move around with the planet until you plug them into it again.
Although I dont want to translate my planet, I just want to rotate it.
Problem is,  I use 24 different layers, some of them image maps, others depending on y-coordinates.
So what is the best way to fix them onto my Planet? I heard something about a transform shader?
Thanks and regards,
J

For images I've observed this, which may help clarify things a little:
1. Add an image as Plan Y at 0,0,0 and change the X position of the planet (both translate and rotate textures off)... image doesn't move.
2. In planet object, check rotate textures with planet and the image map will move by the amount changed in 1.
3. Change image map to Spherical and image will not display correctly. With "translate texture with planet" off you will need to set the position of the image to the center of the planet for it to project correctly.
4. Spherical image map at 0,0,0, check both rotate and translate texture with planet and image displays correctly and moves with the planet.  This combination is the simplest for animations as you only need to edit the planet position/orientation

Screengrab below shows 2 planets both using the same image map. Both planets have rotate and translate texture with planet checked. Different positions and rotations with the image map correctly displayed on both.

Mahnmut

Thanks bigben!
now I begin to understand.
my imagemaps behave as they should (now that I know I need to also check translate )
But Surface layers that depend on altitude dont work any more with these options.
So if I want a planet that uses imagemaps and surfacelayers I still need help.
It´s always more complicared than you think it is. But what did I expect, trying to build a Planet?

[attachimg=1]

I think the solution is to give up the holistic aproach and use imagemaps for the planetary view and procedural terrain without rotation for the closeups.  Not ideal, but practical. 8)
Cheers,
J

Matt

Hi Jan,

"Translate textures with planet" and "Rotates textures with planet" affect anything that uses texture coordinates. Most shaders do, but I think there are some that don't - the Heightfield Shader may be one of them, using world position instead. If the Transform Shader or Warp Shader can affect a shader, then rotate/translate textures with planet will affect the shader too.

However, if you use a "Tex Coords From XYZ" node or a "Compute Terrain" node, it will recompute the texture coordinates downstream based on the world position. Therefore any shaders downstream will not be translated or rotated.

Matt
Just because milk is white doesn't mean that clouds are made of milk.

Mahnmut

Thanks Matt, that was helpful.
I think now I understand most of the problem and can decide which solution is best in terms of complexity and rendertimes.
Cheers,
J