Ground surface rendering method and device, computer equipment and computer readable storage medium
By setting up dynamic texture containers and safe areas in the game rendering engine, obtaining terrain height information for surface rendering and fusion, the problems of high surface rendering consumption and poor flexibility in the existing technology are solved, and efficient rendering and diversified surface effects are achieved.
Patent Information
- Application Number
- CN202510435566.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-08
- Publication Date
- 2025-08-22
AI Technical Summary
The prior art surface rendering method consumes a lot of performance in game rendering, increases memory footprint and is less flexible, making it difficult to meet diversified needs.
By setting up a dynamic texture container in the game rendering engine, the safe area is determined based on the player's character location, the terrain height information is obtained and the surface rendering and fusion is performed, and high-detail rendering is performed only in the safe area, and other areas maintain a consistent resolution.
Reduce rendering resource consumption, reduce memory usage, improve rendering flexibility, meet the game's diverse rendering needs, and improve the richness and realism of rendering effects.
Smart Images

Figure CN120515079A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a surface rendering method, apparatus, computer equipment, and computer-readable storage medium. Background Art
[0002] During game development, the ground, as the most fundamental object in the scene, its rendering and processing technology is crucial to the game's overall visual effects and performance. Various objects placed on the ground, such as stones, vegetation, boxes, and buildings, need to blend and transition naturally with the ground to create a realistic game surface environment. Therefore, the game rendering process often requires obtaining terrain height information and rendering the surface according to this terrain height information. For example, in surface parallax calculation, height information is used to simulate the unevenness and details of the surface, enhancing the three-dimensionality and realism of the surface. In water simulation, height information is used to determine the flow and fluctuation of water, as well as its interaction with the surface. In the rendering of weather effects such as snow lines and fog effects, the surface and surface objects are blended and transitioned according to terrain height information to ensure a natural connection between objects and the ground.
[0003] In the related art, SceneCapture is usually used to capture the terrain height information and perform surface rendering, and RVT is used for real-time calculation. However, the applicant realized that when SceneCapture captures the surface height information and performs surface rendering, it actually renders the entire surface repeatedly, undergoes a complete rendering process, consumes a lot of performance, and SceneCapture is not convenient for dynamically controlling the timing of capture; and when RVT captures the surface height information and performs surface rendering, it also renders the entire surface twice to obtain the height of the surface. Therefore, the above two methods will not only increase rendering consumption, increase memory usage and rendering pressure, but also have poor flexibility, making it difficult to meet the diverse needs of game rendering while ensuring rendering effects. Summary of the Invention
[0004] In view of this, the present application provides a surface rendering method, apparatus, computer equipment and computer-readable storage medium, the main purpose of which is to solve the current problems of increased rendering consumption, increased memory usage and rendering pressure, and poor flexibility, making it difficult to meet the diverse needs of game rendering while ensuring rendering effects.
[0005] According to a first aspect of the present application, a method for rendering a ground surface is provided, the method comprising:
[0006] Determining a target scene for terrain rendering, setting a dynamic texture container in the target scene based on the current position of the player character in the target scene, and setting the created dynamic virtual texture in the target scene according to the dynamic texture container;
[0007] Determining a safe area in the dynamic texture container according to the current position of the player character in the target scene;
[0008] Terrain height information of the safety area is obtained, the dynamic virtual texture is used to render the surface of the target scene, and the terrain height information is used to perform fusion rendering of the surface in the safety area and objects on the surface.
[0009] Optionally, setting a dynamic texture container in the target scene according to the current position of the player character in the target scene, and setting the created dynamic virtual texture in the target scene according to the dynamic texture container, includes:
[0010] Creating the dynamic virtual texture and material parameter set;
[0011] Querying the current position of the player character in the target scene, and setting the dynamic texture container at the position;
[0012] The dynamic virtual texture is set in the dynamic texture container so that the dynamic virtual texture is set in the target scene, and the material parameter set is set in the dynamic texture container.
[0013] Optionally, before determining the safe area in the dynamic texture container based on the current position of the player character in the target scene, the method further includes:
[0014] Create a terrain height render target;
[0015] Setting a terrain height acquisition component on a scene view target of the target scene, so that the terrain height acquisition component moves with the scene view target to acquire scene terrain height information of the target scene;
[0016] The scene terrain height information is set in the terrain height render target.
[0017] Optionally, obtaining scene terrain height information of the target scene includes:
[0018] Based on the terrain height acquisition component, traverse all scene objects in the target scene, and determine at least one terrain modeling object from among all the scene objects, wherein the at least one terrain modeling object is used to construct a terrain feature;
[0019] The object information of each terrain modeling object is read to obtain at least one object information, and the at least one object information is used as the scene terrain height information.
[0020] Optionally, determining a safe area in the dynamic texture container according to the current position of the player character in the target scene includes:
[0021] Get the preset distance threshold;
[0022] Based on the terrain height acquisition component, with the current position of the player character in the dynamic texture container as the center, an area with a distance from the center less than or equal to the distance threshold is used as the safe area.
[0023] Optionally, obtaining terrain height information of the safety area, using the dynamic virtual texture to render the surface of the target scene, and using the terrain height information to perform fusion rendering of the surface in the safety area and objects on the surface include:
[0024] Performing surface rendering on the target scene using the dynamic virtual texture;
[0025] Reading scene terrain height information stored in a terrain height rendering target of the target scene, and obtaining the terrain height information related to the safety area from the scene terrain height information;
[0026] Modifying the material of an object on the surface of the safety area based on the terrain height information so that the object on the surface of the safety area samples the terrain height information;
[0027] The objects on the surface of the safe area are rendered using the terrain height rendering target in the target scene and the material parameter set set in the dynamic texture container. During the rendering process, the objects on the surface of the safe area are controlled to be merged with the surface according to the sampled terrain height information.
[0028] Optionally, the method further includes:
[0029] Using other areas in the dynamic texture container except the safety area as scanning areas;
[0030] After the target scene is rendered on the ground surface using the dynamic virtual texture, the surface objects in the scan area are rendered using the material parameter set in the dynamic texture container.
[0031] Optionally, the method further includes:
[0032] Continuously detecting whether a scene view target of the target scene moves;
[0033] When it is detected that the scene view target moves and moves beyond the safety area, read the scene terrain height information from the terrain height acquisition component set in the target scene, and set the scene terrain height information in the terrain height rendering target of the target scene;
[0034] Acquiring terrain starting position information from the scene terrain height information, and reading area range information of the scanning area, and using the starting position information and the area range information to update the information stored in the material parameter set;
[0035] Re-determining a new safe area according to the current position of the scene view target, and obtaining new terrain height information related to the new safe area in the terrain height rendering target;
[0036] Modifying the material of objects on the surface of the new safety zone based on the new terrain height information so that the objects on the surface of the new safety zone sample the new terrain height information;
[0037] The terrain height rendering target and the updated material parameter set are used to render objects on the surface of the new safe area, and during the rendering process, the objects on the surface of the new safe area are controlled to be merged with the surface according to the sampled new terrain height information.
[0038] Optionally, the method further includes:
[0039] Using other areas in the dynamic texture container except the new safe area as new scanning areas;
[0040] The updated material parameter set is used to render surface objects in the new scan area.
[0041] According to a second aspect of the present application, a surface rendering device is provided, the device comprising:
[0042] A setting module is used to determine a target scene for terrain rendering, set a dynamic texture container in the target scene according to the current position of the player character in the target scene, and set the created dynamic virtual texture in the target scene according to the dynamic texture container;
[0043] a determination module, configured to determine a safe area in the dynamic texture container according to a current position of the player character in the target scene;
[0044] A rendering module is used to obtain the terrain height information of the safety area, use the dynamic virtual texture to render the surface of the target scene, and use the terrain height information to perform fusion rendering of the surface in the safety area and objects on the surface.
[0045] Optionally, the setting module is used to create the dynamic virtual texture and material parameter set; query the current position of the player character in the target scene, and set the dynamic texture container at the position; set the dynamic virtual texture in the dynamic texture container so that the dynamic virtual texture is set in the target scene, and set the material parameter set in the dynamic texture container.
[0046] Optionally, the setting module is further used to create a terrain height rendering target; set a terrain height acquisition component on the scene view target of the target scene, so that the terrain height acquisition component moves with the scene view target to obtain scene terrain height information of the target scene; and set the scene terrain height information in the terrain height rendering target.
[0047] Optionally, the setting module is used to traverse all scene objects in the target scene based on the terrain height acquisition component, determine at least one terrain modeling object among all the scene objects, wherein the at least one terrain modeling object is used to construct terrain features; read object information of each of the terrain modeling objects to obtain at least one object information, and use the at least one object information as the scene terrain height information.
[0048] Optionally, the determination module is used to obtain a preset distance threshold; based on the terrain height acquisition component, with the current position of the player character in the target scene as the center, the area whose distance from the center is less than or equal to the distance threshold is used as the safe area.
[0049] Optionally, the rendering module is used to use the dynamic virtual texture to render the surface of the target scene; read the scene terrain height information stored in the terrain height rendering target of the target scene, and obtain the terrain height information related to the safe area from the scene terrain height information; modify the material of the object on the surface of the safe area based on the terrain height information so that the objects on the surface of the safe area sample the terrain height information; use the terrain height rendering target in the target scene and the material parameter set set in the dynamic texture container to render the objects on the surface of the safe area, and during the rendering process, control the objects on the surface of the safe area to merge with the surface according to the sampled terrain height information.
[0050] Optionally, the rendering module is also used to use other areas in the dynamic texture container except the safety area as scanning areas; after using the dynamic virtual texture to render the surface of the target scene, the material parameter set set in the dynamic texture container is used to render the surface objects in the scanning area.
[0051] Optionally, the rendering module is further configured to continuously detect whether a scene view target of the target scene moves; upon detecting that the scene view target moves beyond the safe area, read scene terrain height information from a terrain height acquisition component set in the target scene, and set the scene terrain height information in a terrain height rendering target of the target scene; obtain terrain starting position information from the scene terrain height information, read area range information of the scanning area, and update information stored in the material parameter set using the starting position information and the area range information; redetermine a new safe area based on the current position of the scene view target, and obtain new terrain height information related to the new safe area from the terrain height rendering target; modify the material of objects on the surface of the new safe area based on the new terrain height information so that the objects on the surface of the new safe area sample the new terrain height information; render the objects on the surface of the new safe area using the terrain height rendering target and the updated material parameter set, and during the rendering process, control the objects on the surface of the new safe area to merge with the surface according to the sampled new terrain height information.
[0052] Optionally, the rendering module is further configured to use other areas in the dynamic texture container except the new safe area as new scanning areas; and render surface objects in the new scanning area using the updated material parameter set.
[0053] According to a third aspect of the present application, a computer device is provided, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the methods described in the first aspect when executing the computer program.
[0054] According to a fourth aspect of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of any one of the methods in the first aspect are implemented.
[0055] By means of the above technical solution, the present application provides a surface rendering method, apparatus, computer device, and computer-readable storage medium. The present application determines a target scene to be rendered for terrain, sets a dynamic texture container in the target scene based on the current position of a player character in the target scene, and sets a created dynamic virtual texture in the target scene according to the dynamic texture container. Based on the current position of the player character in the target scene, a safe area is determined in the dynamic texture container, terrain height information of the safe area is obtained, the surface of the target scene is rendered using the dynamic virtual texture, and the surface and objects on the surface in the safe area are rendered in a fusion manner using the terrain height information. By setting the dynamic texture container, determining the safe area, obtaining the terrain height information, and performing fusion rendering, the terrain and objects on the surface near the player character can present richer details and layers of expression through the fusion processing of the terrain height wherever the player character walks. For other locations farther away from the player character, only a consistent rendering resolution is maintained and the fusion rendering of the terrain height is omitted. This reduces the consumption of rendering resources, alleviates memory usage and rendering pressure, improves rendering flexibility, and meets the diverse needs of game rendering while achieving high-quality rendering effects.
[0056] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Various other advantages and benefits will become apparent to those skilled in the art upon reading the detailed description of the preferred embodiment below. The accompanying drawings are for illustration purposes only and are not to be considered as limiting the present application. The same reference symbols are used throughout the drawings to represent the same components. In the drawings:
[0058] Figure 1 A schematic diagram of a process flow of a surface rendering method provided by an embodiment of the present application is shown;
[0059] Figure 2A A schematic diagram of another method for rendering a ground surface provided in an embodiment of the present application is shown;
[0060] Figure 2B A schematic diagram of a surface rendering method provided by an embodiment of the present application is shown;
[0061] Figure 2C A schematic diagram of a surface rendering method provided by an embodiment of the present application is shown;
[0062] Figure 2DA schematic diagram of a flow chart of another surface rendering method provided in an embodiment of the present application is shown;
[0063] Figure 2E A schematic diagram of a surface rendering method provided by an embodiment of the present application is shown;
[0064] Figure 2F A schematic diagram of a surface rendering method provided by an embodiment of the present application is shown;
[0065] Figure 3 A schematic structural diagram of a ground surface rendering device provided in an embodiment of the present application is shown;
[0066] Figure 4 A schematic diagram of the device structure of a computer device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0067] The following describes exemplary embodiments of the present application in more detail with reference to the accompanying drawings. Although exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.
[0068] The present application embodiment provides a method for rendering a ground surface, such as Figure 1 As shown, the method includes:
[0069] 101. Determine a target scene for terrain rendering, set a dynamic texture container in the target scene according to the current position of the player character in the target scene, and set the created dynamic virtual texture in the target scene according to the dynamic texture container.
[0070] Embodiments of the present application can be applied to a game rendering engine. The game rendering engine first determines the target scene for terrain rendering. The target scene is the virtual space where the player character conducts game activities. To optimize rendering performance, the game rendering engine sets a dynamic texture container in the target scene based on the player character's current position within the target scene. The dynamic texture container is used to store and manage dynamically generated dynamic virtual textures, which are applied to the surface and objects in the target scene.
[0071] In an embodiment of the present application, the dynamic texture container is a virtual area that can adjust its position in real time as the player character or scene view target (i.e., the scene camera) moves, so that no matter where the player character or scene view target moves, the terrain and objects on the surface around it can be updated and rendered in real time, providing a basis for subsequent terrain height fusion processing. Furthermore, in an embodiment of the present application, the size and shape of the dynamic texture container can be set according to actual needs. For example, it can be set to a rectangular or circular area centered on the player character. A dynamic virtual texture is created and applied in this area. The dynamic virtual texture maintains a consistent resolution throughout the target scene, and will be fused with terrain height information in subsequent processes to enhance the terrain height performance near the player character.
[0072] For example, the target scene is a wilderness scene, and the player character is walking in a forest. As the player character moves, the dynamic texture container will adjust its position in real time to ensure that the forest surface and tree textures wherever the player character goes can be updated and rendered in real time.
[0073] 102. Determine a safe area in the dynamic texture container based on the current position of the player character in the target scene.
[0074] In this embodiment of the present application, the game rendering engine determines a safe area ("SafeArea" is used in the following description to refer to the safe area) in the dynamic texture container based on the player character's current position in the target scene. The safe area is a specific range around the player character. The surface and objects on the surface within the safe area are rendered in a fusion manner based on the terrain height information to enhance the sense of height layering and detail.
[0075] It should be noted that the size and shape of the safe zone can be set according to game requirements or the movement speed of the player character. In the embodiment of the present application, when setting the safe zone, a circular or rectangular area centered on the player character is selected as the safe zone, and its radius or side length is ensured to be sufficient to cover key terrain and objects within the player character's field of view. This allows for additional terrain height fusion processing of the surface and objects on the surface within the safe zone, creating a more realistic and natural scene effect, and enhancing the detail expression and realism of the target scene.
[0076] Continuing with the forest scene mentioned above as an example, when the player character walks in the forest, the trees, grass and other terrain elements around the player character in the safe area are processed through high-height fusion of the terrain, presenting rich height levels and details. The forest area farther away from the player character will be rendered at the same resolution as the safe area, but no terrain height fusion processing is required.
[0077] 103. Obtain terrain height information of the safe area, use dynamic virtual texture to render the surface of the target scene, and use the terrain height information to perform fusion rendering of the surface in the safe area and objects on the surface.
[0078] In this embodiment of the present application, to ensure that the player's nearby terrain is highly integrated and layered, the game rendering engine obtains terrain height information from the safe area. Terrain height information is the basic data for fusion rendering of the ground surface and objects on it. It indicates the surface's undulations and shape, as well as the relative height of objects from the ground surface.
[0079] After obtaining the terrain height information, the game rendering engine will use dynamic virtual textures to render the surface of the target scene, and perform terrain height fusion processing on this basis, that is, use the terrain height information to fuse the surface in the safe area and the objects on the surface for rendering, so as to achieve a natural transition between the surface and the objects and a clear expression of the height levels, thereby enhancing the details and realism of the terrain and objects near the player; at the same time, it is precisely because the terrain height fusion processing is only performed in the safe area that the embodiment of the present application can effectively control the rendering overhead and memory usage, and avoid unnecessary waste of resources.
[0080] The method provided in the embodiment of the present application determines the target scene to be rendered with terrain, sets a dynamic texture container in the target scene according to the current position of the player character in the target scene, and sets the created dynamic virtual texture in the target scene according to the dynamic texture container, determines a safe area in the dynamic texture container according to the current position of the player character in the target scene, obtains terrain height information of the safe area, uses the dynamic virtual texture to render the surface of the target scene, and uses the terrain height information to perform fusion rendering of the surface and objects on the surface in the safe area. By setting the dynamic texture container, determining the safe area, obtaining the terrain height information and performing fusion rendering, the terrain and objects on the surface near the player character can present richer details and layered expressions through the fusion processing of the terrain height wherever the player character walks. For other positions farther away from the player character, only the consistent rendering resolution is maintained and the fusion rendering of the terrain height is omitted. Therefore, while achieving high-quality rendering effects, the consumption of rendering resources is reduced, memory usage and rendering pressure are alleviated, rendering flexibility is improved, and the diverse needs of game rendering are met.
[0081] Furthermore, as a refinement and extension of the specific implementation of the above embodiment, in order to fully illustrate the specific implementation process of this embodiment, the embodiment of the present application provides another surface rendering method, such as Figure 2A As shown, the method includes:
[0082] 201. Determine the target scene for terrain rendering and create a dynamic virtual texture and material parameter set.
[0083] The embodiment of the present application can be applied to a game rendering engine. Before performing terrain rendering, the game rendering engine first determines the target scene to be rendered. The target scene can be the mountains, plains, forests, etc. where the player character is currently located in the game.
[0084] Next, the game rendering engine creates a dynamic virtual texture. In actual application, the dynamic virtual texture created can be a RuntimeVirtualTexture. RuntimeVirtualTexture has high flexibility and can update its content according to the real-time needs of the game or virtual environment. For rendering large-scale terrain, RuntimeVirtualTexture can effectively manage texture data, not only ensuring that it can be quickly loaded and updated when needed, avoiding lags and delays when switching textures, but also promptly releasing it when no longer needed, optimizing memory usage and rendering performance.
[0085] At the same time, the game rendering engine also creates a material parameter set. In actual application, this material parameter set can be an MPC (Material Parameters Collection). An MPC is a structured data set used to store and manage various material properties related to terrain rendering. Material properties include but are not limited to color, roughness, reflectivity, etc., which determine the visual effect and realism of surface objects. Through MPC, the game rendering engine can flexibly adjust and modify material properties to meet the rendering requirements of different game scenes and objects in them.
[0086] 202. Query the current position of the player character in the target scene, set a dynamic texture container at the position, set a dynamic virtual texture in the dynamic texture container so that the dynamic virtual texture is set in the target scene, and set a material parameter set in the dynamic texture container.
[0087] In this embodiment of the present application, the game rendering engine queries the player character's current position in the target scene. This position represents the player character's current coordinates in the virtual world. Next, the game engine sets a dynamic texture container at the player character's position. The dynamic texture container can be thought of as a virtual space or framework for loading and managing dynamic virtual textures. This allows the dynamic virtual texture to dynamically adjust its content based on changes in the target scene, improving the real-time and smoothness of rendering.
[0088] After completing the setup of the dynamic texture container, the game rendering engine will set up a dynamic virtual texture in the dynamic texture container. This dynamic virtual texture is closely linked to the player character's position and the scene camera's perspective, and can be loaded and unloaded in real time based on the player character's position and the scene camera's perspective. This ensures that only textures within the player's current field of view are rendered, optimizing rendering performance. At the same time, the game rendering engine will also set up a material parameter set in the dynamic texture container. The parameters in the material parameter set are associated with the dynamic texture container through a mapping mechanism, making it easy to access and use the material parameters during the rendering process, further enhancing the realism and detail of the rendering.
[0089] It should be noted that, as can be seen from the content of the above step 201, the dynamic virtual texture can be a RuntimeVirtualTexture and the material parameter set can be an MPC. Therefore, the dynamic texture container can be a RuntimeVirtualTextureVolume. In actual application, the game rendering engine can place the RuntimeVirtualTextureVolume in the target scene, set its placement position to the current position of the player character, and set parameters such as the RuntimeVirtualTexture and the material parameter set in the RuntimeVirtualTextureVolume.
[0090] 203. Create a terrain height rendering target, set a terrain height acquisition component on the scene view target of the target scene, so that the terrain height acquisition component moves with the scene view target, obtains the scene terrain height information of the target scene, and sets the scene terrain height information in the terrain height rendering target.
[0091] In the embodiment of the present application, the game rendering engine will first create a terrain height rendering target, which is used to store and manage the structure of terrain height information in the target scene. Specifically, it can be a two-dimensional or three-dimensional array or image, such as Figure 2B The height map shown is used to represent the height distribution of the terrain. In actual application, you can create a WorldHeightRenderTarget in the target scene as the terrain height rendering target.
[0092] Next, the game rendering engine sets the Terrain Height Acquisition Component on the Scene View Target of the target scene. In actual application, you can add the LandscapeHeightBatmanComponent (also known as the Terrain Height Acquisition Component) to the ViewTarget (also known as the Scene View Target). The LandscapeHeightBatmanComponent will move with the Scene View Target, obtain the target scene's scene terrain height information, and set the scene terrain height information in the Terrain Height Render Target.
[0093] When acquiring terrain height information, the game rendering engine uses the Terrain Height Acquisition component to traverse all scene objects in the target scene. This component then checks the type and properties of each scene object to determine which are terrain modeling objects. Terrain modeling objects are used to construct terrain features and are the foundation for constructing terrain features. They contain information such as the terrain's vertex coordinates and normal vectors. Once the terrain modeling objects are identified, the game rendering engine uses the Terrain Height Acquisition component to read the object information of each terrain modeling object, obtain at least one piece of object information, and use the at least one piece of object information as the scene terrain height information. In actual application, the LandscapeHeightBatmanComponent can traverse all Actors (i.e., scene objects) in the current virtual world, identify which are Landscapes (i.e., terrain modeling objects) by Actor type, and obtain Landscape information (i.e., scene terrain height information). This Landscape information is then stored in the WorldHeightRenderTarget to provide height data support for subsequent terrain rendering.
[0094] 204. Obtain a preset distance threshold, obtain a component based on the terrain height, take the current position of the player character in the target scene as the center, and use the area with a distance less than or equal to the distance threshold as the safe area.
[0095] In this embodiment of the present application, the game rendering engine first obtains a preset distance threshold, which is used to define the area around the player character where height rendering and terrain information fusion are required. For example, the distance threshold can be set to 100 meters. Then, based on the terrain height acquisition component, the game rendering engine uses the player character's current position in the target scene as the center and defines the area within the center that is less than or equal to the distance threshold as the safe zone.
[0096] It can be seen from the content of the above step 203 that the terrain height acquisition component can be the LandscapeHeightBatmanComponent component. Therefore, in the actual application process, the game rendering engine can divide the Landscape area in the dynamic texture container into two key areas, ScanArea and SafeArea, through the LandscapeHeightBatmanComponent component. Specifically, the current position of the player character can be used as the coordinate center to calculate the distance between each point in the target scene and the center point, and the area with a distance less than or equal to the distance threshold is marked with SafeArea to refer to the safe area, and the area with a distance greater than the distance threshold is marked with ScanArea to refer to the scan area. It should be noted that in the actual application process, the game rendering engine will simultaneously set WorldHeightRenderTarget to render the terrain height, and adjust the material properties through the material parameter set MPC to optimize the rendering effect.
[0097] This way, when the player character is active within the safe area, the safe area will be rendered in a fused manner in subsequent operations, and the terrain height information within it does not need to be updated frequently. This can significantly save rendering resources and improve game performance. When the player character's activity range exceeds the SafeArea, the game rendering engine can quickly update the terrain height information outside the safe area, that is, within the ScanArea, re-determine the safe area, and perform fused rendering based on this height information. This ensures the visual quality of the game while effectively controlling the rendering performance overhead.
[0098] For example, Figure 2C The figure shows a plan view of a target scene. The area within 100 meters around the player character's current location is designated as a safe area. Figure 2B The area formed by the four boxes in the center, the terrain height information within this safe area is highly rendered to ensure that the player character can clearly see the surrounding details. The other boxes outside the safe area are designated as scanning areas and marked with ScanArea. When the player character or scene camera is detected to move into the scanning area, the game rendering engine will quickly update the terrain height information within the scanning area, redefine the safe area and perform fusion rendering according to the height information. It should be noted that in actual application, the Landscape area set in the dynamic texture container will be much larger than the ScanArea and SafeArea, so that the game can maintain smooth running performance while ensuring visual quality.
[0099] 205. Use dynamic virtual texture to render the surface of the target scene, read the scene terrain height information stored in the terrain height rendering target of the target scene, obtain the terrain height information related to the safe area in the scene terrain height information, and modify the material of the object on the surface of the safe area based on the terrain height information so that the object on the surface of the safe area samples the terrain height information.
[0100] In an embodiment of the present application, the game rendering engine will first use a dynamic virtual texture to render the surface of the target scene, complete the most basic surface rendering, and then start to obtain terrain height information to perform a fusion transition between the surface in the safe area and the objects on the surface. Specifically, the game rendering engine will read the scene terrain height information stored in the terrain height rendering target (that is, the WorldHeightRenderTarget mentioned above), obtain the terrain height information related to the safe area in the scene terrain height information, and modify the material of the objects on the surface of the safe area based on the terrain height information, so that the objects on the surface of the safe area can sample the terrain height information, which is convenient for the subsequent transition and fusion effect between the objects on the surface and the surface during rendering, thereby enhancing the realism of the rendering and improving the layering of the target scene.
[0101] 206. Use the terrain height rendering target in the target scene and the material parameter set set in the dynamic texture container to render the objects on the surface of the safe area, and during the rendering process, control the objects on the surface of the safe area to be merged with the surface according to the sampled terrain height information.
[0102] In an embodiment of the present application, the game rendering engine uses a terrain height rendering target and a material parameter set set in a dynamic texture container to render objects on the ground surface in a safe zone. During the rendering process, these objects are controlled to blend with the ground surface according to the sampled terrain height information, ensuring a natural blend and transition between objects and the ground surface within the safe zone, enhancing the overall rendering effect and immersion. Specifically, in actual applications, the contact points and degree of fusion between objects and the ground surface can be calculated based on their positions and terrain height information, and fusion can be performed. This application does not specifically limit the means used for fusion.
[0103] 207. The areas other than the safe area in the dynamic texture container are used as scanning areas. After the target scene is rendered on the surface using the dynamic virtual texture, the surface objects in the scanning area are rendered using the material parameter set set in the dynamic texture container.
[0104] Through the process in the above steps 201 to 206, the rendering of the ground surface in the safe area and the fusion processing between the objects on the ground surface and the ground surface are completed. In the actual application process, the area outside the safe area is actually within the line of sight of the player character, but it is farther away and may not be clear to the player character, so it also needs to be properly rendered. Therefore, the game rendering engine will use the other areas in the dynamic texture container except the safe area as the scanning area (that is, the ScanArea mentioned above). After using the dynamic virtual texture to render the surface of the target scene, the material parameter set set in the dynamic texture container is also used to render the surface objects in the scanning area, but without high fusion, in order to save rendering resources and improve performance.
[0105] Considering that the player character may not always be in the safe area, or the player may unlock the scene camera lens to view the scene outside the safe area, in the embodiment of the present application, the game rendering engine will continuously detect whether the scene view target (i.e., ViewTarget) of the target scene has moved. If it is detected that the scene view target has moved and the movement exceeds the safe area (i.e., the SafeArea mentioned above), the game development engine will trigger an update operation, so that the height information of the location where the scene camera moves is updated to maintain the fusion effect of the ground surface and the objects on the ground surface.
[0106] Specifically, the game rendering engine reads the scene terrain height information from the terrain height acquisition component set in the target scene, and sets the scene terrain height information in the target scene's terrain height render target as the basis for subsequent rendering and material modification. In other words, the game rendering engine automatically obtains the LandscapeComponent (that is, the scene terrain height information) within the ScanArea area and draws the height information into the WorldHeightRenderTarget (that is, the terrain height render target).
[0107] Next, the game rendering engine retrieves the terrain's starting position information from the scene's terrain height information, as well as the scanned area's range information. It then uses this information to update the information stored in the material parameter set. The starting position information is typically the origin coordinates of the LandscapeComponent, which is used to calculate UV coordinates to ensure the material is correctly mapped to the surface. By updating the material parameter set, the game rendering engine ensures that objects on the surface can sample the latest terrain height information when rendering.
[0108] Subsequently, the game rendering engine will redefine the new safe area based on the current position of the scene view target, and obtain the new terrain height information related to the new safe area in the terrain height rendering target. This information will be used to modify the materials of objects on the surface in the new safe area so that they can sample the new terrain height information, thereby achieving the fusion effect of the surface and objects on the surface. During the rendering process, the game rendering engine will modify the materials of objects on the surface of the new safe area based on the new terrain height information so that objects on the surface of the new safe area sample the new terrain height information, that is, modify the materials of objects on the surface; the game rendering engine continues to use the terrain height rendering target and the updated material parameter set to render objects on the surface in the new safe area, and during the rendering process, control the objects on the surface of the new safe area to merge with the surface according to the sampled new terrain height information. Similarly, the materials of objects on the surface are rendered using WorldHeightRenderTarget and MPC to achieve the fusion effect of the surface and objects on the surface.
[0109] In addition, to maintain the overall consistency of the scene, the game rendering engine will use the rest of the dynamic texture container, except for the new safe area, as a new scanning area. In this new scanning area, the game rendering engine will use the updated material parameter set to render the surface objects in the new scanning area. This ensures that even though the new scanning area may be farther from the view target, it can still ensure that all parts of the scene can maintain a consistent rendering style and quality.
[0110] In summary, by continuously detecting the movement of scene view targets and updating the terrain height information and material parameter set in real time, a dynamic fusion effect of the ground surface and objects on the ground surface can be achieved, so that both the movement of view targets and changes in terrain can be responded to and processed immediately. This not only enhances the realism and layering of the scene, improves the player's immersion and visual enjoyment, but also ensures the overall coherence and consistency of the scene through the rendering processing of the scanned area. In summary, the logical process of the technical solution of this application is as follows:
[0111] See also Figure 2DThe game rendering engine first creates a RuntimeVirtualTexture (also known as a dynamic virtual texture), then creates a WorldHeightRenderTarget (also known as a terrain height render target) and an MPC (also known as a material parameter set), which will be used for subsequent terrain height information processing and material adjustment. Next, the game rendering engine places the RuntimeVirtualTextureVolume (dynamic texture container) in the target scene to ensure that it covers the area that needs to be rendered; at the same time, the game rendering engine adds a LandscapeHeightBatmanComponent component (also known as a terrain height acquisition component) to the ViewTarget (also known as the scene view target). This component will be responsible for processing terrain height information and providing data support for subsequent fusion rendering. Finally, the game rendering engine divides the Landscape (also known as the terrain covered by the dynamic texture container) into regions and sets the ScanArea (also known as the scanning area) and the SafeArea (also known as the safe area). The ScanArea is the area where terrain height fusion is temporarily not required, while the SafeArea is the area where height information fusion is required.
[0112] After the above process is completed, the game rendering engine begins to modify the material of objects on the surface to ensure that the objects can be naturally integrated with the surface. During the running of the game, the game rendering engine will determine in real time whether the scene view target exceeds the SafeArea as it moves. If the scene view target exceeds the SafeArea or the player character exceeds the SafeArea, the game rendering engine will immediately obtain the terrain information in the ScanArea and update the surface height information to ensure that the game rendering engine can respond to the view target changes in real time, integrate the surface height, and maintain the authenticity and consistency of the rendering effect. If the scene view target or the player character moves, but does not move beyond the SafeArea, the game engine will maintain the fusion rendering effect of the objects on the SafeArea surface and the surface. In actual application, the rendering effect of the technical solution in this application can be found in Figure 2E and Figure 2F .
[0113] The method provided in the embodiment of the present application sets a dynamic texture container, determines a safe area, obtains terrain height information and performs fusion rendering, so that wherever the player character walks, the terrain and objects on the surface near it can present richer details and layered performance through the fusion processing of the terrain height. For other locations farther away from the player character, only a consistent rendering resolution is maintained and the fusion rendering of the terrain height is omitted. This reduces the consumption of rendering resources, alleviates memory usage and rendering pressure, improves rendering flexibility, and meets the diverse needs of game rendering while achieving high-quality rendering effects.
[0114] Further, as Figure 1 In a specific implementation of the method, the present application provides a surface rendering device, such as Figure 3 As shown, the device includes: a setting module 301, a determination module 302 and a rendering module 303.
[0115] The setting module 301 is used to determine a target scene for terrain rendering, set a dynamic texture container in the target scene according to the current position of the player character in the target scene, and set the created dynamic virtual texture in the target scene according to the dynamic texture container;
[0116] The determination module 302 is configured to determine a safe area in the dynamic texture container according to the current position of the player character in the target scene;
[0117] The rendering module 303 is used to obtain the terrain height information of the safety area, use the dynamic virtual texture to render the surface of the target scene, and use the terrain height information to perform fusion rendering of the surface in the safety area and objects on the surface.
[0118] In a specific application scenario, the setting module 301 is used to create the dynamic virtual texture and material parameter set; query the current position of the player character in the target scene, and set the dynamic texture container at the position; set the dynamic virtual texture in the dynamic texture container so that the dynamic virtual texture is set in the target scene, and set the material parameter set in the dynamic texture container.
[0119] In a specific application scenario, the setting module 301 is also used to create a terrain height rendering target; set a terrain height acquisition component on the scene view target of the target scene, so that the terrain height acquisition component moves with the scene view target to obtain the scene terrain height information of the target scene; and set the scene terrain height information in the terrain height rendering target.
[0120] In a specific application scenario, the setting module 301 is used to traverse all scene objects in the target scene based on the terrain height acquisition component, determine at least one terrain modeling object among all the scene objects, wherein the at least one terrain modeling object is used to construct terrain features; read object information of each of the terrain modeling objects to obtain at least one object information, and use the at least one object information as the scene terrain height information.
[0121] In a specific application scenario, the determination module 302 is used to obtain a preset distance threshold; based on the terrain height acquisition component, with the current position of the player character in the dynamic texture container as the center, the area whose distance from the center is less than or equal to the distance threshold is used as the safe area.
[0122] In a specific application scenario, the rendering module 303 is used to use the dynamic virtual texture to render the surface of the target scene; read the scene terrain height information stored in the terrain height rendering target of the target scene, and obtain the terrain height information related to the safe area from the scene terrain height information; modify the material of the object on the surface of the safe area based on the terrain height information so that the object on the surface of the safe area samples the terrain height information; use the terrain height rendering target in the target scene and the material parameter set set in the dynamic texture container to render the objects on the surface of the safe area, and during the rendering process, control the objects on the surface of the safe area to merge with the surface according to the sampled terrain height information.
[0123] In a specific application scenario, the rendering module 303 is also used to use other areas in the dynamic texture container except the safety area as scanning areas; after using the dynamic virtual texture to render the surface of the target scene, the material parameter set set in the dynamic texture container is used to render the surface objects in the scanning area.
[0124] In a specific application scenario, the rendering module 303 is further configured to continuously detect whether a scene view target of the target scene moves; if movement of the scene view target is detected and the movement exceeds the safe area, read scene terrain height information from a terrain height acquisition component set in the target scene, and set the scene terrain height information in a terrain height rendering target of the target scene; obtain terrain starting position information from the scene terrain height information, read area range information of the scanning area, and update the information stored in the material parameter set using the starting position information and the area range information; re-determine a new safe area based on the current position of the scene view target, and obtain new terrain height information related to the new safe area from the terrain height rendering target; modify the material of objects on the surface of the new safe area based on the new terrain height information so that the objects on the surface of the new safe area sample the new terrain height information; render the objects on the surface of the new safe area using the terrain height rendering target and the updated material parameter set, and during the rendering process, control the objects on the surface of the new safe area to be merged with the surface according to the sampled new terrain height information.
[0125] In a specific application scenario, the rendering module 303 is further used to use other areas in the dynamic texture container except the new safe area as new scanning areas; and use the updated material parameter set to render surface objects in the new scanning area.
[0126] The device provided in the embodiment of the present application determines the target scene to be rendered with terrain, sets a dynamic texture container in the target scene according to the current position of the player character in the target scene, and sets the created dynamic virtual texture in the target scene according to the dynamic texture container, determines the safe area in the dynamic texture container according to the current position of the player character in the target scene, obtains the terrain height information of the safe area, uses the dynamic virtual texture to render the surface of the target scene, and uses the terrain height information to perform fusion rendering of the surface and objects on the surface in the safe area. By setting the dynamic texture container, determining the safe area, obtaining the terrain height information and performing fusion rendering, the terrain and objects on the surface near the player character can present richer details and layered expression through the fusion processing of the terrain height wherever the player character walks. For other positions farther away from the player character, only the consistent rendering resolution is maintained and the fusion rendering of the terrain height is omitted. Therefore, while achieving high-quality rendering effects, the consumption of rendering resources is reduced, memory usage and rendering pressure are alleviated, rendering flexibility is improved, and the diverse needs of game rendering are met.
[0127] It should be noted that for other corresponding descriptions of the functional units involved in the surface rendering device provided in the embodiment of the present application, please refer to Figure 1 and Figures 2A to 2F The corresponding description in will not be repeated here.
[0128] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0129] The above embodiments and the technical features in the embodiments can be arbitrarily combined with each other. In order to make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0130] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
[0131] In an exemplary embodiment, see Figure 4 A computer device is also provided, comprising a bus, a processor, a memory, and a communication interface. The computer device may also include an input / output interface and a display device, wherein the various functional units can communicate with each other via the bus. The memory stores a computer program, and the processor is configured to execute the program stored in the memory and perform the surface rendering method of the above-described embodiment.
[0132] A computer-readable storage medium stores a computer program, which implements the steps of the surface rendering method when executed by a processor.
[0133] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented through hardware or by means of software plus a necessary general hardware platform. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of the present application.
[0134] Those skilled in the art will understand that the accompanying drawings are only schematic diagrams of a preferred implementation scenario, and the modules or processes in the accompanying drawings are not necessarily required to implement the present application.
[0135] Those skilled in the art will appreciate that the modules in the devices in the implementation scenario can be distributed in the devices of the implementation scenario according to the implementation scenario description, or can be modified accordingly and located in one or more devices different from the implementation scenario. The modules in the above implementation scenario can be combined into one module or further split into multiple submodules.
[0136] The above application serial numbers are for description only and do not represent the advantages or disadvantages of the implementation scenarios.
[0137] The above disclosure only describes several specific implementation scenarios of the present application. However, the present application is not limited thereto, and any changes that can be conceived by those skilled in the art should fall within the scope of protection of the present application.
Claims
1. A method for rendering a ground surface, characterized in that: include: Determining a target scene for terrain rendering, setting a dynamic texture container in the target scene based on the current position of the player character in the target scene, and setting the created dynamic virtual texture in the target scene according to the dynamic texture container; Determining a safe area in the dynamic texture container according to the current position of the player character in the target scene; Terrain height information of the safety area is obtained, the dynamic virtual texture is used to render the surface of the target scene, and the terrain height information is used to perform fusion rendering of the surface in the safety area and objects on the surface.
2. The method according to claim 1, characterized in that The step of setting a dynamic texture container in the target scene according to the current position of the player character in the target scene, and setting the created dynamic virtual texture in the target scene according to the dynamic texture container, comprises: Creating the dynamic virtual texture and material parameter set; Querying the current position of the player character in the target scene, and setting the dynamic texture container at the position; The dynamic virtual texture is set in the dynamic texture container so that the dynamic virtual texture is set in the target scene, and the material parameter set is set in the dynamic texture container.
3. The method according to claim 1, characterized in that Before determining the safe area in the dynamic texture container based on the current position of the player character in the target scene, the method further includes: Create a terrain height render target; Setting a terrain height acquisition component on a scene view target of the target scene, so that the terrain height acquisition component moves with the scene view target to acquire scene terrain height information of the target scene; The scene terrain height information is set in the terrain height render target.
4. The method according to claim 3, characterized in that The acquiring of scene terrain height information of the target scene includes: Based on the terrain height acquisition component, traverse all scene objects in the target scene, and determine at least one terrain modeling object from among all the scene objects, wherein the at least one terrain modeling object is used to construct a terrain feature; The object information of each terrain modeling object is read to obtain at least one object information, and the at least one object information is used as the scene terrain height information.
5. The method according to claim 3, characterized in that Determining a safe area in the dynamic texture container according to the current position of the player character in the target scene includes: Get the preset distance threshold; Based on the terrain height acquisition component, with the current position of the player character in the dynamic texture container as the center, an area with a distance from the center less than or equal to the distance threshold is used as the safe area.
6. The method according to claim 1, characterized in that The obtaining of terrain height information of the safety area, using the dynamic virtual texture to render the surface of the target scene, and using the terrain height information to perform fusion rendering of the surface of the safety area and objects on the surface, includes: Performing surface rendering on the target scene using the dynamic virtual texture; Reading scene terrain height information stored in a terrain height rendering target of the target scene, and obtaining the terrain height information related to the safety area from the scene terrain height information; Modifying the material of an object on the surface of the safety area based on the terrain height information so that the object on the surface of the safety area samples the terrain height information; The objects on the surface of the safe area are rendered using the terrain height rendering target in the target scene and the material parameter set set in the dynamic texture container. During the rendering process, the objects on the surface of the safe area are controlled to be merged with the surface according to the sampled terrain height information.
7. The method according to claim 1, characterized in that The method further comprises: Using other areas in the dynamic texture container except the safety area as scanning areas; After the target scene is rendered on the ground surface using the dynamic virtual texture, the surface objects in the scan area are rendered using the material parameter set in the dynamic texture container.
8. The method according to claim 7, characterized in that The method further comprises: Continuously detecting whether a scene view target of the target scene moves; When it is detected that the scene view target moves and moves beyond the safety area, read the scene terrain height information from the terrain height acquisition component set in the target scene, and set the scene terrain height information in the terrain height rendering target of the target scene; Acquiring terrain starting position information from the scene terrain height information, and reading area range information of the scanning area, and using the starting position information and the area range information to update the information stored in the material parameter set; Re-determining a new safe area according to the current position of the scene view target, and obtaining new terrain height information related to the new safe area in the terrain height rendering target; Modifying the material of objects on the surface of the new safety zone based on the new terrain height information so that the objects on the surface of the new safety zone sample the new terrain height information; The terrain height rendering target and the updated material parameter set are used to render objects on the surface of the new safe area, and during the rendering process, the objects on the surface of the new safe area are controlled to be merged with the surface according to the sampled new terrain height information.
9. The method according to claim 8, characterized in that The method further comprises: Using other areas in the dynamic texture container except the new safe area as new scanning areas; The updated material parameter set is used to render surface objects in the new scan area.
10. A surface rendering device, characterized in that: include: A setting module is used to determine a target scene for terrain rendering, set a dynamic texture container in the target scene according to the current position of the player character in the target scene, and set the created dynamic virtual texture in the target scene according to the dynamic texture container; a determination module, configured to determine a safe area in the dynamic texture container according to a current position of the player character in the target scene; A rendering module is used to obtain the terrain height information of the safety area, use the dynamic virtual texture to render the surface of the target scene, and use the terrain height information to perform fusion rendering of the surface in the safety area and objects on the surface.
11. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 9 are implemented.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.