Virtual scene environment sampling method and device, equipment and storage medium

CN122273099APending Publication Date: 2026-06-26TENCENT TECH (BEIJING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
TENCENT TECH (BEIJING) CO LTD
Filing Date
2026-03-13
Publication Date
2026-06-26

Smart Images

  • Figure CN122273099A_ABST
    Figure CN122273099A_ABST
Patent Text Reader

Abstract

This application discloses a method, apparatus, device, and storage medium for environmental sampling in virtual scenes. In a first operating environment, a material resource package containing physical materials and their associated extended physical materials is generated. This resource package is then loaded in a second operating environment to establish an association between the physical materials and the extended physical material information. A target sampling location is determined based on the application's business data. Physical collision detection is performed at this location to obtain the hit target scene object and its bound target physical material. Based on the association, the corresponding target extended physical material information is searched, and the environment category information is determined. This application, based on collision detection during application runtime and preset rules in the extended physical materials, enables real-time environmental sampling in virtual scenes with low memory consumption. It effectively improves the accuracy of environmental sampling, enhances the interactive experience of virtual scenes, and can be widely applied in the field of virtual scene technology.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of virtual scene technology, and in particular to a method, apparatus, device and storage medium for sampling the environment of a virtual scene. Background Technology

[0002] With the development of digital entertainment, virtual reality, and simulation technologies, virtual scenes are being used more and more widely in games, simulation training, and other fields. To enhance realism and interactivity, the perception and response to environmental category information has become a crucial basis for driving gameplay logic and visual effects. In real-time interaction, the ability to efficiently and accurately acquire environmental category information at a specific location (i.e., environmental sampling) directly impacts the immersive experience and system judgment.

[0003] In related technologies, environmental category information of scene objects is typically associated with extended physical materials. By pre-setting rules within the extended physical materials, environmental category information is determined in real time, achieving dynamic and differentiated feedback. However, the generation and application of extended physical materials are limited to certain platforms, and such mechanisms rely on specific platform environments. To achieve cross-platform compatibility, static pre-storage or offline annotation methods are generally used. During the map building phase, plots are pre-defined and bound to environmental tags corresponding to each scene object, saved in a universal format for cross-platform loading. While this method meets cross-platform requirements, the storage overhead of environmental tags is high, dynamic updates are not possible, and the limited granularity of annotation often affects the accuracy of virtual scene environment sampling. Summary of the Invention

[0004] This application provides an environmental sampling method, apparatus, device, and storage medium for virtual scenes, which can perform real-time environmental sampling in virtual scenes with low memory resource consumption and can effectively improve the accuracy of environmental sampling.

[0005] One aspect of this application provides an environment sampling method for a virtual scene, the method comprising: Obtain the material resource package corresponding to the application; wherein, the application generates a virtual scene during runtime, the material resource package is generated based on the application in the first running environment, and the material resource package stores various physical materials and extended physical materials associated with the physical materials; In the second running environment, the material resource package is loaded and the application is run to establish the association between the physical material and the extended physical material; Based on the application's business data, determine the target sampling location in the virtual scene; Physical collision detection is performed at the target sampling location to determine the target scene object that hits the virtual scene and the target physical material bound to the target scene object. Based on the correlation, the target extended physical material corresponding to the target physical material is determined, and the environmental category information corresponding to the target sampling location is determined based on the target extended physical material.

[0006] On the other hand, embodiments of this application provide an environment sampling device for a virtual scene, the device comprising: An acquisition unit is used to acquire a material resource package corresponding to the application; wherein, the application generates a virtual scene during runtime, the material resource package is generated based on the application in the first runtime environment, and the material resource package stores various physical materials and extended physical materials associated with the physical materials; The loading unit is used to load the material resource package and run the application in the second running environment, and to establish the association between the physical material and the extended physical material. The processing unit is used to determine the target sampling location in the virtual scene based on the application's business data; The detection unit is used to perform physical collision detection at the target sampling location to determine the target scene object that hits the virtual scene and the target physical material bound to the target scene object; An execution unit is configured to determine the target extended physical material corresponding to the target physical material based on the association relationship, and to determine the environmental category information corresponding to the target sampling location based on the target extended physical material.

[0007] Optionally, in some embodiments, the apparatus further includes a generation unit, which is specifically used for: The scene data of the virtual scene is loaded in the first operating environment; wherein, the scene data includes the scene objects, geometric shapes and physical material data in the virtual scene; Based on the scene data, determine the hierarchy of dependent objects corresponding to the physical material; A unique material number is assigned to each of the physical materials, and the association between the physical materials and the extended physical materials is recorded based on the material number; The physical material and the dependent object hierarchy are serialized into a binary data file, and the extended physical material is serialized into a structured data file; The binary data file, the structured data file, and the material number are integrated to obtain the material resource package.

[0008] Optionally, in some embodiments, the generation unit is specifically used for: Create a temporary container; The scene objects in the scene data are traversed to determine the geometric shape bound to each scene object; The geometry is traversed layer by layer to determine the physical material on which each layer of the geometry depends; If the currently identified physical material is not stored in the temporary container, add the currently identified physical material to the temporary container; After the scene data and the geometry have been traversed, a hierarchy of dependent objects corresponding to the physical materials is constructed based on the reference relationships between each physical material in the temporary container and the scene object and the geometry.

[0009] Optionally, in some embodiments, the loading unit is specifically used for: The deserialization interface in the second runtime environment is invoked to parse the binary data file and the structured data file in the material resource package; Based on the parsing results of the binary data file, the physical material and the hierarchy of dependent objects are reconstructed in the second runtime environment, and the physical material is registered to the global object manager; Based on the parsing results of the structured data file, the extended physical material is initialized in the second runtime environment; Based on the material number in the material resource package, establish the association between the physical material and the extended physical material.

[0010] Optionally, in some embodiments, the processing unit is specifically used for: The business data is parsed to identify the virtual objects participating in virtual scene interactions in the application and the current interaction event types of the virtual objects; The target sampling location is determined in the virtual scene based on the virtual object and the type of interaction event.

[0011] Optionally, in some embodiments, the interaction event types include movement-related interactions and action-related interactions; the processing unit is specifically used for: If the interaction event type is a mobile interaction, obtain the object position and posture parameters of the virtual object in the virtual scene, and determine the target sampling position based on the object position and posture parameters; If the interaction event type is a function-based interaction, the coordinates of the action point where the virtual object triggers a specific function in the virtual scene are detected, and the target sampling position is determined based on the action point coordinates.

[0012] Optionally, in some embodiments, the detection unit is specifically used for: Based on the application's business data, determine the detection direction when performing physical collision detection; Starting from the target sampling position, a detection ray is emitted along the detection direction; In the virtual scene, the first scene object hit by the detection ray is determined as the target scene object.

[0013] Optionally, in some embodiments, the detection unit is specifically used for: Determine the coordinates of the contact point between the detection ray and the surface of the target scene object; Based on the target scene object and the coordinates of the contact point, the physical engine interface provided by the second runtime environment is invoked to determine the target physical material.

[0014] Optionally, in some embodiments, the execution unit is specifically used for: Detect the normal vector of the surface of the target scene object at the coordinates of the contact point; Based on the contact point coordinates, the normal vector, and the target extended physical material, the environmental category information corresponding to the target sampling location is determined.

[0015] Optionally, in some embodiments, the apparatus further includes an updating unit, which is specifically used for: Based on the application's business data, detect whether the target scene object has changed; wherein, the change of the target scene object includes changes in physical material and changes in form; If the physical material of the target scene object changes, the target physical material currently bound to the target scene object is redefined; If the target scene object undergoes a change in form, return to the step of determining the target sampling position in the virtual scene.

[0016] On the other hand, embodiments of this application provide an electronic device, including a processor and a memory; The memory is used to store computer programs; The processor executes the computer program to implement the aforementioned virtual scene environment sampling method.

[0017] On the other hand, embodiments of this application provide a computer-readable storage medium storing a computer program that is executed by a processor to implement the aforementioned virtual scene environment sampling method.

[0018] On the other hand, embodiments of this application also provide a computer program product, which includes a computer program stored in a computer-readable storage medium. The processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to execute the aforementioned environment sampling method for implementing the virtual scene.

[0019] The embodiments of this application include at least the following beneficial effects: This application provides a method, apparatus, device, and storage medium for environmental sampling in a virtual scene. In a first operating environment, a material resource package containing physical materials and their associated extended physical materials is generated. This resource package is then loaded in a second operating environment to establish the association between physical materials and extended physical material information. Through the cross-platform resource package, the environmental sampling logic can be universally applicable across different operating environments, avoiding the limitations in sampling accuracy and the loss of multi-layered information caused by static tags. Subsequently, the target sampling location is determined based on the application's business data. Physical collision detection is performed at this location to obtain the hit target scene object and its bound target physical material. Based on the association, the corresponding target extended physical material information is searched, and the environment category information is determined. Based on collision detection during application runtime and preset rules in the extended physical materials, this application can perform real-time environmental sampling in the virtual scene with low memory resource consumption, effectively improving the accuracy of environmental sampling and enhancing the interactive experience of the virtual scene. Attached Figure Description

[0020] The accompanying drawings are used to provide a further understanding of the technical solutions of this application and constitute a part of the specification. They are used together with the embodiments of this application to explain the technical solutions of this application and do not constitute a limitation on the technical solutions of this application.

[0021] Figure 1 This is a schematic diagram of a grassy environment in a game application provided in an embodiment of this application; Figure 2 This is a schematic diagram of a snowy environment in a game application provided in an embodiment of this application; Figure 3 This is a schematic diagram illustrating how a virtual scene is divided into several plots, as provided in an embodiment of this application. Figure 4 This is a system architecture diagram of the virtual scene environment sampling method provided in the embodiments of this application; Figure 5 This is a flowchart illustrating an environment sampling method for a virtual scene provided in an embodiment of this application; Figure 6 This is a schematic diagram of a process for exporting a material resource package corresponding to an application, as provided in an embodiment of this application. Figure 7This is a schematic diagram illustrating the principle of storing environmental category information via environmental tags, as provided in an embodiment of this application. Figure 8 This is a schematic diagram illustrating the relationship between data and a virtual scene in a material resource package provided in this application embodiment; Figure 9 This is a schematic diagram of a process for loading a material resource package provided in an embodiment of this application; Figure 10 This is a schematic diagram of an environment sampling process for a virtual scene provided in an embodiment of this application; Figure 11 This is a schematic diagram illustrating the principle of environmental sampling based on environmental tags, as provided in an embodiment of this application. Figure 12 This is a schematic diagram of a game screen before a scene change, provided in an embodiment of this application. Figure 13 This is a schematic diagram of a game screen after a scene change, provided in an embodiment of this application; Figure 14 This is a structural block diagram of an environment sampling device for a virtual scene provided in the embodiments of this application; Figure 15 This is a structural block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0022] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0023] It is understood that the terms “first,” “second,” etc., used in this application may be used to describe various concepts herein, but unless otherwise stated, these concepts are not limited by these terms. These terms are used only to distinguish one concept from another.

[0024] As used in this application, the terms "at least one", "multiple", "each", "any", etc., "at least one" includes one, two or more, "multiple" includes two or more, "each" refers to each of the corresponding multiples, and "any" refers to any one of the multiples.

[0025] Before providing a further detailed description of the embodiments of this application, the nouns and terms used in the embodiments of this application are explained, and the nouns and terms used in the embodiments of this application shall be interpreted as follows: 1) Physical materials refer to a set of parameters used to describe the physical interaction characteristics of scene objects in a virtual scene. They are usually managed and used by a physics engine (such as PhysX).

[0026] 2) Extended physical materials refer to a set of parameters that, on the basis of physical materials, further carry additional information related to environmental category information determination and gameplay logic.

[0027] 3) PhysX, a physics engine for real-time simulation, provides physical computation capabilities for scene objects in virtual scenes. PhysX can manage physical elements such as physical materials, geometry, rigid and soft bodies, collision detection, and joint constraints, and supports serialization and deserialization mechanisms to achieve complete preservation and restoration of physical objects and their dependencies. In this application, the PhysX engine is mainly used to manage physical materials and export physical materials and their dependency hierarchy as binary data through its serialization interface, providing basic support for the generation and loading of material resource packages.

[0028] 4) Unreal Engine: A comprehensive game engine widely used in game development, virtual reality, simulation training, and other fields. The Unreal Engine provides complete scene editing, rendering, animation, physics simulation, and scripting capabilities. It integrates the PhysX physics engine for physics calculations and supports the configuration and management of extended physical materials (such as UPhysicalMaterial) for scene objects via Blueprints or scripts. In this application, the Unreal Engine's primary runtime environment (editing environment) is used to load virtual scene data, extract physical materials, and generate material resource packs; it is the main source platform for extended physical materials.

[0029] With the development of digital entertainment, virtual reality, and simulation technologies, virtual scenes are being used more and more widely in games, simulation training, and other fields. To enhance realism and interactivity, the perception and response to environmental category information has become a crucial basis for driving gameplay logic and visual effects. In real-time interaction, the ability to efficiently and accurately acquire environmental category information at a specific location (i.e., environmental sampling) directly impacts the immersive experience and system judgment.

