## How to map square planet texture to one face of the planet with spherical map

Started by jimhazel, December 11, 2021, 01:19:39 AM

#### jimhazel

Hey there, I've made a planet texture that is 8x8k and want to spherically map it to the planet, but only mapping it to half of the planet and not the full 360 to not distort and stretch it too much.
Kind of like the u and v extent in nukes sphere node if you have used it.

Cheers

#### Dune

Here's one way of doing that. Probably lots more ways. Projection needs to be done equirectangular (2:1 image ratio) from center of planet.

#### Hannes

Since you need a 2:1 projection for the spherically mapping, I'd just create a 16k by 8k image in PS (or whatever) with your texture either on one half of the image or just duplicated. This is how I understood, what you want to achieve.

Try this.

#### WAS

#4

Create your spherical face in photoshop in 1:1 scale. In another document at the same resolution, save a transparent image, or black or something. Now open the previously downloaded Hugin project (when Hugin is installed). It will ask you to replace missing images for each face of a cubemap. Replace the first back iamge with the blank.png or black.png (whatever you made). And then replace the front with your planet texture. Then replace the rest with blank.png/black.png.

Now under the Stitcher tab, click "Calculate optimal size" and then hit the "Stitch!" button. It will produce a equirectangular map which will have just a single face of the planet mapped with a texture, rather than a whole side.

Preview attached

#### WAS

FYI you could also just use Get Normal, and Convert X/Y/Z to Scalar (use Negate Scalar on the Convert to get opposite side), and than a Scalar not Boolean shader or Colour Adjust and use it as a mask for something. Wouldn't fix the warping of the texture to match the planet. Would need to project probably spherical still or something.

#### sboerner

But why not just use a spherical camera and scale x to 0.5? Seems the simplest solution.

I've used this to project various size maps on a spherical surface. You can scale x and y proportionally and adjust  position as needed, all with the image map shader. Easy peasy.

#### WAS

Quote from: sboerner on December 13, 2021, 01:33:03 PMBut why not just use a spherical camera and scale x to 0.5? Seems the simplest solution.

I've used this to project various size maps on a spherical surface. You can scale x and y proportionally and adjust  position as needed, all with the image map shader. Easy peasy.

From what I see it doesn't give you a face of a planetoid like UV or XYZ, but a whole half of the spheroid. Maybe that's what they want though.

#### sboerner

#8
I thought that was what the op was asking about -- how to apply a square texture to the surface of a sphere with minimal distortion. You can't do that unless you maintain an x:y size ratio of 1:2 in the image map shader to compensate. But if you do that you can scale and place the square almost wherever you like. To achieve pole-to-pole coverage of anything less than a full hemisphere, you need to repeat y. Repeating x will give you coverage around the circumference.

Of course you can't apply a square to a sphere with *no* distortion. It will get pinched as it nears the poles.

#### Dune

Well, I hope he'll come back one day and see what we've all come up with. Interesting discussion anyway.

#### sboerner

Maybe waiting for an email notification . . .