Vapory


NameVapory JSON
Version 0.1.2 PyPI version JSON
download
home_page
Summary3D rendering with Python and POV-Ray
upload_time2021-05-11 12:44:17
maintainer
docs_urlNone
authorZulko
requires_python
licensesee LICENSE.txt
keywords 3d pov-ray photo-realistic ray-tracing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. image:: http://i.imgur.com/XN7e2IP.gif
   :alt: [logo]
   :align: center


Vapory
========

Vapory is a Python library to render photo-realistic 3D scenes with the free ray-tracing engine `POV-Ray <http://en.wikipedia.org/wiki/POV-Ray>`_.

Here is how you would draw a purple sphere:

.. code:: python

    from vapory import *

    camera = Camera( 'location', [0,2,-3], 'look_at', [0,1,2] )
    light = LightSource( [2,4,-3], 'color', [1,1,1] )
    sphere = Sphere( [0,1,2], 2, Texture( Pigment( 'color', [1,0,1] )))

    scene = Scene( camera, objects= [light, sphere])
    scene.render("purple_sphere.png", width=400, height=300)


Vapory enables to pipe the rendered images back into Python and integrates very well in the Python libraries ecosystem (see `this blog post <http://zulko.github.io/blog/2014/11/13/things-you-can-do-with-python-and-pov-ray/>`_ for examples)

Vapory is an open-source software originally written by Zulko_, released under the MIT licence, and hosted on Github_, where everyone is welcome to contribute or ask for support.


Installation
--------------

Vapory should work on any platform with Python 2.7+ or Python 3.

