diff --git a/docs/tutorials/render_colored_points.ipynb b/docs/tutorials/render_colored_points.ipynb index 954fd354..92f5f535 100644 --- a/docs/tutorials/render_colored_points.ipynb +++ b/docs/tutorials/render_colored_points.ipynb @@ -62,7 +62,7 @@ "import matplotlib.pyplot as plt\n", "from skimage.io import imread\n", "\n", - "# Util function for loading point clouds\n", + "# Util function for loading point clouds|\n", "import numpy as np\n", "\n", "# Data structures and functions for rendering\n", @@ -187,6 +187,32 @@ "plt.axis(\"off\");" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We will now modify the **renderer** to use **alpha compositing** with a set background color. " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "renderer = PointsRenderer(\n", + " rasterizer=PointsRasterizer(cameras=cameras, raster_settings=raster_settings),\n", + " # Pass in background_color to the alpha compositor, setting the background color \n", + " # to the 3 item tuple, representing rgb on a scale of 0 -> 1, in this case blue\n", + " compositor=AlphaCompositor(background_color=(0, 0, 1))\n", + ")\n", + "images = renderer(point_cloud)\n", + "plt.figure(figsize=(10, 10))\n", + "plt.imshow(images[0, ..., :3].cpu().numpy())\n", + "plt.grid(\"off\")\n", + "plt.axis(\"off\");" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -234,6 +260,32 @@ "plt.grid(\"off\")\n", "plt.axis(\"off\");" ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We will now modify the **renderer** to use **weighted compositing** with a set background color. " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "renderer = PointsRenderer(\n", + " rasterizer=PointsRasterizer(cameras=cameras, raster_settings=raster_settings),\n", + " # Pass in background_color to the norm weighted compositor, setting the background color \n", + " # to the 3 item tuple, representing rgb on a scale of 0 -> 1, in this case red\n", + " compositor=NormWeightedCompositor(background_color=(1,0,0))\n", + ")\n", + "images = renderer(point_cloud)\n", + "plt.figure(figsize=(10, 10))\n", + "plt.imshow(images[0, ..., :3].cpu().numpy())\n", + "plt.grid(\"off\")\n", + "plt.axis(\"off\");" + ] } ], "metadata": {