hi,
i was using Paraviewer and was able to use the OSPRayCaster to render the volume with raycasting to get better lighting and shadows and colors,
how can this be achived in vtk in python?
thanks
hi,
i was using Paraviewer and was able to use the OSPRayCaster to render the volume with raycasting to get better lighting and shadows and colors,
how can this be achived in vtk in python?
thanks
Hi, Abhi,
Below is a manual implementation explained in high details in Python that was done in 2014 (quite old):
Note that this was prior to ray tracing officially supported by VTK in 2016.
Since then, googling led to more recent isolated efforts published in public source repositories:
all the best,
Paulo
The OSPRay/OptiX ray tracing engines can be accessed from python like so:
rw = vtk.vtkRenderWindow()
r = vtk.vtkRenderer()
rw.AddRenderer®
rtp = vtk.vtkOSPRayPass()
r.SetPass(rtp)
From then on (or until you call r.SetPass(None)) rw.Render() will go through the ray tracer.
See the tests (all in c++ at the VTK level unfortunately) for ideas of what to do with it.
OptiX rendering works quite well, too (and it’s real-time if your GPU is good enough).
The only painful limitation is that volume rendering is not supported (at least not when I last tried). Is there a chance that volume rendering will be supported by the OptiX backend? Can OptiX and IndeX be used in VTK for mixed polygonal geometry and volumetric rendering?
I am not aware of any current work to enable VolumeRendering in VisRTX and thus OptiX within VTK. There are some leanings toward promoting IndeX from ParaView up to VTK, but I don’t know of any plans for tight OptiX/IndeX interoperability.
OSPRay’s path tracer in VTK also lacks volume rendering. That option will get volume rendering later this year when we bump to OSPRay 2.x and add OpenVKL. OSPRay’s ray caster already has VolumeRendering, but could use minor tweaks to improve sampling in some situations.
Thanks a lot this is very useful information. Photorealistic volume rendering (mixed with polygonal geometry) is getting more and more common in medical image visualization and it would be great if we had a solution for this in VTK (preferably with GPU acceleration).
That sounds very promising, I look forward to trying it out when the work is done. I must confess that I was surprised that the OSPRay volume ray tracing looked more like ray casting with shadows when I tried it a year or two ago. This explains why that was. I’ll second the call for GPU acceleration (potentially NVidia RTX?), this would be great.