You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How do I run Polyscope remotely in a browser, via a notebook, or on headless server?
1718
1760
</a>
1719
1761
1720
1762
</li>
@@ -1738,9 +1780,10 @@ <h1>FAQ, Tips, and Tricks</h1>
1738
1780
1739
1781
<ul>
1740
1782
<li>
1741
-
<p><strong>Interface</strong></p>
1783
+
<p><strong>Interface and Camera Controls</strong></p>
1742
1784
<ul>
1743
1785
<li><ahref="#saving-and-restoring-camera-poses">Saving and restoring camera poses</a></li>
1786
+
<li><ahref="#centering-the-view-on-an-area-of-interest">Centering the view on an area of interest</a></li>
1744
1787
<li><ahref="#how-do-i-take-a-screenshot-save-an-image">How do I take a screenshot / save an image?</a></li>
1745
1788
<li><ahref="#positioning-objects-in-the-scene-and-reading-back-results">Positioning objects in the scene and reading back results</a></li>
1746
1789
<li><ahref="#managing-large-numbers-of-structures-and-quantities">Managing large numbers of structures and quantities</a></li>
@@ -1764,7 +1807,7 @@ <h1>FAQ, Tips, and Tricks</h1>
1764
1807
<li>
1765
1808
<p><strong>System</strong></p>
1766
1809
<ul>
1767
-
<li><ahref="#how-do-i-run-polyscope-on-a-remote-or-headless-server">How do I run Polyscope on a remote or headless server?</a></li>
1810
+
<li><ahref="#how-do-i-run-polyscope-remotely-in-a-browser-via-a-notebook-or-on-headless-server">How do I run Polyscope remotely / on a headless server / in a notebook?</a></li>
1768
1811
</ul>
1769
1812
</li>
1770
1813
</ul>
@@ -1784,39 +1827,39 @@ <h1>FAQ, Tips, and Tricks</h1>
1784
1827
<!-- - give focus on show -->
1785
1828
<!-- - implicits -->
1786
1829
1787
-
<h3id="saving-and-restoring-camera-poses"><strong>Saving and restoring camera poses</strong></h3>
1830
+
<h3id="saving-and-restoring-camera-poses"><strong>Saving and restoring camera poses</strong><aclass="headerlink" href="#saving-and-restoring-camera-poses" title="Permanent link">¶</a></h3>
1788
1831
<p>Use <code>lookAt()</code> and <ahref="/basics/camera_controls/">other functions</a> to manually specify the viewing camera pose. </p>
1789
1832
<p>Or, you can interactively position the camera in the scene, <ahref="/basics/camera_controls/#savingrestoring-views">copy it to your clipboard as a json string</a> with <code>ctrl-c</code>, then restore it from the clipboard with <code>ctrl-v</code>. These strings can also be saved and restored programmatically.</p>
1790
-
<h3id="how-do-i-take-a-screenshot-save-an-image"><strong>How do I take a screenshot / save an image?</strong></h3>
1833
+
<h3id="centering-the-view-on-an-area-of-interest"><strong>Centering the view on an area of interest</strong><aclass="headerlink" href="#centering-the-view-on-an-area-of-interest" title="Permanent link">¶</a></h3>
1834
+
<p>See <ahref="/basics/camera_controls/#centering-the-view-on-scene-content">camera controls</a>. You can use ctrl+shift+click (cmd+shift+click on macOS) to orbit the view about a point of interest, as well as zooming in relative to that point.</p>
1835
+
<h3id="how-do-i-take-a-screenshot-save-an-image"><strong>How do I take a screenshot / save an image?</strong><aclass="headerlink" href="#how-do-i-take-a-screenshot-save-an-image" title="Permanent link">¶</a></h3>
1791
1836
<p>See <ahref="/features/screenshots/">Screenshots</a>. Call <code>polyscope::screenshot()</code>, or click the <code>[screenshot]</code> button in the upper-left corner of the UI.</p>
1792
-
<h3id="positioning-objects-in-the-scene-and-reading-back-results"><strong>Positioning objects in the scene and reading back results</strong></h3>
1837
+
<h3id="positioning-objects-in-the-scene-and-reading-back-results"><strong>Positioning objects in the scene and reading back results</strong><aclass="headerlink" href="#positioning-objects-in-the-scene-and-reading-back-results" title="Permanent link">¶</a></h3>
1793
1838
<p>See <ahref="/structures/structure_management/#transforms">Transforms</a> for various options and to set and get per-structure transformations.
1794
1839
In the GUI, you can use the <code>[Options] --> [Transform]</code> menu to enable a widget to interactively transform each object within the scene.</p>
1795
-
<h3id="managing-large-numbers-of-structures-and-quantities"><strong>Managing large numbers of structures and quantities</strong></h3>
1840
+
<h3id="managing-large-numbers-of-structures-and-quantities"><strong>Managing large numbers of structures and quantities</strong><aclass="headerlink" href="#managing-large-numbers-of-structures-and-quantities" title="Permanent link">¶</a></h3>
1796
1841
<p>Polyscope generally scales just fine with 100s or even 1000s of distinctly named structures in the scene. However, with this many structures, it may become difficult to select what you want in the UI. Polyscope has a few features which can help:</p>
1797
1842
<p>Every structure has controls in its options UI menu under <code>Options --> Structure Selection</code> and <code>Options --> Quantity Selection</code> which can be used to enable/disable all structures and quantities, or isolate to viewing a single structure.</p>
1798
1843
<p>Use <ahref="/features/groups/">Groups</a> to group your structures in to categories which can be enabled/disabled all together. Notice the <code>hide descendants</code> and <code>show details</code> options on groups, which can totally hide structures from the UI while still offering some control via the group.</p>
1799
1844
<p>You can always use the <ahref="/features/callbacks_and_UIs/">Custom UIs</a> to create your own interface buttons and selectors which programmatically enable or disable registered objects or adjust their settings.</p>
1800
-
<h3id="how-do-i-show-animated-data"><strong>How do I show animated data</strong></h3>
1845
+
<h3id="how-do-i-show-animated-data"><strong>How do I show animated data</strong><aclass="headerlink" href="#how-do-i-show-animated-data" title="Permanent link">¶</a></h3>
1801
1846
<p>There is no explicit built-in functionality for animated or time-series data, but it is easy and common to <ahref="/basics/interactive_UIs_and_animation/">do it yourself with a per-frame callback function</a>.</p>
1802
-
<h3id="how-do-i-create-custom-uis-with-buttons-sliders-text-boxes-etc"><strong>How do I create custom UIs with buttons, sliders, text boxes, etc</strong></h3>
1847
+
<h3id="how-do-i-create-custom-uis-with-buttons-sliders-text-boxes-etc"><strong>How do I create custom UIs with buttons, sliders, text boxes, etc</strong><aclass="headerlink" href="#how-do-i-create-custom-uis-with-buttons-sliders-text-boxes-etc" title="Permanent link">¶</a></h3>
1803
1848
<p>Polyscope integrates with the excellent <ahref="https://github.com/ocornut/imgui">Dear ImGui</a> library for UI elements. See the <ahref="/basics/interactive_UIs_and_animation/">interactions page</a> for how to use ImGui functions within polyscope, and see the ImGui docs for everything ImGui can do.</p>
1804
-
<h3id="how-do-i-set-up-mouse-click-interactions-and-callbacks"><strong>How do I set up mouse click interactions and callbacks</strong></h3>
1805
-
<p>See <ahref="/basics/interactive_UIs_and_animation/#mouse-interactions">Mouse Interactions</a>. There are no special callbacks for creating mouse events. Instead, you can implement almost any behavior you want via ImGui’s built-in functions. There are also a few polyscope-specific functions to get information about scene at the location you clicked, such as constructing rays and querying depth.</p>
1806
-
<h3id="rendering-figures-for-papers-and-presentations"><strong>Rendering figures for papers and presentations</strong></h3>
1849
+
<h3id="how-do-i-set-up-mouse-click-interactions-and-callbacks"><strong>How do I set up mouse click interactions and callbacks</strong><aclass="headerlink" href="#how-do-i-set-up-mouse-click-interactions-and-callbacks" title="Permanent link">¶</a></h3>
1850
+
<p>See <ahref="/basics/interactive_UIs_and_animation/#mouse-interactions">Mouse Interactions</a>. Polyscope follows an immediate-mode philosophy for interactions: rather than registering many callbacks for various IO events, you can test for mouse and keyboard state in your main loop, or in the per-frame callback (which is the only callback), to implement any behavior your would like. ImGui offers many functions for testing mouse/keyboard state, and there are also a few polyscope-specific functions to get information about scene at the location you clicked, such as constructing rays and querying depth.</p>
1851
+
<h3id="rendering-figures-for-papers-and-presentations"><strong>Rendering figures for papers and presentations</strong><aclass="headerlink" href="#rendering-figures-for-papers-and-presentations" title="Permanent link">¶</a></h3>
1807
1852
<p>Several settings can be customized to give a more polished appearance. Consider:</p>
1808
1853
<ul>
1809
1854
<li>Adjusting the <ahref="/features/ground_and_shadows/">ground plane</a> to shadow-only for ground shadows </li>
<li>Saving <ahref="/features/screenshots/">screenshots</a> with transparency for compositing</li>
1812
1857
</ul>
1813
-
<h3id="visualizing-colors-as-exact-rgb-values-without-any-shading-or-tonemapping"><strong>Visualizing colors as exact RGB values, without any shading or tonemapping</strong></h3>
1858
+
<h3id="visualizing-colors-as-exact-rgb-values-without-any-shading-or-tonemapping"><strong>Visualizing colors as exact RGB values, without any shading or tonemapping</strong><aclass="headerlink" href="#visualizing-colors-as-exact-rgb-values-without-any-shading-or-tonemapping" title="Permanent link">¶</a></h3>
1814
1859
<p>Normally, colors are shaded and tone-mapped for rendering, which means the colors and colormapped-values you specify are not exactly the colors Polyscope renders to the screen. Use the <ahref="/features/materials/#preserving-colors-with-the-flat-material">flat material</a> to circumvent these effects, and ensure that colors are flat-shaded to the screen with exactly the RGB values specified.</p>
1815
-
<h3id="how-do-i-run-polyscope-on-a-remote-or-headless-server"><strong>How do I run Polyscope on a remote or headless server?</strong></h3>
1816
-
<p>It may not not be possible to use Polyscope on a remote headless machine which does not have a physical monitor. </p>
1817
-
<p>If the machine <em>does</em> have a display attached, there should be no problem. You can run and initialize Polyscope, and even if you are working remotely via script or SSH you can programmatically capture screenshots of the rendered scene. </p>
1818
-
<p>However, Polyscope will only work if it can create an operating system-level display window, which generally means having a physical monitor attached. Various virtual windowing systems and X-servers exist as a hypothetical workaround, however users have reported limited success with these tools, usually because they use software openGL renderers which do not support the openGL features required by Polyscope.</p>
1819
-
<p>In implementation terms, this limitation comes from needing to initialize an OpenGL 3.3 core-profile context using <ahref="https://www.glfw.org/">GLFW</a>. Currently, GLFW can only create an openGL context when a display is present. If you find a good workaround for Polyscope on headless machines, please share! One day, we hope to implement an alternate EGL backend, which would support headless machines.</p>
1860
+
<h3id="how-do-i-run-polyscope-remotely-in-a-browser-via-a-notebook-or-on-headless-server"><strong>How do I run Polyscope remotely in a browser, via a notebook, or on headless server?</strong><aclass="headerlink" href="#how-do-i-run-polyscope-remotely-in-a-browser-via-a-notebook-or-on-headless-server" title="Permanent link">¶</a></h3>
<p>In short, Polyscope <em>does</em> support headless rendering: it can be used on remote serves with no display attached to render images and videos to files or buffers, by initializing with a special EGL backend. However, Polyscope <em>does not</em> currently support any kind of client-server mode, or execution in the browser from remote machines, etc. It must be executing locally on the machine which you are using it from. </p>
0 commit comments