Method and application for generating multi-modal simulation data based on graphics applications
By injecting dynamic link libraries and ray tracing engines into commercial racing games, multimodal simulation data is generated, solving the problems of incomplete data acquisition and insufficient synchronous generation capabilities in autonomous mobile systems, and achieving efficient multimodal data synchronization and custom sensor configuration.
Patent Information
- Application Number
- CN202611419119.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-14
- Publication Date
- 2026-11-27
AI Technical Summary
Existing technologies struggle to generate highly realistic, multimodal, and time-synchronized simulation data in autonomous mobile systems, especially in commercial racing games where the lack of native semantic annotation interfaces and sensor simulation interfaces leads to incomplete acquisition of perception data and insufficient synchronous generation capabilities.
By injecting dynamic link libraries to intercept the rendering pipeline of graphics applications, a cross-process shared memory synchronization mechanism is established to query and inject semantic information in real time, and multimodal sensor data, including RGB images, depth maps, semantic segmentation maps, and LiDAR point clouds, are generated using a ray tracing engine.
It achieves strict time synchronization between multimodal sensor data and ground truth annotation data, supports custom sensor configurations, reuses high-quality scene and dynamic models, reduces repetitive modeling work, and is suitable for various autonomous mobile platforms.
Smart Images

Figure CN123179706A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of autonomous mobile system simulation technology, specifically providing a method and application for generating multimodal simulation data based on graphical applications. Background Technology
[0002] Autonomous mobile systems include ground vehicles, surface vessels, aircraft or drones, mobile robots, and construction machinery. These systems typically require multimodal sensor data and ground truth annotations, such as RGB images, depth maps, semantic segmentation maps, 3D bounding boxes, and LiDAR point clouds, for perception algorithm training, decision and control verification, and system integration testing. Although different types of autonomous mobile systems have different operating environments and dynamic characteristics, they all share a need for highly realistic scenes, multimodal data, and time synchronization in simulation data generation. The following section uses autonomous racing cars as a representative application scenario to illustrate existing technologies and their limitations.
[0003] Autonomous racing, as an important branch of the field of autonomous driving, has received increasing attention in recent years. Just as Formula 1 and the World Rally Championship inspired automotive technology innovations such as disc brakes and turbochargers, researchers hope to explore safer and more efficient autonomous driving solutions by studying driving scenarios of autonomous racing cars under the physical limits of vehicles, and expect to extend these results to a wider range of autonomous driving applications.
[0004] As is well known, autonomous driving testing of real-world racing cars faces extremely high costs and risks. A full-size autonomous racing car (such as the Dallara Super Formula used by A2RL or the Formula car of IAC) costs hundreds of thousands to millions of dollars, and its sensor equipment, such as LiDAR and computing platforms, is equally expensive. In high-speed testing, any error in the algorithm can lead to a serious collision—not only causing huge economic losses to the car and sensors, but also potentially endangering the safety of track staff and spectators. Furthermore, real-world testing is limited by track availability, weather conditions, and the physical flow of time, severely restricting the efficiency of research methods such as reinforcement learning that require massive trial-and-error iterations.
[0005] The core technological challenges facing autonomous racing vehicles include: target detection and localization under high-speed driving conditions, trajectory planning and vehicle control under extreme conditions (such as high-speed cornering, emergency braking, and tire slippage), and the ability to transfer data from simulation environments to real-world environments (sim-to-real gap). Overcoming these challenges requires a large amount of training data, especially multimodal sensor data (RGB images, depth maps, semantic segmentation maps, 3D bounding boxes, and LiDAR point clouds) and vehicle motion data under extreme conditions.
[0006] Existing platforms for acquiring training data from autonomous driving race cars can be divided into three categories, each with significant limitations:
[0007] (1) Full-scale racing car platforms: such as the Dallara Super Formula car used by A2RL, the Formula cars in the IndyAutonomous Challenge (IAC), Roborace, and Formula Student Driverless (FSD). These platforms allow algorithms to directly process real-world data, but they are extremely costly—usually requiring a team of more than 10 people to maintain a single car, and testing activities are limited by track availability and weather conditions. In addition, the time that full-scale platforms spend using the physical world severely limits the efficiency of research that requires a lot of trial and error, such as reinforcement learning.
[0008] (2) Small racing car platforms: such as F1tenth, AutoRally, AWS DeepRacer, etc., with a scale of 1:10 or smaller. Although the cost is lower, due to the reduced size, it is impossible to equip with real sensors such as solid-state LiDAR or multi-line mechanical LiDAR, and usually only equipped with 2D LiDAR. More importantly, the dynamic characteristics (tire mechanics, aerodynamics, suspension response, etc.) of small racing cars are fundamentally different from those of full-size vehicles, and they cannot reach high-speed conditions above 250km / h. The applicability of their research conclusions to full-size vehicles is questionable.
[0009] (3) Simulators: such as general-purpose autonomous driving simulation platforms like CARLA, AirSim, LGSLV Simulator, and AWSIM, and racing-specific simulators like TORCS and AutoDRIVE Simulator. General-purpose simulators are not designed for high-speed racing cars, and their physical simulations (tire dynamics, suspension dynamics, aerodynamics, etc.) cannot meet the requirements of racing cars under extreme conditions. Racing-specific simulators (such as TORCS) are relatively rudimentary in terms of graphics rendering and physical simulation. Their common shortcomings include:
[0010] • Virtual scenes have limited visual realism and a large "domain gap" with the real world, which causes the performance of perception models trained in simulation to drop sharply in real environments.
[0011] • Building high-quality virtual racetrack scenarios is costly and time-consuming;
[0012] • Insufficient accuracy in vehicle dynamics physics simulation: The vehicle physics engine (tire model, suspension dynamics, aerodynamics, etc.) of dedicated simulators is usually simplified and cannot realistically simulate the complex dynamic behavior of vehicles under extreme conditions such as high-speed cornering, emergency braking, road surface changes, and slip recovery.
[0013] Furthermore, modern professional racing games (such as Assetto Corsa, Dirt Rally 2.0, Gran Turismo, iRacing, rFactor 2, etc.) have undergone years of optimization, boasting industry-leading vehicle dynamics simulation (high-precision tire models, multi-body suspension dynamics, aerodynamics, etc.), extremely realistic rendering effects, and rich track scenes. These games are recognized by racing enthusiasts as "hardcore" simulators, with physical simulation accuracy superior to existing general-purpose autonomous driving simulators and dedicated racing simulators.
[0014] Existing academic research has attempted to use commercial racing games for autonomous driving research. Wurman et al. (2022) developed an AI driver in Gran Turismo Sport (GTS) that defeated human champion drivers; Song et al. (2021) developed an overtaking algorithm based on GTS; Remonda et al. (2024) connected Assetto Corsa with Isaac Gym to build a reinforcement learning framework; Weiss et al. (2020) developed an end-to-end autonomous driving racing framework based on F1 2019; Philipp Krähenbühl (CVPR 2018) extracted semantic segmentation supervision signals from GTA V by intercepting the game rendering pipeline.
[0015] However, the aforementioned studies have a fundamental flaw in terms of acquiring sensory data:
[0016] Limitation 1: Overly simplistic sensory input. Most studies directly derive the racing car's status from in-game telemetry data (simplifying the track to just the sidelines and centerline, providing track information in advance), rather than actual visual / LiDAR perception. Some studies only install a single 2D LiDAR at the front of the car, or simply capture RGB images from the game screen, which cannot support the training of modern autonomous driving perception algorithms.
[0017] Limitation 2: Lack of simultaneous generation capability for multimodal data. Existing solutions only support a single camera and some modalities, and cannot simultaneously generate data from multiple sensors. A key requirement for autonomous driving training data is strict temporal alignment of multiple sensor data—RGB images, depth maps, semantic maps, LiDAR point clouds, etc., in the same frame must correspond to the same scene state at the same time. Krähenbühl's method only provides multimodal output from a single camera and does not involve multimodal data such as LiDAR and 3D bounding boxes.
[0018] Limitation 3: Commercial racing games lack native semantic annotation interfaces. Dedicated simulators (such as CARLA) can query the category of each object in the scene via Python API and directly generate semantic truth values. However, commercial racing games do not have such interfaces, and the game does not maintain semantic category information for objects internally.
[0019] Limitation 4: Commercial racing games lack native sensor simulation interfaces. Commercial racing games do not provide interfaces for outputting sensor data such as depth maps and LiDAR point clouds to external applications. Although RGB images and depth buffers can be obtained by intercepting the rendering pipeline, LiDAR point cloud simulation data cannot be directly obtained.
[0020] Limitation 5: Certain behaviors of game engines can lead to unreliable scene data. The internal behavior of some racing game engines (especially those based on scene trees) can cause directly read scene data to be unreliable. For example, the world transformation matrix cache field for dynamic objects (such as moving vehicles) is not updated by the engine every frame—the engine calculates it in real-time during rendering by recursively multiplying local matrices, rather than reading cached values. Directly reading this cached field will yield outdated data, causing inconsistencies between the synchronously output scene data and the actual rendered image.
[0021] Limitation 6: Lack of customizable sensor configuration capabilities. Existing solutions cannot freely change the number, location, and type of sensors (such as configuring multiple cameras simultaneously, 360-degree mechanical LiDAR, etc.), which restricts the freedom of perception research.
[0022] The aforementioned limitations are not limited to racing applications. For graphics applications with real-time 3D scenes and moving subjects, such as ship navigation, aircraft or drone flight, mobile robots, and engineering equipment, there is also a need to obtain synchronous multimodal data, reliable scene status, and custom sensor data from existing graphics applications when there is a lack of native semantic annotation interfaces for autonomous systems, depth or LiDAR sensor interfaces. Summary of the Invention
[0023] To overcome the above-mentioned shortcomings, this invention provides a method and application for generating multimodal simulation data based on graphics applications. It intercepts the rendering pipeline of graphics applications by injecting dynamic link libraries, establishes a cross-process shared memory synchronization mechanism, queries and injects semantic information in real time during the rendering process, and performs intersection calculations on the same scene states in an external process through a ray tracing engine. Finally, it outputs six types of strictly time-synchronized multimodal sensor data and ground truth annotation data.
[0024] In a first aspect, the present invention provides a method for generating multimodal simulation data based on a graphics application, comprising the following steps:
[0025] S1: Disguise the custom dynamic link library as the system graphics interface library and load it automatically when the target graphics application starts, establish a rendering pipeline interception layer, and load at least one functional plugin that registers rendering event callbacks through a unified programming interface.
[0026] S2: Based on the debugging symbol information of the target graphics application, locate the scene tree, traverse and flatten the scene tree into a node array, and establish semantic category labeling for each node in the scene tree;
[0027] S3: In the rendering event callback of each frame, establish and maintain a memory area shared by the graphics application process and the external simulation process, obtain all scene data from the scene tree node, write the scene data into the corresponding area of the shared memory and increment the version number, calculate the world transformation matrix of each node in the scene and write it into the shared memory, and update the published data through the frame identifier and atomic region index.
[0028] S4: During the rendering process intercepted by the rendering pipeline interception layer, the same scene is rendered from multiple perspectives by multiple custom virtual cameras to generate multimodal image data. In the external simulation process, the scene state with the same current frame is intersected based on the ray tracing engine to generate LiDAR point cloud simulation data.
[0029] S5: Associate the generated multimodal image data, LiDAR point cloud simulation data, and 3D bounding box data with the 2D bounding box data with the same frame identifier and output them.
[0030] Furthermore, step S1 includes:
[0031] S11: Rename the compiled custom dynamic link library to the filename of the system graphics interface library, and place it in the directory where the executable file of the target graphics application is located, so that the target graphics application automatically loads the custom dynamic link library when it starts.
[0032] S12: In the entry function of the custom dynamic link library, load the system graphics interface library and forward the exported functions of the custom dynamic link library to the system graphics interface library one by one.
[0033] S13: Use the function hook library to install function-level hooks on the key rendering functions of the target graphics application, and replace the graphics device object and graphics context object with a wrapper class that inherits the original graphics interface, so that every drawing call, shader binding and rendering target setting of the target graphics application is intercepted.
[0034] S14: Load at least one functional plugin, which registers callback functions for key rendering events through a unified programming interface.
[0035] Furthermore, step S2 includes:
[0036] S21: Obtain the debugging symbol information of the target graphics application. By parsing the debugging symbol information, obtain the memory layout, global variable offset, and virtual function table offset of the key classes inside the target graphics application. Based on this, locate the scene root object and its scene tree member fields by combining virtual function table address scanning with memory scanning.
[0037] S22: Traverse the scene tree, flatten it into a node array, and read the name string, hierarchical relationship, local transformation matrix and grid data pointer of each node according to the memory layout;
[0038] S23: Perform semantic category labeling for each node and obtain the collision box data for each node.
[0039] Furthermore, the semantic category annotation is implemented in the following way:
[0040] After the scene is loaded, all nodes in the scene tree are traversed. Based on the node name and its hierarchical relationship within the scene tree, the nodes are semantically categorized. For nodes that cannot be directly matched, their semantic categories are inherited from their parent nodes; and / or
[0041] During the scene model creation stage, custom metadata fields are embedded in the model file through the extended interface of the target graphics application. The custom metadata fields also include semantic category identifiers. When the scene is loaded, the rendering pipeline interception layer parses the custom metadata fields and establishes the correspondence between nodes and semantic categories.
[0042] Furthermore, step S3 includes:
[0043] S31: Establish the shared memory between the graphics application process and the external simulation process. The shared memory is divided into a header region, a symbol table region, a node topology region, a transformation matrix region, a mesh geometry region, a camera parameter region, and a collision box region. Frame identifier, region index, and update version number fields at each level are set in the header region.
[0044] S32: When the scene is loaded, write the node name, parent-child relationship, semantic category identifier, object pointer, mesh index and local bounding box fields after the semantic category is marked into the node topology region, write the mesh vertex and index data into the mesh geometry region, write the collision box data into the collision box region, and increment the corresponding topology version number, mesh version number and collision box version number in the header region.
[0045] S33: At the beginning of each frame, the writing end reads the index of the currently published region in the header region, selects the currently inactive buffer region as the writing target, reads the local transformation matrix of each node in the scene tree, calculates the world transformation matrix by accumulating the results level by level from the root node, and writes the calculated world transformation matrix into the inactive region.
[0046] S34: After writing is complete, update the frame identifier and timestamp in the header area, update the region index field in the header area through an atomic storage operation with release semantics, and publish the data of this frame to the reading end;
[0047] S35: The reading end first reads the current frame identifier, and then reads the frame identifier again. If the frame identifiers read twice are the same, it means that the writing end has not published new frame data during the reading period, and the complete and consistent current frame data is obtained. If the frame identifiers read twice are different, it means that the writing end has published new frame data during the reading period, and the reading end discards the current result and reads again.
[0048] Furthermore, the process of generating multimodal image data in step S4 includes:
[0049] S411: Register multiple custom rendering targets in the target graphics application, each corresponding to a multiple virtual camera viewpoint;
[0050] S412: For each frame, the world transformation matrix of each virtual camera is calculated based on the world transformation matrix of the corresponding node of the target moving subject in the scene tree and the preset offset of each viewpoint, i.e. the camera pose of the virtual camera viewpoint.
[0051] S413: Write the view matrix, field of view, and near / far clipping plane parameters of each virtual camera into the camera parameter area of the shared memory;
[0052] S414: In the post-processing stage of each frame, the global screen color rendering target pointer and depth rendering target pointer of the target graphics application are replaced with the pre-created private rendering target and private depth rendering target, respectively, so that the color and depth of subsequent re-rendering are written to the private rendering target and private depth rendering target, respectively.
[0053] S415: Call the camera manager and graphics manager inside the target graphics application, trigger a re-rendering of the same scene tree with the world transformation matrix of each virtual camera, write the original RGB image of each frame to the private rendering target, and at the same time, intercept the depth-specific shader inside the target graphics application through the rendering pipeline interception layer, capture its output depth image and write it to the private depth rendering target.
[0054] S416: Restore the global screen rendering target pointer, and obtain the RGB image and depth image from the private rendering target and the private depth rendering target, respectively.
[0055] Furthermore, during the re-rendering process, when a scene node is about to be drawn, the following steps are performed:
[0056] By using hooks pre-installed on the node rendering function, the pointer to the currently rendering node object is captured and recorded as the thread-local current node;
[0057] Using the node object pointer as an index, a search is performed in the node topology table of the shared memory to obtain the semantic category identifier of the node;
[0058] Write the obtained semantic category identifier into a predefined shader constant buffer;
[0059] Determine whether the currently bound pixel shader meets the injectability conditions, which include excluding post-processing shaders, excluding depth-specific shaders, and excluding shaders whose constant buffer slots are already occupied.
[0060] If the injectability condition is met, an additional shader code is appended to the end of the currently bound pixel shader to write the corresponding color value to an additional render target according to the category.
[0061] The additional rendering target and the original rendering target are output simultaneously in the same rendering channel.
[0062] Furthermore, the process of generating the lidar point cloud simulation data in step S4 includes:
[0063] S421: In the external simulation process, read a snapshot of the scene topology and transformation matrix of the current frame from the shared memory;
[0064] S422: Construct a ray tracing acceleration structure based on the snapshot, including constructing a geometric acceleration structure for each mesh, and constructing the geometric acceleration structure and the material information of the mesh object into an instance of the ray tracing engine, organizing all instances into an instance acceleration structure, and performing an update operation to update the instance acceleration structure in place only when the transformation matrix changes, and performing a full reconstruction only when the topology or the number of instances changes.
[0065] S423: Obtain the scanning mode parameters recorded by the actual lidar device, the scanning mode parameters including the horizontal angle of each beam. with vertical angle ;
[0066] S424: Calculates the light emission direction at each angle by combining the sensor pose matrix. Specifically, it starts with the horizontal angle... and vertical angle Calculate the local light direction of the sensor Then, by rotating, the direction of light in world space is obtained. The origin of light emission is taken from the sensor's world coordinates. ;
[0067] S425: Obtain the world coordinates of the hit point by intersecting each ray with the scene's accelerated structure using the ray tracing engine. ;
[0068] S426: Set the world coordinates of the hit point Transform to sensor local coordinate system This generates point cloud data that is consistent with the output format of the actual lidar device.
[0069] Furthermore, step S5 includes:
[0070] S51: Calculate the 3D bounding box data from the mesh vertex data of the scene node, or generate the 3D bounding box data by reading the boundary coordinate parameters cached by the node itself, or directly read the collision box data in the node as the 3D bounding box data. After the obtained 3D bounding box is transformed to screen coordinates by view transformation and projection transformation, the bounding rectangle is taken to obtain the 2D bounding box data.
[0071] S52: Associate multimodal image data, LiDAR point cloud simulation data, and 3D bounding box data with 2D bounding box data with the same frame identifier and output them synchronously.
[0072] Secondly, this invention provides an application of a method for generating multimodal simulation data based on graphical applications, applicable to ground vehicles, surface vessels, unmanned surface vessels, aircraft, drones, mobile robots, or engineering machinery.
[0073] The beneficial effects of this invention include:
[0074] 1. Multimodal frame synchronization: Through the frame identifier mechanism of shared memory, it is ensured that the multimodal sensor data and the ground truth label data strictly correspond to the scene state at the same moment.
[0075] 2. No native semantic interface required: Through the link of node rendering hooks and shared memory queries, even if the target graphics application does not provide a native semantic annotation interface, a semantic segmentation image corresponding to the rendering screen space can still be generated based on the pre-established node semantic category mapping.
[0076] 3. Real LiDAR Simulation: Ray tracing is driven by scanning mode parameters recorded using a real LiDAR device, and the generated point cloud data is consistent with the output format of the real device.
[0077] 4. Reuse of scene and rendering content: Training or test data can be generated using the existing rendering effects, scene models and environment content of the target graphics application without having to reconstruct the entire 3D scene in the data generation system of this invention; when the target graphics application has high visual quality, its visual performance can be reused accordingly.
[0078] 5. Reduced overhead of additional data generation: Semantic segmentation images are generated by setting additional rendering targets in the original rendering pipeline, eliminating the need to add a separate full scene rendering for semantic segmentation; the synchronization of shared memory adopts a lock-free double buffering mechanism to reduce blocking during cross-process data synchronization.
[0079] 6. Reuse of motion and physics simulation results of target graphics applications: There is no need to re-implement the complete dynamic model of the target moving subject in the data generation system of this invention, but the existing motion model, environment model and scene interaction results of the target graphics application can be reused; when the target graphics application is a professional racing game, its vehicle dynamics simulation results can be reused accordingly.
[0080] 7. Scene content reuse: For target graphics applications with mature content or extended ecosystems, existing scene, target moving subject, weather and environmental objects can be directly utilized, reducing the workload of repeatedly performing scene modeling and content creation for multimodal simulation data generation.
[0081] 8. Customizable sensor configuration capability: By customizing the virtual camera and configurable LiDAR scanning mode, the number of sensors, installation location, orientation, field of view and scanning parameters can be set according to the specific application to adapt to the sensor configuration requirements of different moving targets and different simulation tasks.
[0082] 9. Data generation capability in conjunction with human operation processes: For target graphical applications that can record or replay human operator behavior, the multimodal sensor data and ground truth annotation data generated by this invention can be used in conjunction with the corresponding human operation processes, providing a data foundation for imitation learning, strategy evaluation, or other research based on demonstration data.
[0083] 10. Applicability across autonomous mobile platforms: The rendering pipeline interception, scene tree synchronization, multimodal image generation, external ray tracing, and same-frame identifier synchronization mechanisms of this invention do not depend on the specific target moving subject of the race car. They can be applied to different types of autonomous mobile platforms such as ground vehicles, water vessels, aircraft or drones, mobile robots, and engineering machinery by adjusting semantic categories, sensor installation positions, and scanning parameters. Attached Figure Description
[0084] The disclosure of this invention will become more readily understood with reference to the accompanying drawings. It will be readily understood by those skilled in the art that these drawings are for illustrative purposes only and are not intended to limit the scope of protection of this invention. Furthermore, similar numbers in the drawings are used to denote similar components, wherein:
[0085] Figure 1 This is a schematic diagram of the main steps of the multimodal simulation data generation method of the present invention;
[0086] Figure 2 This is a schematic diagram of the multi-view RGB image, depth map and semantic map in the multimodal data output of the present invention;
[0087] Figure 3 This is a schematic diagram illustrating the visualization of lidar point clouds in the multimodal data output of this invention;
[0088] Figure 4 This is a system block diagram of the multimodal simulation data generation method of the present invention. Detailed Implementation
[0089] Some embodiments of the present invention will now be described with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are merely illustrative of the technical principles of the present invention and are not intended to limit the scope of protection of the present invention.
[0090] Here we will first explain some of the terms involved in this invention.
[0091] System graphics interface library: The standard program library provided by the operating system for communication between application programs and graphics hardware (such as the DirectX DXGI library).
[0092] Wrapper object: A custom object that implements the same application programming interface as the original graphics interface, but adds interception logic at each method call. The target graphics application actually holds this wrapper object, not the real object.
[0093] World transformation matrix: The transformation matrix that transforms the local coordinates of scene nodes to global scene coordinates. It is obtained by accumulating the local transformation matrix level by level along the path from parent node to child node in the scene tree hierarchy.
[0094] Collision box data: The representation of object boundaries used for physical collision detection within the game engine.
[0095] Target moving entity: A movable entity used as a sensor mounting reference or research object of autonomous system in target graphics applications. It can be a ground vehicle, a surface vessel or unmanned surface vessel, an aircraft or drone, a mobile robot or engineering machinery, etc.
[0096] Example 1
[0097] like Figure 1 As shown, the method for generating multimodal simulation data based on graphics applications in this embodiment mainly includes the following steps S1-S5.
[0098] Step S1: Disguise the custom dynamic link library (DLL) as a system graphics interface library (such as the DirectX DXGI library), and automatically load the custom dynamic link library when the target graphics application starts, establish a rendering pipeline interception layer, and load at least one functional plugin that registers rendering event callbacks through a unified programming interface to intercept the rendering pipeline of the target graphics application.
[0099] Specifically, step S1 includes the following sub-steps.
[0100] S11: Rename the compiled custom dynamic link library to the filename of the system graphics interface library (e.g., dxgi.dll corresponding to the DirectX DXGI library), and place it in the directory where the executable file of the target graphics application is located, so that the target graphics application will automatically load the custom dynamic link library when it starts.
[0101] In this embodiment, since the operating system prioritizes searching the directory where the target graphics application is located when loading the system graphics interface library, the target graphics application will automatically load the custom dynamic link library when it starts up, thus completing the injection without modifying the original executable file.
[0102] S12: In the entry function of the custom dynamic link library, load the system graphics interface library and forward the exported functions of the custom dynamic link library to the system graphics interface library one by one, so that the graphics interface call behavior of the target graphics application is not affected.
[0103] S13: Utilize the function hook library to install function-level hooks on the key rendering functions of the target graphics application, and replace the graphics device object and graphics context object with a wrapper class that inherits from the original graphics interface, so that every drawing call, shader binding and rendering target setting of the target graphics application can be intercepted and observed or modified.
[0104] In this embodiment, since the wrapper class implements a complete graphics interface, what the target graphics application actually holds is the wrapper object. Therefore, every time it draws, binds shaders, and sets the rendering target, it is intercepted and can be observed or rewritten.
[0105] S14: Load at least one functional plugin, which registers callback functions for key rendering events through a unified programming interface.
[0106] In this embodiment, key rendering events include, but are not limited to: frame start event, frame end event, shader creation event, shader binding event, draw call start event, draw call end event, and post-processing event.
[0107] In one implementation, three functional plugins can be loaded as needed, each responsible for scene synchronization, game adaptation, and data output, respectively.
[0108] Step S2: Based on the debugging symbol information of the target graphics application, locate the scene tree, traverse and flatten the scene tree into a node array, and establish semantic category and collision box annotation for each node in the scene tree;
[0109] Specifically, step S2 includes the following sub-steps.
[0110] S21: Obtain the debugging symbol information of the target graphics application (e.g., the program database PDB file). By parsing the debugging symbol information, obtain the memory layout, global variable offset, and virtual function table offset of the key classes inside the target graphics application. Based on this, locate the scene root object (e.g., the global singleton object) and its scene tree member fields by combining virtual function table address scanning with memory scanning.
[0111] S22: Traverse the scene tree, flatten it into a node array, and read the name string, hierarchical relationship, local transformation matrix and grid data pointer of each node according to the memory layout.
[0112] In this embodiment, the scene contains thousands of nodes, each corresponding to a mesh. The offset information also provides the basis for subsequent steps such as reading the node transformation matrix in step S3 and installing function hooks for node rendering and mesh compilation in step S4.
[0113] S23: Perform semantic category labeling for each node and obtain the collision box data for each node;
[0114] The collision box data is obtained by accessing the mesh resource object inside the target graphics application through the mesh data pointer read in step S22, obtaining the mesh vertex data and index data of each node, and obtaining the physical collider object associated with each node in the scene tree.
[0115] During the scene model creation phase, custom metadata fields are embedded in the model file through the target graphics application's extended interface. These fields include 3D bounding box corner coordinates (corner coordinates refer to the object's coordinates in the local coordinate system, which will later be transformed into world coordinate system corner coordinates through hierarchical multiplication). This yields the object's collision box position in the world coordinate system, also known as the 3D ground truth or 3D annotation. In practice, the collision box of the graphics application itself sometimes does not meet the ground truth requirements for 3D object detection in terms of size and orientation. In such cases, a custom 3D bounding box can be created and imported into the game (target graphics application) using the game's modSDK as the collision box.
[0116] Semantic category annotations are obtained through any of the following methods:
[0117] Method (a) Automatic classification at runtime: After the scene is loaded, all nodes in the scene tree are traversed. Based on the node's name string and its hierarchical relationship in the scene tree, the nodes are semantically classified. For nodes that cannot be directly matched, the semantic category of their parent node is inherited.
[0118] Method (b) Model embedding metadata: As mentioned above, during the scene model creation stage, custom metadata fields are embedded in the model file through the extended interface of the target graphics application. The custom metadata fields also include semantic category identifiers. When the scene is loaded, the rendering pipeline interception layer parses the custom metadata fields and establishes the correspondence between nodes and semantic categories.
[0119] Method (c) Hybrid mode: Method (b) embeds metadata for some nodes and Method (a) automatically classifies the remaining nodes. The results of the two methods are then combined and used.
[0120] In this invention, the nodes of the scene tree in the game can be roughly understood as objects in the game scene. For example, a car is a parent node, while the wheels, windows, and bumpers are child nodes under the parent node.
[0121] Step S3: In the rendering event callback of each frame, establish and maintain a memory region shared by the graphics application process and the external simulation process, obtain all scene data from the scene tree nodes, write the scene data into the corresponding region of the shared memory (node topology region, mesh geometry region and collision box region) and increment the version number, calculate the world transformation matrix of each node in the scene and write it into the shared memory, and update the published data through the frame identifier and atomic region index.
[0122] Specifically, step S3 includes the following sub-steps.
[0123] S31: Establish shared memory between the graphics application process and the external simulation process. As shown in Table 1, the shared memory is divided into a header region, a symbol table region, a node topology region, a transformation matrix region, a mesh geometry region, a camera parameter region, and a collision box region. The header region is set with frame identifier, region index, and update version number fields for each level.
[0124] Table 1
[0125]
[0126] S32: When the scene loading is complete, write the node topology entries (each entry includes node name, parent-child relationship, semantic category identifier, object pointer, mesh index and local bounding box field) after the semantic category is labeled into the node topology region, write the mesh vertex data and index data into the mesh geometry region, write the collision box data into the collision box region, and increment the corresponding update version number (including topology version number, mesh version number and collision box version number) in the header region so that the external simulation process can determine whether it is necessary to reread the scene-level data by comparing the topology version number.
[0127] In this embodiment, the update version number is incremented only when the scene changes, not every frame. Node topology entries include a grid index field, which is linked to the corresponding grid record (vertex, index position) in the grid geometry table. Nodes without grids have empty grid indexes. Subsequent frames only synchronize the transformation matrix and camera parameters.
[0128] S33: At the beginning of each frame, the writing end reads the index of the currently published region in the header region, selects the currently inactive buffer region (the buffer on the side of the transformation matrix region and the camera parameter region that has not been published) as the writing target, reads the local transformation matrix of each node in the scene tree, and calculates the world transformation matrix by accumulating the results level by level from the root node (the local transformation matrix is only used for calculation and is not written to shared memory), and writes the calculated world transformation matrix into the inactive region.
[0129] Specifically, a depth-first preorder traversal is performed starting from the root node of the scene tree, maintaining a last-in-first-out depth stack. The top of the stack always contains the world matrix of the current node's parent node. The world transformation matrix of the current node is obtained by progressively multiplying the world matrix level by level using the following formula. ,in, Let i be the world transformation matrix. Its local transformation matrix, This is the world transformation matrix of its parent node. This type of scene-tree based graphics engine does not update the cached world transformation matrix field for dynamic nodes every frame, but instead calculates it in real-time during rendering by recursively multiplying local matrices; directly reading this cached field will result in outdated data.
[0130] S34: After writing is complete, update the frame identifier and timestamp in the header area, update the region index field in the header area through an atomic storage operation with release semantics, and publish the data of this frame to the reading end, which is an external simulation process.
[0131] In this embodiment, the frame identifier increments every frame, which is a separate counting mechanism from the aforementioned update version number that only increments when the scene changes.
[0132] S35: The reading end first reads the current frame identifier, and then reads the frame identifier again. If the frame identifiers read twice are the same, it means that the writing end has not published new frame data during the reading period, and the complete and consistent current frame data is obtained. If the frame identifiers read twice are different, it means that the writing end has published new frame data during the reading period, and the reading end discards the current result and reads again.
[0133] In this embodiment, the reading end obtains a consistent data snapshot by reading the frame identifier once before and once after the same reading operation and using a frame number double-checking mechanism.
[0134] Step S4: During the rendering process intercepted by the rendering pipeline interception layer, multiple custom virtual cameras are used to render the same scene from multiple perspectives to generate multimodal image data. In the external simulation process, the intersection calculation of the scene state with the same current frame is performed based on the ray tracing engine to generate LiDAR point cloud simulation data.
[0135] Specifically, the process of generating multimodal image data includes the following sub-steps.
[0136] S411: Register multiple custom rendering targets in the target graphics application, each corresponding to a different virtual camera view (such as rear-end collision view, front view, bumper view, dashboard view, bird's-eye view, etc.).
[0137] S412: For each frame, the world transformation matrix of each virtual camera is calculated based on the world transformation matrix of the focused vehicle at the corresponding node in the scene tree and the preset offset (position and orientation) of each viewpoint, i.e., the camera pose of the virtual camera viewpoint.
[0138] S413: Writes the view matrix, field of view, and near and far clipping plane parameters of each virtual camera into the camera parameter area of shared memory (double buffered, written to inactive areas) so that the external simulation process can read the same camera pose.
[0139] S414: In the post-processing stage of each frame, the global screen color rendering target pointer and depth rendering target pointer of the target graphics application are replaced with pre-created private rendering targets and private depth rendering targets, respectively. This allows the colors and depths of subsequent re-rendered images to be written to the private rendering targets and private depth rendering targets, respectively, instead of being written to the game's visible background buffer. In this way, when the camera is rendering, it will output to the private rendering targets instead of the screen, so as not to affect the visual effects of the game itself.
[0140] S415: Call the camera manager and graphics manager inside the target graphics application, trigger a re-render of the same scene tree with the world transformation matrix of each virtual camera, and write the original RGB image of each frame (directly acquired by the camera) to the private rendering target; at the same time, intercept the depth-specific shader inside the target graphics application through the rendering pipeline interception layer, capture its output depth image and write it to the private depth rendering target.
[0141] In one implementation, during the re-rendering process, a semantically segmented image that is strictly aligned with the original RGB image is obtained through semantic injection. Specifically, when a scene node is about to be drawn:
[0142] (1) Capture the pointer of the currently rendered node object and record it as the thread-local current node by using a hook pre-installed on the node rendering function;
[0143] (2) Using the node object pointer as an index, search in the node topology table of shared memory to obtain the semantic category identifier of the node;
[0144] (3) Write the obtained semantic category identifier into a predefined shader constant buffer;
[0145] For example, the semantic category identifier for a building is the number 1. At the same time, an RGB value and semantic category identifier mapping table is written into the shader. When the object being drawn belongs to category "1", (128, 128, 128) is drawn, which is the RGB value corresponding to gray.
[0146] (4) Determine whether the currently bound pixel shader meets the injectability condition. The injectability condition includes excluding post-processing shaders, excluding depth-specific shaders, and excluding shaders whose constant buffer slots are already occupied.
[0147] (5) If the injectability condition is met, an additional shader code is appended to the end of the currently bound pixel shader, and the corresponding color value is written to an additional rendering target according to the category to obtain the semantic segmentation image.
[0148] In this embodiment, the additional rendering target and the original rendering target are output simultaneously in the same rendering pass, without the need for additional rendering passes. A semantic segmentation map refers to assigning a color to objects of the same category, such as assigning blue to the sky, gray to all buildings, and yellow to all pedestrians; different categories will have different corresponding color values.
[0149] S416: Restore the global screen rendering target pointer and obtain the RGB image and depth image from the private rendering target and private depth rendering target, respectively. The depth image is read from the private depth rendering target, and the depth data in the private depth rendering target is written by the depth-specific shader during the re-rendering process.
[0150] In this embodiment, the multimodal image data includes RGB images, depth images, and semantic segmentation images from multiple perspectives. The RGB images are obtained from a private rendering target. The depth images are obtained by intercepting the game's dedicated depth shader and capturing its output to the private depth rendering target. The semantic segmentation images are obtained by injecting semantic category identifiers during node rendering and rendering the corresponding color values according to the category.
[0151] In one implementation, the multimodal image data can be output to an external source for display or acquisition in any of the following ways:
[0152] Method (a) Network interface output: Send image data to clients such as browsers for display via network interfaces such as HTTP / WebSocket.
[0153] Method (b) Cross-process GPU shared texture output: In the graphics application process, the rendering target is created as a cross-process shared GPU texture and its shared handle is obtained. An independent external display process opens the same GPU texture through the shared handle and reads it directly. The read and write sides use keyed mutexes for synchronization. Method (b) does not require CPU copying and network transmission, and the transmission latency is significantly lower than that of method (a), enabling low-latency real-time display.
[0154] Specifically, the process of generating lidar point cloud simulation data includes the following sub-steps.
[0155] S421: In the external simulation process, read all the data of the current frame from the node topology region and mesh geometry region of the shared memory as the scene topology, and read all the data of the current frame from the transformation matrix region of the shared memory as the transformation matrix snapshot.
[0156] S422: Construct ray tracing acceleration structures based on snapshots, including building a geometric acceleration structure for each mesh object, and constructing an instance of the ray tracing engine by combining the geometric acceleration structure and the material information (reflectivity, transmittance, etc.) of the mesh object, and organizing all instances into an instance acceleration structure; only when the transformation matrix changes, the instance acceleration structure is updated in place using an update operation, and a full reconstruction is performed only when the topology or the number of instances changes.
[0157] In this embodiment, the purpose of constructing the geometry acceleration structure is to quickly traverse all the triangle meshes in a mesh object, while the purpose of constructing the instance acceleration structure is to quickly traverse each instance in the scene.
[0158] S423: Acquire scanning mode parameters recorded by a real LiDAR device (e.g., RoboSense M1P), including the horizontal angle of each beam. with vertical angle .
[0159] S424: Combining sensor pose matrix (rotation matrix) With translation vector ), calculate the direction of light emission at each angle. Specifically, start with the horizontal angle and vertical angle Calculate the local light direction of the sensor Then, by rotating, the direction of light in world space is obtained. The origin of light emission is taken from the sensor's world coordinates. .
[0160] S425: Obtain the world coordinates of the hit point by intersecting each ray with the scene's accelerated structure using the ray tracing engine. .
[0161] S426: Set the world coordinates of the hit point Transform to sensor local coordinate system It generates point cloud data with the same output format as real lidar equipment.
[0162] Step S5: Associate the generated multimodal image data, LiDAR point cloud simulation data, and 3D bounding box data with the 2D bounding box data using the same frame identifier and output the result. The 3D bounding box data originates from the collision box data of each node in the scene tree, and the 2D bounding box is obtained by projecting the 3D bounding box data onto the camera plane.
[0163] Figure 2 This is a schematic diagram illustrating the multi-view RGB image, depth map, and semantic map in the multimodal data output of this invention. Figure 3 This is a schematic diagram of the visualization of LiDAR point clouds in the multimodal data output of this invention, where the orange frame represents the 3D bounding box of the player's vehicle, and the blue frame represents the 3D bounding boxes of other vehicles, as shown below. Figure 2 and Figure 3 As shown, step S5 includes the following sub-steps.
[0164] S51: Generate 3D bounding box data and 2D bounding box data.
[0165] In one implementation, the 3D bounding box data is generated by calculating the mesh vertex data of the scene nodes, or by reading the boundary coordinate parameters cached by the nodes themselves, or by directly reading the collision box data in the nodes as the 3D bounding box data. The 2D bounding box data is obtained by taking the bounding rectangle after the obtained 3D bounding box is transformed to screen coordinates through view transformation and projection transformation.
[0166] S52: Associate multimodal image data (RGB image, depth image, semantic segmentation image), LiDAR point cloud simulation data, and 3D bounding box data with 2D bounding box data with the same frame identifier.
[0167] In this embodiment, by associating with the same frame identifier, it can be confirmed that the frame identifiers of the sensor data and the ground truth are equal, which means they are from the same frame, i.e., data alignment. This means that the sensor data and the object's position information in the world come from the same moment. If they are not aligned, it will affect the detection effect of the target detection algorithm. This is also a problem faced in the real world. Real-world sensors all have delays, and these delays are not equal, so they need to be matched before they can be fed into the model for inference.
[0168] S53: Simultaneously outputs multimodal image data, LiDAR point cloud data, 3D bounding box data, and 2D bounding box data, ensuring that they strictly correspond to the same scene state at the same time.
[0169] Based on steps S1-S5 above, a custom dynamic link library is disguised as a system graphics interface library to achieve lossless interception of the rendering pipeline of commercial real-time graphics applications (such as professional racing games). On this basis, the scene tree is located using debug symbol information and semantic category labels are established for each node. Subsequently, a double-buffered shared memory synchronization mechanism is established between the graphics application process and the external simulation process. The scene topology, mesh geometry, and node world transformation matrix calculated in real time for each frame with semantic labels are published to the external process in a lock-free manner. Based on the scene snapshot of the same frame, the graphics application process generates RGB images and depth images by replacing the rendering target and intercepting the depth shader. At the same time, it queries semantic information by using node rendering hooks and injects it into the pixel shader to generate semantic segmentation images. The external simulation process builds a ray tracing acceleration structure based on the same snapshot and drives ray intersection to generate point cloud data using real LiDAR scanning mode parameters. Finally, all six modal data (color image, depth image, semantic segmentation image, 3D bounding box, 2D bounding box, and LiDAR point cloud) are associated with the same frame identifier and output synchronously. This method reuses the high-fidelity physics engine and realistic rendering effects of commercial racing games, and achieves strict time-synchronized generation of multimodal training data without requiring native semantic interfaces and sensor interfaces of games. This significantly reduces the cost and cycle of acquiring high-realism autonomous driving simulation data, while also supporting custom sensor configurations. It provides a low-cost, high-efficiency, and high-realism data source for training autonomous driving racing cars and general autonomous driving perception algorithms.
[0170] In actual testing, this system successfully ran in real-time on a large track scene containing thousands of scene nodes and thousands of meshes. The generation of semantic segmentation images requires no additional rendering passes, and the added shader code only adds about a few dozen instructions, having a minimal impact on the overhead of a single draw call. Shared memory synchronization employs a lock-free double-buffering mechanism, resulting in sub-millisecond latency. It should be noted that because multimodal data generation involves additional rendering passes from multiple custom cameras, depth rendering target capture, and cross-process data transfer, the overall system has some impact on the game's frame rate, but it remains within an acceptable performance range for offline data acquisition applications.
[0171] It should be noted that although the steps in the above embodiments are described in a specific order, those skilled in the art will understand that in order to achieve the effects of the present invention, different steps do not necessarily have to be executed in such an order. They can be executed simultaneously (in parallel) or in other orders, and these variations are all within the scope of protection of the present invention.
[0172] Example 2
[0173] The method for generating multimodal simulation data based on graphical applications, as proposed in the embodiments, is as follows: Figure 4 As shown, this method runs on two independent processes:
[0174] (1) The process running the target graphics application. The target graphics application is a commercial real-time graphics application (such as a professional racing game), which runs a game engine and provides functions such as scene rendering, vehicle dynamics simulation and scene management. This process does not provide native sensor simulation interfaces or semantic annotation interfaces.
[0175] (2) Run the external simulation process. A separate process from the graphics application process runs the sensor simulation program, which performs lidar point cloud simulation and multimodal data synthesis based on the ray tracing engine.
[0176] The two processes exchange data through a cross-process shared memory and use a frame identifier mechanism to achieve time alignment of the data, thereby synchronizing the high-quality scene state in the graphics application process to the external simulation process for sensor simulation.
[0177] Example 3
[0178] In one alternative implementation, the target moving entity is a surface vessel or unmanned surface vessel, and the target graphics application is a real-time 3D graphics application capable of generating the surface environment, vessel motion state, and other dynamic or static objects. This implementation can utilize steps S1-S5 of Embodiment 1 and the dual-process structure of Embodiment 2.
[0179] In this implementation, the scene tree of the target graphics application can be located based on the debugging symbol information. Scene nodes, mesh geometry, local transformation matrices, and semantic categories are obtained according to steps S2 and S3 in Embodiment 1. The world transformation matrix of each node is calculated by accumulating the results at each level and then written to shared memory. The semantic categories can be configured according to the water scene as water surface, shoreline, dock, building, buoy, other ships, sky, etc.
[0180] Multiple virtual cameras and LiDARs can be configured with preset positions and orientations relative to the ship's coordinate system. Each frame calculates the world pose of each sensor based on the world transformation matrix of the corresponding node in the scene tree and the preset offset of each sensor. The graphics application process continues to generate multi-view RGB images, depth images, and semantic segmentation images according to steps S411-S416, while the external simulation process continues to generate LiDAR point cloud simulation data based on the same frame's scene topology and transformation matrix snapshot according to steps S421-S426.
[0181] Ultimately, the multimodal image data, LiDAR point cloud simulation data, 3D bounding box data, and 2D bounding box data are still associated with the same frame identifier and output according to step S5. This implementation only adjusts the target moving subject, semantic category, and sensor installation parameters for water surface applications, without changing the aforementioned rendering pipeline interception, scene data synchronization, semantic injection, and external ray tracing technical solutions.
[0182] Example 4
[0183] In another alternative implementation, the target moving subject is an aircraft or drone, and the target graphics application is a real-time 3D graphics application capable of generating terrain, buildings, runways or takeoff and landing areas, other aircraft and ground objects, and maintaining the position and attitude of the target aircraft. This implementation can also use steps S1-S5 in Embodiment 1 and the dual-process structure in Embodiment 2.
[0184] The scene tree localization, traversal, semantic category labeling, world transformation matrix calculation, and shared memory deployment can be implemented according to steps S2 and S3. For aviation scenes, semantic categories can be configured as terrain, runway, buildings, vegetation, sky, other aircraft, ground vehicles, etc., as needed for the task.
[0185] Multiple virtual cameras and lidar can be configured with preset positions and orientations relative to the aircraft's body coordinate system. When the aircraft translates and rotates in the world coordinate system, the sensor world pose is calculated based on the world transformation matrix of the corresponding node of the aircraft and the preset offset of each sensor. Then, according to steps S411-S416 and steps S421-S426, multimodal image data and lidar point cloud simulation data corresponding to the scene state of the same frame are generated respectively.
[0186] Finally, following step S5, the multimodal image data, LiDAR point cloud simulation data, 3D bounding box data, and 2D bounding box data are associated with the same frame identifier and output. This implementation mainly changes the target moving subject, the domain-related semantic category, and the sensor installation parameters, without changing the technical implementation link described in Embodiment 1.
[0187] Example 5
[0188] In another alternative implementation, the target moving entity can also be a mobile robot or engineering machinery. For objects with chassis, vehicle body, robotic arms, or other hierarchical moving parts, the root node of the entity or the moving part on which sensors are installed can be selected as the sensor mounting reference, and the world transformation matrix of that node can be calculated according to the scene tree hierarchy.
[0189] The virtual camera and LiDAR are set with a preset offset relative to the selected mounting reference node, and the sensor world pose is determined based on the world transformation matrix of that node for each frame. Scene data acquisition, shared memory synchronization, multimodal image generation, LiDAR point cloud generation, and 2D and 3D ground truth output can all continue to be executed according to steps S1-S5, and the semantic category set is configured according to the task scenario of the robot or engineering equipment.
[0190] Therefore, without changing the rendering pipeline interception, scene tree processing, shared memory synchronization, semantic injection, and external ray tracing technology solutions described in Embodiment 1, the method can be applied to different autonomous mobile platforms by changing the target moving subject type and sensor installation parameters.
[0191] The technical solution of the present invention has been described above with reference to the preferred embodiments shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of the present invention is obviously not limited to these specific embodiments. Without departing from the principles of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after such changes or substitutions will all fall within the scope of protection of the present invention.
Claims
1. A method for generating multimodal simulation data based on graphical applications, characterized in that, Includes the following steps: S1: Disguise the custom dynamic link library as the system graphics interface library and load it automatically when the target graphics application starts, establish a rendering pipeline interception layer, and load at least one functional plugin that registers rendering event callbacks through a unified programming interface. S2: Based on the debugging symbol information of the target graphics application, locate the scene tree, traverse and flatten the scene tree into a node array, and establish semantic category labeling for each node in the scene tree; S3: In the rendering event callback of each frame, establish and maintain a memory area shared by the graphics application process and the external simulation process, obtain all scene data from the scene tree node, write the scene data into the corresponding area of the shared memory and increment the version number, calculate the world transformation matrix of each node in the scene and write it into the shared memory, and update the published data through the frame identifier and atomic region index. S4: During the rendering process intercepted by the rendering pipeline interception layer, the same scene is rendered from multiple perspectives by multiple custom virtual cameras to generate multimodal image data. In the external simulation process, the scene state with the same current frame is intersected based on the ray tracing engine to generate LiDAR point cloud simulation data. S5: Associate the generated multimodal image data, LiDAR point cloud simulation data, and 3D bounding box data with the 2D bounding box data with the same frame identifier and output them.
2. The method for generating multimodal simulation data based on graphics applications according to claim 1, characterized in that, Step S1 includes: S11: Rename the compiled custom dynamic link library to the filename of the system graphics interface library, and place it in the directory where the executable file of the target graphics application is located, so that the target graphics application automatically loads the custom dynamic link library when it starts. S12: In the entry function of the custom dynamic link library, load the system graphics interface library and forward the exported functions of the custom dynamic link library to the system graphics interface library one by one. S13: Use the function hook library to install function-level hooks on the key rendering functions of the target graphics application, and replace the graphics device object and graphics context object with a wrapper class that inherits the original graphics interface, so that every drawing call, shader binding and rendering target setting of the target graphics application is intercepted. S14: Load at least one functional plugin, which registers callback functions for key rendering events through a unified programming interface.
3. The method for generating multimodal simulation data based on graphics applications according to claim 1, characterized in that, Step S2 includes: S21: Obtain the debugging symbol information of the target graphics application. By parsing the debugging symbol information, obtain the memory layout, global variable offset, and virtual function table offset of the key classes inside the target graphics application. Based on this, locate the scene root object and its scene tree member fields by combining virtual function table address scanning with memory scanning. S22: Traverse the scene tree, flatten it into a node array, and read the name string, hierarchical relationship, local transformation matrix and grid data pointer of each node according to the memory layout; S23: Perform semantic category labeling for each node and obtain the collision box data for each node.
4. The method for generating multimodal simulation data based on graphics applications according to claim 3, characterized in that, The semantic category annotation is implemented in the following way: After the scene is loaded, all nodes in the scene tree are traversed. Based on the node name and its hierarchical relationship within the scene tree, the nodes are semantically categorized. For nodes that cannot be directly matched, their semantic categories are inherited from their parent nodes; and / or During the scene model creation stage, custom metadata fields are embedded in the model file through the extended interface of the target graphics application. The custom metadata fields also include semantic category identifiers. When the scene is loaded, the rendering pipeline interception layer parses the custom metadata fields and establishes the correspondence between nodes and semantic categories.
5. The method for generating multimodal simulation data based on graphics applications according to claim 1, characterized in that, Step S3 includes: S31: Establish the shared memory between the graphics application process and the external simulation process. The shared memory is divided into a header region, a symbol table region, a node topology region, a transformation matrix region, a mesh geometry region, a camera parameter region, and a collision box region. Frame identifier, region index, and update version number fields at each level are set in the header region. S32: When the scene is loaded, write the node name, parent-child relationship, semantic category identifier, object pointer, mesh index and local bounding box fields after the semantic category is marked into the node topology region, write the mesh vertex and index data into the mesh geometry region, write the collision box data into the collision box region, and increment the corresponding topology version number, mesh version number and collision box version number in the header region. S33: At the beginning of each frame, the writing end reads the index of the currently published region in the header region, selects the currently inactive buffer region as the writing target, reads the local transformation matrix of each node in the scene tree, calculates the world transformation matrix by accumulating the results level by level from the root node, and writes the calculated world transformation matrix into the inactive region. S34: After writing is complete, update the frame identifier and timestamp in the header area, update the region index field in the header area through an atomic storage operation with release semantics, and publish the data of this frame to the reading end; S35: The reading end first reads the current frame identifier, and then reads the frame identifier again. If the frame identifiers read twice are the same, it means that the writing end has not published new frame data during the reading period, and the complete and consistent current frame data is obtained. If the frame identifiers read twice are different, it means that the writing end has published new frame data during the reading period, and the reading end discards the current result and reads again.
6. The method for generating multimodal simulation data based on graphics applications according to claim 1, characterized in that, The process of generating multimodal image data in step S4 includes: S411: Register multiple custom rendering targets in the target graphics application, each corresponding to a multiple virtual camera viewpoint; S412: For each frame, the world transformation matrix of each virtual camera is calculated based on the world transformation matrix of the corresponding node of the target moving subject in the scene tree and the preset offset of each viewpoint, i.e. the camera pose of the virtual camera viewpoint. S413: Write the view matrix, field of view, and near / far clipping plane parameters of each virtual camera into the camera parameter area of the shared memory; S414: In the post-processing stage of each frame, the global screen color rendering target pointer and depth rendering target pointer of the target graphics application are replaced with the pre-created private rendering target and private depth rendering target, respectively, so that the color and depth of subsequent re-rendering are written to the private rendering target and private depth rendering target, respectively. S415: Call the camera manager and graphics manager inside the target graphics application, trigger a re-rendering of the same scene tree with the world transformation matrix of each virtual camera, write the original RGB image of each frame to the private rendering target, and at the same time, intercept the depth-specific shader inside the target graphics application through the rendering pipeline interception layer, capture its output depth image and write it to the private depth rendering target. S416: Restore the global screen rendering target pointer, and obtain the RGB image and depth image from the private rendering target and the private depth rendering target respectively.
7. The method for generating multimodal simulation data based on graphics applications according to claim 6, characterized in that, During the re-rendering process, when a scene node is about to be drawn, the following steps are performed: By using hooks pre-installed on the node rendering function, the pointer to the currently rendering node object is captured and recorded as the thread-local current node; Using the node object pointer as an index, a search is performed in the node topology table of the shared memory to obtain the semantic category identifier of the node; Write the obtained semantic category identifier into a predefined shader constant buffer; Determine whether the currently bound pixel shader meets the injectability conditions, which include excluding post-processing shaders, excluding depth-specific shaders, and excluding shaders whose constant buffer slots are already occupied. If the injectability condition is met, an additional shader code is appended to the end of the currently bound pixel shader to write the corresponding color value to an additional render target according to the category. The additional rendering target and the original rendering target are output simultaneously in the same rendering channel.
8. The method for generating multimodal simulation data based on graphics applications according to claim 1, characterized in that, The process of generating lidar point cloud simulation data in step S4 includes: S421: In the external simulation process, read a snapshot of the scene topology and transformation matrix of the current frame from the shared memory; S422: Construct a ray tracing acceleration structure based on the snapshot, including constructing a geometric acceleration structure for each mesh object, and constructing the geometric acceleration structure and the material information of the mesh object into an instance of the ray tracing engine, organizing all instances into an instance acceleration structure, and performing an update operation to update the instance acceleration structure in place only when the transformation matrix changes, and performing a full reconstruction only when the topology or the number of instances changes. S423: Obtain the scanning mode parameters recorded by the actual lidar device, the scanning mode parameters including the horizontal angle of each beam. with vertical angle ; S424: Combining the sensor pose matrix, calculate the light emission direction at each angle. Specifically, start with the horizontal angle... and vertical angle Calculate the local light direction of the sensor Then, by rotating, the direction of light in world space is obtained. The origin of light emission is taken from the sensor's world coordinates. ; S425: Obtain the world coordinates of the hit point by intersecting each ray with the scene's accelerated structure using the ray tracing engine. ; S426: Set the world coordinates of the hit point Transform to sensor local coordinate system This generates point cloud data that is consistent with the output format of the actual lidar device.
9. The method for generating multimodal simulation data based on graphics applications according to claim 1, characterized in that, Step S5 includes: S51: Calculate the 3D bounding box data from the mesh vertex data of the scene node, or generate the 3D bounding box data by reading the boundary coordinate parameters cached by the node itself, or directly read the collision box data in the node as the 3D bounding box data. After the obtained 3D bounding box is transformed to screen coordinates by view transformation and projection transformation, the bounding rectangle is taken to obtain the 2D bounding box data. S52: Associate multimodal image data, LiDAR point cloud simulation data, and 3D bounding box data with 2D bounding box data with the same frame identifier and output them synchronously.
10. The application of the method for generating multimodal simulation data based on graphics applications as described in any one of claims 1-9, characterized in that, It can be applied to ground vehicles, surface vessels, unmanned boats, aircraft, drones, mobile robots, or construction machinery.
