A three-dimensional scene interaction control method and system based on ray plane intersection

By employing a ray-plane intersection method in 3D scene interaction, initializing and locking the anchor plane height, and performing pure mathematical intersection during continuous dragging, the problems of camera shake and device load were solved, achieving smooth 3D scene dragging and browsing and low-load device operation.

CN123157101APending Publication Date: 2026-11-24ZHONGKE HUIZHI (BEIJING) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611450176.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-18
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

In existing 3D virtual scene camera drag-and-drop interaction, physical rays are prone to hitting tall buildings and other high protruding objects, causing sudden changes in the Z-axis height of the anchor point, resulting in severe camera shake. Furthermore, frequent physical ray detection increases the device's computing load, affecting the frame rate and response speed.

Method used

A ray-plane intersection method is adopted. During initialization, a physical ray detection is performed to lock the anchor plane height. During the continuous dragging stage, a virtual horizontal plane is used to perform pure mathematical intersection, calculate virtual ground points and generate translation vectors to perform reverse displacement compensation for the camera, thus avoiding physical ray detection and reducing the computational load.

Benefits of technology

It effectively eliminates camera shake, improves visual smoothness, reduces device load, minimizes screen stuttering and operational lag, and enhances the 3D scene dragging and browsing experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123157101A_ABST
    Figure CN123157101A_ABST
Patent Text Reader

Abstract

The present application belongs to the field of three-dimensional graphics rendering and human-computer interaction technology, and provides a three-dimensional scene interaction control method and system based on ray plane intersection, which comprises the following steps: collecting initial anchor screen coordinates, emitting a physical detection ray to a three-dimensional world by means of a camera projection matrix inverse transformation, obtaining an anchor ground point by intersecting the physical detection ray with a scene collision body, extracting a height component and taking it as an anchor plane height, obtaining frame-by-frame real-time screen coordinates in response to continuous dragging instructions in a dragging continuous stage, closing scene physical ray collision detection throughout the whole process, generating a current frame world ray by back-projecting the real-time screen coordinates, obtaining a virtual ground point by solving the intersection point of the current frame world ray and a virtual horizontal plane corresponding to the anchor plane height through analytic geometry, constructing a translation vector by calculating the horizontal position difference between the virtual ground point and the anchor ground point, and applying reverse displacement compensation to the camera according to the translation vector.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of 3D graphics rendering and human-computer interaction technology, specifically a 3D scene interaction control method and system based on ray plane intersection. Background Technology

[0002] In existing camera drag-and-drop navigation solutions for 3D virtual scenes, each rendering frame in response to a drag operation performs a real-time physical raycasting calculation: a physical ray is emitted from the screen touch coordinates into 3D space, and the ground anchor point is determined based on the intersection results of the ray with various colliders in the scene. The camera's drag-following and displacement compensation logic is then based on the height of this point. Scenes commonly contain collision entities with abrupt changes in vertical height, such as tall buildings, mountains, and protruding structures. During dragging, the physical ray is highly likely to hit these high-level colliders instantaneously, causing a step-like change in the calculated Z-axis height of the anchor point. This height change is directly input into the camera displacement compensation calculation, ultimately resulting in irregular and significant camera shake during dragging and navigation, severely disrupting the visual smoothness of 3D scene browsing and reducing the user's interactive experience.

[0003] Meanwhile, continuous execution of physical ray collision detection across the entire frame constantly calls the intersection calculation module of the physics engine. In large-scale, high-precision 3D scenes and under the low computing power of mobile hardware, this can lead to unnecessary performance overhead, increase the device's computational load, and easily cause secondary problems such as decreased frame rate and delayed operation response. To address this, the present invention provides a 3D scene interaction control method and system based on ray plane intersection. Summary of the Invention

[0004] In order to overcome the shortcomings of the prior art, at least one technical problem raised in the background art is solved.

[0005] The technical solution adopted by this invention to solve its technical problem is: On one hand, the present invention provides a three-dimensional scene interactive control method based on ray plane intersection, including: In response to the drag-and-drop initialization command, the current screen coordinates are obtained as the initial anchor screen coordinates, and a physical detection ray is emitted into the three-dimensional world space based on the inverse transformation of the camera projection matrix. The intersection test is performed between the physical detection ray and the collider in the 3D scene to obtain the world coordinates of the hit as the anchor ground point, and the height component of the anchor ground point is extracted as the anchor plane height. In response to continuous drag commands, obtain the real-time screen coordinates of the current frame, disable physical ray detection for colliders in the 3D scene, and backproject the real-time screen coordinates to generate the world ray of the current frame. Based on analytical geometry algorithms, the mathematical intersection point of the world ray in the current frame and the virtual horizontal plane with a height equal to the height of the anchor plane is calculated and used as the virtual ground point of the current frame. Calculate the position difference between the virtual ground point and the anchored ground point on the horizontal plane, generate a translation vector, and apply reverse displacement compensation to the camera based on the translation vector.

[0006] As a further improvement of the present invention, the specific process of obtaining the current screen coordinates as the initial anchor screen coordinates is as follows: When a specific key press is detected, a drag initialization command is generated, and the two-dimensional pixel coordinates of the cursor in the current application window are obtained when the interaction occurs. It is then determined whether the two-dimensional pixel coordinates are within the UI occlusion area defined by the boundary pixel threshold. If they are not occluded, they are confirmed as the current screen coordinates and recorded as the initial anchor screen coordinates.