[0030] Taking virtual scenes in game applications as an example, environmental sampling refers to the process by which a game application, during runtime, obtains the physical texture of surface objects at a specified location within the virtual scene through detection methods to determine the environmental category information of that location. Through environmental sampling, the virtual scene environment is no longer just a static set of artwork, but a dynamic element that can directly participate in the game logic. For example, in some game applications, when the environmental category information sampling result is water, it can trigger combat rules such as reduced fire skill damage and changes in character movement speed; when the environmental category information sampling result is grass, it can apply specific buffs or debuffs and change the sound of footsteps; when the environmental category information sampling result is mud, it can introduce slowing or defense reduction effects; and when the environmental category information sampling result is lava, it can cause continuous damage.

[0031] For example, please refer to Figure 1 and Figure 2 ,in, Figure 1 This illustration shows a schematic diagram of a grassy environment in a game application provided in an embodiment of this application. Figure 2 This illustration shows a schematic diagram of a snowy environment in a game application provided in an embodiment of this application. For example... Figure 1 As shown, assuming the current virtual character (not shown in the image) is in a grassy environment, environmental sampling reveals the current location's environmental category information as "grass." Based on this category information, the system determines that the virtual character has an affinity for the grassy environment, triggering the "speed boost" rule, which is then displayed on the game screen. The virtual character gains a movement speed bonus when moving or fighting on grass, demonstrating the direct impact of the environment on gameplay. Conversely, as... Figure 2 As shown, when the environment changes to snow, environmental sampling identifies the environment category as "snow." The system determines that the virtual character resists the snow environment, triggering the "speed reduction" rule, which is displayed on the game screen. The virtual character's movement or combat in the snow will be slowed, demonstrating the environment's restrictive effect on character behavior. This example demonstrates that through environmental sampling, different environment category information can be transformed into specific gameplay parameters, extending the virtual scene's environment from visual representation to gameplay logic. This achieves a deep integration of environmental attributes and character interaction, thereby creating a more layered and strategic interactive experience in game applications.

[0032] Of course, it is easy to understand that this kind of differentiated gameplay based on the sampling results of environmental category information relies on the accurate perception of location information and the determination of the physical material of environmental objects, which is the foundation for realizing immersive scene interaction and diversified combat experience.

[0033] In related technologies, scene objects in virtual scenes (such as terrain blocks, the ground beneath a character's feet, interactive objects, etc.) are typically configured with physical materials and related parameters such as extended physical materials to describe the physical properties of scene objects and their environmental characteristics at the gameplay level. Among them, physical materials are mainly used to define the basic physical interaction characteristics of scene objects, such as including but not limited to: friction coefficient, elasticity coefficient, density, etc. These data are generally managed and used by physics engines (such as PhysX) to support underlying physical simulations such as collision detection, rigid body motion, and force feedback.

[0034] Extended physics materials build upon physical materials, adding supplementary information related to environmental category determination and gameplay logic. This typically includes, but is not limited to: material type identifiers (e.g., water, grass, mud, lava), attribute parameters (e.g., drag coefficient, skill influence factor), and referenced external resources (e.g., weight maps, normal vector sampling configurations). Extended physics materials can also include preset calculation rules to dynamically calculate the environmental category information of a sampling location at runtime, combining the spatial coordinates and surface orientation, thereby driving different gameplay effects.

[0035] In some applications, by setting extended physical materials for scene objects in a virtual environment, it's possible to establish a correlation between these materials and the corresponding environment category information. This allows for real-time determination of the environment category information based on pre-defined rules within the extended physical materials during interactive scenarios. This approach enables dynamic and differentiated environmental feedback, significantly improving the coupling between the virtual scene and gameplay logic.

[0036] However, it's important to note that not all runtime environments support the configuration and use of extended physics materials. In actual development, extended physics materials often rely on the editing tools and runtime interfaces provided by a specific platform (such as a game engine and its accompanying editor), and their generation and application are bound to the native development environment. Many cross-platform applications (such as backend servers, cloud-based decision-making systems, or third-party simulation platforms) lack the ability to parse or execute these extended physics materials, resulting in the inability to use the configured extended physics material information for environment category determination when outside the native environment.

[0037] For example, taking the commonly used Unreal Engine environment, its content editing and runtime natively support the configuration of extended physical materials (such as UPhysicalMaterial). Material types, attribute parameters, and external resource references can be directly bound to terrain and models in the editor, and this information is read through the engine interface during game runtime, combined with the sampled location to calculate the environment category in real time. However, if the same virtual scene is migrated to other runtime environments, such as a backend server for combat settlement, a cloud-based AI decision-making module for evaluating movement costs, or a third-party simulation platform for physics simulation, these environments typically lack Unreal Engine's material management system and interface, and cannot directly parse the internal structure and preset rules of UPhysicalMaterial. Therefore, the original extended physical material information cannot be used for dynamic environment determination.

[0038] To address the aforementioned issues and ensure the universality of environmental sampling across different platforms, static pre-storage or offline annotation methods are typically employed. This involves dividing the virtual scene into several plots during the map construction phase, binding each plot with a fixed environmental label, and saving these labels in a universal format for cross-platform loading and use.

[0039] For example, please refer to Figure 3 , Figure 3 The illustration shows a diagram of dividing a virtual scene into several plots, as provided in an embodiment of this application. Figure 3 As shown, the current virtual scene is a three-dimensional terrain mesh model, containing complex topography and multi-layered structures. In related technologies, when sampling the environment, the entire virtual scene is often divided into multiple plots according to specified rules, such as plot 310. For a planar virtual environment, two-dimensional division results in planar plots; for a three-dimensional virtual environment, it can be divided into three-dimensional plots. At each plot, its corresponding coordinates and environmental labels (such as grass, water, snow, etc.) can be recorded. This yields a set of data based on location coordinates and environmental labels, which can be saved offline and used by different platforms during runtime.

[0040] While the above approach satisfies the need for cross-platform reuse to some extent, it also has many limitations and struggles to meet the dynamic, precise, and scalable requirements of virtual scenes. These limitations are manifested in at least the following aspects: 1) Sampling accuracy is severely limited, resulting in the loss of multi-layered information: Due to the division of plots according to specified rules (e.g., 50cm×50cm), there may be situations where a single plot actually contains different environmental categories, especially common at the boundaries of multiple different environments. Moreover, due to the influence of the z-axis sampling interval, some layered geological information is often lost, making it difficult to support detailed business logic.

[0041] 2) Data is fixed after generation and cannot be dynamically updated: Static environment labels generated through offline presampling are immutable at runtime. This mechanism has significant drawbacks when facing dynamic scenes, such as the collapse of destructible terrain, temporary changes in surface materials caused by NPC or vehicle movement, and material state switching triggered by weather systems (e.g., slippery roads in rain, snow cover, etc.). The above solution lacks runtime awareness and resampling capabilities for environmental states, making it impossible to update environment labels in real time. This causes dynamic interaction logic that relies on environmental feedback (e.g., characters slipping in collapsed areas, skills having increased trigger range on wet ground, vehicles slowing down in mud, etc.) to fail to respond correctly to scene changes, impacting the immersion of the game world and the depth of gameplay strategies.

[0042] 3) Extremely large exported file size, with memory consumption strongly coupled to map scale: Each plot stores an independent environment label, exporting as a binary file based on map scale. Because the sampling granularity is at the plot level, the total data volume is exponentially related to the map area, resulting in a massive binary file size that consumes a large amount of memory during loading. This not only increases the cost of cross-platform transmission and storage but also severely restricts the scalability and operational efficiency of the solution under large-scale scenes or high-resolution sampling requirements.

[0043] 4) Unable to connect to the custom functions of extended physical materials: It cannot carry information such as material type identifier, attribute parameters, external resource references and preset calculation rules defined in extended physical materials, and can only degenerate into simple tag matching.

[0044] In view of this, this application provides a method, apparatus, device, and storage medium for environmental sampling in a virtual scene. A material resource package containing physical materials and their associated extended physical materials is generated in a first operating environment. This resource package is then loaded in a second operating environment to establish the association between physical materials and extended physical material information. Through the cross-platform resource package, the environmental sampling logic can be universally applied across different operating environments, avoiding the limitations in sampling accuracy and the loss of multi-layered information caused by static tags. Subsequently, the target sampling location is determined based on the application's business data. Physical collision detection is performed at this location to obtain the hit target scene object and its bound target physical material. Based on the association, the corresponding target extended physical material information is found, and the environment category information is determined. This application, based on collision detection during application runtime and preset rules in the extended physical materials, enables real-time environmental sampling in the virtual scene with low memory resource consumption, effectively improving the accuracy of environmental sampling and enhancing the interactive experience of the virtual scene.

[0045] System architecture and scenario description used in the embodiments of this application Please refer to Figure 4 , Figure 4 The diagram shows a system architecture diagram of an environment sampling method for a virtual scene provided in an embodiment of this application. It includes a terminal device 440, an Internet 430, a gateway 420, a backend server 410, etc.

[0046] In this embodiment, the terminal device 440 may include various forms such as a desktop computer, laptop computer, PDA (personal digital assistant), mobile phone, vehicle terminal, home theater terminal, and dedicated terminal. Furthermore, it can be a single device or a collection of multiple devices. The terminal device 440 can communicate with the Internet 430 via wired or wireless means to exchange data. The terminal device 440 can be used to install and run related applications that can present virtual scenes and generate various types of data required for the virtual scene during operation, including the geometry of scene objects, physical material configurations, and extended physical material information.

[0047] The backend server 410 refers to a computer system that can provide certain services to the terminal device 440. In this embodiment, the backend server 410 can be a backend server for a virtual scene, used to provide services such as application logic processing, data storage and synchronization, and multi-user online matching and management. Compared to ordinary terminal devices 440, the backend server 410 has higher requirements in terms of stability, security, and performance. The backend server 410 can be a single high-performance computer in a network platform, a cluster of multiple high-performance computers, a portion of a single high-performance computer (e.g., a virtual machine), or a combination of portions of multiple high-performance computers (e.g., virtual machines).

[0048] Gateway 420, also known as an internetwork connector or protocol converter, is a computer system or device that acts as a translator, enabling network interconnection at the transport layer. It bridges the gap between two systems using different communication protocols, data formats, languages, or even completely different architectures. Gateways can also provide filtering and security functions. Messages sent from terminal device 440 to backend server 410 are forwarded to the corresponding backend server 410 via gateway 420. Messages sent from backend server 410 to terminal device 440 are also forwarded to the corresponding terminal device 440 via gateway 420.

[0049] The backend server 410 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.

[0050] The virtual scene environment sampling method provided in this application embodiment can be executed independently on the terminal device 440, or based on the data interaction between the terminal device 440 and the backend server 410.

[0051] For example, when executed independently on the terminal device 440, the application can complete the entire process from generating and loading the material resource package to environmental sampling locally. The terminal device 440 loads virtual scene data in the first runtime environment, extracts physical materials and their dependent structures, and generates a resource package. Subsequently, it loads this resource package in the second runtime environment (which can be the same device or different devices), establishes the association between physical materials and extended physical material information, determines the target sampling location based on business data, performs physical collision detection, obtains the target physical material and its corresponding extended physical material information, and finally determines the environment category and drives the gameplay logic. The entire process requires no interaction with the backend server 410, making it suitable for scenarios with low reliance on real-time network communication, such as single-player games or offline simulations, reducing latency and ensuring the independence of local operation.

[0052] For example, in the case of execution based on data interaction between terminal device 440 and backend server 410, terminal device 440 can upload the generated material resource package or part of the scene data to backend server 410 for centralized management and distribution. Backend server 410 synchronizes the material resource package and basic data required for environment sampling across multiple terminals, and distributes corresponding resources to terminal device 440 when needed, ensuring consistency of environment judgment logic across different devices. The environment sampling process can be completed locally by terminal device 440, or some calculations (such as calculations for complex extended physical materials) can be handled by backend server 410 before returning the results, achieving load sharing and data unification. This mode is suitable for multiplayer online games, cloud simulations, or cross-platform online applications, and can improve the collaboration efficiency and data consistency of large-scale scenes while ensuring the dynamism and accuracy of environment sampling.

[0053] Of course, it is understood that the implementation environment corresponding to the method in the embodiments of this application is not limited to that of the implementation environment. Figure 4 As shown, those skilled in the art can flexibly select the specific implementation environment according to actual needs, and this application does not impose any restrictions on this.

[0054] The virtual scene environment sampling method provided in this application embodiment can be executed in various scenarios, and the following is an exemplary description of it.

[0055] (a) Scenarios of multiplayer online tactical competitive games The method provided in this application embodiment can be applied in the scenario of multiplayer online tactical competitive games, and is used to adjust the combat rules and skill effects in real time according to the environmental category information of the player's location.

[0056] For example, in a tactical competitive game that supports multi-terrain combat, players may fight in different areas such as urban ruins, open grasslands, lakes, or swamps. Traditional solutions rely on statically stored environment tags, which cannot reflect environmental changes caused by destructible terrain (such as walls collapsing to expose water) or weather changes (such as heavy rain making the ground slippery) in a timely manner during combat, resulting in a disconnect between combat feedback and scene status.

[0057] By applying the method provided in this application, the game client or backend server can determine the player's target sampling location based on real-time business data when the player enters combat. Utilizing the correlation between physical materials and extended physical materials in the material resource pack, the environment category of that location is dynamically calculated at runtime, and the corresponding combat rules are immediately applied. For example, in water, fire-based skills are triggered, resulting in damage reduction and movement speed changes; in mud, deceleration and defense reduction are triggered; and on slippery ground, the probability of slipping is increased. This method makes the environment a crucial variable driving gameplay, significantly enhancing the game's strategic depth and immersion.

