I have a script which uses the raycaster to analyze .stl dental scans. I use the raycaster to measure the outside of the dental model and detect teeth and also their shapes. Locations of maximum width and related undercut depth are critical to designing dental prostheses. The script executes the raycaster several thousand times to make calculations and draw undercut maps.
The problem I am having is with raycaster is performance when using standard full size dental scans. I read suggestions to use raycaster.intersectObject rather than raycaster.intersectObjects (plural). I tried that approach but there was no significant difference.
To run the script on 5 MB size .stl file, the process takes a minute or less, however, on a 45 MB standard dental .stl file, it takes much longer, like 5-6 minutes.
I would like to find a solution to speed up the raycaster. I only need (2) intersects and the related distances. Are there any ways to improve performance?