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?
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.
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}}]]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With