[0058] (II) Industrial Simulation and Training Scenarios The method provided in this application embodiment can be applied to virtual simulation and training systems in the industrial field, for example, it can be used to simulate factory workshops, energy facilities or complex mechanical operating environments.

[0059] For example, in maintenance training for oil drilling platforms, trainees need to perform equipment inspections, pipeline disassembly and assembly, and leak handling in a virtual scenario. Different areas may contain materials such as metal decks, anti-slip coatings, water accumulation, or oil stains, with significant differences in their coefficients of friction, anti-slip performance, and operational risks. Traditional solutions use fixed environmental labels, which cannot promptly reflect changes in surface conditions caused by equipment movement, liquid leaks, or personnel movement, thus affecting the relevance of the training and the effectiveness of safety assessments.

[0060] By applying the method provided in the embodiments of this application, the training system can determine the target sampling location based on real-time business data (such as equipment location, liquid diffusion range, and personnel movement path) during the trainee's operation. It can also dynamically determine the environment category using material resource packages at runtime and adjust operation prompts, risk warnings, or operation restrictions accordingly. For example, when the sampling location is detected to be an oily area, the system can prompt for anti-slip measures or restrict high-speed movement, making the simulation process closer to real working conditions and improving training effectiveness and accident prevention capabilities.

[0061] Of course, it is understood that the methods in the embodiments of this application are not limited to the application scenarios given in the above examples. The methods in the embodiments of this application can also be applied in other scenarios, and this application does not impose any restrictions on them.

[0062] General Description of Embodiments in this Application Please refer to Figure 5 , Figure 5 A flowchart illustrating an environment sampling method for a virtual scene provided in an embodiment of this application is shown. Figure 5 As shown, the virtual scene environment sampling method according to one embodiment of this application includes, but is not limited to, the following steps: Step 510: Obtain the material resource package corresponding to the application; wherein, the application generates a virtual scene during runtime, and the material resource package is generated based on the application in the first running environment. The material resource package stores various physical materials and extended physical materials associated with the physical materials. Step 520: Load the material resource package and run the application in the second running environment to establish the association between physical materials and extended physical materials; Step 530: Determine the target sampling location in the virtual scene based on the application's business data; Step 540: Perform physical collision detection at the target sampling location to determine the target scene object that hits the virtual scene and the target physical material bound to the target scene object; Step 550: Based on the correlation, determine the target extended physical material corresponding to the target physical material, and determine the environmental category information corresponding to the target sampling location based on the target extended physical material.

[0063] In this embodiment of the application, an environment sampling method for a virtual scene is provided. The method first generates a material resource package containing physical materials and their associated extended physical materials in a first running environment that supports extended physical materials, and loads the resource package in a second running environment to establish the association between the two. Then, the target sampling position in the virtual scene is determined according to the application's business data, and physical collision detection is performed at the position to obtain the hit target scene object and its bound target physical material. The corresponding target extended physical material information is found according to the association, and the environment category information at the target sampling position is determined accordingly.

[0064] The virtual scene environment sampling method provided in this application upgrades the traditional offline processing method that relies on statically pre-stored environment tags to a runtime dynamic determination mechanism based on material resource packages. This design decouples the environment sampling logic from the application business logic, allowing environment category information to be no longer limited to fixed plot tags or the extended physical material configuration of a single platform, but to be flexibly and in real-time calculated through cross-platform reusable material resources and runtime collision detection.

[0065] Furthermore, the environmental sampling process in this method can be abstracted into loading material resource packages, establishing associations, and invoking rules for extended physical materials, giving the embodiments of this application a high degree of dynamism and scalability. The same environmental sampling mechanism can be applied to various scenarios such as combat judgment, simulation training, and emergency command; differentiated environmental feedback can be achieved simply by configuring different extended physical materials. This significantly reduces the cost of developing dedicated environmental judgment logic for different business scenarios, improving the efficiency of content production and the diversity of interaction strategies.

[0066] Therefore, overall, the virtual scene environment sampling method provided in this application embodiment constructs an efficient, dynamic, and cross-platform compatible environment perception solution. It replaces static label-based detection logic by combining material resource packages with real-time physical collision detection, ensuring real-time performance and accuracy while giving the system the ability to flexibly respond to scene changes. This effectively enhances the realism of virtual scene interaction, the depth of gameplay strategies, and the maintainability and portability of the project.

[0067] The following section describes and explains the virtual scene environment sampling method provided in the embodiments of this application, with specific steps.

[0068] In step 510, when executing the virtual scene environment sampling method provided in this embodiment, the material resource package corresponding to the application is first obtained. Here, "application" refers to a software program capable of generating virtual scenes at runtime, which can run on various computing devices, such as desktop computers, laptops, mobile phones, tablets, in-vehicle terminals, dedicated simulation equipment, or a combination of the above devices. This application can implement one or more types of virtual scenes based on different business needs, such as video games, virtual reality training systems, simulation platforms, and 3D visualization systems. This application does not limit the specific type of application or the virtual scenes it generates.

[0069] A material resource package refers to an application-related, universally applicable data package containing physical materials and their associated extended physical materials. In this embodiment, the application can build and maintain a virtual scene at runtime. This virtual scene consists of several scene objects, such as, but not limited to, terrain, buildings, interactive objects, characters, and their equipment. When these scene objects are created or imported, they are bound to corresponding physical materials to describe their basic properties in the physical simulation (such as friction coefficient, elasticity coefficient, density, etc.). In the development (or partial deployment) environment, extended physical materials can be further configured to record additional information related to environment category information determination and gameplay logic (such as material type identifier, attribute parameters, external resource references, and preset calculation rules).

[0070] To achieve universality of extended physical materials across various operating environments, this embodiment of the application allows the material resource package to be generated based on an application in a first operating environment. Here, the first operating environment refers to a type of operating platform that natively supports the definition, configuration, and serialization of extended physical materials, providing a complete editing toolchain and runtime interface for them. In the first operating environment, information such as material type identifiers, attribute parameters, external resource references, and preset operation rules contained in the extended physical materials can be identified and processed. This information can then be bound to the physical materials of scene objects using a supporting editor or development framework (such as Unreal Engine). In other words, in the first operating environment, the application can not only load the virtual scene and extract the physical materials bound to the scene objects, but also access all custom fields and logic defined in the extended physical materials, performing dependency structure analysis and serialization packaging together with the physical materials to form a material resource package.

[0071] In this embodiment, the material resource package can be integrated in the form of binary data files and structured data files, and can still be parsed and used in other operating environments (such as backend servers, cloud decision-making systems or third-party simulation platforms) that are not on the native platform. That is, the material resource package itself can be cross-platform universal.

[0072] The material resource pack includes at least various physical materials and related extended physical materials. As mentioned earlier, physical materials are a set of parameters used to describe the physical interaction characteristics of scene objects, such as friction coefficient, elasticity coefficient, and density. They are managed by the physics engine and support underlying physical simulations such as collision detection, rigid body motion, and force feedback. Extended physical materials are a set of parameters that further carry environmental category information and additional information related to gameplay logic, building upon physical materials. They typically include material type identifiers (such as water, grass, mud, lava, etc.), attribute parameters (such as drag coefficient, skill influence factor, etc.), external resource references (such as weight maps, normal vector sampling configurations, etc.), and preset calculation rules. Extended physical materials enable environmental information not only to participate in physical simulations but also to dynamically calculate environmental categories at runtime by combining the spatial coordinates of the sampling location and the surface orientation, thereby driving differentiated application logic.

[0073] In step 510, the method of obtaining the material resource package may include: generating and saving it locally in the first running environment, or reading the previously generated material resource package from persistent storage (such as local disk or cloud storage). This application does not limit this.

[0074] It is understood that, in the embodiments of this application, the design of the material resource package solves the problem that extended physical materials are available in the native editing environment but cannot be parsed in other operating environments, so that the environment sampling logic can maintain consistency across different platforms, and provides data and rule support for the subsequent establishment of association relationships and dynamic environment determination.

[0075] It should be noted that the virtual scene environment sampling method in this application embodiment can be executed in a cross-platform environment different from the first running environment. The running environment in which the environment sampling method in this application embodiment is executed is referred to as the second running environment. Specifically, the second running environment refers to a computing environment other than the first running environment that is capable of loading and parsing the material resource package. It may include, but is not limited to, a backend server, a cloud decision-making system, a third-party simulation platform, running instances of different hardware devices, or any application running environment that has basic physics engine support but does not have native editing capabilities for extended physical materials. This application does not impose any restrictions on this.

[0076] In step 520, after obtaining the material resource package, the material resource package can be loaded and the application can be run in the second runtime environment to establish the association between physical materials and extended physical materials based on the material resource package.

[0077] As described above, in this embodiment, the second runtime environment refers to a runtime platform capable of loading and parsing material resource packages, but not natively supporting extended physical material definitions. The difference between the second runtime environment and the first runtime environment lies in their support capabilities for extended physical materials. The first runtime environment is a native definition and configuration platform for extended physical materials, capable of directly creating, editing, storing, and runtime invoking material type identifiers, attribute parameters, external resource references, and preset operation rules within extended physical materials. Therefore, it can completely capture this information when generating material resource packages.

[0078] The second runtime environment lacks native support for extended physical materials, and cannot directly define extended physical materials through an editor or accompanying tools. Therefore, in this embodiment, a material resource package is loaded, allowing the second runtime environment to indirectly obtain the environmental judgment logic carried by the extended physical materials by utilizing the serialized physical materials and extended physical materials within the package, as well as pre-established associations. This achieves dynamic environment awareness capabilities equivalent to those in the first runtime environment without relying on the configuration capabilities of native extended physical materials. It is easy to understand that the material resource package can be used not only in a second runtime environment different from the first runtime environment, but also universally on different devices within the same first runtime environment.

[0079] Specifically, in this embodiment, after the application starts in the second runtime environment, it can call the deserialization interface provided by that environment to parse the binary data files and structured data files in the material resource package. The binary data files are used to reconstruct the physical materials and their dependent object hierarchy, while the structured data files are used to initialize extended physical materials and other information. After parsing, the physical materials are registered to the global object manager of the second runtime environment, enabling them to be normally called in collision detection and rigid body simulation in physics engines (such as PhysX). Simultaneously, extended physical material information is loaded into memory and associated with the registered physical materials. This association is crucial for the second runtime environment to perform dynamic environment determination. During subsequent physical collision detection, once the target physical material bound to the target scene object is obtained, the corresponding target extended physical material can be quickly found through this association, and the preset calculation rules within it can be invoked to calculate the environment category information in real time. Therefore, step 520 not only completes the deployment of the material resource package in the target environment, but also restores the environmental awareness capability that the extended physical material only has in the native platform through the association relationship, so that the environmental sampling logic can be consistent across different platforms, providing a foundation for dynamic and differentiated application logic.

[0080] It should be further noted that the application in this embodiment is not only the carrier of the virtual scene, but also the generator and user of the material resource package. In the first runtime environment, the application, as the generator, is responsible for generating the material resource package, transforming the extended physical materials that originally relied on specific platform editing tools and runtime interfaces into standardized data that can be parsed and reused in different environments. During cross-platform use, the application, as the user, loads the generated material resource package in the second runtime environment, re-registers the physical materials and extended physical materials information in it into the management system of the current runtime environment, and establishes the association between the two. In particular, the second runtime environment can include various types and is not limited to a single fixed platform or device.

[0081] By defining it once and using it in multiple places, the application's environmental sampling logic can be transformed from a closed capability of a specific platform into a general capability that can be reused in diverse computing environments. This not only reduces the workload of repeatedly configuring and extending physical materials for different platforms, but also ensures the consistency and integrity of environmental perception in cross-platform scenarios.

[0082] In step 530, after loading the material resource package, the environment sampling task of the virtual scene can be executed normally. At this time, the application will parse the key points that need to be perceived by the environment from the business data according to the current running business status and interaction requirements, thereby determining the target sampling location in the virtual scene.

[0083] In this embodiment, business data refers to a set of real-time or historical data generated and maintained by the application's logic modules (such as gameplay systems, task systems, control systems, physics engines, or event systems) during application operation, used to describe scene states and interaction processes. The specific content of this data depends on the type of application and specific business needs, and can be flexibly configured. For example, in some game applications, business data may include, but is not limited to: the coordinates, orientation, movement speed, current action state, activated skills or interaction commands, the skill's range and target point, task progress, plot triggering conditions, and environmental change events (such as weather changes, terrain collapses, and water level rises / falls). In industrial simulation or emergency command applications, business data may include equipment location, operation stage, sensor data, environmental parameters (temperature, humidity, wind speed), and the location of sudden events. Business data is typically updated by the application's main logic loop every frame or when a critical event is triggered, and can be obtained by calling internal APIs, reading state caches, or subscribing to event bus messages; this application does not impose any limitations on this.

[0084] After obtaining the application's business data, the target sampling location can be determined in the virtual scene based on this data. Here, the target sampling location refers to the specific coordinates within the virtual scene where environmental category information needs to be determined. It's easy to understand that determining the target sampling location directly determines the object and result of environmental sampling. Therefore, the target sampling location must be closely linked to the application's business logic and real-time interaction status to ensure the accuracy and effectiveness of environmental feedback.