You first need to install POV-Ray. See `here <http://www.povray.org/download/>`_ for the Windows binaries. For Linux/MacOS you must `compile the source <https://github.com/POV-Ray/povray/>`_ (tested on Ubuntu, it's easy).

If you have PIP installed you can : ::

    (sudo) pip install vapory

If you have neither setuptools nor ez_setup installed the command above will fail, is this case type this before installing: ::

    (sudo) pip install ez_setup


Vapory can also be installed manually by unzipping the source code in one directory and typing in a terminal: ::

    (sudo) python setup.py install

Getting started
----------------

In Vapory you create a scene, and then render it:

.. code:: python

    from vapory import *

    scene = Scene( camera = mycamera , # a Camera object
               objects= [light, sphere], # POV-Ray objects (items, lights)
               atmospheric = [fog], # Light-interacting objects
               included = ["colors.inc"]) # headers that POV-Ray may need

    scene.render("my_scene.png", # output to a PNG image file
      width = 300, height=200, # in pixels. Determines the camera ratio.
      antialiasing = 0.01 # The nearer from zero, the more precise the image.
      quality=1) # quality=1 => no shadow/reflection, quality=10 is 'normal'

    # passing 'ipython' as argument at the end of an IPython Notebook cell
    # will display the picture in the IPython notebook.
    scene.render('ipython', width=300, height=500)

    # passing no 'file' arguments returns the rendered image as a RGB numpy array
    image = scene.render(width=300, height=500)


Objects are defined by passing a list of arguments: ::

    camera = Camera( 'location', [0,2,-3], 'look_at', [0,1,2] )

Keep in mind that this snippet will later be transformed into POV-Ray code by converting each argument to a string and placing them on different lines, to make a valid POV-Ray code ::

    camera {
        location
        <0,1,0>
        look_at
        <0,0,0>
    }

All the objects (Sphere, Box, Plane... with a few exceptions) work the same way. Therefore syntax of Vapory is the same as the syntax of POV-Ray. To learn how to use the different objects:

- Have a look at the scenes in the ``examples`` folder
- See the docstring of the different objects, which provides a basic example.
- See the online `POV-Ray documentation <http://www.povray.org/documentation/3.7.0/t2_0.html/>`_ which will give you all the possible uses of each object (there can be many !). This documentation is easily accessible from Vapory, just type ```Sphere.help()``, ``Plane.help()`` etc., it will open it in your browser.
- Finally, it is easy to find POV-Ray examples online and transcribe them back into Vapory.


Missing Features
""""""""""""""""""

For the moment a many features (Sphere, Fog, etc.) are implemented but not all of them (POV-Ray has a LOT of possible shapes and capabilities).

It is really easy to add new features, because they all basically do the same thing, are just empty classes. For instance here is how Camera is implemented: ::

    class Camera(POVRayElement):
        """ Camera([type,]  'location', [x,y,z], 'look_at', [x,y,z]) """

Yep, that's all, but just the name of the class is sufficient for Vapory to understand that this will translate into POV-Ray code ``camera{...}``. So in most case it shouldn't be difficult to create your own new feature. If you need a non-implemented feature to be included in the package, just open an issue or push a commit.

.. _Zulko : https://github.com/Zulko
.. _Github: https://github.com/Zulko/vapory



            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "Vapory",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "3D POV-Ray Photo-realistic ray-tracing",
    "author": "Zulko",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/fb/4e/76ad473b54c7d12b4625e067ff736432dc25602d6ec07e82aec5a670e698/Vapory-0.1.2.tar.gz",
    "platform": "",
    "description": ".. image:: http://i.imgur.com/XN7e2IP.gif\n   :alt: [logo]\n   :align: center\n\n\nVapory\n========\n\nVapory is a Python library to render photo-realistic 3D scenes with the free ray-tracing engine `POV-Ray <http://en.wikipedia.org/wiki/POV-Ray>`_.\n\nHere is how you would draw a purple sphere:\n\n.. code:: python\n\n    from vapory import *\n\n    camera = Camera( 'location', [0,2,-3], 'look_at', [0,1,2] )\n    light = LightSource( [2,4,-3], 'color', [1,1,1] )\n    sphere = Sphere( [0,1,2], 2, Texture( Pigment( 'color', [1,0,1] )))\n\n    scene = Scene( camera, objects= [light, sphere])\n    scene.render(\"purple_sphere.png\", width=400, height=300)\n\n\nVapory enables to pipe the rendered images back into Python and integrates very well in the Python libraries ecosystem (see `this blog post <http://zulko.github.io/blog/2014/11/13/things-you-can-do-with-python-and-pov-ray/>`_ for examples)\n\nVapory is an open-source software originally written by Zulko_, released under the MIT licence, and hosted on Github_, where everyone is welcome to contribute or ask for support.\n\n\nInstallation\n--------------\n\nVapory should work on any platform with Python 2.7+ or Python 3.\n\nYou first need to install POV-Ray. See `here <http://www.povray.org/download/>`_ for the Windows binaries. For Linux/MacOS you must `compile the source <https://github.com/POV-Ray/povray/>`_ (tested on Ubuntu, it's easy).\n\nIf you have PIP installed you can : ::\n\n    (sudo) pip install vapory\n\nIf you have neither setuptools nor ez_setup installed the command above will fail, is this case type this before installing: ::\n\n    (sudo) pip install ez_setup\n\n\nVapory can also be installed manually by unzipping the source code in one directory and typing in a terminal: ::\n\n    (sudo) python setup.py install\n\nGetting started\n----------------\n\nIn Vapory you create a scene, and then render it:\n\n.. code:: python\n\n    from vapory import *\n\n    scene = Scene( camera = mycamera , # a Camera object\n               objects= [light, sphere], # POV-Ray objects (items, lights)\n               atmospheric = [fog], # Light-interacting objects\n               included = [\"colors.inc\"]) # headers that POV-Ray may need\n\n    scene.render(\"my_scene.png\", # output to a PNG image file\n      width = 300, height=200, # in pixels. Determines the camera ratio.\n      antialiasing = 0.01 # The nearer from zero, the more precise the image.\n      quality=1) # quality=1 => no shadow/reflection, quality=10 is 'normal'\n\n    # passing 'ipython' as argument at the end of an IPython Notebook cell\n    # will display the picture in the IPython notebook.\n    scene.render('ipython', width=300, height=500)\n\n    # passing no 'file' arguments returns the rendered image as a RGB numpy array\n    image = scene.render(width=300, height=500)\n\n\nObjects are defined by passing a list of arguments: ::\n\n    camera = Camera( 'location', [0,2,-3], 'look_at', [0,1,2] )\n\nKeep in mind that this snippet will later be transformed into POV-Ray code by converting each argument to a string and placing them on different lines, to make a valid POV-Ray code ::\n\n    camera {\n        location\n        <0,1,0>\n        look_at\n        <0,0,0>\n    }\n\nAll the objects (Sphere, Box, Plane... with a few exceptions) work the same way. Therefore syntax of Vapory is the same as the syntax of POV-Ray. To learn how to use the different objects:\n\n- Have a look at the scenes in the ``examples`` folder\n- See the docstring of the different objects, which provides a basic example.\n- See the online `POV-Ray documentation <http://www.povray.org/documentation/3.7.0/t2_0.html/>`_ which will give you all the possible uses of each object (there can be many !). This documentation is easily accessible from Vapory, just type ```Sphere.help()``, ``Plane.help()`` etc., it will open it in your browser.\n- Finally, it is easy to find POV-Ray examples online and transcribe them back into Vapory.\n\n\nMissing Features\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nFor the moment a many features (Sphere, Fog, etc.) are implemented but not all of them (POV-Ray has a LOT of possible shapes and capabilities).\n\nIt is really easy to add new features, because they all basically do the same thing, are just empty classes. For instance here is how Camera is implemented: ::\n\n    class Camera(POVRayElement):\n        \"\"\" Camera([type,]  'location', [x,y,z], 'look_at', [x,y,z]) \"\"\"\n\nYep, that's all, but just the name of the class is sufficient for Vapory to understand that this will translate into POV-Ray code ``camera{...}``. So in most case it shouldn't be difficult to create your own new feature. If you need a non-implemented feature to be included in the package, just open an issue or push a commit.\n\n.. _Zulko : https://github.com/Zulko\n.. _Github: https://github.com/Zulko/vapory\n\n\n",
    "bugtrack_url": null,
    "license": "see LICENSE.txt",
    "summary": "3D rendering with Python and POV-Ray",
    "version": "0.1.2",
    "project_urls": null,
    "split_keywords": [
        "3d",
        "pov-ray",
        "photo-realistic",
        "ray-tracing"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3ac347335d0cbd3b9eeff8383aa7f634bb2191587a2763756a92c255d854cdff",
                "md5": "627e98fffff07c96fff2dec5fadcb703",
                "sha256": "58e4c09f6ab689e812cdf57e5a46056c8fb466af6d95395e9ffc565ac17806c5"
            },
            "downloads": -1,
            "filename": "Vapory-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "627e98fffff07c96fff2dec5fadcb703",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 15213,
            "upload_time": "2021-05-11T12:44:16",
            "upload_time_iso_8601": "2021-05-11T12:44:16.373475Z",
            "url": "https://files.pythonhosted.org/packages/3a/c3/47335d0cbd3b9eeff8383aa7f634bb2191587a2763756a92c255d854cdff/Vapory-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fb4e76ad473b54c7d12b4625e067ff736432dc25602d6ec07e82aec5a670e698",
                "md5": "1005a15fc3e04e6b1df5d8d5976970fe",
                "sha256": "e0213caaac5cbb1d336ef7455a18e7ffcc8b864093040958ef45bddac8204231"
            },
            "downloads": -1,
            "filename": "Vapory-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "1005a15fc3e04e6b1df5d8d5976970fe",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 18137,
            "upload_time": "2021-05-11T12:44:17",
            "upload_time_iso_8601": "2021-05-11T12:44:17.482055Z",
            "url": "https://files.pythonhosted.org/packages/fb/4e/76ad473b54c7d12b4625e067ff736432dc25602d6ec07e82aec5a670e698/Vapory-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-05-11 12:44:17",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "vapory"
}
        
Elapsed time: 0.21376s