<p>You might look into <a href="https://www.mitsuba-renderer.org/" rel="nofollow noreferrer">Mitsuba</a>, which is a physically based path tracing renderer that's designed to be easy to extend with plugins. It might be useful as a base for you to build on, implementing your own algorithms as plugins or by modifying its code.</p>
<p>It already contains facilities for measuring the amount of light falling on some geometry, in the form of the &quot;<a href="https://mitsuba2.readthedocs.io/en/latest/generated/plugins.html#irradiance-meter-irradiancemeter" rel="nofollow noreferrer">irradiance meter</a>&quot; object. I'm not sure how much it can help you with geometry modification as it's not really designed for that (it just imports geometry from a file and renders it), but maybe you can find some other libraries to help with that part, depending on what kind of geometry operations you need to do.</p>

CC BY-SA 4.0
2020-11-26T05:07:58.143Z
Thank you for your answer. Unfortunately I think that the geometry modification is actually the crux of the problem. But I will take a look!
Christopher A. Wong
CC BY-SA 4.0
2020-11-26T19:52:43.620Z
Maybe you could add to your question some more details about what kind of geometry modifications you want to do? People might be able to recommend something.
Nathan Reed
CC BY-SA 4.0
2020-11-27T07:31:06.487Z
I have updated my question accordingly.
Christopher A. Wong
CC BY-SA 4.0
2020-11-28T19:27:31.770Z
Hi @ChristopherA.Wong. You are right to prefer not to reinvent the wheel. A library like Mistuba that can not only render an image, but also as a by-product tell how much light some materials receive, in a physically accurate fashion, looks like a very strong asset for you. It can probably produce accurately the precise information your specific application needs to know how to change the geometry (e.g., melting wax). Writing your code like: make a mesh -> get an image + illumination info -> your_plugin_that changes_geometry -> new mesh, loop, looks like a sane and strong approach.
Stéphane Gourichon
CC BY-SA 4.0
2020-11-26T04:34:19.600Z
2020-11-26T04:34:19.600Z
Nathan Reed
<p>I am interested in a scientific application in which ray tracing is necessary, but also where the light itself alters the geometry of the surface mesh (imagine perhaps that the beams of light have enough energy to damage the surface). Right now I am writing everything from scratch and not using any existing libraries, and thus my (obviously naive) implementation is extremely slow. As I understand it, this boils down to clever methods by which to update the BVH, interleaved with each rendering step.</p>
<p>Some slight elaboration on the problem: when a ray of light hits a surface, we consider two possibilities: either it reflects off the surface (as is typical in a ray tracer), or it impacts the surface and essentially burns a hole into the surface. This alters the geometry  of the mesh and affects any future light rays, and thus forces an update of the boundary volume hierarchy. The surface deformation is usually local but <em>can</em> be global-scale, for example if the hole is large enough it may cause the structure to collapse or break off. Thus ray tracing affects the geometry &quot;in real time&quot;, but simultaneously geometry is necessary to perform ray tracing at each step as well.</p>
<p>While I'm interested in the algorithmic problem, what I'm more interested in is whether or not there is a graphics library that is well suited to this task, so that I don't have to re-invent the wheel, or dive too deep into the literature. I am quite a beginner when it comes to available software libraries so please forgive me.</p>

CC BY-SA 4.0
2020-11-27T14:55:12.000Z
This sounds like an animation issue. That is, the light would affect the geometry you would use *next* frame, not on the current frame. And you'd need to store the changes to the geometry from frame to frame, lest the removal of light cause the geometry to repair itself.
Nicol Bolas
CC BY-SA 4.0
2020-11-27T20:23:23.467Z
@NicolBolas Yeah that sounds right. Right now everything is done exactly but very slow, so basically if this whole problem could be mostly solved "efficiently" using some well-known graphics library we would save a lot of trouble, so that's what I was hoping for.
Christopher A. Wong
<raytracing>
Ray tracing where illumination itself affects the geometry
Christopher A. Wong
# Ray tracing where illumination itself affects the geometry

(Asked by: username_0 on 2020-11-26)

I am interested in a scientific application in which ray tracing is necessary, but also where the light itself alters the geometry of the surface mesh (imagine perhaps that the beams of light have enough energy to damage the surface). Right now I am writing everything from scratch and not using any existing libraries, and thus my (obviously naive) implementation is extremely slow. As I understand it, this boils down to clever methods by which to update the BVH, interleaved with each rendering step.

Some slight elaboration on the problem: when a ray of light hits a surface, we consider two possibilities: either it reflects off the surface (as is typical in a ray tracer), or it impacts the surface and essentially burns a hole into the surface. This alters the geometry of the mesh and affects any future light rays, and thus forces an update of the boundary volume hierarchy. The surface deformation is usually local but *can* be global-scale, for example if the hole is large enough it may cause the structure to collapse or break off. Thus ray tracing affects the geometry "in real time", but simultaneously geometry is necessary to perform ray tracing at each step as well.

While I'm interested in the algorithmic problem, what I'm more interested in is whether or not there is a graphics library that is well suited to this task, so that I don't have to re-invent the wheel, or dive too deep into the literature. I am quite a beginner when it comes to available software libraries so please forgive me.

**Tags:** raytracing

> **Comments:**
> **username_1**: This sounds like an animation issue. That is, the light would affect the geometry you would use *next* frame, not on the current frame. And you'd need to store the changes to the geometry from frame to frame, lest the removal of light cause the geometry to repair itself.  
> **username_0**: @username_1 Yeah that sounds right. Right now everything is done exactly but very slow, so basically if this whole problem could be mostly solved "efficiently" using some well-known graphics library we would save a lot of trouble, so that's what I was hoping for.  

---

## 1 answers

### Answer by username_2 on 2020-11-26. Score: 3

You might look into [Mitsuba](https://www.mitsuba-renderer.org/), which is a physically based path tracing renderer that's designed to be easy to extend with plugins. It might be useful as a base for you to build on, implementing your own algorithms as plugins or by modifying its code.

It already contains facilities for measuring the amount of light falling on some geometry, in the form of the "[irradiance meter](https://mitsuba2.readthedocs.io/en/latest/generated/plugins.html#irradiance-meter-irradiancemeter)" object. I'm not sure how much it can help you with geometry modification as it's not really designed for that (it just imports geometry from a file and renders it), but maybe you can find some other libraries to help with that part, depending on what kind of geometry operations you need to do.

> **Comments:**
> **username_0**: Thank you for your answer. Unfortunately I think that the geometry modification is actually the crux of the problem. But I will take a look!  
> **username_2**: Maybe you could add to your question some more details about what kind of geometry modifications you want to do? People might be able to recommend something.  
> **username_0**: I have updated my question accordingly.  
> **username_3**: Hi @username_0. You are right to prefer not to reinvent the wheel. A library like Mistuba that can not only render an image, but also as a by-product tell how much light some materials receive, in a physically accurate fashion, looks like a very strong asset for you. It can probably produce accurately the precise information your specific application needs to know how to change the geometry (e.g., melting wax). Writing your code like: make a mesh -> get an image + illumination info -> your_plugin_that changes_geometry -> new mesh, loop, looks like a sane and strong approach.  

---