[0085] In practical implementation, the target sampling location can originate from one or more pieces of information in the business data, such as the current coordinates of the virtual character or vehicle, the skill release point, the center of the contact surface of the hit object, the landing point of the camera viewpoint projected onto the ground, key nodes of the pathfinding path, or the position of the operating tool in contact with the scene. The application can extract the location most relevant to the interaction or judgment from this data based on the currently executed business function and use it as the target sampling location. For example, in some game applications, if a virtual character uses a fire-based skill to attack a target in front, the skill's point of effect (such as the bullet's landing point) can be set as the target sampling location to determine whether the point is located in water, thereby deciding whether to apply the fire-based skill damage reduction rule. In other game applications, if the vehicle the virtual character is riding in is traveling along a predetermined path, key locations on the path (such as the area about to be entered) can be set as target sampling locations to pre-calculate the impact of terrain on speed or control (such as increased driving speed in snowy terrain).

[0086] Of course, the above examples are only used to briefly introduce the situation of determining the target sampling position from the virtual scene in this application, and do not mean that there are any restrictions on its specific implementation.

[0087] It should be further noted that, in the embodiments of this application, the process of determining the target sampling position is not limited to a single calculation. It can also continuously and dynamically generate a series of positions in a single frame or multiple frames according to business needs, in order to achieve continuous environmental perception or regional environmental prediction. For example, during a virtual character's long-distance running or a vehicle's high-speed movement, multiple target sampling positions can be generated along its trajectory at certain intervals (such as every 0.5 meters or every frame) to detect changes in the environment along the way, achieving a smooth transition from grassland to mud, from land to water, and the gradual activation of corresponding gameplay effects. When releasing area-of-effect skills, multiple target sampling positions can also be generated within the skill's radius of effect to segment the environmental determination of the skill's coverage area, thereby enabling special effects to be triggered in certain areas (such as flames burning at a reduced height in mud, or spreading more slowly in snow).

[0088] Furthermore, the determination of the target sampling location can be combined with spatial query optimization strategies to reduce unnecessary computational overhead. For example, when business data indicates that the virtual character is still in the same environmental area as the previous sampling and has not undergone significant displacement or state change, the previous environmental category information can be reused. The target sampling location can be recalculated and environmental sampling can be performed only when crossing area boundaries or triggering specific events (such as entering new terrain, weather changes, or skill switching). This dynamic scheduling based on business data not only ensures the real-time nature of environmental feedback but also improves the system's operating efficiency in large-scale scenarios or high-frequency interactions.

[0089] In step 540, after determining the target sampling location, physical collision detection can be performed at the target sampling location to determine the scene object that is hit in the virtual scene and the physical material bound to the scene object. In this embodiment, the hit scene object is recorded as the target scene object, and the physical material bound to the target scene object is recorded as the target physical material.

[0090] Physics collision detection refers to the process of using a physics engine (such as PhysX) supported by a secondary runtime environment to emit detection rays, volumes, or shapes in a vertically downward direction from the target sampling location within the virtual scene space, and to perform intersection tests with geometry or colliders in the virtual scene. This process is implemented at the underlying level by the physics engine, which can efficiently and accurately determine which scene objects are in contact with the target sampling location and return information about the hit objects.

[0091] In this embodiment, the direction of physical collision detection is not limited to vertical downwards and can be flexibly set according to business needs. For example, when a character is climbing or hanging on the edge of a cliff, detection can be performed diagonally upwards or horizontally to determine the environment of the hand gripping position or foothold; in the trajectory analysis of flying vehicles or projectiles, multiple sampling detections can be performed along the direction of movement to obtain environmental changes along the path. This flexible detection direction configuration allows environmental sampling to cover more interaction forms and meet the perception needs in complex scenarios.

[0092] When physical collision detection hits multiple scene objects (e.g., the detection ray simultaneously passes through transparent glass and a wall behind it), this application embodiment can select a unique target scene object based on preset priority rules (e.g., by closest collision distance, by highest object level, by material type weight, etc.) to ensure the uniqueness and certainty of the environment category determination. Meanwhile, for cases where no scene object is hit (e.g., the sampling point is located in the air or in an area without collision objects inside a body of water), the application can be processed according to the default environment category or specific rules in subsequent steps to avoid interruption of application business logic due to sampling failure; this application does not impose any restrictions on this.

[0093] The target scene object is an entity in the virtual scene that intersects with the detection line or detection volume in physical collision detection. It can include, but is not limited to, terrain blocks, building models, interactive objects, character body parts, vehicle parts, etc. These scene objects are usually bound to physical materials when the virtual scene is constructed or imported to describe their physical interaction attributes. In the embodiments of this application, the target physical material bound to the target scene object can be obtained.

[0094] It should be added that, in the cross-platform second runtime environment, although it does not have the ability to edit and define native extended physical materials, it generally needs to support the loading and collision detection functions of the basic physics engine, because the acquisition of the target physical material depends on the physics engine's parsing of the materials bound to the scene objects.

[0095] Through step 540, this embodiment of the application realizes real-time physical detection of the virtual scene at the target sampling location, deeply integrating environmental sampling with the collision detection mechanism of the physics engine, so that the determination of environmental category information can directly reflect the actual spatial relationship and object state during application runtime, providing a reliable and accurate foundation for subsequently obtaining extended physical materials and dynamically calculating environmental information through association relationships.

[0096] In step 550, the target extended physical material corresponding to the target physical material is determined based on the correlation relationship. Then, the environmental category information corresponding to the target sampling location can be determined based on the target extended physical material.

[0097] In this embodiment, the association relationship refers to the one-to-one mapping between physical materials and extended physical materials established after the application loads and runs the material resource package in the second runtime environment in step 520. This association relationship can be stored through material numbers, index tables, or key-value pair structures to ensure that the application can quickly retrieve the associated extended physical material information based on the physical material during runtime. Essentially, the association relationship uses the physical material as the index key and the extended physical material as the target data, thereby achieving the association from underlying physical interaction attributes to high-level environmental category information in subsequent sampling processes.

[0098] For example, in the specific implementation of step 550, starting from the target physical material obtained in step 540, the corresponding target extended physical material can be found in the established association relationship using its unique identifier (such as material ID, name hash, or index value). The target extended physical material includes material type identifiers (such as water, grassland, swamp, lava, etc.), attribute parameters (such as resistance coefficient, skill influence factor, etc.), external resource references (such as weight map, normal vector sampling configuration, etc.), and preset calculation rules. This data has been serialized into the material resource package in the first running environment and restored to memory when the resource package is loaded in the second running environment.

[0099] Subsequently, the application invokes the preset calculation rules in the target extended physical material, and dynamically calculates the environmental category information of the location by combining the spatial coordinates of the target sampling position (determined by step 530) and the surface orientation information (the normal direction that can be obtained from the physical collision detection results). In this application embodiment, the implementation of the calculation rules is diverse. In some embodiments, the water or snow coverage range can be determined by comparing the height of the target sampling position with the color value of the multi-layer weight map; in some embodiments, the slope category (such as steep slope, gentle slope, flat land) can be determined according to the angle between the surface normal and the horizontal plane; in some embodiments, spatial interpolation calculation can also be performed by combining external resources (such as a muddy distribution map) to achieve continuous environmental gradient determination.

[0100] The calculated result is the environmental category information for the target sampling location. Environmental category information describes the type of environment at the target sampling location, such as "water," "grassland," "mud," "snow," "lava," "sand," and "rock." In some embodiments, it may include not only the basic environmental type but also attribute parameters related to that environment. For example, if the result is "water," the returned attribute parameters might include buoyancy coefficient, underwater resistance, and swimming energy consumption; if it's "mud," it might return deceleration ratio and immersion depth threshold. This information is then passed to the application's business logic modules (such as role controllers, skill systems, and decision-making modules) to drive differentiated environmental feedback, such as adjusting movement speed, changing skill effects, or triggering specific animations or sound effects.

[0101] In this embodiment, the determination of environmental category information in step 550 can be performed in real time and on demand, rather than relying on statically pre-stored environmental labels. This means that when the virtual scene undergoes dynamic changes during operation (such as destructible terrain exposing new materials, weather systems changing the surface state, or NPCs or vehicles moving and causing the surface of the sampling location to change), as long as step 540 is re-executed to obtain the new target physical material, and the operation rules of the extended physical material are called through the association relationship, the updated environmental category information can be obtained, thereby achieving synchronous changes in environmental feedback and scene state.

[0102] Based on step 550, this embodiment of the application realizes the transformation from collision detection at the physical level to environment category determination at the logical level. By using extended physical materials stored in the material resource package, even if the second runtime environment lacks native extended physical material editing capabilities, it can still achieve dynamic environment perception equivalent to the first runtime environment. This mechanism not only ensures the consistency of environment sampling logic across different platforms but also enables environmental information to deeply participate in gameplay logic, achieving a tight coupling between virtual scenes and interaction strategies.

[0103] It is understood that the virtual scene environment sampling method provided in this application generates a material resource package containing physical materials and their associated extended physical materials in a first running environment, and loads the resource package in a second running environment to establish the association between physical materials and extended physical material information. Through the cross-platform resource package, the universality of environment sampling logic across different running environments can be achieved, avoiding the problems of limited sampling accuracy and loss of multi-layer information caused by static tags. Subsequently, the target sampling position is determined based on the application's business data, and physical collision detection is performed at this position to obtain the hit target scene object and its bound target physical material. Based on the association, the corresponding target extended physical material information is found and the environment category information is determined. Based on collision detection during application runtime and preset rules in the extended physical materials, this application can perform real-time environment sampling in the virtual scene with low memory resource consumption, effectively improving the accuracy of environment sampling and enhancing the interactive experience of the virtual scene.

[0104] Specifically, in some embodiments, the material resource package is generated through the following steps: The scene data of the virtual scene is loaded in the first runtime environment; the scene data includes the scene objects, geometry, and physical material data in the virtual scene. Based on the scene data, determine the hierarchy of dependent objects corresponding to the physical materials; Assign a unique material number to each physical material, and record the relationship between physical materials and extended physical materials based on the material number; Serialize the physical material and dependent object hierarchy into a binary data file, and serialize the extended physical material into a structured data file; By integrating binary data files, structured data files, and material numbers, a material resource package is obtained.

[0105] In this embodiment of the application, a specific method for generating a material resource package is provided. This method serializes and structures the physical materials of the virtual scene and their associated extended physical materials in a first operating environment that supports extended physical materials. This realizes the universal migration of environment sampling logic from a specific platform to a multi-platform environment and solves the problem that extended physical materials cannot be parsed in non-native environments.

[0106] Specifically, in this embodiment, the generation of the material resource package can be a processing flow based on scene data parsing and dependency structure analysis. First, scene data of the virtual scene is loaded in the first running environment. This scene data includes data on scene objects, geometric shapes, and physical materials in the virtual scene. Physical materials are used to describe the basic properties of scene objects in physical simulation, such as friction coefficient, elastic coefficient, and density. Extended physical materials, on the other hand, carry additional information related to environmental category information and gameplay logic, such as material type identifiers, attribute parameters, external resource references, and preset calculation rules.

[0107] After acquiring scene data, the dependency object hierarchy structure corresponding to the physical material is determined based on the scene data. In this embodiment, the dependency object hierarchy structure refers to the association tree between the physical material and other objects (such as geometry, colliders, texture resources, weight maps, etc.) in the virtual scene, used to ensure that all external references and configurations required by the physical material can be completely restored during cross-platform loading. Subsequently, a unique material number is assigned to each physical material, and the association relationship between the physical material and extended physical materials is recorded based on the material number. This association relationship can be stored in the form of a mapping table or index structure so that the corresponding extended physical material can be quickly found through the physical material at runtime.

[0108] After the association records are completed, the hierarchical structure of the physical material and its dependent objects is serialized into a binary data file, and the extended physical material is serialized into a structured data file. Here, the binary data file is used for efficient storage and fast loading of the underlying data of the physical material and its dependencies, while the structured data file (such as JSON, XML, or a custom format) is used to save the logical information and rule configurations in the extended physical material, ensuring that it can still be parsed and executed in the second runtime environment. Finally, the binary data file, the structured data file, and the material number are integrated to obtain the material resource package. This resource package is packaged in a unified format and can be loaded and used on other platforms (such as backend servers, cloud-based decision-making systems, or third-party simulation platforms) outside the first runtime environment.

[0109] It is understood that, in this embodiment of the application, by introducing a serialization mechanism for the dependency object hierarchy and a material number indexing mechanism, the environmental sampling logic and platform-specific editing tools can be completely decoupled in terms of technical architecture, ensuring that the environmental judgment rules carried by the extended physical materials remain consistent across different operating environments. This not only reduces the workload of repeatedly configuring extended physical materials in cross-platform development but also ensures the real-time performance and reliability of environmental perception in diverse application scenarios, providing reusable basic data and services for dynamic interaction and gameplay innovation in virtual scenes.

[0110] Specifically, in some embodiments, the hierarchy of dependent objects corresponding to physical materials is determined based on scene data, including: Create a temporary container; Iterate through each scene object in the scene data to determine the geometric shape bound to each scene object; Traverse the geometry layer by layer to determine the physical material on which each layer of geometry depends; If the currently identified physical material is not stored in the temporary container, add the currently identified physical material to the temporary container; After traversing the scene data and geometry, a hierarchy of dependent objects corresponding to the physical materials is constructed based on the reference relationships between each physical material and the scene objects and geometry in the temporary container.

[0111] In this application embodiment, a specific implementation method for determining the hierarchical structure of dependent objects corresponding to physical materials is provided. This method achieves complete capture and structured organization of physical materials and their dependent resources by traversing scene data and geometric shapes layer by layer and collecting reference relationships, laying the foundation for the serialization and reuse of material resource packages.

