Sphere Texture

In this tutorial, we will show how to create a sphere with a texture.

import numpy as np
from fury import window, actor, utils, primitive, io
from fury.data import read_viz_textures, fetch_viz_textures

Create a scene to start.

Load an image (png, bmp, jpeg or jpg) using io.load_image. In this example, we will use read_viz_textures to access an image of the Earth’s surface from the fury Github after using ‘’fetch_viz_textures()’’ to download the available textures.


Dataset is already in place. If you want to fetch it again please first remove the folder /Users/koudoro/.fury/textures

Next, use actor.texture_on_sphere to add a sphere with the texture from your loaded image to the already existing scene. To add a texture to your scene as visualized on a plane, use actor.texture instead.

Lastly, record the scene, or set interactive to True if you would like to manipulate your new sphere.

interactive = False
if interactive:
    window.show(scene, size=(600, 600), reset_camera=False)
window.record(scene, size=(900, 768), out_path="viz_texture.png")

Total running time of the script: ( 0 minutes 1.847 seconds)

Gallery generated by Sphinx-Gallery