.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/01_introductory/viz_texture.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_01_introductory_viz_texture.py: =============== Sphere Texture =============== In this tutorial, we will show how to create a sphere with a texture. .. GENERATED FROM PYTHON SOURCE LINES 7-11 .. code-block:: Python from fury import actor, io, window from fury.data import fetch_viz_textures, read_viz_textures .. GENERATED FROM PYTHON SOURCE LINES 12-13 Create a scene to start. .. GENERATED FROM PYTHON SOURCE LINES 13-16 .. code-block:: Python scene = window.Scene() .. GENERATED FROM PYTHON SOURCE LINES 17-21 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. .. GENERATED FROM PYTHON SOURCE LINES 21-26 .. code-block:: Python fetch_viz_textures() filename = read_viz_textures('1_earth_8k.jpg') image = io.load_image(filename) .. rst-class:: sphx-glr-script-out .. code-block:: none Dataset is already in place. If you want to fetch it again please first remove the folder /Users/skoudoro/.fury/textures .. GENERATED FROM PYTHON SOURCE LINES 27-31 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. .. GENERATED FROM PYTHON SOURCE LINES 31-34 .. code-block:: Python scene.add(actor.texture_on_sphere(image)) .. GENERATED FROM PYTHON SOURCE LINES 35-37 Lastly, record the scene, or set interactive to True if you would like to manipulate your new sphere. .. GENERATED FROM PYTHON SOURCE LINES 37-42 .. code-block:: Python interactive = False if interactive: window.show(scene, size=(600, 600), reset_camera=False) window.record(scene, size=(900, 768), out_path='viz_texture.png') .. image-sg:: /auto_examples/01_introductory/images/sphx_glr_viz_texture_001.png :alt: viz texture :srcset: /auto_examples/01_introductory/images/sphx_glr_viz_texture_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.470 seconds) .. _sphx_glr_download_auto_examples_01_introductory_viz_texture.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: viz_texture.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: viz_texture.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_