[0112] Specifically, in this embodiment, a temporary container is first established to temporarily store the discovered physical materials during the traversal process. This temporary container can adopt a hash set or list structure to ensure that each physical material is recorded only once, avoiding duplicate storage and redundant dependencies.

[0113] Subsequently, the scene objects in the scene data are traversed. Scene objects are the basic building blocks of a virtual scene, including terrain blocks, building models, interactive objects, characters, and their equipment. When traversing each scene object, its bound geometry (such as mesh models, collider outlines, etc.) is determined. Geometry is the spatial carrier for the actual application of physical materials in the scene. After obtaining the geometry, its structure is traversed layer by layer. This layer-by-layer traversal includes both the hierarchical combination of geometry (such as parent and child meshes, segmented models and the overall model) and the material slots or physical material binding information referenced by the geometry. Through layer-by-layer traversal, the physical material on which each layer of geometry depends can be determined. For example, in a composite building model, the outer wall mesh is bound to a brick physical material, and the inner floor mesh is bound to a wood physical material; the traversal process will capture these two materials separately.

[0114] During the traversal, if a currently identified physical material is not yet stored in a temporary container, it is added to the temporary container. This deduplication mechanism ensures that the physical material nodes in the dependency object hierarchy are unique, facilitating the subsequent construction of a clear reference relationship graph.

[0115] Once all scene objects and geometries in the scene data have been traversed, the temporary container has collected all the physical materials used in the scene. Next, based on the reference relationships between each physical material and scene object / geometry in the temporary container, a hierarchical structure of dependent objects corresponding to the physical materials is constructed. This hierarchical structure typically uses a tree or graph data model, where the root node is the physical material, and the child nodes are dependent external resources such as geometries, texture resources, weight maps, and normal vector sampling configurations, and can be further traced back to the scene object bound to the physical material.

[0116] It is understood that, in this embodiment of the application, by introducing a temporary container and a layer-by-layer traversal mechanism, a comprehensive capture and efficient organization of physical material dependencies can be achieved in the technical architecture, ensuring that no external references related to physical materials are missed when the material resource package is generated. This not only guarantees that the configuration of physical materials can be completely restored when the resource package is loaded in the second runtime environment, but also makes the invocation of physical materials and the lookup of related extended physical materials more reliable during environment sampling, providing a solid data foundation for cross-platform environment perception and dynamic interaction in virtual scenes.

[0117] The process of generating and exporting the material resource package corresponding to the application in this application will be introduced and explained below with reference to specific application embodiments.

[0118] In this embodiment, the first runtime environment can be an environment provided by the Unreal Engine. The Unreal Engine provides Extended Physical Materials (UPhysicalMaterial) to associate with the physical materials of the PhysX Engine and implement custom business logic. (Refer to...) Figure 6 , Figure 6 This illustration shows a flowchart of exporting a material resource package corresponding to an application, as provided in an embodiment of this application. Figure 6 As shown in the embodiments of this application, the steps for exporting the material resource package corresponding to the application include: 1. Load Scene Data: In Unreal Engine's edit mode, load the complete scene data of the virtual scene, including all scene objects, geometry, and associated physical materials. This step ensures that the subsequent extraction process can traverse all physically interactive elements within the scene, providing a complete data foundation for material collection.

[0119] 2. Physical Material Extraction: This process iterates through all scene objects within the virtual scene, accessing their associated geometric shapes layer by layer, extracting the physical materials that these shapes depend on, and placing them into a temporary container. A deduplication mechanism within the container ensures that the same physical material is collected only once, preventing redundant data from entering subsequent processing. This process can completely capture all actually used physical materials in the scene, providing an accurate set of materials for cross-platform resource packages.

[0120] 3. Numbering and Association: After all physical materials have been collected, a unique material number is assigned to each physical material. This number establishes an explicit association between the physical material and its extended physical materials. In the implementation, the relevant pointer information of the extended physical materials is stored in the extended data field of the physical material, forming an implicit binding. This allows for rapid reconstruction of the mapping between the two during subsequent loading and use, ensuring accurate restoration of the environment determination logic.

[0121] 4. Dual-track export: For the physical materials component: the serialization interface of the physics engine is directly called to serialize the physical materials and their dependent physical objects, geometric shapes, and other objects, along with the complete hierarchical relationships after dependency completion, into a binary data file. This file can be quickly loaded in a cross-platform environment to restore the basic properties and dependency structure of the physical materials.

[0122] The extended physical materials section is exported using a business-defined text format. The content includes: material type (e.g., base surface, weight map material, normal vector material), material attributes (physical parameters, custom rule switches), and referenced external assets (e.g., weight map paths, normal vector sampling configurations). Because the physics engine's serialization mechanism cannot handle pointer objects in extended data fields, the material ID is used as the association key during both export and loading. At runtime, this ID is used to reconstruct the correspondence between physical materials and extended physical materials.

[0123] Through the above process, the embodiments of this application can export the physical materials used in the virtual scene and their associated extended physical material information completely and structurally as a material resource package in the first running environment of Unreal Engine, so that the environment sampling logic can still be used in other running environments that are not on the native platform, and maintain consistent judgment behavior and gameplay effects.

[0124] For example, please refer to Figure 7 , Figure 7 The diagram illustrates a principle diagram of storing environmental category information via environmental tags, as provided in an embodiment of this application. Figure 7As shown, when constructing environment labels, the entire space of the virtual scene can be divided into multiple regions according to predetermined specifications. Each region can be recorded using tiles combined with coordinates. Each region can be further divided into multiple plots. In three-dimensional space, plots can also have layers (e.g., z=0, z=1000, etc.). Thus, based on the plot's planar location and layer number, an environment label corresponding to a location can be recorded. For example, a plot at layer z=0 corresponds to the environment label "Env=Rock," and at layer z=1000, the corresponding environment label is "Env=Water." The specific plot and layer division standards can be flexibly set according to actual needs, and this application does not impose any restrictions on this.

[0125] In contrast, please refer to Figure 8 , Figure 8 The diagram illustrates the relationship between data in a material resource package and a virtual scene, as provided in an embodiment of this application. The technical solution in this embodiment enables standardized encapsulation and cross-platform reuse of scene objects in a virtual scene through precise correspondence between structured data and scene objects. Figure 8 The document lists two specific data entries, each organized in standard JSON format and containing fields such as MaterialId, MaterialName, MaterialType, and CustomData. MaterialId is a numeric identifier uniquely identifying the physical material; MaterialName is the readable name of the physical material; MaterialType distinguishes the category or purpose of the physical material; and CustomData is a custom data container used to hold platform-independent or engine-specific extended attributes. In this embodiment, CustomData embeds the SurfaceType attribute to identify the surface characteristics of the physical material (e.g., 6 represents stone, 19 represents brick). This explicit association between structured data and scene objects means that relevant information is no longer implicitly or hard-coded into scene meshes or texture files, but exists independently as parsable and reusable metadata. Therefore, during cross-platform export, it can be independent of the original engine's resource dependencies, reconstructing the behavior and visual representation of physical materials on the target platform solely through standardized fields such as MaterialId and SurfaceType.

[0126] It's easy to understand that related technologies store environment category information through environment tags, exporting data in blocks by plot. Each plot contains sub-plots, and environment category information is stored hierarchically along the vertical axis. This results in data logic being strongly bound to plots, growing exponentially with map size, reaching GB levels in large scenes. Furthermore, due to the extensive duplication of identical material information, data utilization is low. In contrast, the technical solution in this application uses physical materials as the basic export unit. Scene objects only need to reference material numbers, eliminating the need to repeatedly store specific physical material data. A deduplication mechanism ensures that only one copy of the same physical material is exported, decoupling data logic from objects and supporting multiple objects sharing the same material resource. This optimization brings extremely high data utilization. In large scenes, only a small number of physical materials are needed to support a large number of scene objects, significantly reducing storage overhead and loading burden. Simultaneously, the material resource package built based on material numbers maintains the consistency of environment sampling logic and the accuracy of gameplay effects even outside the native Unreal Engine environment, providing solid technical support for cross-platform scene reuse, dynamic environment determination, and multi-terminal collaborative development.

[0127] To more intuitively compare the effects of the technical solution provided in this application embodiment and the traditional solution, a material resource package was exported using the technical solution provided in this application embodiment in a virtual scene. The traditional solution, however, sampled at equal intervals according to land parcels, recording the environmental category information corresponding to each sampling point to obtain the corresponding offline file. The material resource package exported in this application embodiment is only 7KB in size, while the offline file is 977MB in size, a significant difference. Simultaneously, in terms of data querying and usage, the static lookup mode of "pre-calculation, full storage" has been shifted to a flexible mode of "runtime physical query, dynamic calculation."

[0128] As can be seen, the technical solution in this application abandons the traditional approach of brute-force, equally spaced sampling of the entire map, and instead captures and exports the definitions and properties of all physical materials in the scene, achieving exponential compression of data volume and improved system flexibility. The exported product is reduced from a bloated 977MB of sampling point data to only 7KB of material metadata, significantly reducing memory resource consumption and better supporting dynamic scenes and complex material rules.

[0129] Specifically, in some embodiments, the material resource package is loaded and the application is run in a second runtime environment to establish the association between physical materials and extended physical materials, including: Call the deserialization interface in the second runtime environment to parse the binary data files and structured data files in the material resource package; Based on the parsing results of the binary data file, the physical materials and the hierarchy of dependent objects are reconstructed in the second runtime environment, and the physical materials are registered to the global object manager; Based on the parsing results of the structured data file, the extended physical material is initialized in the second runtime environment; Establish the association between physical materials and extended physical materials based on the material numbers in the material resource package.

[0130] In this application embodiment, a specific implementation method is provided for loading material resource packages and establishing the association between physical materials and extended physical materials in a second running environment. This method achieves seamless migration of environment sampling logic from the native platform to multiple platforms through deserialization, resource reconstruction and number mapping, ensuring the consistency of environment judgment behavior and gameplay effects in cross-platform environments.

[0131] For example, please refer to Figure 9 , Figure 9 The diagram illustrates a flowchart of loading a material resource package according to an embodiment of this application. In this embodiment, the deserialization interface supported by the application is called in the second runtime environment to parse the binary data file and the structured data file in the material resource package. The binary data file carries the serialized information of the physical material and its dependent object hierarchy, while the structured data file contains the complete definition of the extended physical material, including material type identifier, attribute parameters, external resource references, and preset operation rules.

[0132] After parsing the binary data file, the physical materials and their dependent object hierarchy are reconstructed in the second runtime environment based on the parsing results. The dependent object hierarchy includes resources such as geometry, colliders, and texture references, which are reassociated with the corresponding physical materials during reconstruction. Once reconstruction is complete, the physical materials are registered with the global object manager of the second runtime environment, ensuring they can be correctly invoked in collision detection and rigid body simulation by the physics engine (such as PhysX), thereby guaranteeing the correctness of physical interaction behavior.

[0133] Simultaneously, the structured data file is parsed, and the extended physical material is initialized in the second runtime environment. During the initialization process, the extended physical material loads its attribute parameters and external resource references. However, since the second runtime environment typically does not have the ability to edit native extended physical materials, this initialization data is only used for runtime logic decisions and does not participate in the underlying physical simulation.

[0134] Furthermore, in this embodiment, an association between physical materials and extended physical materials is established based on the material ID in the material resource package. Here, the material ID serves as a unique identifier, binding the physical material and extended physical material in the first operating environment. In the second operating environment, the mapping relationship between the two can be quickly reconstructed using the ID index. This association allows, in the subsequent environment sampling process, once the physical collision detection obtains the target physical material, the corresponding extended physical material can be found through this mapping, and its preset calculation rules can be invoked to determine the environment category.

[0135] It is understood that, in this embodiment of the application, the deserialization reconstruction and number mapping mechanism enables precise association between physical materials and extended physical materials in the second runtime environment, thus solving the problem of extended physical materials being unresolvable on non-native platforms. This not only ensures the availability of the material resource package but also ensures that the environment sampling logic remains completely consistent across different runtime environments.

[0136] Specifically, in some embodiments, determining the target sampling location in a virtual scene based on application business data includes: Analyze business data to identify virtual objects participating in virtual scene interactions in the application and the current interaction event types of the virtual objects; The target sampling location is determined in the virtual scene based on the virtual object and the type of interaction event.

[0137] In this application embodiment, a specific implementation method for dynamically determining the target sampling location based on business data is provided. This method realizes the precise linkage between environmental sampling logic and virtual scene interaction behavior by parsing high-level business semantics into spatial coordinate input, ensuring that environmental perception can respond to gameplay requirements in real time.

[0138] Specifically, in this embodiment, the application's business data is first parsed to identify the virtual objects participating in the interaction in the current virtual scene and the current interaction event type of those virtual objects. Here, virtual objects can be player-controlled characters, non-player characters, vehicles, interactive objects, or skill projectiles, etc., which are the core entities in the business data; the interaction event type describes the action or triggered state of the virtual object, such as normal movement, skill release, climbing, driving, picking up items, or colliding with the environment. The business data is usually updated by the application's main logic module every frame or when a key event is triggered, and includes information such as object coordinates, orientation, action state, skill parameters, and task progress.

