fresnel.interact

Overview

fresnel.interact.SceneView

View a fresnel Scene in real time

Details

Interactive Qt widgets.

class fresnel.interact.SceneView(scene, max_samples=2000)

View a fresnel Scene in real time

SceneView is a PySide2 widget that displays a fresnel.Scene, rendering it with fresnel.tracer.Path interactively. Use the mouse to rotate the camera view.

Parameters
  • scene (Scene) – The scene to display.

  • max_samples (int) – Sample until max_samples have been averaged.

  • Left click to pitch and yaw

  • Right click to roll

  • Middle click to pan

  • Hold ctrl to make small adjustments

Using in a standalone script

To use SceneView in a standalone script, import the fresnel.interact module, create your fresnel.Scene, instantiate the SceneView, show it, and start the app event loop.

import fresnel, fresnel.interact
# build Scene
view = fresnel.interact.SceneView(scene)
view.show()
fresnel.interact.app.exec_();

Using with jupyter notebooks

To use SceneView in a jupyter notebook, import PySide2.QtCore and activate jupyter’s qt5 integration.

from PySide2 import QtCore
% gui qt

Import the fresnel.interact module, create your fresnel.Scene, and instantiate the SceneView. Do not call the app event loop, jupyter is already running the event loop in the background. When the SceneView object is the result of a cell, it will automatically show and activate focus.

import fresnel, fresnel.interact
# build Scene
fresnel.interact.SceneView(scene)

Note

The interactive window will open on the system that hosts jupyter.

See also

examples/02-Advanced-topics/03-Interactive-scene-view

Tutorial: Interactive scene display

setScene(scene)

Set a new scene

Parameters

scene (Scene) – The scene to render.

Also call setScene when you make any changes to the scene so that SceneView window will re-render the scene with the changes.