MeshLib icon indicating copy to clipboard operation
MeshLib copied to clipboard

Add overload to find closest intersections for computeSkyViewFactor

Open mariuszhermansdorfer opened this issue 10 months ago • 1 comments

Hi @Fedr & @Grantim,

could we please add an overload to the computeSkyViewFactor functions to return the closest intersections? I understand that it could slow things down that's why it's set to false by default, but in certain situations I care about finding the closest point. One example is a view analysis, where I want to visualize the field of view from a specific point. Here you can see that sometimes the backfaces are returned as hit points.

image

https://github.com/MeshInspector/MeshLib/blob/523fb4679100e22d5a474c378bd8dc99f6cd9189/source/MRCuda/MRCudaSolarRadiation.cpp#L84-L87

https://github.com/MeshInspector/MeshLib/blob/523fb4679100e22d5a474c378bd8dc99f6cd9189/source/MRMesh/MRSolarRadiation.cpp#L51

mariuszhermansdorfer avatar Apr 15 '24 18:04 mariuszhermansdorfer

Hmm, it might be even simpler. Each time we return std::vectorMR::MeshIntersectionResult* outIntersections, these should be always the closest intersection. If we only care about occlusion tests, we wouldn’t return the intersection points.

mariuszhermansdorfer avatar Apr 15 '24 21:04 mariuszhermansdorfer

Hello, @mariuszhermansdorfer! @egrebenchenko has updated the functions, so in new version of meshlib it should return closest intersection if outIntersections is not nullptr

Grantim avatar Apr 17 '24 09:04 Grantim

Thanks @Grantim, I can see the commit addressed the CPU logic but not the Cuda version of this function. Could this be changed as well?

mariuszhermansdorfer avatar Apr 17 '24 09:04 mariuszhermansdorfer

https://github.com/MeshInspector/MeshLib/commit/555e43c243b2b281a651e2dccea0c55d311f8cdc here it is

Grantim avatar Apr 17 '24 09:04 Grantim

Super! Thanks a million!

mariuszhermansdorfer avatar Apr 17 '24 09:04 mariuszhermansdorfer