[0007] As a further improvement of the present invention, the specific process of emitting a physical detection ray into the three-dimensional world space based on the inverse transformation of the camera projection matrix is ​​as follows: Obtain the view-projection inverse matrix of the camera in the current rendering frame; The initial anchor screen coordinates are homogeneously transformed and normalized to generate normalized device coordinates. The normalized device coordinates are then multiplied with the view-projection inverse matrix to calculate the corresponding three-dimensional spatial direction vector. Starting from the world coordinate position of the camera in the current frame, a physical detection ray is emitted into the three-dimensional world space along the three-dimensional spatial direction vector.

[0008] As a further improvement of the present invention, the specific process of obtaining the hit world coordinates as the anchor ground point is as follows: Following the priority sequence of physical collision channels, which includes the visibility channel, the static world channel, and the dynamic world channel, the physical detection ray is used to perform intersection tests with colliders in the 3D scene in sequence. When a physical intersection is first detected in any physical collision path, the test is interrupted, and the absolute three-dimensional coordinates of the physical intersection point are obtained as the anchor ground point. If no valid physical intersection is detected after penetrating all physical collision channels, the mathematical intersection of the physical detection ray and the default zero-elevation reference plane of the 3D scene is calculated, and the coordinates of the mathematical intersection are used as the anchor ground point.

[0009] As a further improvement of the present invention, the specific process of obtaining the real-time screen coordinates of the current frame is as follows: Based on the absolute three-dimensional coordinates of the anchoring ground point, the vertical component is extracted as the height of the anchoring plane. Monitor the key hold status of the drag initialization command, read the two-dimensional pixel coordinates of the cursor on the screen in the current rendering frame, calculate the pixel distance between the currently read two-dimensional pixel coordinates and the screen coordinates recorded in the previous frame, and if the pixel distance is greater than or equal to the micro-jitter threshold, then confirm the currently read two-dimensional pixel coordinates as the real-time screen coordinates.

[0010] As a further improvement of the present invention, the specific process of generating the current frame world ray by back-projecting the real-time screen coordinates is as follows: Intercept the physics collision query interface at the code logic level and disable the physical ray detection call for colliders in the 3D scene; Obtain the view-projection inverse matrix of the camera in the current rendering frame; The real-time screen coordinates are normalized and mapped to standard device coordinates; Multiply the standard device coordinates with the view-projection inverse matrix of the current frame to resolve the world coordinate starting point of the camera in the current frame and the corresponding three-dimensional spatial direction vector; A spatial ray is constructed using the world coordinate starting point and the three-dimensional spatial direction vector, and serves as the world ray for the current frame.

[0011] As a further improvement of the present invention, the specific process of calculating the mathematical intersection point of the current frame's world ray and the virtual horizontal plane with a height equal to the anchor plane's height, as the virtual ground point of the current frame, is as follows: Extract the starting coordinates and direction vector of the world ray in the current frame, and construct a virtual horizontal plane in the logical space with the equation of the anchor plane height. Determine whether the vertical component of the direction vector is less than the parallel tolerance threshold. If it is greater than or equal to the parallel tolerance threshold, the distance parameter is calculated based on the intersection formula of the spatial line and the plane; If the distance parameter is greater than or equal to zero, the distance parameter is substituted into the parameterized equation of the three-dimensional spatial ray to calculate the coordinates of the three-dimensional spatial intersection point, which is used as the virtual ground point of the current frame.

[0012] As a further improvement of the present invention, the specific process of generating the translation vector is as follows: Extract the three-dimensional coordinates of the virtual ground point and the anchor ground point in the current frame, strip the coordinate data in the vertical direction, calculate the horizontal difference between the two in the X-axis and Y-axis directions of the horizontal plane, combine the calculated horizontal difference values, and force the horizontal difference in the Z-axis direction to be set to zero to construct the translation vector in three-dimensional space.

[0013] As a further improvement of the present invention, the specific process of applying reverse displacement compensation to the camera based on the translation vector is as follows: Obtain the camera's real-time world coordinates position in the current rendered frame; The target world coordinate position after camera compensation is calculated by subtracting the translation vector from the real-time world coordinate position. When updating entity displacement by passing the target world coordinates to the 3D rendering engine, the collision scanning mechanism for scene colliders is forcibly disabled, allowing the camera to penetrate the macroscopic colliders to reach the target world coordinates.

[0014] On the other hand, the present invention provides a three-dimensional scene interaction control system based on ray plane intersection, comprising: Initial Anchor Point Picking Module: In response to the drag initialization command, it obtains the current screen coordinates as the initial anchor screen coordinates, and emits a physical detection ray into the three-dimensional world space based on the inverse transformation of the camera projection matrix; Reference plane calibration module: It performs intersection tests between the physical detection ray and the collider in the 3D scene, obtains the world coordinates of the hit as the anchor ground point, and extracts the height component of the anchor ground point as the anchor plane height. Drag-and-drop ray generation module: In response to continuous drag commands, it obtains the real-time screen coordinates of the current frame, disables physical ray detection for colliders in the 3D scene, and back-projects the real-time screen coordinates to generate the world ray of the current frame. Virtual plane mathematical intersection module: Based on analytical geometry algorithm, calculate the mathematical intersection point of the current frame's world ray and the virtual horizontal plane with a height equal to the anchor plane's height, and use it as the virtual ground point of the current frame; Camera displacement compensation calculation module: calculates the position difference between the virtual ground point and the anchored ground point on the horizontal plane, generates a translation vector, and applies reverse displacement compensation to the camera based on the translation vector.

