{ "cells": [ { "cell_type": "raw", "id": "68baaf5f", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ ".. _example_blank:\n", "\n", "Rendering blank image\n", "==========================\n", "\n", "Let's start to use Lightmetrica by rendering a blank image.\n", "We first import the ``lightmetrica`` module, where we use ``lm`` as an alias of ``lightmetrica`` for simplicity.\n", "\n", ".. note::\n", " Although we recommend to use Python API to organize the experiments, similar APIs can be accessible from C++. See `example directory`_ for the detail.\n", "\n", " .. _example directory: https://github.com/hi2p-perim/lightmetrica-v3/tree/master/example\n", "\n", ".. note::\n", " ``lmenv`` is a simple module to configure Lightmetrica envrionment from a specified file. Here we load ``.lmenv``. You want to create your own ``.lmenv`` file if you want to execute examples or tests by yourself. For detail, please refer to :ref:`executing_functional_tests`." ] }, { "cell_type": "code", "execution_count": 1, "id": "8204dec3", "metadata": { "execution": { "iopub.execute_input": "2021-10-22T11:24:03.659460Z", "iopub.status.busy": "2021-10-22T11:24:03.656588Z", "iopub.status.idle": "2021-10-22T11:24:03.763295Z", "shell.execute_reply": "2021-10-22T11:24:03.763712Z" } }, "outputs": [ { "data": { "text/plain": [ "Namespace(bin_path='/lightmetrica-v3/_build/bin', path='/lightmetrica-v3', scene_path='/lm3/scenes')" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import lmenv\n", "lmenv.load('.lmenv')" ] }, { "cell_type": "code", "execution_count": 2, "id": "be977276", "metadata": { "execution": { "iopub.execute_input": "2021-10-22T11:24:03.767696Z", "iopub.status.busy": "2021-10-22T11:24:03.767026Z", "iopub.status.idle": "2021-10-22T11:24:03.776287Z", "shell.execute_reply": "2021-10-22T11:24:03.775869Z" } }, "outputs": [], "source": [ "import lightmetrica as lm" ] }, { "cell_type": "code", "execution_count": 3, "id": "b7481574", "metadata": { "execution": { "iopub.execute_input": "2021-10-22T11:24:03.780824Z", "iopub.status.busy": "2021-10-22T11:24:03.779655Z", "iopub.status.idle": "2021-10-22T11:24:03.781394Z", "shell.execute_reply": "2021-10-22T11:24:03.781768Z" }, "nbsphinx": "hidden" }, "outputs": [], "source": [ "if not lm.Release:\n", " lm.debug.attach_to_debugger()" ] }, { "cell_type": "raw", "id": "766ccba8", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "Lightmetrica offers an extension for the Jupyter notebook to support logging or interactive progress reporting inside the notebook. The extension can be loaded by a line magic command as below." ] }, { "cell_type": "code", "execution_count": 4, "id": "f997f175", "metadata": { "execution": { "iopub.execute_input": "2021-10-22T11:24:03.785780Z", "iopub.status.busy": "2021-10-22T11:24:03.785123Z", "iopub.status.idle": "2021-10-22T11:24:04.201930Z", "shell.execute_reply": "2021-10-22T11:24:04.202321Z" } }, "outputs": [], "source": [ "%load_ext lightmetrica_jupyter" ] }, { "cell_type": "raw", "id": "b17589cd", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "After importing the module, you can initialize the framwork by calling :cpp:func:`lm::init` function. You can pass various arguments to configure the framework to the function, but here we keep it empty so that everything is configured to be default." ] }, { "cell_type": "code", "execution_count": 5, "id": "448f1643", "metadata": { "execution": { "iopub.execute_input": "2021-10-22T11:24:04.206987Z", "iopub.status.busy": "2021-10-22T11:24:04.206308Z", "iopub.status.idle": "2021-10-22T11:24:04.208522Z", "shell.execute_reply": "2021-10-22T11:24:04.208118Z" } }, "outputs": [], "source": [ "lm.init()" ] }, { "cell_type": "raw", "id": "08225bda", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "Logging and progress reporting in Jupyter notebook can be enabled by :cpp:func:`lm::log::init` and :cpp:func:`lm::progress::init` functions with corresponding types." ] }, { "cell_type": "code", "execution_count": 6, "id": "6045792a", "metadata": { "execution": { "iopub.execute_input": "2021-10-22T11:24:04.212364Z", "iopub.status.busy": "2021-10-22T11:24:04.211803Z", "iopub.status.idle": "2021-10-22T11:24:04.214083Z", "shell.execute_reply": "2021-10-22T11:24:04.213683Z" } }, "outputs": [], "source": [ "lm.log.init('jupyter')\n", "lm.progress.init('jupyter')" ] }, { "cell_type": "raw", "id": "a9399b41", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "Once the framework has been initialized properly, you can get an splash message using :cpp:func:`lm::info()` function." ] }, { "cell_type": "code", "execution_count": 7, "id": "cf979a1e", "metadata": { "execution": { "iopub.execute_input": "2021-10-22T11:24:04.217982Z", "iopub.status.busy": "2021-10-22T11:24:04.217431Z", "iopub.status.idle": "2021-10-22T11:24:04.220364Z", "shell.execute_reply": "2021-10-22T11:24:04.220754Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[I|0.005] Lightmetrica -- Version 3.0.0 (rev. 70601db) Linux x64\n" ] } ], "source": [ "lm.info()" ] }, { "cell_type": "raw", "id": "f743e38d", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "Next we define `assets` necessary to execute renderer, like materials, meshes, etc. In this example, we only need a `film` to which the renderer outputs the image. We can define assets by ``lm::load_*`` function, where ``*`` represents the name of the asset. In this example, we want to make ``film`` asset. So we use :cpp:func:`lm::load_film` function.\n", "\n", "The first argument (``film``) specifies id of the asset to be referenced. The second argument (``bitmap``) is given as the type of the assets.\n", "The optional keyword arguments specify the parameters passed to the instance.\n", "\n", "For convenicence, we will refer to the asset of the specific type in ``::`` format. For instance, ``film::bitmap`` represents a `bitmap film` asset. ``film::bitmap`` takes two parameters ``w`` and ``h`` which respectively specify width and height of the film.\n", "\n", "This function returns a reference to the asset. You can access the underlying member functions. You can find details in :ref:`api_ref`." ] }, { "cell_type": "code", "execution_count": 8, "id": "523ba371", "metadata": { "execution": { "iopub.execute_input": "2021-10-22T11:24:04.304420Z", "iopub.status.busy": "2021-10-22T11:24:04.302980Z", "iopub.status.idle": "2021-10-22T11:24:04.306282Z", "shell.execute_reply": "2021-10-22T11:24:04.305868Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[I|0.013] Loading asset [name='film']\n" ] } ], "source": [ "film = lm.load_film('film', 'bitmap', w=1920, h=1080)" ] }, { "cell_type": "raw", "id": "7103e607", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "The created instance of the asset is internally managed by the framework.\n", "Lightmetrica uses `component locator` to access the instance.\n", "\n", "A component locator is a string starting with the character ``$`` and the words connected by ``.``. A locator indicates a location of the instance managed by the framework. For instance, the locator of the ``film`` asset is ``$.assets.film``. This can be queried by ``.loc()`` function." ] }, { "cell_type": "code", "execution_count": 9, "id": "31779890", "metadata": { "execution": { "iopub.execute_input": "2021-10-22T11:24:04.311258Z", "iopub.status.busy": "2021-10-22T11:24:04.310717Z", "iopub.status.idle": "2021-10-22T11:24:04.313740Z", "shell.execute_reply": "2021-10-22T11:24:04.314111Z" } }, "outputs": [ { "data": { "text/plain": [ "'$.assets.film'" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "film.loc()" ] }, { "cell_type": "raw", "id": "6a75c680", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "To rendering an image, we need to create `renderer` asset. Here, we will create ``renderer::blank`` renderer. ``renderer::blank`` is a toy renderer that only produces a blank image to the film. The renderer takes ``film`` parameter to specify the film to output the image, and ``color`` parameter for the background color.\n", "\n", "A reference to the other asset as a parameter can be passed using component locator. Here we use ``film.loc()`` to get a locator of the film. Althernaively, you can directly pass the instance of the asset directly as a parameter. " ] }, { "cell_type": "code", "execution_count": 10, "id": "fdc0680f", "metadata": { "execution": { "iopub.execute_input": "2021-10-22T11:24:04.318260Z", "iopub.status.busy": "2021-10-22T11:24:04.317762Z", "iopub.status.idle": "2021-10-22T11:24:04.320089Z", "shell.execute_reply": "2021-10-22T11:24:04.320475Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[I|0.106] Loading asset [name='renderer']\n" ] } ], "source": [ "renderer = lm.load_renderer('renderer', 'blank',\n", " output=film, # or alternatively, film.loc()\n", " color=[1,1,1]\n", ")" ] }, { "cell_type": "raw", "id": "6d20406b", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ ":cpp:func:`lm::Renderer::render` function executes rendering." ] }, { "cell_type": "code", "execution_count": 11, "id": "a81ebafb", "metadata": { "execution": { "iopub.execute_input": "2021-10-22T11:24:04.323775Z", "iopub.status.busy": "2021-10-22T11:24:04.322591Z", "iopub.status.idle": "2021-10-22T11:24:04.583615Z", "shell.execute_reply": "2021-10-22T11:24:04.584010Z" } }, "outputs": [], "source": [ "renderer.render()" ] }, { "cell_type": "raw", "id": "51a53868", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "After rendering, the generated image is kept in ``film``. :cpp:func:`lm::Film::save` function outputs this film to the disk as an image." ] }, { "cell_type": "code", "execution_count": 12, "id": "3fb63ff7", "metadata": { "execution": { "iopub.execute_input": "2021-10-22T11:24:05.076355Z", "iopub.status.busy": "2021-10-22T11:24:05.074949Z", "iopub.status.idle": "2021-10-22T11:24:05.079478Z", "shell.execute_reply": "2021-10-22T11:24:05.077834Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[I|0.376] Saving image [file='blank.png']\n" ] }, { "data": { "text/plain": [ "True" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "film.save('blank.png')" ] }, { "cell_type": "raw", "id": "63560423", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "You can also visualize the film directly in Jupyter notebook. :cpp:func:`lm::Film::buffer` gets the internal image data as numpy array which you can visualize using matplotlib. We rendered a white blank image thus the following image is as we expected." ] }, { "cell_type": "code", "execution_count": 13, "id": "8b4ce008", "metadata": { "execution": { "iopub.execute_input": "2021-10-22T11:24:05.085374Z", "iopub.status.busy": "2021-10-22T11:24:05.084262Z", "iopub.status.idle": "2021-10-22T11:24:05.086106Z", "shell.execute_reply": "2021-10-22T11:24:05.086480Z" } }, "outputs": [], "source": [ "import numpy as np\n", "%matplotlib inline\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "code", "execution_count": 14, "id": "ad46d46b", "metadata": { "execution": { "iopub.execute_input": "2021-10-22T11:24:05.197755Z", "iopub.status.busy": "2021-10-22T11:24:05.196714Z", "iopub.status.idle": "2021-10-22T11:24:05.983500Z", "shell.execute_reply": "2021-10-22T11:24:05.983876Z" } }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAA3MAAAH2CAYAAADaq9U4AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAZEklEQVR4nO3df4xl93nX8c+DtzH50ai2vLaMbbCDloKDRJOOrJSoUUQKdqDKGiSjjWi7AkumlQMJPwR2kWiFFCktUEElUmSa0K1I4y5pIluoP2KZigqpjTNOAontGG/j1N56a2+pIBEgB7sPf8xxudnMOtm5m5l5dl8vaXTP/c45935XX52bvH3PvVPdHQAAAGb5Q3s9AQAAAM6dmAMAABhIzAEAAAwk5gAAAAYScwAAAAOJOQAAgIEO7PUEvp4rrriir7/++r2eBgAAwJ54+OGHf7e7D545vu9j7vrrr8/m5uZeTwMAAGBPVNVvbTfuMksAAICBxBwAAMBAYg4AAGAgMQcAADCQmAMAABhIzAEAAAwk5gAAAAYScwAAAAOJOQAAgIHEHAAAwEBiDgAAYCAxBwAAMJCYAwAAGEjMAQAADCTmAAAABhJzAAAAA4k5AACAgcQcAADAQGIOAABgIDEHAAAwkJgDAAAYSMwBAAAMJOYAAAAGEnMAAAADiTkAAICBxBwAAMBAYg4AAGAgMQcAADCQmAMAABjo68ZcVX2wqp6rqs+tjF1eVQ9U1RPL7WUrv7u7qk5U1eNVdfPK+HdW1WeX3/1kVdX5/+cAAABcHL6Rd+Z+JsktZ4zdleTB7j6U5MHlfqrqxiRHkrx+Oeb9VXXJcsxPJbkjyaHl58zHBAAA4Bv0dWOuu38tye+dMXw4ybFl+1iSW1fG7+3u57v7ySQnktxUVVcneW13/3p3d5KfXTkGAACAc7TTz8xd1d2nkmS5vXIZvybJ0yv7nVzGrlm2zxwHAABgB873F6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WbO7s/Xthw8sr5O/0d0/mK1v5PsnVfVCkheT/GB3v/SlDtZsl5xlzd66g9dCa7ZLtluz7v5AvvYz4InzbG21XE0AAADAIPv1MksAAABehpgDAAAYSMwBAAAMJOYAAAAGEnMAAAADiTkAAICBxBwAAMBAYg4AAGCg/weM/nR6erV4bwAAAABJRU5ErkJggg==\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "img = np.copy(film.buffer())\n", "f = plt.figure(figsize=(15,15))\n", "ax = f.add_subplot(111)\n", "ax.imshow(np.clip(np.power(img,1/2.2),0,1), origin='lower')\n", "plt.show()" ] }, { "cell_type": "raw", "id": "cbff4e29", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "Finally, we gracefully shutdown the framework with :cpp:func:`lm::shutdown` function. Usually you don't want to explicitly call shutdown function." ] }, { "cell_type": "code", "execution_count": 15, "id": "06db683e", "metadata": { "execution": { "iopub.execute_input": "2021-10-22T11:24:05.987986Z", "iopub.status.busy": "2021-10-22T11:24:05.987364Z", "iopub.status.idle": "2021-10-22T11:24:05.989584Z", "shell.execute_reply": "2021-10-22T11:24:05.989177Z" } }, "outputs": [], "source": [ "lm.shutdown()" ] } ], "metadata": { "jupytext": { "cell_metadata_json": true, "formats": "ipynb,py:light", "text_representation": { "extension": ".py", "format_name": "light", "format_version": "1.5", "jupytext_version": "1.3.3" } }, "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.10" } }, "nbformat": 4, "nbformat_minor": 5 }