[0139] After identifying the virtual object and the type of interaction event, the target sampling location is determined in the virtual scene based on the characteristics of the virtual object and the specific nature of the interaction event. For example, if the virtual object is a character and the interaction event is releasing a fire skill forward, the landing point of the skill's trajectory or the center of the contact surface with the target can be used as the target sampling location to determine whether the point is located in water or mud, thereby triggering skill effect adjustments; if the interaction event is a character walking along a path, the current position of the character's feet or the area that the character is about to enter can be used as the target sampling location to calculate in advance the impact of terrain on movement speed or control; if the interaction event is a vehicle sailing on water, the contact point between the bottom of the vehicle and the water surface can be used as the target sampling location to determine buoyancy and drag parameters.

[0140] In this way, the determination of the target sampling location is no longer static or preset, but closely follows the real-time state and interaction intent of the virtual object, enabling environmental sampling to serve the gameplay logic accurately and on demand. At the same time, because business data can be flexibly defined in different application scenarios, this solution has good versatility and scalability, and can be adapted to various virtual scenario types such as games, simulation training, and emergency command.

[0141] It is understood that, in this embodiment of the application, by combining business data parsing with interactive event mapping, a deep coupling between environmental sampling input and upper-layer gameplay logic is achieved in the technical architecture. This ensures both the real-time and relevance of environmental perception and avoids the performance waste caused by full-map scanning or invalid sampling, providing efficient and reliable environmental information support for the dynamic interaction and differentiated strategies of virtual scenes.

[0142] Specifically, in some embodiments, the interaction event types include movement-related interactions and action-related interactions; determining the target sampling location in the virtual scene based on the virtual object and the interaction event type includes: If the interaction event type is a mobile interaction, obtain the object position and posture parameters of the virtual object in the virtual scene, and determine the target sampling position based on the object position and posture parameters; If the interaction event type is a function-based interaction, detect the coordinates of the action point where the virtual object triggers a specific function in the virtual scene, and determine the target sampling position based on the action point coordinates.

[0143] In this embodiment, a method for refining target sampling locations based on interaction event types is provided. By classifying interactive behaviors into movement-type interactions and action-type interactions, and adopting object posture-driven and function action point positioning strategies respectively, the method achieves accurate matching between environmental sampling locations and virtual object behavior patterns, further improving the real-time performance and business relevance of environmental perception.

[0144] Specifically, in this embodiment, the interaction event types can be divided into two main categories: movement-related interactions and action-related interactions. The former refers to the behavior of virtual objects changing their position or posture in a virtual scene, such as walking, running, jumping, flying, driving vehicles, climbing, etc.; the latter refers to the behavior of virtual objects triggering specific functions or producing direct effects in the scene, such as releasing skills, throwing objects, using tools, physical collisions with the environment, triggering mechanisms, etc. The methods for determining the target sampling position also differ for these two different interaction modes.

[0145] In some embodiments, when the interaction event type is a movement-related interaction, the object's position and posture parameters in the virtual scene can be obtained. Here, the object position typically refers to the virtual object's three-dimensional coordinates in the world coordinate system, such as the center of the character's feet or the center of the vehicle's chassis; posture parameters include the object's orientation, pitch angle, roll angle, etc., used to describe its spatial posture. Based on the object's position and posture parameters, key points that are in direct or imminent contact with the environment can be calculated, such as the position of the character's feet, the ground contact point of the vehicle's tires, and the ground landing point in the direction the character is facing. These points are determined as target sampling positions to detect the current or upcoming environment category, thereby adjusting movement speed, friction, sound effects, or animation performance.

[0146] In other embodiments, when the interaction event type is a function-based interaction, the coordinates of the action point where a virtual object triggers a specific function in the virtual scene can be detected. The action point coordinates refer to the precise location in space where the function or behavior has a direct impact, such as the trajectory of a skill's trajectory, the point where a projectile hits a target, the contact point between a tool and the scene, or the center of an explosion or shockwave. These coordinates are typically calculated and transmitted by the application logic module when the event is triggered. The environment sampling module directly uses these coordinates as the target sampling location to determine the environment category to which the point belongs and executes the corresponding gameplay logic accordingly, such as adjusting skill damage, triggering environmental effects, or changing physical feedback.

[0147] Understandably, through this classification and processing mechanism, the embodiments of this application can determine the spatial input of environmental sampling in an appropriate manner under different interaction scenarios, so that the environmental information can not only reflect the current state of virtual objects, but also proactively capture the impact of upcoming interactions. This not only ensures a high degree of consistency between environmental perception and gameplay logic, but also optimizes sampling efficiency, avoids redundant detection in irrelevant locations, and provides more refined technical support for the dynamic interaction and cross-platform consistency of virtual scenes.

[0148] Specifically, in some embodiments, physical collision detection is performed at the target sampling location to determine the target scene object that has been hit in the virtual scene, including: Based on the application's business data, determine the detection direction when performing physical collision detection; Starting from the target sampling location, a detection ray is emitted along the detection direction; In a virtual scene, the first scene object hit by the detection ray is identified as the target scene object.

[0149] In this application embodiment, a specific implementation method is provided for performing physical collision detection at the target sampling location and accurately determining the target scene object. This method dynamically sets the detection direction by combining business data and obtains the first hit scene object by using a ray detection mechanism, thereby achieving a high degree of fit between environmental sampling and virtual scene interaction behavior, and improving the accuracy and real-time performance of environmental perception.

[0150] Specifically, in this embodiment, the triggering of physical collision detection does not employ a fixed direction or globally preset rules, but rather determines the detection direction based on the application's business data. This business data may include the real-time state and interaction intent of virtual objects, such as the character's movement direction, skill release trajectory, vehicle travel route, and camera viewing angle. This information reflects the spatial extension trend of the current interaction. By parsing this business data, the directional information most relevant to the current interaction can be extracted as the detection direction for physical collision detection. For example, when the character moves forward, the detection direction can be set to the direction the character is facing; when a skill is released, it can be set to the flight direction of the skill projectile; and when detecting from the camera's perspective, it can be set to the line-of-sight direction.

[0151] After determining the detection direction, a detection ray is emitted from the target sampling position along that direction. The detection ray is a highly efficient geometric query tool, defined by its starting point and direction, extending infinitely in the three-dimensional space of the virtual scene until it intersects with geometry or colliders in the scene. The physics engine (such as PhysX) performs a fast intersection test on the ray at a low level, traversing the set of colliders in the scene to determine which objects intersect with the ray and returning the intersection information.

[0152] In a virtual scene, the first scene object hit by the detection ray is identified as the target scene object. Here, "first" refers to the scene object closest to the starting point and the first one touched by the ray in the detection direction. This typically corresponds to the environmental entity that the virtual object is currently in direct contact with or about to contact. For example, in character movement detection, the first object hit might be the ground, wall, or obstacle in front; in skill release detection, it might be the target hit by the projectile or terrain. By selecting the first object hit, it ensures that the environmental sampling reflects the most relevant and timely environmental information, avoiding interference or misjudgment caused by subsequently hit scene objects.

[0153] It is understood that, in this embodiment of the application, by driving the detection direction selection with business data and combining ray detection with hit rules, precise linkage between environmental sampling input and virtual object behavior can be achieved in the technical architecture. This approach not only improves the targeting and efficiency of physical collision detection but also ensures that the environmental category determination can truly reflect the spatial relationships of virtual objects during runtime.

[0154] Specifically, in some embodiments, determining the target physical material to which the target scene object is bound includes: Determine the coordinates of the contact point between the detection ray and the surface of the target scene object; Based on the target scene object and the coordinates of the contact point, the physical engine interface provided by the second runtime environment is called to determine the target physical material.

[0155] In this embodiment of the application, a specific implementation method for determining the target physical material bound to the target scene object is provided. This method obtains the precise contact point coordinates between the detection ray and the surface of the target scene object, and calls the physical engine interface of the second running environment to query, thereby realizing the accurate extraction of physical material information and providing reliable underlying data support for subsequent environment category determination.

[0156] Specifically, in this embodiment, after the detection ray is emitted at the target sampling location and intersects with the target scene object, the coordinates of the contact point between the detection ray and the object's surface can be further determined. The contact point coordinates are the three-dimensional spatial position where the ray intersects with the surface of the geometry or collider, typically returned by the physics engine during ray detection. They reflect the specific location where the virtual object directly contacts the environment under the current interaction behavior. For example, in character movement detection, the contact point might be the point where the foot intersects with the ground; in skill release detection, the contact point might be the location where the projectile hits a wall or the ground. These coordinates not only contain positional information but can also be combined with the collision normal returned by the physics engine to describe the orientation of the contact surface.

[0157] After obtaining the contact point coordinates, the physics engine interface provided by the second runtime environment can be invoked based on the target scene object and the contact point coordinates to query and determine the target physical material bound to that location. The physics engine interface is a low-level function in the second runtime environment used to access the properties of physical objects. It can return the physical material information applied at that location, including basic physical properties such as friction coefficient, elasticity coefficient, and density, based on the scene object and its spatial position. Since the target scene object is registered in the physics engine's object manager when the material resource package is loaded, and the binding relationship between the physical material and the object is correctly restored when the resource package is loaded, the physics engine can accurately return the target physical material corresponding to the contact point.

[0158] It is understandable that, through this mechanism based on the query of the contact point coordinates and the physics engine interface, the embodiments of this application can obtain the physical material of the target scene object at a specific location in the second operating environment in a manner equivalent to the original first operating environment, ensuring the consistency of the environment sampling process across different platforms.

[0159] Specifically, in some embodiments, determining the environmental category information corresponding to the target sampling location based on the target extended physical material includes: Detect the normal vector of the surface of the target scene object at the coordinates of the contact point; Based on the contact point coordinates, normal vector, and target extended physical material, determine the environmental category information corresponding to the target sampling location.

[0160] In this embodiment of the application, a specific implementation method is provided for determining the environmental category information at the target sampling location based on the target extended physical material. This method achieves accurate and dynamic determination of the environmental category by fusing the contact point coordinates, surface normal vectors and preset operation rules in the target extended physical material, so that the environmental perception can fully reflect the geometric features and interaction details of the virtual scene.

[0161] Specifically, in this embodiment, after obtaining the target scene object and contact point coordinates through physical collision detection, and further determining the target physical material bound to the target scene object and its associated target extended physical material, the normal vector of the target scene object's surface at the contact point coordinates can be detected. The normal vector is a unit vector perpendicular to the surface's tangent plane, used to describe the surface's orientation at that location; for example, the normal vector of a horizontal ground point upwards, the normal vector of a wall points horizontally outwards, and the normal vector of a slope is inclined. This information is usually returned by the physics engine during ray detection or collision query, or it can be calculated by accessing the geometric data of the target scene object. The introduction of normal vectors allows environmental category determination to not only rely on location but also combine spatial features such as surface tilt and orientation, thereby supporting more complex gameplay logic, such as slowing down on a slope or being unable to walk on a vertical wall.

[0162] After obtaining the contact point coordinates and normal vector, these are combined with preset calculation rules in the target extended physical material to calculate the environmental category information at the target sampling location. For example, in some embodiments, the target extended physical material includes material type identifiers (such as water, grassland, mud, lava, etc.), attribute parameters (such as drag coefficient, skill influence factor, etc.), external resource references (such as weight maps, normal vector sampling configurations), and calculation rules for environmental determination. These rules can be flexibly defined during design. For example, for water materials, it can be set that when the contact point normal vector is nearly vertically upward and the height is below the water surface threshold, it is determined to be in water; for mud materials, the probability of entrapment can be calculated by combining the normal vector tilt and the weight map sampling value; for lava materials, the normal vector is ignored, and the determination is based solely on height and area identifier. The system calls these rules, using the contact point coordinates and normal vector as input parameters, performs corresponding logical or interpolation calculations, and outputs environmental category information.

[0163] It is understandable that by combining contact point coordinates, normal vectors, and target extended physical material calculation rules, this embodiment of the application can dynamically calculate the environment category of the target sampling position in the second operating environment with equivalent or even higher accuracy than the first operating environment. This not only ensures the consistency of cross-platform environment sampling logic but also enables environmental feedback to better fit the geometry and interaction state of the virtual scene, providing reliable environmental input for character control, skill effects, and automatic decision-making.

[0164] The process of environmental sampling in the virtual scene in this application will be introduced and explained below with reference to specific application embodiments.

[0165] For example, please refer to Figure 10 , Figure 10 The diagram illustrates a flowchart of an environment sampling process for a virtual scene according to an embodiment of this application. In this embodiment, the process for performing environment sampling in a virtual scene may include: 1. Determine the target sampling location: Determine the actual sampling coordinates within the virtual scene (such as the character's feet or the skill's hit point) as the starting point for ray detection.

[0166] 2. Collision Detection and Result Determination: The PhysX engine is invoked to perform raycast detection. A ray is emitted vertically downwards (or in other directions) from the sampled coordinates. The PhysX engine detects the nearest ground object (i.e., the target scene object) and returns key information, including: the ground object; the precise location of the ground (world coordinates); the ground normal vector (used to determine slope and orientation); if it is a mesh, the triangle number is additionally returned (identifying the specific mesh face hit).

[0167] 3. Obtain the target physical material of the target scene object: Using the surface object, the precise location of the surface and the triangular face number, call the PhysX interface getMaterialFromInternalFaceIndex to dynamically calculate and return the associated physical material (PxMaterial).

[0168] 4. Obtain the target extended physical material: Obtain the associated extended physical material through the pre-stored material number.

