LeiaRaycastFocus
LeiaRaycastFocus
Pros:
Fast
Accurate
Easy to use
Doesn't require using shaders which write to the depth buffer (unlike LeiaDepthFocus).
Cons:
Requires colliders to be setup properly in the scene for auto focus to work properly.
Physics simulation can be more expensive on performance, depending on sample count.
The LeiaRaycastFocus component uses raycasting to determine the distance to visible objects in the scene, and then uses that information to determine a suitable focal distance and depth factor for the LeiaDisplay.
Unique Parameters:
Max Raycast Distance
The maximum distance the auto focus algorithm is allowed to raycast to collect sample points. Note that if this is smaller than the focal distance range max value, then it will take precedence over the focal distance range max value when determining the max focal distance.
Samples
How many raycast samples to take to use in calculations determining the depth factor and focal distance. More samples will yield more accurate results but be more expensive performance-wise.
Show Debug Raycasts
Show debug rays in the scene editor.