It is slightly outdated, but see here
https://hoi4.paradoxwikis.com/Naval_missions#Spotting and especially the tooltip in the accompanying screenshot:
So the big picture formula is the spotting starting at "Base detection in region" and then increasing by "Hourly change" until it reaches 100%. Base detection is just nice-to-have and the components are relatively self explanatory. Here are the formulas for Hourly change:
- Hourly change = Coordination × (Surface detection + Sub detection + Speed difference)
- Surface detection = SPOTTING_MULTIPLIER_FOR_SURFACE × (Our detection chance + Their detection chance) = Our detection chance + Their detection chance
- Our detection chance = 0.1% × our_detection × VISIBILITY_MULTIPLIER_FOR_SPOTTING × their_visibility = 0.01% × our_detection × their_visibility
- Their detection chance = -0.1% × SPOTTING_ENEMY_SPOTTING_MULTIPLIER_FOR_RUNNING_AWAY × their_detection × VISIBILITY_MULTIPLIER_FOR_SPOTTING × our_visibility = -0.008% × their_detection × our_visibility
- Sub Detection works the same way, just using sub visibility/detection/defines instead
- Speed difference: 0.1% × (our_speed - their_speed)
- when target runs away (difference < 0): × SPOTTING_SPEED_MULT_FOR_RUNNING_AWAY = × 0.5
- when catching up (difference > 0): × SPOTTING_SPEED_MULT_FOR_CATCHING_UP = × 0.2