chbergmann / OpticsWorkbench

GNU Lesser General Public License v3.0
69 stars 23 forks source link

introducing a ray uglyfies the graphics ;) #4

Open wohltat opened 2 years ago

wohltat commented 2 years ago

When adding a ray then the graphics look kind of broken. Looks like something is messing with the z-buffer.

opticsWB_zbuffer_bug

When adding an absorber the effect disappears, which makes sense since the ray doesn't go to infinity and decreasing the z-buffer resolution. @chbergmann You probably already know this but maybe its good to put an info somewhere that the absorbers are meant for that.

wohltat commented 2 years ago

Wouldn't it be possible to automatically absorb the rays at a certain distance? Outside of the project bounding box it would not interact with objects anyways.

wohltat commented 2 years ago

Ok i found your hint on using a absorber box around the scene. https://forum.freecadweb.org/viewtopic.php?style=5&f=8&t=59860&start=10#p515683

But would still be nice if this could happen automatically. Lets say twice the size of the scene bounding box.

chbergmann commented 2 years ago

There is a parameter MaxRayLength. This will cut off each ray when it reaches a certain length. Lowering MaxRayLength is like putting an absorber sphere around your design.

wohltat commented 2 years ago

Just tested it. Works as promised. This is much easier and cleaner than an absorber cube.

I personally think the default for MaxRayLength is way to high. I can't imagine many uses for such a long ray since it can't interact anyways. It doesn't add value to the simulation and in a way breaks functionality like "Fit all". The only reason would be to limit the overall ray path length, but it does not do this. MaxRayLength is just for one linear segment.

What do you think about the idea to couple the MaxRayLength or the outer limit (= INFINITY?) to the size of the scene? At least for creation of the ray.

chbergmann commented 2 years ago

I think coupling the ray length to the scene will confuse the users. Different ray length for different scenes ? On the other way I want to keep the workbench as simple as possible