[0015] The beneficial effects of this invention are as follows: Traditional methods perform physical ray detection every frame, which easily hits tall buildings, mountains, and other high-protruding collision objects, causing frequent abrupt changes in the Z-axis height of the anchor point and significant screen jitter. This invention performs physical ray detection only once during the drag initialization phase and locks the anchor plane height. Throughout continuous dragging, a fixed-elevation virtual horizontal plane is used for pure mathematical intersection calculations, ensuring the intersection point height remains constant. This eliminates camera jitter caused by abrupt elevation changes at its source, significantly improving the visual smoothness of dragging and browsing 3D scenes.

[0016] During the continuous dragging phase, the physical collision query interface is directly intercepted and bypassed, eliminating the need to traverse multiple priority physical collision channels frame by frame to perform mesh intersection tests, thus saving the physics engine a large number of bounding box intersection calculations. The intersection calculation is completed using only lightweight analytical geometric linear equations, resulting in extremely low computational load. In mobile devices and large-scale GIS / digital twin high-precision scenarios, this can effectively reduce device load and reduce screen lag and operation response delays. Attached Figure Description

[0017] The invention will now be further described with reference to the accompanying drawings.

[0018] Figure 1 This is a flowchart of the steps of a three-dimensional scene interactive control method based on ray plane intersection according to the present invention; Figure 2 This is a system module diagram of a three-dimensional scene interactive control system based on ray plane intersection according to the present invention.

[0019] Figure 3 A comparison curve of the change in intersection height (Z-axis) during continuous dragging process provided in an embodiment of the present invention; Figure 4 This is a line graph comparing the time taken to perform intersection calculations in a single frame during continuous dragging, as provided in an embodiment of the present invention. Detailed Implementation

[0020] To make the technical means, creative features, objectives and effects of this invention easier to understand, the invention will be further described below in conjunction with specific embodiments. Example 1

[0021] like Figure 1 As shown in the embodiment of the present invention, a three-dimensional scene interaction control method based on ray plane intersection includes: Step 1: In response to the drag initialization command, obtain the current screen coordinates as the initial anchor screen coordinates, and emit a physical detection ray into the three-dimensional world space based on the inverse transformation of the camera projection matrix; In a specific embodiment of the present invention, the specific process of obtaining the current screen coordinates as the initial anchor screen coordinates in response to the drag initialization command in step one is as follows: The system listens for interaction events from the input device. When a specific cursor key (such as the left button) is pressed or a single finger touches the touchscreen, the system generates the drag initialization command at the underlying level. In response to the drag-and-drop initialization command, the viewport interface of the 3D rendering engine is invoked to obtain the two-dimensional pixel coordinates of the cursor in the current application window at the moment the interactive action occurs; The viewport validity of the two-dimensional pixel coordinates is verified to determine whether they are within the effective rendering area of ​​the three-dimensional scene; the specific process is as follows: Extract the boundary pixel thresholds occupied by various UI panels (such as the left menu bar and top toolbar) in the current system interface. If the two-dimensional pixel coordinates fall within the UI occlusion area defined by the boundary pixel thresholds, the trigger is deemed invalid and the instruction is discarded. If the two-dimensional pixel coordinates are located within the unoccluded valid rendering area, they are confirmed as the current screen coordinates and recorded as the initial anchored screen coordinates. ,in, and These represent the pixel values ​​in the horizontal and vertical directions of the screen, respectively.

[0022] In a specific embodiment of the present invention, the specific process of emitting a physical detection ray into the three-dimensional world space based on the inverse transformation of the camera projection matrix in step one is as follows: Obtain the view matrix and projection matrix of the camera in the current rendering frame in the 3D rendering engine, multiply the view matrix and the projection matrix to obtain the view-projection matrix, and invert the view-projection matrix to obtain the view-projection inverse matrix; For example, suppose the actual resolution of the current 3D rendering viewport is the width. pixels, height Pixels. When the user presses the mouse button in the center of the screen to trigger dragging, the initial anchor screen coordinates obtained are... .

[0023] First, the initial two-dimensional anchored screen coordinates are converted to normalized device coordinates (NDC). This is done according to the standard computer graphics mapping formula: Horizontal direction: ; Vertical direction: ; (Note: The Y-axis is flipped here to accommodate the difference between the screen coordinate system origin being in the upper left corner and the Y-axis being upward in the 3D standard coordinate system.) To generate rays pointing into the depth of the scene, a depth component is set. (Represents the far clipping plane pointing to the camera), and supplements homogeneous coordinate components. Construct the normalized device coordinates in homogeneous coordinate form. .

[0024] Subsequently, the system obtains the view matrix from the engine's underlying layer. With the projection matrix The view-projection matrix is ​​obtained by matrix multiplication. .because The matrix implements a forward projection transformation from three-dimensional world space to two-dimensional screen space. The system performs a matrix inversion operation on it to obtain the view-projection inverse matrix. .

[0025] The constructed normalized device coordinates With the view-projection inverse matrix Perform matrix multiplication (i.e.) ), to obtain homogeneous components The homogeneous world coordinates of the screen pixel are obtained; then, perspective division (i.e., dividing its X, Y, and Z components by the component) is performed to resolve the absolute coordinates of the distant target point corresponding to the screen pixel in the three-dimensional world space.

