LuxCoreRender / LuxCore

LuxCore source repository
Apache License 2.0
1.15k stars 144 forks source link

Unexpected rendering result: some volumetric caustics seem to be missing #403

Open emogenet opened 4 years ago

emogenet commented 4 years ago

Summary: In a somewhat complex volumetric caustic rendering scene, it looks like luxcore fails to render some volumetric caustics.

The attached scene works as follows (=> means : sends light to)

Wide area light in laser mode => Sphere 1: inner homogeneous volume (scatt=0.01) and glass shader (no dispersion, index=1.3, white trans. and refl.) => 45 degree pure mirror => Sphere 2: inner homogeneous volume (scatt=0.01) and glass shader (no dispersion, index=1.3, white trans. and refl.) => Prism: inner homogeneous volume (scatt=0.01) and glass shader (dispers.=0.01, index=1.3, white trans green refl.) => 45 degree pure mirror => Sphere 3: inner homogeneous volume (scatt=0.01) and glass shader (no dispersion, index=1.3, white trans. and refl.) => White diffuse screen (ceiling of enclosing box)

The whole scene is "immersed" in a world homogeneous volume with scatt=0.01 and low priority (pri=0) whereas all the glasses have pri=10

The whole scene, including camera is fully enclosed in a box to "keep all energy in".

See attached render and blender file to understand.

There seems to be two issues:

  1. The first issue is something I've experienced in many light simulation scene with luxcore: its seems to be quasi-impossible to render the volumetric caustics inside the glass spheres and prism, even though they have a high-priority inner volume shader with non-zero scattering.

The only way I've found to get those to show up is to set the opacity of the glass shaders to 50%, which unfortunately ruins the whole scene because half of the light isn't affected by the object and bounces all over the place.

  1. The second issue feels like a straight bug: the light that gets into the prism is properly refracted and dispersed twice (once upon entry, once upon exit) to form a beautiful exit volumetric caustic on the left side of the prism.

That light also gets internally reflected twice to produce a secondary light beam that comes out from the bottom of the prism.

Luxrender does know about these internal reflections, as demonstrated by the presence of a green patch of light at the bottom of the scene (I have set the prism reflection color to pure green to highlight the problem).

However, shouldn't there also be a green volumetric caustic coming out of the bottom of the prism and joining the green patch?

Software versions: blender-2.83.0-linux64 luxcorerender2.3 CPU only

volCaustics.blend.gz

volCaustics s

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/91897722-unexpected-rendering-result-some-volumetric-caustics-seem-to-be-missing?utm_campaign=plugin&utm_content=tracker%2F79505306&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F79505306&utm_medium=issues&utm_source=github).
CodeFHD commented 4 years ago

Regarding issue 1:

The reason is that the scattering inside the glass would have to connect to the camera through a specular glass surface. This can't be done directly. And as the camera is a non-intersectable object, the "random hit after random scattering"-way also won't work. Same reason goes for path tracing, as the laser is also of non-intersectable type. I have made a visualisation of a lens system before, including such scattered rays. For this I used cross-section models of the lenses and used a null-material on the cross-section face. This might not make sense in this particular scene, but perhaps a hint for future applications.

Regarding issue 2:

The beam is actually there. You have to consider the difference in brightness between the green spot on the floor and the caustic on the ceiling. Image 1 below is with the camera gain turned down a factor of 100. Now it is about as bright as the green in yours. See how faint the dusty air scatter is now. At your gain, the green beam will simply fall below the brightness of the wall.

Image 2 below was done with the opposite: camera gain up a lot, color of the wall almost to 0, amount of air scattering tuned. Now you can see that the beam actually is there (as well as the much more obvious one from the front face towards the ceiling, which you didn't seem to miss cause it's spot is hidden in the "regular" overexposed caustics ;) )

darkrender

brightrender

Sarah-C commented 2 months ago

The reason is that the scattering inside the glass would have to connect to the camera through a specular glass surface. This can't be done directly. And as the camera is a non-intersectable object, the "random hit after random scattering"-way also won't work.

Ohhh, that's why my prisms always turn to milk!
Has anyone figured out a way of doing this that isn't a hack?
Thea Render R2 has solved this issue some how....

image

I'll try setting my camera facing material to Null for now. Fantastic... I see how it's done. Thanks for sharing. image