Once again: How do you use an image map to apply altitude to planet surface?

Started by PabloMack, November 17, 2011, 02:38:26 PM

Previous topic - Next topic

PabloMack

I am trying to get back into TG2 again and I am trying to apply a global image map to wrap spherically around the planet and displace its surface. Brightness codes for increased altitude. I run TG2 and delete the default Heightfield because I am creating a whole planet. I want to create displacement so I select Terrain then:

Add Terrain->Displacement Shader->Displacement Shader.

I see that the default "displacement direction" is "Along normal" which is what I think I want for a whole planet. But there is no option to load an image so in Function I select Create new shader->Displacement Shader->Displacement shader. So far I have selected "Displacement Shader" four levels deep and I still don't seem to have a way to map a displacment map. Looks like new shader screen also has a Function field where you can select Create new shader->Displacement Shader->Displacement shader and I am six levels deep and still I have no way to load an image map. This thing is not very intuitive. I feel I am groping around in the dark with no flashlight. I know I've done it before but I am sure that is because I have had to take someone's word for it. How is this done again?

Tangled-Universe

Ghehe, I can't help simultaneously feeling pity for you struggling with this and laughing :) Forgive me ;D

I can understand the logic you're following though.
You want to displace a surface so you need a displacement shader.
Check, you did that.

Now, this displacement shader wants a shader as input in order to create the displacement.
Creating another displacement shader one level below creates the exact same displacement shader which still needs that damn input.
And again and again...

What the displacement shader actually needs is colours and scalars as input for example.
You already have something as colour, your global image map.
So instead of creating a displacement shader you choose "new shader -> colour shader -> image map shader -> select your global image map"

Go to your image map shader and set the projection mode from "through camera" to "spherical".
Copy the coordinates from the planet-node into the coordinate input of the image map shader and your texture will be correctly spherical mapped.
The image map shader needs these coordinates in order to spherically map from a centre position, which is the planet you want to map on.

That should be it!

Cheers,
Martin

PabloMack

Thanks Martin. It is starting to make a bit of sense to me now. I think I have it working.

Tangled-Universe

Cool, if I remember correctly this works best with images which are in a 2:1 aspect ratio.

PabloMack

My images are 2wide by 1high. I am assuming that the displacement I applied to my planet adds to the diameter of the planet and doesn't subtract from it. In other words, the brightness value from the image file is treated as an unsigned number that is added to what is already there and not as a signed number that both adds altitude and subtracts by treating $80 as the midpoint (zero) for brightness (depending on the brightness value of each pixel).

Now I want to add an ocean. I have created a sphere with the same center as my planet but it needs displacement for waves and transparency. Is it better to create a planet for this and remove the atmosphere or can I do everything with just a sphere?

Dune


Tangled-Universe

Quote from: PabloMack on November 17, 2011, 06:48:06 PM
My images are 2wide by 1high. I am assuming that the displacement I applied to my planet adds to the diameter of the planet and doesn't subtract from it.

That's correct, displacement will be from 0m (black pixel) to Y metres (white pixels) where Y is the value you've set in your displacement shader.