[0026] Finally, by subtracting the camera's current world coordinate starting point from the absolute coordinates of the distant target point and performing vector normalization, the three-dimensional spatial direction vector of length 1 can be accurately calculated. Using the camera's world coordinate position as the starting point, the calculated three-dimensional spatial direction vector can be used to accurately emit the physical detection ray in three-dimensional world space.

[0027] Based on the actual resolution (width and height) of the current 3D rendering viewport, the initial anchor screen coordinates in 2D are transformed and normalized to be mapped to the standard coordinate range of [-1,1], generating Normalized Device Coordinates (NDC). Perform matrix multiplication on the normalized device coordinates and the view-projection inverse matrix to back-project the two-dimensional screen space coordinates to the three-dimensional world space, and calculate the corresponding three-dimensional space direction vector. For example, suppose the actual resolution of the current 3D rendering viewport is the width. pixels, height The initial anchor screen coordinates of the two-dimensional image obtained after user interaction are: pixels. .

[0028] First, perform homogeneous coordinate transformation and normalization: Calculate the horizontal mapping: ; Calculate the vertical mapping (since the origin of the screen's 2D coordinate system is usually at the top left corner, a Y-axis flip is needed to adapt it to the 3D coordinate system): ; Set depth component (Represents the far clipping plane of the ray pointing in three-dimensional space) and supplements homogeneous components. This generates a mapping to The normalized device coordinates within the standard coordinate range .

[0029] Subsequently, the normalized device coordinates were... The obtained view-projection inverse matrix (denoted as...) Perform matrix multiplication, that is ; The calculation yields homogeneous components. homogeneous world coordinates ; Next, perspective division is performed on the homogeneous world coordinates, dividing its first three spatial components by the homogeneous component. The back projection transformation is performed to obtain the absolute coordinates of the distant target point corresponding to the screen pixel in three-dimensional world space. ; Finally, the absolute coordinates of the distant target point are... Subtract the camera's current world coordinate starting point By normalizing the difference vector obtained by subtraction, the corresponding three-dimensional spatial direction vector with a length of 1 can be accurately calculated.

[0030] Using the world coordinate position of the camera in the current frame as the starting point of the ray, and the calculated three-dimensional spatial direction vector as the direction of the ray, a theoretical ray is constructed that starts from the camera and points into the scene. The physical detection module of the 3D rendering engine is invoked to emit the physical detection ray into the 3D world space along the direction of the ray. In order to ensure that the ray does not fail under the high-altitude view of the macro Geographic Information System (GIS) scene, a maximum detection distance threshold is set for the physical detection ray. The maximum detection distance threshold is dynamically set according to the camera's FarClipping Plane parameter (for example, set to 1,000,000.0 engine space units) to ensure that the ray can fully penetrate space and reach the bottom surface.

[0031] Step 2: Perform an intersection test between the physical detection ray and the collider in the 3D scene to obtain the world coordinates of the hit as the anchor ground point, and extract the height component of the anchor ground point as the anchor plane height; In a specific embodiment of the present invention, the process of obtaining the world coordinates of the hit as the anchor ground point by performing an intersection test between the physical detection ray and the collider in the three-dimensional scene in step two is as follows: The physical collision channel priority sequence is pre-configured in the 3D rendering engine. The order of the physical collision channel priority sequence is set according to the human-computer interaction logic of "user visual intuition takes precedence over macroscopic spatial reference, and macroscopic spatial reference takes precedence over temporary dynamic entities". It includes the visibility channel, the world static channel, and the world dynamic channel in sequence. Specifically, the visibility channel is set to the highest priority because there may be semi-transparent materials, decals, or visually visible primitives without physical collision volume in the 3D scene. Prioritizing the detection of this channel ensures that the ray hits the surface object that the user actually sees on the screen, guaranteeing an absolute visual anchoring sense of "what you see is what you click". The world static channel is set to the second highest priority to accurately hit structures such as terrain, building models, and roads when there are no special obstructions to the line of sight, obtaining a stable macroscopic spatial reference. The world dynamic channel is set to the lowest priority and is only used to provide a final anchor point when the user clicks on a floating position that happens to fall on a moving vehicle, drone, or temporary loading and unloading equipment. The physical detection module that controls the 3D rendering engine performs traversal intersection tests (Raycast / LineTrace) with the colliders in the 3D scene in sequence according to the physical collision channel priority sequence. When the physical detection ray first detects a physical intersection with the mesh surface of the collider in any physical collision channel, the testing of subsequent lower priority channels is immediately interrupted, and the engine interface is called to obtain the absolute three-dimensional coordinates of the physical intersection point in the three-dimensional world space, denoted as . Record it as the anchoring ground point; To prevent program errors caused by users accidentally clicking on the sky boundary or unmodeled abyss areas, resulting in the ray not hitting any colliders, a fallback mechanism for intersection point handling is implemented: if the physical detection ray penetrates all physical collision channels without detecting a valid physical intersection point, then the default zero-elevation reference plane of the 3D scene (i.e., ...) is forcibly used. The horizontal plane is used as a virtual collision body. The mathematical intersection point between the physical detection ray and the reference plane is calculated by analytical geometry, and the coordinates of the mathematical intersection point are used as the anchor ground point, thereby ensuring that the spatial coordinate anchor point can be successfully obtained at any click position.

[0032] For example, in a 3D scene of a digital twin city or a large-scale Geographic Information System (GIS), suppose a user raises the camera viewpoint and accidentally clicks on a "sky" area without configured colliders, or clicks on a "deep abyss" boundary area not covered by the model. In this case, the physical detection ray, after traversing all physical collision channels, does not return any valid physical intersections.

[0033] The system then triggers the intersection fallback mechanism, forcing the construction of the equation within pure mathematical logic. The default zero-elevation reference surface is assumed to be [missing information]. The starting point of the current camera's world coordinates in three-dimensional world space is assumed to be [missing information]. (That is, the current camera altitude is 500 spatial units), and the three-dimensional spatial direction vector of the physical detection ray calculated in step one is... (This indicates that the ray is pointing diagonally downwards towards the scene.)

[0034] Based on analytical geometry algorithms, the system calculates the relationship between the ray and... Mathematical intersection of planes: First, calculate the distance parameter from the starting point of the ray to the reference plane. The calculation formula is: ; Then, the distance parameters Substituting these values ​​into the parameterized equations of the 3D spatial rays, the precise coordinates of the 3D spatial intersection points are calculated: Horizontal X-axis coordinate: ; Horizontal Y-axis coordinate: ; Vertical Z-axis coordinate: ; Finally, the system will calculate the absolute three-dimensional coordinates. The record is the anchor point. Through this fallback calculation process, even if the user clicks on a void area without a physical collision object, the system can still forcibly anchor a valid spatial coordinate in the underlying mathematical logic, thereby ensuring the normal operation of the subsequent drag-and-drop translation algorithm and completely avoiding program null pointer exceptions or interactive deadlocks caused by missing intersection data.

[0035] In a specific embodiment of the present invention, the specific process of extracting the height component of the anchoring ground point as the anchoring plane height in step two is as follows: The absolute three-dimensional coordinates of the anchored ground point obtained by analysis Among them, components and Each component represents the horizontal projection position (such as longitude, latitude, or local planar coordinates) of the anchored ground point in the three-dimensional world coordinate system. The elevation or absolute height value of the anchored ground point in the vertical direction; Stripping away the horizontal position data, and extracting only the vertical component (i.e., ...) from the absolute three-dimensional coordinates. The numerical value is assigned and recorded as the height of the anchoring plane. Allocate a dedicated state cache space in system memory for the current drag-and-drop session, and set the anchor plane height. The state is locked in the state cache space; throughout the entire lifecycle of this drag-and-drop interaction (i.e., from the moment the drag initialization command is received until the mouse button is released or the touch is lifted to end the drag), the anchoring plane height is... The value remains absolutely constant; By locking the height of the anchoring plane, a unique and stable height reference is provided for constructing a virtual horizontal plane that is not affected by terrain undulations in subsequent steps, thus cutting off the source of elevation data mutations caused by terrain protrusions from the underlying data structure.

[0036] Step 3: In response to continuous drag commands, obtain the real-time screen coordinates of the current frame, disable physical ray detection for colliders in the 3D scene, and backproject the real-time screen coordinates to generate the world ray of the current frame. In a specific embodiment of the present invention, step three, the specific process of obtaining the real-time screen coordinates of the current frame in response to continuous drag commands, is as follows: In each rendering cycle (Tick) of the 3D rendering engine, the key holding state of the input device is continuously monitored; when it is detected that the key that triggered the drag initialization command (such as the left mouse button) is in a continuously pressed state and the cursor position moves, the system layer encapsulates the continuous input event into the continuous drag command. In response to the continuous drag command, the engine viewport interface is invoked to read the two-dimensional pixel coordinates of the cursor on the screen in the current rendering frame in real time; To filter out physiological tremors of the user's hand or high-frequency sampling noise from a high-precision mouse, a pixel-level anti-shake mechanism is introduced: the pixel distance between the currently read two-dimensional pixel coordinates and the screen coordinates recorded in the previous frame (or the initial anchored screen coordinates if it is the first frame of dragging). A preset micro-jitter threshold is set (e.g., 1 to 2 pixel units). If the calculated pixel distance is less than the micro-jitter threshold, it is determined to be an invalid micro-jitter, and subsequent translation calculations for this frame are skipped to save system computing power. If the pixel distance is greater than or equal to the micro-jitter threshold, the currently read 2D pixel coordinates are confirmed as the real-time screen coordinates, denoted as... ; In a specific embodiment of the present invention, the specific process of turning off physical ray detection for colliders in the three-dimensional scene and generating the world ray of the current frame by back-projecting the real-time screen coordinates is as follows: After obtaining the real-time screen coordinates, the system actively intercepts and bypasses the physical collision query interface (such as Raycast or LineTrace) of the 3D rendering engine at the code logic level, forcibly closing the physical ray detection call for any 3D entity model (including terrain, buildings, equipment and other colliders) in the scene, thereby fundamentally removing the interference of the underlying physical engine bounding box scanning mechanism on camera motion. Extract the latest view matrix and projection matrix of the camera in the current rendering frame from the 3D rendering engine, and calculate the view-projection inverse matrix of the current frame; The real-time screen coordinates Normalize the coordinates according to the current viewport resolution and map them to standard device coordinates (NDC). The standard device coordinates are multiplied with the view-projection inverse matrix of the current frame to complete the inverse mathematical transformation from two-dimensional screen space to three-dimensional world space, and the world coordinate starting point of the camera in the current frame and the corresponding three-dimensional space direction vector are analyzed. Using the resolved world coordinates starting point and 3D spatial direction vector, a purely mathematical spatial ray is constructed in memory and used as the current frame's world ray. This step completely reduces the collision and intersection process, which originally relied on a physics engine, to a purely mathematical analytical geometry preparation stage.

[0037] Step 4: Based on the analytical geometry algorithm, calculate the mathematical intersection point between the world ray of the current frame and the virtual horizontal plane with a height equal to the anchor plane height, and use it as the virtual ground point of the current frame; In a specific embodiment of the present invention, the process of calculating the mathematical intersection point of the current frame's world ray and the virtual horizontal plane with a height equal to the anchor plane's height, based on an analytical geometry algorithm, as the virtual ground point of the current frame, is as follows: Analyze the data structure of the world ray in the current frame and extract the starting coordinates of the ray in the three-dimensional world space. and the normalized direction vector ; Extract the anchor plane height locked in the system state cache space. In a purely mathematical logical space, an infinitely extending virtual horizontal plane is constructed, the mathematical equation of which is defined as follows: ; To prevent program crashes caused by division by zero during analytical geometry calculations, the direction vector... vertical component Perform parallel verification: Set a preset parallel tolerance threshold (e.g., set to...). Determine the vertical component If the absolute value is less than the parallel tolerance threshold, it is determined that the current frame world ray and the virtual horizontal plane tend to be parallel and cannot generate a valid intersection point. The system directly discards the translation calculation instruction of this frame and exits the update logic of the current rendering frame. If vertical component If the absolute value is greater than or equal to the parallel tolerance threshold, then the distance parameter from the starting point to the virtual horizontal plane is calculated based on the intersection formula of a spatial line and a plane. The calculation formula is: ; The calculated distance parameters Perform direction validity verification: if the distance parameter This indicates that the virtual horizontal plane is located behind the camera (i.e., in the opposite direction of the ray), and is therefore determined to be an invalid intersection point and the update of this frame is skipped. If distance parameter Then the distance parameter Substituting these values ​​into the parameterized equations of the 3D spatial rays, the precise coordinates of the 3D spatial intersection points are calculated using the following formula: ; in, Mathematically, it is strictly equal to ; The calculated coordinates of the intersection points in three-dimensional space The virtual ground point is recorded as the current frame. Through the mathematical intersection process of pure analytical geometry described above, the problem of sudden changes in intersection height when physical ray detection encounters terrain protrusions or tall building models is completely avoided, ensuring the absolute smoothness of dragging and translation references.

[0038] Step 5: Calculate the position difference between the virtual ground point and the anchored ground point on the horizontal plane, generate a translation vector, and apply reverse displacement compensation to the camera based on the translation vector.

[0039] In a specific embodiment of the present invention, the specific process of calculating the position difference between the virtual ground point and the anchored ground point on the horizontal plane and generating the translation vector in step five is as follows: Extract the three-dimensional coordinates of the virtual ground points of the current frame calculated in step four. and the three-dimensional coordinates of the anchoring ground point recorded in step two. Since both the virtual ground point and the anchored ground point are located on the same virtual horizontal plane with a height equal to the height of the anchoring plane, that is... Therefore, when calculating the position difference, the coordinate data in the vertical direction (Z-axis) is directly stripped away, and only the coordinate components in the horizontal plane (X-axis and Y-axis) are algebraically subtracted; the horizontal difference in the X-axis direction and the horizontal difference in the Y-axis direction are calculated separately. Combine the calculated horizontal differences and force the horizontal difference in the Z-axis direction to be zero (i.e., The translation vector in three-dimensional space is constructed.

[0040] By forcibly locking the Z-axis horizontal difference to zero, it ensures that the camera only slides relative to the ground in a two-dimensional plane during dragging, completely eliminating vertical drift or sudden changes in camera view.

[0041] In a specific embodiment of the present invention, step five, the specific process of applying reverse displacement compensation to the camera based on the translation vector, is as follows: Obtain the real-time world coordinates of the camera in the current rendering frame in the 3D rendering engine. ; According to the principle of relative motion, in order to achieve the visual anchoring effect of "the ground moving with the mouse drag", the actual direction of camera movement in world space must be strictly opposite to the direction of mouse sliding on the screen (i.e., the direction of the translation vector). The camera's real-time world coordinates position Subtract the translation vector The target world coordinates position after camera compensation is calculated. ; Call the entity displacement interface of the 3D rendering engine (such as AddActorWorldOffset or SetActorLocation) to update the camera coordinates to the target world coordinate position. ; During this displacement injection process, a parameter command to disable collision scanning is forcibly passed to the engine's underlying layer (e.g., setting Sweep=false). This allows the camera, as an observer entity, to ignore and penetrate any macroscopic collision objects (such as high-altitude cloud bounding boxes, invisible boundary walls, or super high-rise buildings) that may exist in the 3D scene when performing large-span spatial translation, thereby avoiding dragging stutters or high-altitude failures caused by collision blocking. After the reverse displacement compensation is completed, the camera perspective changes, and the original anchored ground point will be accurately projected back to the position of the initial anchored screen coordinates under the new camera perspective, thus completing a perfect screen-world anchored drag interaction at the visual level.

[0042] Combination Figure 3 and Figure 4 As shown, in order to further verify the technical effect of the present invention when performing screen-world anchored translation interaction in a 3D rendering engine, this embodiment collected the underlying running data during 60 consecutive dragging frames and compared and analyzed it with the traditional 3D camera control scheme.

[0043] like Figure 3 The curve showing the change in intersection height (Z-axis) illustrates that in traditional methods, the system emits a physical detection ray into the 3D world space every frame when responding to continuous drag commands. When the drag path (e.g., from frame 20 to frame 40) passes over protrusions in the 3D scene (such as building models or undulating terrain), the height of the intersection point hit by the physical ray undergoes a drastic change (from a base height of 10.0 to over 50.0). This sudden change in the Z-axis coordinate directly leads to a severe error in the generated translation vector, which visually manifests as a violent shaking of the camera's viewpoint.

[0044] In contrast, this invention extracts and locks the anchor plane height in step two, and constructs a virtual horizontal plane with a constant height equal to the anchor plane height in step four. Throughout the continuous dragging process, regardless of the complexity of the 3D model the mouse cursor passes over, the system calculates the mathematical intersection point between the current frame's world ray and this virtual horizontal plane based on an analytical geometry algorithm. Figure 3 As shown by the solid line, the Z-axis coordinate of the virtual ground point in the current frame remains absolutely smooth (constantly 10.0), completely eliminating the interference of terrain undulations on the translation vector from the underlying data structure, and achieving a smooth dragging experience with zero jitter.

[0045] like Figure 4 The line graph showing the time consumption for single-frame intersection calculations illustrates that in traditional methods, the computation time per frame is high (averaging over 1.5ms) because each frame requires calling the underlying physics engine to perform complex bounding box scanning and mesh intersection tests according to the priority sequence of physical collision channels. This time consumption spikes further when encountering complex building meshes, easily leading to dropped frames during rendering. In contrast, this invention explicitly disables physical ray detection for colliders in the 3D scene in step three, downgrading the previously expensive physics engine call to purely mathematical analytical geometric operations. Figure 4 As shown by the solid line, the time required to calculate the virtual ground points in the current frame using this invention is extremely low and very stable (around 0.05ms). This mechanism not only ensures smooth interaction but also significantly frees up the computing resources of the CPU and GPU, enabling them to better serve the rendering needs of large-scale geographic information system (GIS) scenarios. Example 2

[0046] like Figure 2 As shown, based on the specific implementation process of Embodiment 1, the present invention provides a three-dimensional scene interactive control system based on ray plane intersection, comprising: Initial Anchor Point Picking Module: In response to the drag initialization command, it obtains the current screen coordinates as the initial anchor screen coordinates, and emits a physical detection ray into the three-dimensional world space based on the inverse transformation of the camera projection matrix; Reference plane calibration module: It performs intersection tests between the physical detection ray and the collider in the 3D scene, obtains the world coordinates of the hit as the anchor ground point, and extracts the height component of the anchor ground point as the anchor plane height. Drag-and-drop ray generation module: In response to continuous drag commands, it obtains the real-time screen coordinates of the current frame, disables physical ray detection for colliders in the 3D scene, and back-projects the real-time screen coordinates to generate the world ray of the current frame. Virtual plane mathematical intersection module: Based on analytical geometry algorithm, calculate the mathematical intersection point of the current frame's world ray and the virtual horizontal plane with a height equal to the anchor plane's height, and use it as the virtual ground point of the current frame; Camera displacement compensation calculation module: calculates the position difference between the virtual ground point and the anchored ground point on the horizontal plane, generates a translation vector, and applies reverse displacement compensation to the camera based on the translation vector.

[0047] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of the present invention is defined by the appended claims and their equivalents.

Claims

1. A three-dimensional scene interactive control method based on ray-plane intersection, characterized in that: include: In response to the drag-and-drop initialization command, the current screen coordinates are obtained as the initial anchor screen coordinates, and a physical detection ray is emitted into the three-dimensional world space based on the inverse transformation of the camera projection matrix. The intersection test is performed between the physical detection ray and the collider in the 3D scene to obtain the world coordinates of the hit as the anchor ground point, and the height component of the anchor ground point is extracted as the anchor plane height. In response to continuous drag commands, obtain the real-time screen coordinates of the current frame, disable physical ray detection for colliders in the 3D scene, and backproject the real-time screen coordinates to generate the world ray of the current frame. Based on analytical geometry algorithms, the mathematical intersection point of the world ray in the current frame and the virtual horizontal plane with a height equal to the height of the anchor plane is calculated and used as the virtual ground point of the current frame. Calculate the position difference between the virtual ground point and the anchored ground point on the horizontal plane, generate a translation vector, and apply reverse displacement compensation to the camera based on the translation vector.

2. The three-dimensional scene interactive control method based on ray plane intersection as described in claim 1, characterized in that, The specific process of obtaining the current screen coordinates as the initial anchor screen coordinates is as follows: When a specific key press is detected, a drag initialization command is generated, and the two-dimensional pixel coordinates of the cursor in the current application window are obtained when the interaction occurs. It is then determined whether the two-dimensional pixel coordinates are within the UI occlusion area defined by the boundary pixel threshold. If they are not occluded, they are confirmed as the current screen coordinates and recorded as the initial anchor screen coordinates.

3. The three-dimensional scene interactive control method based on ray plane intersection as described in claim 1, characterized in that, The specific process of emitting physical detection rays into the three-dimensional world space based on the inverse transformation of the camera projection matrix is ​​as follows: Obtain the view-projection inverse matrix of the camera in the current rendering frame; The initial anchor screen coordinates are homogeneously transformed and normalized to generate normalized device coordinates. The normalized device coordinates are then multiplied with the view-projection inverse matrix to calculate the corresponding three-dimensional spatial direction vector. Starting from the world coordinate position of the camera in the current frame, a physical detection ray is emitted into the three-dimensional world space along the three-dimensional spatial direction vector.

4. The three-dimensional scene interactive control method based on ray plane intersection as described in claim 1, characterized in that, The specific process of obtaining the hit world coordinates as the anchor ground point is as follows: Following the priority sequence of physical collision channels, which includes the visibility channel, the static world channel, and the dynamic world channel, the physical detection ray is used to perform intersection tests with colliders in the 3D scene in sequence. When a physical intersection is first detected in any physical collision path, the test is interrupted, and the absolute three-dimensional coordinates of the physical intersection point are obtained as the anchor ground point. If no valid physical intersection is detected after penetrating all physical collision channels, the mathematical intersection of the physical detection ray and the default zero-elevation reference plane of the 3D scene is calculated, and the coordinates of the mathematical intersection are used as the anchor ground point.

5. The three-dimensional scene interactive control method based on ray plane intersection as described in claim 1, characterized in that, The specific process for obtaining the real-time screen coordinates of the current frame is as follows: Based on the absolute three-dimensional coordinates of the anchoring ground point, the vertical component is extracted as the height of the anchoring plane. Monitor the key hold status of the drag initialization command, read the two-dimensional pixel coordinates of the cursor on the screen in the current rendering frame, calculate the pixel distance between the currently read two-dimensional pixel coordinates and the screen coordinates recorded in the previous frame, and if the pixel distance is greater than or equal to the micro-jitter threshold, then confirm the currently read two-dimensional pixel coordinates as the real-time screen coordinates.

6. The three-dimensional scene interactive control method based on ray plane intersection as described in claim 1, characterized in that, The specific process of generating the current frame world ray by back-projecting the real-time screen coordinates is as follows: Intercept the physics collision query interface at the code logic level and disable the physical ray detection call for colliders in the 3D scene; Obtain the view-projection inverse matrix of the camera in the current rendering frame; The real-time screen coordinates are normalized and mapped to standard device coordinates; Multiply the standard device coordinates with the view-projection inverse matrix of the current frame to resolve the world coordinate starting point of the camera in the current frame and the corresponding three-dimensional spatial direction vector; A spatial ray is constructed using the world coordinate starting point and the three-dimensional spatial direction vector, and serves as the world ray for the current frame.

7. The three-dimensional scene interactive control method based on ray plane intersection as described in claim 1, characterized in that, The specific process of calculating the mathematical intersection point of the current frame's world ray and the virtual horizontal plane with a height equal to the anchor plane's height, and using this intersection point as the virtual ground point of the current frame, is as follows: Extract the starting coordinates and direction vector of the world ray in the current frame, and construct a virtual horizontal plane in the logical space with the equation of the anchor plane height. Determine whether the vertical component of the direction vector is less than the parallel tolerance threshold. If it is greater than or equal to the parallel tolerance threshold, the distance parameter is calculated based on the intersection formula of the spatial line and the plane; If the distance parameter is greater than or equal to zero, the distance parameter is substituted into the parameterized equation of the three-dimensional spatial ray to calculate the coordinates of the three-dimensional spatial intersection point, which is used as the virtual ground point of the current frame.

8. The three-dimensional scene interactive control method based on ray plane intersection as described in claim 1, characterized in that, The specific process for generating the translation vector is as follows: Extract the three-dimensional coordinates of the virtual ground point and the anchor ground point in the current frame, strip the coordinate data in the vertical direction, calculate the horizontal difference between the two in the X-axis and Y-axis directions of the horizontal plane, combine the calculated horizontal difference values, and force the horizontal difference in the Z-axis direction to be set to zero to construct the translation vector in three-dimensional space.

9. A three-dimensional scene interactive control method based on ray plane intersection as described in claim 1, characterized in that, The specific process of applying reverse displacement compensation to the camera based on the translation vector is as follows: Obtain the camera's real-time world coordinates position in the current rendered frame; The target world coordinate position after camera compensation is calculated by subtracting the translation vector from the real-time world coordinate position. When updating entity displacement by passing the target world coordinates to the 3D rendering engine, the collision scanning mechanism for scene colliders is forcibly disabled, allowing the camera to penetrate the macroscopic colliders to reach the target world coordinates.

10. A three-dimensional scene interaction control system based on ray-plane intersection, applied to the method described in any one of claims 1-9 above, characterized in that: include: Initial Anchor Point Picking Module: In response to the drag initialization command, it obtains the current screen coordinates as the initial anchor screen coordinates, and emits a physical detection ray into the three-dimensional world space based on the inverse transformation of the camera projection matrix; Reference plane calibration module: It performs intersection tests between the physical detection ray and the collider in the 3D scene, obtains the world coordinates of the hit as the anchor ground point, and extracts the height component of the anchor ground point as the anchor plane height. Drag-and-drop ray generation module: In response to continuous drag commands, it obtains the real-time screen coordinates of the current frame, disables physical ray detection for colliders in the 3D scene, and back-projects the real-time screen coordinates to generate the world ray of the current frame. Virtual plane mathematical intersection module: Based on analytical geometry algorithm, calculate the mathematical intersection point of the current frame's world ray and the virtual horizontal plane with a height equal to the anchor plane's height, and use it as the virtual ground point of the current frame; Camera displacement compensation calculation module: calculates the position difference between the virtual ground point and the anchored ground point on the horizontal plane, generates a translation vector, and applies reverse displacement compensation to the camera based on the translation vector.