[0169] 5. Determine environment category information: Call the predefined virtual function interface, combine the precise location (or sampled coordinates) of the ground surface, normal vector and other parameters to calculate the environment category information of a specific location and a specific normal vector in real time, so as to facilitate the determination of terrain type, combat gain coefficient, etc.

[0170] In contrast, please refer to Figure 11 , Figure 11 The diagram illustrates a principle diagram of environmental sampling based on environmental tags provided in an embodiment of this application. In conventional schemes, when environmental information needs to be obtained at a target sampling location, the plot and corresponding layer number to which the target sampling location belongs are determined, and then the corresponding environmental tag is obtained as environmental category information. For example, the world coordinates of the sampling point are converted into the corresponding plot plane number through a predetermined division specification. This step realizes a fast mapping from continuous space to a discrete grid, so that any location can be assigned to a specific plot unit. Subsequently, according to the numbering rules in the z-axis direction, all predefined surface layers within the plot are searched in the vertical direction, and the surface layer that is closest to the z-axis coordinates of the sampling point and located below it is selected as the valid result.

[0171] By comparing the implementation logic of the two, it can be understood that the technical solution of this application, by introducing a dynamic environment sampling mechanism based on physical collision detection and extended physical materials, is significantly superior to the traditional solution that relies on static labels in terms of accuracy, dynamic response and special material adaptation.

[0172] While traditional methods acquire environmental category information through coordinate transformation and plot indexing, their sampling accuracy is limited by fixed grid intervals and center-point sampling. They can only distinguish macroscopic environmental categories, failing to capture subtle material differences and struggling to handle multi-layered surface conditions. More importantly, they rely on offline pre-generated static plot data. If the terrain changes dynamically, such as with destructible surface collapse or water level fluctuations, the sampling results cannot be updated, leading to delayed or even erroneous environmental feedback. Furthermore, traditional methods lack runtime computing power to handle complex material effects such as weighted map-controlled material distribution and normal vector-based surface orientation determination, limiting the freedom of gameplay design.

[0173] In contrast, this application's embodiment relies on the real-time ray detection capability of the physics engine to locate sampling points with finer granularity and perform dynamic calculations by combining contact point coordinates, surface normal vectors, and preset calculation rules in the extended physical materials. This allows environmental sampling to not only distinguish the real materials under multiple surfaces but also respond in real time to changes in the virtual scene. Whether it's terrain collapse or dynamic water bodies, the sampling results can be updated instantly, ensuring that environmental perception is synchronized with the scene state. Simultaneously, through custom algorithms for extended physical materials, this application can fully reproduce all material effects of the original platform, enabling complex and nuanced environmental interactions. At the data level, traditional solutions require storing static plot information that expands rapidly with map size, while this application only needs to store lightweight data. Through dynamic referencing and calculation by physical objects at runtime, it significantly reduces resource volume and improves the flexibility and maintainability of cross-platform deployment.

[0174] Specifically, in some embodiments, the method further includes: Based on the application's business data, detect whether the target scene object has changed; among which, changes to the target scene object include changes in physical material and changes in form; If the physical material of the target scene object changes, the target physical material bound to the current target scene object is redefined; If the target scene object changes shape, return to the step of determining the target sampling position in the virtual scene.

[0175] In this embodiment of the application, a specific implementation method for dynamically responding to changes in target scene objects during environmental sampling is also provided. This method continuously monitors business data to determine whether the physical material or form of the target scene object has changed, and adjusts the sampling logic accordingly to ensure that environmental perception can reflect the latest state of the virtual scene in real time and accurately.

[0176] Specifically, in this embodiment, after any step of the environmental sampling process is executed, the system continuously detects whether the target scene object has changed based on the application's business data. Changes to the target scene object include two categories: first, changes in physical materials, meaning the physical materials bound to the object are replaced or updated during operation, such as destructible terrain changing from rock to gravel after being attacked, or water changing from water to ice after freezing; second, changes in form, meaning the spatial form of the object changes within the scene, such as terrain collapsing to create new surfaces, buildings being destroyed to expose their internal structures, or deployable devices changing their shape. These changes are typically triggered by gameplay logic, physics simulation, or event systems and are updated in real-time to the business data.

[0177] When a change in the physical material of a target scene object is detected, the target physical material currently bound to that object will be redefined. Since the target physical material is the basis for determining the environment category, a change in the material means that its associated environment attributes and rules may be completely different. Therefore, a new physical material must be obtained, and the corresponding extended physical material must be found through the association relationship to ensure that subsequent calculations of environment category information are based on the latest material data.

[0178] Conversely, when a change in the shape of the target scene object is detected, the process returns to the step of determining the target sampling position in the virtual scene. A shape change often means that the original target sampling position is no longer valid. For example, after the terrain collapses, the position under the character's feet may be suspended in the air or on a new surface. In this case, it is necessary to recalculate the target sampling position based on the business data according to the new scene state and interaction requirements, and then continue to execute the subsequent collision detection and material determination process.

[0179] Understandably, through this dynamic monitoring and branching processing mechanism, the embodiments of this application can keep the environmental sampling input and the target object state updated synchronously during the operation of the virtual scene, avoiding environmental feedback lag or errors caused by scene changes. This not only improves the real-time performance and accuracy of environmental perception, but also enables the gameplay logic to respond based on the latest scene state, enhancing the interactive realism and strategic depth of the virtual scene.

[0180] For example, please refer to Figure 12 and Figure 13 ,in, Figure 12 The image shown is a schematic diagram of a game screen before a scene change, provided in an embodiment of this application. Figure 13 The image shows a schematic diagram of a game screen after a scene change, as provided in an embodiment of this application. Figure 12 In the game, the virtual scene is presented as an initial aquatic environment. The water surface exists as a static virtual object, bound to the physical material of the water. During underwater combat, the movement and skill release of the virtual character follow the rules of the aquatic environment. When the player triggers certain mechanisms, the scene changes state, such as... Figure 13 As shown, when the physical objects on the water surface are dynamically repositioned (e.g., descending to expose previously submerged land areas), the system immediately re-detects the changes in physical objects in that area, causing the physical material corresponding to certain sampling locations to switch from "water" to "land." At this time, if a virtual character initiates combat in this area, the battlefield environment appearance and combat logic will be switched synchronously based on the new environmental category information loading rules (e.g., movement speed recovery, skill effect adjustments, enemy behavior changes, etc.).

[0181] It can be seen that this dynamic scene interaction mechanism transforms the game scene from a fixed setting into an interactive object. It not only achieves visual form switching, but also allows gameplay elements such as combat type, character actions, and skill effects to dynamically evolve with the scene through real-time sampling and adjustment of environmental category information, greatly enhancing the game's immersion and strategic diversity.

[0182] In summary, the technical solutions provided in this application have lightweight storage, high-precision sampling, dynamic adaptation, and cross-platform compatibility as their core advantages. They have achieved a paradigm shift from static pre-storage to real-time calculation of environmental category information, providing high-performance and highly scalable underlying technical support for environmental response and gameplay logic innovation in large-scale open virtual scenes.

[0183] Reference Figure 14 In this embodiment of the application, an environment sampling device for a virtual scene is also provided, the environment sampling device for the virtual scene comprising: The acquisition unit 1410 is used to acquire the material resource package corresponding to the application; wherein, the application generates a virtual scene during runtime, the material resource package is generated based on the application in the first running environment, and the material resource package stores various physical materials and extended physical materials associated with the physical materials; Loading unit 1420 is used to load material resource packages and run applications in the second running environment, and to establish the association between physical materials and extended physical materials. The processing unit 1430 is used to determine the target sampling location in the virtual scene based on the application's business data; The detection unit 1440 is used to perform physical collision detection at the target sampling location to determine the target scene object that hits the virtual scene and the target physical material bound to the target scene object. The execution unit 1450 is used to determine the target extended physical material corresponding to the target physical material according to the association relationship, and to determine the environmental category information corresponding to the target sampling location according to the target extended physical material.

[0184] Optionally, in some embodiments, the apparatus further includes a generation unit, which is specifically used for: The scene data of the virtual scene is loaded in the first runtime environment; the scene data includes the scene objects, geometry, and physical material data in the virtual scene. Based on the scene data, determine the hierarchy of dependent objects corresponding to the physical materials; Assign a unique material number to each physical material, and record the relationship between physical materials and extended physical materials based on the material number; Serialize the physical material and dependent object hierarchy into a binary data file, and serialize the extended physical material into a structured data file; By integrating binary data files, structured data files, and material numbers, a material resource package is obtained.

[0185] Optionally, in some embodiments, the generating unit is specifically used for: Create a temporary container; Iterate through each scene object in the scene data to determine the geometric shape bound to each scene object; Traverse the geometry layer by layer to determine the physical material on which each layer of geometry depends; If the currently identified physical material is not stored in the temporary container, add the currently identified physical material to the temporary container; After traversing the scene data and geometry, a hierarchy of dependent objects corresponding to the physical materials is constructed based on the reference relationships between each physical material and the scene objects and geometry in the temporary container.

[0186] Optionally, in some embodiments, the loading unit is specifically used for: Call the deserialization interface in the second runtime environment to parse the binary data files and structured data files in the material resource package; Based on the parsing results of the binary data file, the physical materials and the hierarchy of dependent objects are reconstructed in the second runtime environment, and the physical materials are registered to the global object manager; Based on the parsing results of the structured data file, the extended physical material is initialized in the second runtime environment; Establish the association between physical materials and extended physical materials based on the material numbers in the material resource package.

[0187] Optionally, in some embodiments, the processing unit is specifically used for: Analyze business data to identify virtual objects participating in virtual scene interactions in the application and the current interaction event types of the virtual objects; The target sampling location is determined in the virtual scene based on the virtual object and the type of interaction event.

[0188] Optionally, in some embodiments, the interaction event types include movement-type interactions and action-type interactions; the processing unit is specifically used for: If the interaction event type is a mobile interaction, obtain the object position and posture parameters of the virtual object in the virtual scene, and determine the target sampling position based on the object position and posture parameters; If the interaction event type is a function-based interaction, detect the coordinates of the action point where the virtual object triggers a specific function in the virtual scene, and determine the target sampling position based on the action point coordinates.

[0189] Optionally, in some embodiments, the detection unit is specifically used for: Based on the application's business data, determine the detection direction when performing physical collision detection; Starting from the target sampling location, a detection ray is emitted along the detection direction; In a virtual scene, the first scene object hit by the detection ray is identified as the target scene object.

[0190] Optionally, in some embodiments, the detection unit is specifically used for: Determine the coordinates of the contact point between the detection ray and the surface of the target scene object; Based on the target scene object and the coordinates of the contact point, the physical engine interface provided by the second runtime environment is called to determine the target physical material.

[0191] Optionally, in some embodiments, the execution unit is specifically used for: Detect the normal vector of the surface of the target scene object at the coordinates of the contact point; Based on the contact point coordinates, normal vector, and target extended physical material, determine the environmental category information corresponding to the target sampling location.

[0192] Optionally, in some embodiments, the apparatus further includes an updating unit, which is specifically used for: Based on the application's business data, detect whether the target scene object has changed; among which, changes to the target scene object include changes in physical material and changes in form; If the physical material of the target scene object changes, the target physical material bound to the current target scene object is redefined; If the target scene object changes shape, return to the step of determining the target sampling position in the virtual scene.

[0193] It is understandable that, such as Figure 5 The content of the virtual scene environment sampling method embodiment shown is applicable to the environment sampling device embodiment of this virtual scene. The specific functions implemented by the environment sampling device embodiment of this virtual scene are the same as those shown. Figure 5 The environmental sampling method for the virtual scene shown is the same as that in the embodiment, and the beneficial effects achieved are the same as those in the example. Figure 5 The beneficial effects achieved by the virtual scene environment sampling method embodiment shown are also the same.

[0194] This application also discloses an electronic device, including: At least one processor; At least one memory for storing at least one program; When at least one program is executed by at least one processor, such that at least one processor implements as Figure 5 An example of an environment sampling method for a virtual scene is shown.

[0195] The electronic device in the embodiments of this application may be a terminal device, a computer device, or a server device.

[0196] For example, refer to Figure 15 , Figure 15 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Taking a terminal device as an example, Figure 15 In this context, the electronic device 1500 may include an RF (Radio Frequency) circuit 1510, a memory 1520 including one or more computer-readable storage media, an input unit 1530, a display unit 1540, a sensor 1550, an audio circuit 1560, a short-range wireless transmission module 1570, a processor 1580 including one or more processing cores, and a power supply 1590, among other components. Those skilled in the art will understand that... Figure 15 The device structure shown does not constitute a limitation on the terminal device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0197] RF circuit 1510 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink information from the base station and hands it over to one or more processors 1580 for processing; additionally, it transmits uplink data to the base station. Typically, RF circuit 1510 includes, but is not limited to, an antenna, at least one amplifier, a tuner, one or more oscillators, a SIM card, a transceiver, a coupler, an LNA (Low Noise Amplifier), a duplexer, etc. Furthermore, RF circuit 1510 can also communicate wirelessly with networks and other devices. Wireless communication can use any communication standard or protocol, including but not limited to GSM (Global System for Mobile communication), GPRS (General Packet Radio Service), CDMA (Code Division Multiple Access), WCDMA (Wideband Code Division Multiple Access), LTE (Long Term Evolution), email, SMS (Short Messaging Service), etc.

