Driving behavior is crucial in shaping traffic dynamics and serves as the foundation for safe and efficient autonomous driving. Despite the widespread interest in driving behavior modeling, existing models often focus on specific behaviors and cannot describe all types of vehicle movements, while vehicle status and driving scenarios are dynamic and infinite. That means comprehending and modeling generalized driving behavior mechanisms is essential. Risk Homeostasis Theory (RHT) emerges as a compelling conceptual framework to explain human risk behaviors comprehensively. The critical problem in modeling behavior using RHT is quantifying the subject risk precepted by humans. RHT has been applied in car-following behavior modeling based on the one-dimensional risk indicator Safety Margin (SM), simplifying the specific behavior along its direction. While the generalized perceived risk indicator on the two-dimensional surface still lacks. Considering the collision avoidance capacity from the driver’s perspective, this paper proposes the two-dimensional safety margin (TSM) to describe the driver’s risk perception in generalized driving scenarios with two-dimensional movements. Results demonstrate that TSM could accurately describe car-following behavior compared to existing risk indicators, with a 9.1 % correlation improvement and the reasonably calibrated response time (1.07 s). And TSM could effectively capture the discrepant risk perceptions of different drivers involved in the same conflict, underscoring the alignment of TSM with drivers’ subjective risk perceptions. Besides, TSM reflects the risk homeostasis of driving behaviors, as both typical scenarios have the normally distributed and concentrated target levels. Further, TSM also achieves a generalized, scenario-independent risk quantification with a mean target level of 0.85. As a good representation of driver’s risk perception in two-dimensional scenarios, TSM serves as a crucial basis in areas such as driving behavior modeling, and decision-making and testing of autonomous driving.