summaryrefslogtreecommitdiff
path: root/doc/source/render.rst
blob: 23b473597c4f18dd31e14c9c037d05c6b7357a8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Rendering Tools
===============

.. module:: chroma

There are three different ways to render a geometry: you can explicitly create a :class:`Camera` instance, call the function :func:`view`, or use the script `chroma-cam`.

Example:
        >>> chroma.view(chroma.make.cube())

.. image:: images/cube.png
   :height: 100px

To control the camera refer to the following table and :ref:`camera_hotkeys`.

.. _camera_controls:

============== =========== ===========================
Thing You Do   Modifier    Thing That Happens
============== =========== ===========================
click and drag             rotate camera around object
click and drag shift       translate camera
click and drag control     rotate camera
mouse wheel                zoom
============== =========== ===========================


.. _camera_hotkeys:

Camera Hotkeys
--------------

========= ===============================
Command   Thing That Happens
========= ===============================
alt       toggle fine motion
F11       toggle fullscreen
escape    quit
=         increase the alpha depth by one
\-        decrease the alpha depth by one
pagedown  move down through the bounding volume hierarchy tree
pageup    move up through the bounding volume hierarchy tree
3         toggle 3d mode
g         toggle 3d colors between red/cyan and green/magenta
F12       take a screenshot
m         make a movie
F5 [#f1]_ toggle hybrid monte carlo rendering mode
F6 [#f2]_ place a light source at the camera's current location
F7 [#f2]_ add another light source at the camera's current location
========= ===============================

.. rubric:: Footnotes

.. [#f1] The hybrid monte carlo rendering mode requires the geometry have surfaces with a non-zero diffuse reflection probability.

.. [#f2] Only available in hybrid monte carlo rendering mode.

The Camera Class
----------------

.. class:: Camera(geometry, size=(800,600), device_id=None)

   The :class:`Camera` class uses :mod:`pygame` to render a geometry.
   :class:`Camera` objects inherit from :class:`multiprocessing.Process` so
   that you can render multiple geometries in separate windows at the same
   time. 

   .. method:: start()

      Create a :mod:`pygame` window, intialize CUDA, and start the camera.