[0198] Memory 1520 can be used to store software programs and modules (or units). Processor 1580 executes various functional applications and data processing by running the software programs and modules (or units) stored in memory 1520. Memory 1520 may primarily include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.); the data storage area may store data created based on the use of electronic device 1500 (such as audio data, telephone directory, etc.). Furthermore, memory 1520 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, memory 1520 may also include a memory controller to provide access to memory 1520 for processor 1580 and input unit 1530. Although Figure 15 The RF circuit 1510 is shown, but it is understood that it is not a necessary component of the electronic device 1500 and can be omitted as needed without changing the nature of the invention.

[0199] Input unit 1530 can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical, or trackball signal inputs related to object settings and function control. Specifically, input unit 1530 may include touch-sensitive surface 1531 and other input devices 1532. Touch-sensitive surface 1531, also known as a touch display screen or touchpad, can collect touch operations on or near the object (such as operations performed by the object using a finger, stylus, or any suitable object or accessory on or near the touch-sensitive surface 1531), and drive the corresponding connection device according to a pre-set program. Optionally, touch-sensitive surface 1531 may include two parts: a touch detection device and a touch controller. The touch detection device detects the touch position of the object and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, sends it to processor 1580, and can receive and execute instructions from processor 1580. In addition, the touch-sensitive surface 1531 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. Besides the touch-sensitive surface 1531, the input unit 1530 may also include other input devices 1532. Specifically, other input devices 1532 may include, but are not limited to, one or more of the following: a physical keyboard, function keys (such as volume control buttons, power buttons, etc.), a trackball, a mouse, and a joystick.

[0200] Display unit 1540 can be used to display information input by an object or information provided to an object, as well as various graphical object interfaces for controlling electronic device 1500. These graphical object interfaces can be composed of graphics, text, icons, video, and any combination thereof. Display unit 1540 may include display panel 1541, optionally configured as LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), etc. Further, touch-sensitive surface 1531 may cover display panel 1541. When touch-sensitive surface 1531 detects a touch operation on or near it, it transmits the information to processor 1580 to determine the type of touch event. Subsequently, processor 1580 provides corresponding visual output on display panel 1541 according to the type of touch event. Although in Figure 15 In this embodiment, the touch-sensitive surface 1531 and the display panel 1541 are implemented as two separate components to realize input and output functions. However, in some embodiments, the touch-sensitive surface 1531 and the display panel 1541 can be integrated to realize input and output functions.

[0201] The electronic device 1500 may also include at least one sensor 1550, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor. The ambient light sensor can adjust the brightness of the display panel 1541 according to the ambient light level, and the proximity sensor can turn off the display panel 1541 or the backlight when the electronic device 1500 is moved to the ear. As a type of motion sensor, a gravity acceleration sensor can detect the magnitude of acceleration in various directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity and can be used for applications that recognize the phone's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition-related functions (such as pedometers, taps), etc. Other sensors that the electronic device 1500 may be configured with, such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be described in detail here.

[0202] Audio circuitry 1560, speaker 1561, and microphone 1562 provide an audio interface between the device and electronic equipment 1500. Audio circuitry 1560 converts received audio data into electrical signals and transmits them to speaker 1561, where speaker 1561 converts them into sound signals for output. Conversely, microphone 1562 converts collected sound signals into electrical signals, which are then received by audio circuitry 1560, converted back into audio data, processed by processor 1580, and then transmitted via RF circuitry 1510 to another electronic device, or output to memory 1520 for further processing. Audio circuitry 1560 may also include an earphone jack to facilitate communication between external headphones and electronic equipment 1500.

[0203] The short-range wireless transmission module 1570 can be a WIFI (wireless fidelity) module, Bluetooth module, or infrared module, etc. The electronic device 1500 can transmit information with wireless transmission modules on other devices via the short-range wireless transmission module 1570.

[0204] Processor 1580 is the control center of electronic device 1500. It connects various parts of the device via various interfaces and lines, and performs various functions and processes data of electronic device 1500 by running or executing software programs or modules stored in memory 1520 and calling data stored in memory 1520, thereby providing overall control of the device. Optionally, processor 1580 may include one or more processing cores; optionally, processor 1580 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and application programs, and the modem processor mainly handles wireless communication. It is understood that the aforementioned modem processor may also not be integrated into processor 1580.

[0205] Electronic device 1500 also includes a power supply 1590 (such as a battery) for supplying power to various components. Optionally, the power supply 1590 can be logically connected to the processor 1580 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. The power supply 1590 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0206] Although not shown, the electronic device 1500 may also include a camera, Bluetooth module, etc., which will not be described in detail here.

[0207] This application also discloses a computer-readable storage medium storing a processor-executable program, which, when executed by a processor, is used to implement, for example... Figure 5 An example of an environment sampling method for a virtual scene is shown.

[0208] Understandable, Figure 5 The content of the virtual scene environment sampling method embodiments shown is applicable to the embodiments of this computer-readable storage medium. The specific functions implemented by the embodiments of this computer-readable storage medium are the same as those in the embodiments of this computer-readable storage medium. Figure 5 The environmental sampling method for the virtual scene shown is the same as that in the embodiment, and the beneficial effects achieved are the same. Figure 5 The beneficial effects achieved by the virtual scene environment sampling method embodiment shown are also the same.

[0209] This application also discloses a computer program product or computer program, which includes computer instructions stored in the aforementioned computer-readable storage medium. Figure 15 The processor of the illustrated electronic device can read the computer instructions from the aforementioned computer-readable storage medium, and the processor executes the computer instructions, causing the computer device to perform... Figure 5 An example of an environment sampling method for a virtual scene is shown.

[0210] Understandable, Figure 5 The content of the virtual scene environment sampling method embodiments shown is applicable to this computer program product or computer program embodiment. The specific functions implemented by this computer program product or computer program embodiment are the same as those described above. Figure 5 The environmental sampling method for the virtual scene shown is the same as that in the embodiment, and the beneficial effects achieved are the same. Figure 5 The beneficial effects achieved by the virtual scene environment sampling method embodiment shown are also the same.

[0211] In some alternative embodiments, the functions / operations mentioned in the block diagrams may not occur in the order shown in the operation diagrams. For example, depending on the functions / operations involved, two consecutively shown blocks may actually be executed substantially simultaneously, or the blocks may sometimes be executed in reverse order. Furthermore, the embodiments presented and described in the flowcharts of this application are provided by way of example to provide a more comprehensive understanding of the technology. The disclosed methods are not limited to the operations and logic flows presented herein. Alternative embodiments are contemplated in which the order of various operations is changed and sub-operations described as part of a larger operation are executed independently.

[0212] Furthermore, although this application is described in the context of functional modules, it should be understood that, unless otherwise stated to the contrary, one or more of the functions and / or features may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding this application. Rather, given the properties, functions, and internal relationships of the various functional modules in the apparatus disclosed herein, the actual implementation of the module will be understood within the scope of conventional technology for an engineer. Therefore, those skilled in the art can implement the application set forth in the claims using ordinary techniques without excessive experimentation. It is also understood that the specific concepts disclosed are merely illustrative and not intended to limit the scope of this application, which is determined by the full scope of the appended claims and their equivalents.

[0213] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0214] In the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.

[0215] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable storage medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable storage medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.

[0216] It should be understood that various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0217] In the foregoing description of this specification, the references to terms such as "one embodiment," "another embodiment," or "some embodiments," etc., indicate that a specific feature, structure, material, or characteristic described in connection with an embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0218] Although embodiments of this application have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles and spirit of this application, the scope of which is defined by the claims and their equivalents.

[0219] The above is a detailed description of the preferred embodiments of this application, but this application is not limited to the embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of this application, and these equivalent modifications or substitutions are all included within the scope defined by the claims of this application.

Claims

1. A method for environmental sampling in a virtual scene, characterized in that, The method includes: Obtain the material resource package corresponding to the application; wherein, the application generates a virtual scene during runtime, the material resource package is generated based on the application in the first running environment, and the material resource package stores various physical materials and extended physical materials associated with the physical materials; In the second running environment, the material resource package is loaded and the application is run to establish the association between the physical material and the extended physical material; Based on the application's business data, determine the target sampling location in the virtual scene; Physical collision detection is performed at the target sampling location to determine the target scene object that hits the virtual scene and the target physical material bound to the target scene object. Based on the correlation, the target extended physical material corresponding to the target physical material is determined, and the environmental category information corresponding to the target sampling location is determined based on the target extended physical material.

2. The virtual scene environment sampling method according to claim 1, characterized in that, The material resource package is generated through the following steps: The scene data of the virtual scene is loaded in the first operating environment; wherein, the scene data includes the scene objects, geometric shapes and physical material data in the virtual scene; Based on the scene data, determine the hierarchy of dependent objects corresponding to the physical material; A unique material number is assigned to each of the physical materials, and the association between the physical materials and the extended physical materials is recorded based on the material number; The physical material and the dependent object hierarchy are serialized into a binary data file, and the extended physical material is serialized into a structured data file; The binary data file, the structured data file, and the material number are integrated to obtain the material resource package.

3. The virtual scene environment sampling method according to claim 2, characterized in that, The step of determining the dependency object hierarchy structure corresponding to the physical material based on the scene data includes: Create a temporary container; The scene objects in the scene data are traversed to determine the geometric shape bound to each scene object; The geometry is traversed layer by layer to determine the physical material on which each layer of the geometry depends; If the currently identified physical material is not stored in the temporary container, add the currently identified physical material to the temporary container; After the scene data and the geometry have been traversed, a hierarchy of dependent objects corresponding to the physical materials is constructed based on the reference relationships between each physical material in the temporary container and the scene object and the geometry.

4. The virtual scene environment sampling method according to claim 2, characterized in that, The process of loading the material resource package and running the application in the second runtime environment, and establishing the association between the physical material and the extended physical material, includes: The deserialization interface in the second runtime environment is invoked to parse the binary data file and the structured data file in the material resource package; Based on the parsing results of the binary data file, the physical material and the hierarchy of dependent objects are reconstructed in the second runtime environment, and the physical material is registered to the global object manager; Based on the parsing results of the structured data file, the extended physical material is initialized in the second runtime environment; Based on the material number in the material resource package, establish the association between the physical material and the extended physical material.

5. The virtual scene environment sampling method according to claim 1, characterized in that, Determining the target sampling location in the virtual scene based on the application's business data includes: The business data is parsed to identify the virtual objects participating in virtual scene interactions in the application and the current interaction event types of the virtual objects; The target sampling location is determined in the virtual scene based on the virtual object and the type of interaction event.

6. The virtual scene environment sampling method according to claim 5, characterized in that, The types of interactive events include movement-related interactions and action-related interactions; Determining the target sampling location in the virtual scene based on the virtual object and the interaction event type includes: If the interaction event type is a mobile interaction, obtain the object position and posture parameters of the virtual object in the virtual scene, and determine the target sampling position based on the object position and posture parameters; If the interaction event type is a function-based interaction, the coordinates of the action point where the virtual object triggers a specific function in the virtual scene are detected, and the target sampling position is determined based on the action point coordinates.

7. The virtual scene environment sampling method according to claim 1, characterized in that, The step of performing physical collision detection at the target sampling location to determine the target scene object that hits the virtual scene includes: Based on the application's business data, determine the detection direction when performing physical collision detection; Starting from the target sampling position, a detection ray is emitted along the detection direction; In the virtual scene, the first scene object hit by the detection ray is determined as the target scene object.

8. The virtual scene environment sampling method according to claim 7, characterized in that, Determining the target physical material bound to the target scene object includes: Determine the coordinates of the contact point between the detection ray and the surface of the target scene object; Based on the target scene object and the coordinates of the contact point, the physical engine interface provided by the second runtime environment is invoked to determine the target physical material.

9. The virtual scene environment sampling method according to claim 8, characterized in that, The step of determining the environmental category information corresponding to the target sampling location based on the target extended physical material includes: Detect the normal vector of the surface of the target scene object at the coordinates of the contact point; Based on the contact point coordinates, the normal vector, and the target extended physical material, the environmental category information corresponding to the target sampling location is determined.

10. The environment sampling method for a virtual scene according to any one of claims 1-9, characterized in that, The method further includes: Based on the application's business data, detect whether the target scene object has changed; wherein, the change of the target scene object includes changes in physical material and changes in form; If the physical material of the target scene object changes, the target physical material currently bound to the target scene object is redefined; If the target scene object undergoes a change in form, return to the step of determining the target sampling position in the virtual scene.

11. An environment sampling device for a virtual scene, characterized in that, The device includes: An acquisition unit is used to acquire a material resource package corresponding to the application; wherein, the application generates a virtual scene during runtime, the material resource package is generated based on the application in the first runtime environment, and the material resource package stores various physical materials and extended physical materials associated with the physical materials; The loading unit is used to load the material resource package and run the application in the second running environment, and to establish the association between the physical material and the extended physical material. The processing unit is used to determine the target sampling location in the virtual scene based on the application's business data; The detection unit is used to perform physical collision detection at the target sampling location to determine the target scene object that hits the virtual scene and the target physical material bound to the target scene object; An execution unit is configured to determine the target extended physical material corresponding to the target physical material based on the association relationship, and to determine the environmental category information corresponding to the target sampling location based on the target extended physical material.

12. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the environment sampling method for the virtual scene as described in any one of claims 1 to 10.

13. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the environment sampling method for the virtual scene as described in any one of claims 1 to 10.

14. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the environment sampling method for the virtual scene as described in any one of claims 1 to 10.