# Lensing of black holes / custom ray-tracing with ParaView

**URL:** https://discourse.paraview.org/t/lensing-of-black-holes-custom-ray-tracing-with-paraview/3732
**Category:** ParaView Support
**Created:** [March 3, 2020, 4:51pm UTC](https://discourse.paraview.org/t/lensing-of-black-holes-custom-ray-tracing-with-paraview/3732 "2020-03-03T16:51:52Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![nilsleiffischer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/nilsleiffischer/32/3145_2.png) [@nilsleiffischer](https://discourse.paraview.org/u/nilsleiffischer)
#### Post date: [March 3, 2020, 4:51pm UTC](https://discourse.paraview.org/t/lensing-of-black-holes-custom-ray-tracing-with-paraview/3732/1 "2020-03-03T16:51:52Z")

</div>

I am looking for ways to create a lensing effect similar to the black hole in the Interstellar movie in ParaView. Here‘s another example where scientists at NASA have used a ray-tracing code to create this effect: [https://www.nasa.gov/feature/goddard/2018/new-simulation-sheds-light-on-spiraling-supermassive-black-holes](https://www.nasa.gov/feature/goddard/2018/new-simulation-sheds-light-on-spiraling-supermassive-black-holes). Ideally, here’s what I would like to do to enable this sort of thing:

1. Load 3D point data from my black hole simulation (no problem, works already)
2. Hook into one of ParaView‘s ray-tracing renderers (ideally the ‚GPU Based‘ one) to update the direction of each ray given its current position and the value of my point data at that position based on a formula I provide.

Is this possible at all with current builds of ParaView, or do you think this will become possible? If no, is it possible for me to contribute this functionality to ParaView? I would be grateful for any pointers 🙂

---

<div class="post-metadata">

### Author: ![Dave\_DeMarle](https://discourse.paraview.org/user_avatar/discourse.paraview.org/dave_demarle/32/27_2.png) [@Dave\_DeMarle](https://discourse.paraview.org/u/Dave_DeMarle)
#### Post date: [March 3, 2020, 9:02pm UTC](https://discourse.paraview.org/t/lensing-of-black-holes-custom-ray-tracing-with-paraview/3732/2 "2020-03-03T21:02:19Z")

</div>

This is definitely doable. And I would love to see it happen.

It boils down to creating a new material in either visRTX about [here](https://github.com/NVIDIA/VisRTX/blob/master/src/Material.cpp#L293) or OSPRay about [here](https://github.com/ospray/ospray/tree/master/ospray/render/pathtracer/materials) (or preferably both) and exposing it in ParaView about [here](https://gitlab.kitware.com/vtk/vtk/-/blob/master/Rendering/RayTracing/vtkOSPRayMaterialLibrary.cxx#L41).

FYI @carsonsbrownlee @tbiedert

---

<div class="post-metadata">

### Author: ![carsonsbrownlee](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/c/45deac/32.png) [@carsonsbrownlee](https://discourse.paraview.org/u/carsonsbrownlee)
#### Post date: [March 3, 2020, 11:12pm UTC](https://discourse.paraview.org/t/lensing-of-black-holes-custom-ray-tracing-with-paraview/3732/3 "2020-03-03T23:12:47Z")

</div>

This can be done in OSPRay, but would require writing custom code in OSPRay  
as a plugin in order to be able to change ray directions based on data values, we do not currently possess a custom sampling function that is exposed externally. I would be happy to help you through that process id you chose that route, the results would certainly look great!
