Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Texturing a sphere primitive

I'm using Mathematica 8 and I am struggling with texturing. Although texturing of polyhedral objects has proved to be relatively simple, I hit a problem trying to texture a sphere. In the documentation, the only way to texture a sphere shown is using SphericalPlot3D, which, IMHO, is a kludgey solution, especially since I'm trying to perform operations (e.g.: translation) on the sphere. In toto, my question is: is there any way to texture a sphere primitive?

like image 586
taktoa Avatar asked Jan 01 '12 21:01

taktoa


People also ask

How do you texture a sphere?

There are 2 ways to texture a sphere. Either by applying a cubemap or by applying a 2D texture. For best result, use a cubemap. The problem with applying a 2D texture is that when you wrap a 2D texture onto a sphere, the top and bottom area of the sphere, the texture looks squeezed.


1 Answers

You can't texture a Sphere directly, but you could create a textured sphere using e.g. SphericalPlot3D and extract the first part to get a primitive which you can manipulate with Translate. For example

sphere = SphericalPlot3D[1, th, phi, Mesh -> False, PlotPoints -> 25,
  PlotStyle -> {Opacity[1], Texture[ExampleData[{"ColorTexture", "GiraffeFur"}]]},
  TextureCoordinateFunction -> ({#4, #5} &)][[1]];

Graphics3D[Translate[sphere, {{0, 0, 0}, {2, 2, 2}}]]

textured spheres

like image 119
Heike Avatar answered Oct 10 '22 16:10

Heike