-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Volume rendering is broken #44
Comments
Seeing this in JS console:
|
This was a browser caching issue. All seems to be working now |
|
Fixed the error by adding an alias but the rendering is still empty... |
Any reason for 2 fields with a weird one set at setScalars?
|
Seems to be a blend of PyVista and trame-vtk expectation. As I remember, the vtkSmartVolumeMapper prevent us to grab proper info from the concrete mapper. At some point you did something to override the vtkSmartVolumeMapper by a concrete one within PyVista... |
The VTK volume rendering example is working. |
Which example? Is it using |
Here is a pure VTK wxample: import vtk
from trame.app import get_server
from trame.ui.vuetify import SinglePageLayout
from trame.widgets import vuetify
from trame.widgets.vtk import VtkLocalView, VtkRemoteView
server = get_server()
state, ctrl = server.state, server.controller
state.trame__title = "VTK Volume Rendering"
# -----------------------------------------------------------------------------
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
iren.GetInteractorStyle().SetCurrentStyleToTrackballCamera()
source = vtk.vtkRTAnalyticSource()
source.Update()
# mapper = vtk.vtkFixedPointVolumeRayCastMapper() # works!
# mapper = vtk.vtkSmartVolumeMapper() # fails!
# mapper = vtk.vtkOpenGLGPUVolumeRayCastMapper() # fails
mapper = vtk.vtkGPUVolumeRayCastMapper() # fails
mapper.SetInputConnection(source.GetOutputPort())
actor = vtk.vtkVolume()
actor.SetMapper(mapper)
actor.GetProperty().SetScalarOpacityUnitDistance(10)
ren.AddActor(actor)
colorTransferFunction = vtk.vtkColorTransferFunction()
colorTransferFunction.AddRGBPoint(0.0, 0.0, 0.0, 0.0)
colorTransferFunction.AddRGBPoint(64.0, 1.0, 0.0, 0.0)
colorTransferFunction.AddRGBPoint(128.0, 0.0, 0.0, 1.0)
colorTransferFunction.AddRGBPoint(192.0, 0.0, 1.0, 0.0)
colorTransferFunction.AddRGBPoint(255.0, 0.0, 0.2, 0.0)
opacityTransferFunction = vtk.vtkPiecewiseFunction()
opacityTransferFunction.AddPoint(20, 0.0)
opacityTransferFunction.AddPoint(255, 0.2)
volumeProperty = vtk.vtkVolumeProperty()
volumeProperty.SetColor(colorTransferFunction)
volumeProperty.SetScalarOpacity(opacityTransferFunction)
volumeProperty.ShadeOn()
volumeProperty.SetInterpolationTypeToLinear()
actor.SetProperty(volumeProperty)
cube = vtk.vtkCubeAxesActor()
cube.SetCamera(ren.GetActiveCamera())
cube.SetBounds(source.GetOutput().GetBounds())
ren.AddActor(cube)
iren.Initialize()
ren.ResetCamera()
ren.SetBackground(0.7, 0.7, 0.7)
renWin.Render()
# -----------------------------------------------------------------------------
# GUI
# -----------------------------------------------------------------------------
with SinglePageLayout(server) as layout:
layout.icon.click = ctrl.view_reset_camera
layout.title.set_text(state.trame__title)
with layout.toolbar:
vuetify.VSpacer()
with layout.content:
with vuetify.VContainer(
fluid=True,
classes="pa-0 fill-height",
):
with vuetify.VContainer(fluid=True, classes="pa-0 fill-height", style="width: 50%;"):
local = VtkLocalView(renWin)
with vuetify.VContainer(fluid=True, classes="pa-0 fill-height", style="width: 50%;"):
remote = VtkRemoteView(renWin)
# hide footer
layout.footer.hide()
# -----------------------------------------------------------------------------
# Main
# -----------------------------------------------------------------------------
if __name__ == "__main__":
server.start() |
Yes just tested |
I can't get volume rendering to work with any client-side views right now
The text was updated successfully, but these errors were encountered: