Realistic simulation of camera and laser

Use this forum for general user support and related questions.
Forum rules
Please upload a testscene that allows developers to reproduce the problem, and attach some images.
Doc_CC
Posts: 2
Joined: Tue Dec 11, 2018 10:02 pm

Realistic simulation of camera and laser

Post by Doc_CC »

I'm hoping I can use LuxCoreRender/BlendLuxCore for some scientific work. I need to run a functional simulation (nothing super precise, just functional) for an optical system I'm hoping to build - lasers, refracting elements, cameras, etc.

As part of this, I need the camera to act like a physical camera. It needs to simulate an actual sensor surface that will register pixel illumination when directly struck by a laser (or other light source, but the laser is the most crucial).

I haven't gotten good results so far. "Hitting" the camera with a laser, either directly or after it passes through glass objects, does nothing. If the laser light lands on an external surface, the camera can see its effects as normal, but that's not what I need. I need the camera to be the surface that the light hits (or act like it at least).

Considering how advanced LuxCore is, I'm sure there's got to be a way to do this. It would really help me out if someone could let me know what I'm missing here.
User avatar
FarbigeWelt
Donor
Donor
Posts: 1046
Joined: Sun Jul 01, 2018 12:07 pm
Location: Switzerland
Contact:

Re: Realistic simulation of camera and laser

Post by FarbigeWelt »

You may read one of my posts related to laser, glass and visibility.. Some effects could be improved since alpha version.

viewtopic.php?f=2&t=474&start=90#p5577
viewtopic.php?f=2&t=474&start=120#p5737
viewtopic.php?f=2&t=474&start=120#p5784
Light and Word designing Creator - www.farbigewelt.ch - aka quantenkristall || #luxcorerender
MacBook Air with M1
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Realistic simulation of camera and laser

Post by Dade »

Doc_CC wrote: Tue Dec 11, 2018 10:47 pm As part of this, I need the camera to act like a physical camera. It needs to simulate an actual sensor surface that will register pixel illumination when directly struck by a laser (or other light source, but the laser is the most crucial).

I haven't gotten good results so far. "Hitting" the camera with a laser, either directly or after it passes through glass objects, does nothing. If the laser light lands on an external surface, the camera can see its effects as normal, but that's not what I need. I need the camera to be the surface that the light hits (or act like it at least).
It should be possible to do it indirectly: hit a plane with the laser, use an orthographic camera looking perpendicular to the plane, than use the Irradiance AOV if you want some numerical values or just check the normal rendered image for a qualitative evaluation :idea:

The only other option I see is to write a dedicated new camera type but it would require to write code. But the combo "orthographic camera+planes" should pretty much model the new type of camera you need.
Support LuxCoreRender project with salts and bounties
User avatar
FarbigeWelt
Donor
Donor
Posts: 1046
Joined: Sun Jul 01, 2018 12:07 pm
Location: Switzerland
Contact:

Re: Realistic simulation of camera and laser

Post by FarbigeWelt »

Not sure anymore, what you want to visualize.

But you can start with using e.g. this scene here:
Laser and Glass.zip
Laser and Glass.zip
(80.32 KiB) Downloaded 239 times
You can use the view port (shift z) and adjust camera's angle with mouse (ctrl f) or move camera if selected (g).
Change material or properties according to your needs. I've chosen these parameters to show their influence on the way laser can be handled by material or volume settings.

What actually seems not to be possible is to see the beam in a clear glass. I think now, I made an error trying to visualize this in former scenes. I cannot remember to have seen light in any clear medium or a "clear" beam in optical dense but scattering medium. Just think about glass fibres or any glass in front of you with any good drink.
Light and Word designing Creator - www.farbigewelt.ch - aka quantenkristall || #luxcorerender
MacBook Air with M1
CodeHD
Donor
Donor
Posts: 437
Joined: Tue Dec 11, 2018 12:38 pm
Location: Germany

Re: Realistic simulation of camera and laser

Post by CodeHD »

This is an interesting topic for me as well. I tried this a while back with v1.6 with a 5-element lens system. I sent some lasers through it to check the focus and everything worked as intended. See the image attached. Even got nice ghosts and shadows of the focal plane spot cast by the lens.
When using an Ortho-camera to observe the "focal plane" at the bottom I had mixed results. At some point I managed to correctly image Suzanne with an emission shader through the lens system, but imaging a more complex baffle system in front of the optics (the science case) did not work. It might have been too many reflections in total, not sure... I'll try to follow this up with v2.0 when I have some time for it.

A "plain-CDD"-camera would be interesting indeed. Would that be too difficult in terms of ray tracing to implement? Isn't it pretty much the same as for a regular camera with extended aperture, just using a different mapping function between the ray coordinates and angles to the image pixels?

@FarbigeWelt: The laser beam should be visible in homogeneous glass as well. It was not visible in your scene because your glass material had an opacitiy of 1, i.e. not transparent. Lower the value and you see the beam inside the glass cube.
Attachments
fitswork_edit.jpg
User avatar
FarbigeWelt
Donor
Donor
Posts: 1046
Joined: Sun Jul 01, 2018 12:07 pm
Location: Switzerland
Contact:

Re: Realistic simulation of camera and laser

Post by FarbigeWelt »

CodeHD wrote: Wed Dec 12, 2018 12:08 pm @FarbigeWelt: The laser beam should be visible in homogeneous glass as well. It was not visible in your scene because your glass material had an opacitiy of 1, i.e. not transparent. Lower the value and you see the beam inside the glass cube.
Hi CodeHD
Opacity is not the same as transparancy in LuxCoreRender. Opacity makes objects vanish to set amount. This is the reason I did not have the idea to use opacity.

It is not clear to me what happens to rays passing through a partial vanished glass lens. Does the vanished part interact with the rays and bend them according to IOR of the visible object?

An optical denser medium than air, let's take water, has about thousand times more density than air. Assuming scattering is an effect based on foreign particles in medium, then one has to choose less particles per thickness than for air. Scattering acts usually in 3 dimensions. In reality there are often too many foreing particles and beam cannot be seen clearly. One had to produce a specific medium to get the beam "clearly" visiual. Because of different IOR and other physical effects like diffraction I am still not sure if you can make a beam visible in optical dense mediums also consider waveguide effect.

Regards
FarbigeWelt
Light and Word designing Creator - www.farbigewelt.ch - aka quantenkristall || #luxcorerender
MacBook Air with M1
CodeHD
Donor
Donor
Posts: 437
Joined: Tue Dec 11, 2018 12:38 pm
Location: Germany

Re: Realistic simulation of camera and laser

Post by CodeHD »

FarbigeWelt wrote: Thu Dec 13, 2018 6:49 am Hi CodeHD
Opacity is not the same as transparancy in LuxCoreRender. Opacity makes objects vanish to set amount. This is the reason I did not have the idea to use opacity.
I guess you mean "varnished", i.e. painted, not "vanished"? From what I saw in your example file, the behaviour of luxcore was not like this though, because the clarity of the beam gradually decreased with opacity. Also, it is not completely black at opacity =1, the maximum value. (Another point to consider is that opacity can be defined in different ways).
FarbigeWelt wrote: Thu Dec 13, 2018 6:49 am It is not clear to me what happens to rays passing through a partial vanished glass lens. Does the vanished part interact with the rays and bend them according to IOR of the visible object?
Assuming the case above of varnished in the sense of a surface paint: that would depend on what this varnish is. Your description sounds to me like a thin-film coating (with high absorbing properties). Assuming a negligible film thickness, the refractive angle would be unaffected independent of film IOR. The reflection/transmission ratio should change though.

If it means something else, it becomes a matter of definition what physical process you want to be the cause of this opacity value.
FarbigeWelt wrote: Thu Dec 13, 2018 6:49 am An optical denser medium than air, let's take water, has about thousand times more density than air. Assuming scattering is an effect based on foreign particles in medium, then one has to choose less particles per thickness than for air. Scattering acts usually in 3 dimensions. In reality there are often too many foreing particles and beam cannot be seen clearly. One had to produce a specific medium to get the beam "clearly" visiual. Because of different IOR and other physical effects like diffraction I am still not sure if you can make a beam visible in optical dense mediums also consider waveguide effect.
Well that depends on the scattering scale, i.e. the mean path between two scattering processes. A real-world example is the solar corona, where you observe white light that has been thomson-scattered on free electrons. You have an incoming high-intensity-beam (in this case sunlight, could be a strong laser), of which only a few photons are scattered. Afterwards the free path is so long that you have no rescatter until you reach the Earth/the camera.
This is quite different though from the definition of an optically dense medium. So no, quite naturally you won't have a clearly visible beam because multiple re-scattering washes out your features. I've seen that luxcore already has a "multiscatter" switch.

You mentioned waveguides (fibers) as an example, but there is a different process involved: total internal reflection. In you example scene, you send a beam in at 90 degrees to the surface and observe at 90 degrees to a surface. There is no TIR involved at those view angles.
And also, you ideally shouldn't have much scattering in an optical fiber anyways, or it will be a pretty bad fiber for long-range applications ;)

If you want to experiment with this, you can add a few drops of low-fat milk to water. It will also scatter blue light more than red, which is why we use it to demonstrate the blue sky phenomenon.
Using fluorescent ink doesn't represent this well, because then the scattering/absoprtion scale is very different for the exciting and the emitted wavelength. Hence you can get very short absorption distances, but still see the beam very clearly from the outside.
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: Realistic simulation of camera and laser

Post by B.Y.O.B. »

Opacity is a common property of all LuxCore materials, meaning it's not specific to glass.
It is a bit like alpha transparency.
If you want the glass to be physically correct, you should not use it.

I think FarbigeWelt meant "vanish" in the sense of "being transparent".
CodeHD
Donor
Donor
Posts: 437
Joined: Tue Dec 11, 2018 12:38 pm
Location: Germany

Re: Realistic simulation of camera and laser

Post by CodeHD »

B.Y.O.B. wrote: Thu Dec 13, 2018 12:01 pm Opacity is a common property of all LuxCore materials, meaning it's not specific to glass.
It is a bit like alpha transparency.
If you want the glass to be physically correct, you should not use it.

I think FarbigeWelt meant "vanish" in the sense of "being transparent".
Ok, thought he might mean that, just wanted to discuss the other option anyways ;)

What exactly do you mean by "like alpha" then?
I just had some time to play with FarbigeWelt's Laser and Glass example. The glass block indeed only behaves the way I would expect when I set its opacity to 0. Increasing it has a strange effect: the reflectance of the cube where the laser enters behaves as if the homogeneous glass scattering scale is increased, the transmission through the block appears unaltered, and the way I see the block from the side behaves like decreasing absorption depth with a grey absorption color.

EDIT: I forgot to mention: This opacity behaviour is opposite to when I just have a clear glass block and observe another object through it, seeing a refractive shift in its apparent position or TIR on the glass block sides. In that case opacity=1 is when I observe the effects as I would expect...
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: Realistic simulation of camera and laser

Post by B.Y.O.B. »

Opacity=1 is the default.
I should have said "you should leave it at 1" instead of "not use it".
CodeHD wrote: Thu Dec 13, 2018 2:46 pm What exactly do you mean by "like alpha" then?
Like transparency in an image manipulation program or a compositor.
Post Reply