Terrain effect rendering method and device, equipment, storage medium and program product
By obtaining the location and height information of adjacent terrain in the virtual scene, determining the rendering area affected by terrain, the problem of storage space occupation and rendering range control caused by terrain subdivision in the virtual scene is solved, and a more natural and rich visual is achieved. Effect.
Patent Information
- Application Number
- CN202411344808.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2024-12-20
AI Technical Summary
When the existing technology subdivides the terrain of the world into small pieces in virtual scenes, it causes a lot of storage space to occupy and cannot flexibly control the rendering range, making it difficult to differentiate objects within the rendering range, resulting in the visual effect not natural and rich enough. .
By obtaining the location information and height information of adjacent terrains in the target scene, the rendering area affected by the terrain effect is determined, and the influence range is controlled based on the height information, flexible control of the rendering area is achieved, saving storage space and improving rendering efficiency.
It improves the determination efficiency and flexibility of the rendering area, saves storage space, and realizes flexible control over whether objects in the rendering area are affected by terrain effects, enhancing the naturalness and richness of the visual effect.
Smart Images

Figure CN119158259A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present specification relate to the field of image rendering technology, and more particularly to a method, device, equipment, storage medium and program product for rendering terrain effects. Background Art
[0002] In order to simulate a more vivid and realistic large-world visual effect, the large-world terrain in the virtual scene is often subdivided into many small terrains. For each small terrain, more detailed terrain material processing will be performed according to the terrain distribution in the scene.
[0003] However, processing each small piece of terrain and storing the corresponding terrain parameters will take up a lot of storage space, and it is impossible to flexibly control the rendering range and it is difficult to perform differentiated processing on different objects within the rendering range as needed, resulting in the final visual effect of the large world map being unnatural and not rich enough. Summary of the invention In view of this, an embodiment of the present specification provides a method for rendering terrain effects. One or more embodiments of the present specification also relate to a device for rendering terrain effects, a computing device, a computer-readable storage medium, and a computer program product to solve the technical defects existing in the prior art.
[0004] According to a first aspect of an embodiment of this specification, a method for rendering terrain effects is provided, comprising: Acquire first position information and height information of a first terrain and second position information of a second terrain in a target scene, wherein the second terrain is adjacent to the first terrain; Determine a target rendering area according to the first position information, the second position information and the height information, wherein the target rendering area is an area of the first terrain and the second terrain that is affected by the terrain effect of the first terrain; Render the terrain effect for the target rendering area.
[0005] According to a second aspect of an embodiment of this specification, a device for rendering terrain effects is provided, including: An acquisition module is configured to acquire first position information and height information of a first terrain and second position information of a second terrain in a target scene, wherein the second terrain is adjacent to the first terrain; A determination module is configured to determine a target rendering area according to the first position information, the second position information and the height information, wherein the target rendering area is an area of the first terrain and the second terrain that is affected by the terrain effect of the first terrain; The rendering module is configured to render terrain effects for a target rendering area.
[0006] According to a third aspect of an embodiment of this specification, a computing device is provided, including: Memory and processor; The memory is used to store computer executable instructions, and the processor is used to execute the computer executable instructions. When the computer executable instructions are executed by the processor, the steps of the rendering method of the above-mentioned terrain effect are implemented.
[0007] According to a fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores computer-executable instructions, and when the instructions are executed by a processor, the steps of the rendering method of the above-mentioned terrain effect are implemented.
[0008] According to a fifth aspect of the embodiments of this specification, a computer program product is provided, including a computer program / instruction, which, when executed by a processor, implements the steps of the above-mentioned method for rendering terrain effects.
[0009] An embodiment of the present specification implements obtaining first position information and height information of a first terrain and second position information of a second terrain in a target scene, wherein the second terrain is adjacent to the first terrain; determining a target rendering area based on the first position information, the second position information and the height information, wherein the target rendering area is an area of the first terrain and the second terrain that is affected by the terrain effect of the first terrain; and rendering the terrain effect for the target rendering area.
[0010] In this way, by determining the target rendering area according to the first position information, the second position information and the height information, the height range affected by the terrain effect of the first terrain can be controlled based on the height information, and the area range affected by the terrain effect of the first terrain can be controlled based on the first position information and the second position information, thereby improving the efficiency and flexibility of determining the target rendering area; by rendering the terrain effect for the target rendering area, the terrain effect can be rendered for the target rendering area as a whole, without the need to add additional rendering channels for each piece of terrain, which can save storage space and improve rendering efficiency. At the same time, it is also possible to flexibly control whether objects in the target rendering area are affected by the terrain effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 is a flow chart of a method for rendering terrain effects provided by an embodiment of this specification; Figure 2 is a process flow chart of a method for rendering terrain effects provided by an embodiment of this specification; Figure 3 It is a schematic diagram of a water surface model of a method for rendering terrain effects provided by an embodiment of this specification; Figure 4aIt is a schematic diagram of a water surface height mask of a method for rendering terrain effects provided by an embodiment of this specification; Figure 4b It is a schematic diagram of the position of each terrain in the water surface height mask provided by an embodiment of this specification; Figure 5a It is a schematic diagram of a water surface SDF mask of a method for rendering terrain effects provided by an embodiment of this specification; Figure 5b It is a schematic diagram of the position of each terrain in the water surface SDF mask provided by an embodiment of this specification; Figure 6 It is a schematic diagram of a wet effect of a method for rendering terrain effects provided by an embodiment of this specification; Figure 7 It is a schematic diagram of turning on and off a moisture effect provided by an embodiment of this specification; Figure 8 It is a structural schematic diagram of a device for rendering terrain effects provided by an embodiment of this specification; Fig. 9 It is a structural block diagram of a computing device provided by an embodiment of this specification. DETAILED DESCRIPTION
[0012] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.
[0013] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0014] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0015] In addition, 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 one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0016] First, the terms involved in one or more embodiments of this specification are explained.
[0017] Houdini: is a 3D animation production software, commonly used in film and television, games and virtual reality.
[0018] Mask: Ability to control the display area of another image or graphic through a specific graphic or image (also called a mask).
[0019] Decal: A texture or pattern is applied to another surface to enhance the visual effect.
[0020] Decal Projector: Used to add decal effects to terrain, scene objects, etc.
[0021] In actual applications, in order to simulate a more vivid and realistic large-world visual effect, the large-world terrain in the virtual scene is often subdivided into many small terrains. For each small terrain, more detailed terrain material processing will be performed according to the terrain distribution in the scene.
[0022] However, processing each small piece of terrain and storing the corresponding terrain parameters will take up a lot of storage space, and it is impossible to flexibly control the rendering range and it is difficult to perform differentiated processing on different objects within the rendering range as needed, resulting in the final visual effect of the large world map being unnatural and not rich enough. Based on this, an embodiment of the present specification provides a method for rendering terrain effects, which obtains first position information and height information of a first terrain and second position information of a second terrain in a target scene, wherein the second terrain is adjacent to the first terrain; determines a target rendering area based on the first position information, the second position information, and the height information, wherein the target rendering area is an area of the first terrain and the second terrain that is affected by the terrain effect of the first terrain; and renders the terrain effect for the target rendering area.
[0023] In this way, by determining the target rendering area according to the first position information, the second position information and the height information, the height range affected by the terrain effect of the first terrain can be controlled based on the height information, and the area range affected by the terrain effect of the first terrain can be controlled based on the first position information and the second position information, thereby improving the efficiency and flexibility of determining the target rendering area; by rendering the terrain effect for the target rendering area, the terrain effect can be rendered for the target rendering area as a whole, without the need to add additional rendering channels for each piece of terrain, which can save storage space and improve rendering efficiency. At the same time, it is also possible to flexibly control whether objects in the target rendering area are affected by the terrain effect.
[0024] In this specification, a method for rendering terrain effects is provided. This specification also relates to a device for rendering terrain effects, a computing device, a computer-readable storage medium, and a computer program product, which are described in detail one by one in the following embodiments.
[0025] See also Figure 1 , Figure 1 A flowchart of a method for rendering terrain effects provided according to an embodiment of the present specification is shown, which specifically includes the following steps.
[0026] Step 102: Acquire first position information and height information of a first terrain and second position information of a second terrain in a target scene, wherein the second terrain is adjacent to the first terrain.
[0027] In practical applications, first position information and height information of a first terrain and second position information of a second terrain in a target scene may be obtained.
[0028] Specifically, the first terrain can be understood as having a terrain effect on the terrain of the big world. For example, when the first terrain is a water surface terrain, the water surface will have a wet effect on the terrain of the big world. The second terrain can be understood as other terrains adjacent to the first terrain in the big world, and some areas in the second terrain will be affected by the terrain effect of the first terrain. For example, the second terrain can be land, desert, grassland, etc. The terrain effect of the first terrain can be understood as a wet effect.
[0029] It should be noted that the first terrain and the second terrain are divided according to geographical types, for example, the first terrain is water surface and the second terrain is land. The actual large world terrain is composed of multiple small terrains, for example, 256 1024x1024-sized terrains. Each small terrain has location information in the large world, and each small terrain may include only one geographical type of terrain, or may include at least two geographical types of terrain.
[0030] In one or more embodiments of the present specification, the terrain effect of the first terrain not only affects the large world terrain, but also affects the scene objects located in the affected terrain area. The scene objects include but are not limited to stones, bridge piers, trees, cars, houses, and pastures.
[0031] Specifically, the target scene can be understood as the scene currently displayed in the big world, or can be understood as the scene currently located by the player in the big world. The first position information can be understood as the position of the first terrain in the target scene. The height information can be understood as the absolute height of the first terrain in the big world.
[0032] Optionally, the point with the lowest altitude in the big world may be predetermined as the zero point, and the altitude information of the first terrain may be determined based on the altitude difference of the first terrain relative to the zero point.
[0033] Specifically, the second position information may be understood as the position of the second terrain in the target scene.
[0034] According to an optional embodiment of the present specification, obtaining first position information and height information of a first terrain and second position information of a second terrain in a target scene may include the following steps: Determine a first terrain model corresponding to the first terrain, and obtain first position information and height information of the first terrain model in the target scene; A second terrain model corresponding to the second terrain is determined, and second position information of a terrain boundary area between the second terrain model and the first terrain model is obtained, wherein the terrain boundary area is located at an edge of the second terrain model.
[0035] Optionally, the first terrain model may be obtained in advance by modeling the first terrain; and the second terrain model may be obtained in advance by modeling the second terrain.
[0036] In practical applications, scene modeling can be performed in advance for a large world in 3D software. A large world can include multiple scenes, and each scene can correspond to a set of scene modeling data.
[0037] For example, in Houdini, for a target scene, modeling data including scene information such as terrain, environment, and lighting can be pre-baked. Further, based on the target scene pre-baked in Houdini, the scene information can be directly read, and the read data can be saved in a map.
[0038] Specifically, if the first terrain is a water surface terrain, the first terrain model may be a water surface model; if the second terrain is a ground surface terrain, the second terrain model may be a ground surface model.
[0039] Optionally, the first position information and height information of the first terrain model in the target scene can be directly read from the target scene pre-baked in the 3D software; the position information of the second terrain model can also be directly read from the target scene pre-baked in the 3D software.
[0040] Optionally, the terrain boundary area is located at an edge position on the second terrain model, and the second position information of the terrain boundary area can be determined according to the needs of actual applications. When the first terrain is a water surface terrain and the second terrain is a surface terrain, the terrain boundary area can be understood as a river bank.
[0041] Exemplarily, the second position information may be determined based on the first position information and a preset river bank width, or may be determined based on the first position information and a default river bank width.
[0042] By applying this embodiment, by obtaining the first position information and height information of the first terrain model in the target scene and the second position information of the terrain boundary area in the target scene, the position and height of the first terrain in the target scene can be determined, so that a height mask map can be obtained based on the height, and a signed distance field SDF mask map can be obtained based on the first position information and the second position information, so as to facilitate the subsequent determination of the affected area range based on these two maps.
[0043] Step 104: determining a target rendering area according to the first position information, the second position information and the height information, wherein the target rendering area is an area of the first terrain and the second terrain that is affected by the terrain effect of the first terrain.
[0044] In practical applications, the target rendering area may be determined according to the first position information, the second position information and the height information.
[0045] Specifically, the target rendering area can be understood as an area affected by the terrain effect of the first terrain. The target rendering area can not only control the range of the affected terrain area, but also control the waterline effect of the affected objects within the terrain area.
[0046] For example, affected by the terrain effect, the affected areas in the first terrain and the second terrain may produce effects such as wetness, smoothness, and darkening of color.
[0047] According to an optional embodiment of the present specification, determining the target rendering area according to the first position information, the second position information and the height information may include the following steps: According to the height information, a height mask image is obtained; Obtaining a regional mask map according to the first position information and the second position information, wherein the regional mask map includes the first terrain and a terrain boundary area between the first terrain and the second terrain; Based on the height mask and the area mask, the target rendering area is determined.
[0048] Specifically, the height mask map can be used to indicate the range of the water surface area, and the height mask map includes the height information of the water surface area. The area mask map can be used to indicate the range of the water surface area and the range of the riverbank area. The target rendering area can be understood as the area affected by the terrain effect of the first terrain, that is, the wet effect area. The target rendering area is used not only to control the area range on the terrain, but also to control the height range (that is, the waterline effect of the object).
[0049] By applying this embodiment, by obtaining a height mask map and an area mask map, the target rendering area can be determined based on the height mask map and the area mask map, thereby determining the area affected by the terrain effect, which can improve the efficiency and flexibility of determining the target rendering area.
[0050] According to an optional embodiment of the present specification, obtaining a height mask map according to the height information may include the following steps: Store the height information into the height mask map according to the preset precision format.
[0051] In practical applications, since the accuracy of height information is required to be high in the process of generating wet rendering effects, the read height information can be saved in a height mask map in a high-precision format.
[0052] By applying this embodiment, by storing the height information in a preset precision format into a height mask map, the rendering accuracy of the wet effect can be improved, the waterline effect of objects within the affected area can be simulated more accurately, and the authenticity and naturalness of the large world scene can be improved.
[0053] According to an optional embodiment of the present specification, the second position information is the position information of the terrain boundary area; obtaining the regional mask map according to the first position information and the second position information may include the following steps: Determine the first vertex position of each first vertex on the first terrain according to the first position information; Determine the second vertex position of each second vertex in the terrain boundary area according to the second position information; The distance information between each first vertex and each second vertex is calculated to obtain a region mask graph.
[0054] Optionally, the first vertex position of each first vertex on the model surface may be determined according to the first terrain model.
[0055] Furthermore, the shortest distance from each first vertex position to the terrain boundary area can be calculated to obtain a regional mask map from each point on the water surface to the shore. Specifically, the regional mask map can also be understood as a directed distance field SDF mask map.
[0056] Optionally, calculating the shortest distance from each first vertex position to the terrain boundary area may include: Determine the second vertex position of each second vertex in the terrain boundary area according to the second position information; Calculate the shortest distance between each first vertex and each second vertex.
[0057] Furthermore, the second vertex position can be determined based on the position coordinates of each second vertex located on the shore on the surface model.
[0058] By applying this embodiment, by calculating the distance information between each first vertex and each second vertex, a regional mask map is obtained, which can control the width of the shore and thus control the range of the terrain area affected by the wet effect, which is beneficial to improving the efficiency and flexibility of determining the target rendering area.
[0059] According to an optional embodiment of the present specification, determining the target rendering area based on the height mask map and the area mask map may include the following steps: Take the intersection of the height mask map and the area mask map to obtain the target mask map; Determine the target rendering area based on the target mask map.
[0060] Optionally, taking the intersection of the height mask map and the area mask map may include: multiplying the height mask map and the area mask map.
[0061] In practical applications, after taking the intersection of the height mask map and the area mask map, a target mask map containing water surface height information can be obtained. The target mask map can indicate the terrain area range affected by the terrain effect and the waterline effect of the scene objects within the terrain area.
[0062] By applying this embodiment, a target mask map is obtained by taking the intersection of the height mask map and the area mask map, so that a soft transition effect of the wet rendering effect on the shore can be achieved; and the scene objects in the mask area can be automatically controlled so that the part above the water surface is not affected by the wet effect, while the part below the water surface is affected by the wet effect, thereby automatically achieving the waterline effect of the scene objects and improving the rendering efficiency and realism of the wet effect.
[0063] Step 106: Rendering terrain effects for the target rendering area.
[0064] In practical applications, on the basis of determining the target rendering area based on the target mask map, the terrain effect can be rendered for the target rendering area.
[0065] Specifically, the terrain effect can be understood as the geographical effect that the first terrain produces on the larger world, such as a moisture effect.
[0066] According to an optional embodiment of the present specification, rendering terrain effects for a target rendering area may include the following steps: Determine rendering parameters of target scene objects affected by terrain effects within the target rendering area; Renders the target scene object based on the rendering parameters.
[0067] Specifically, the target scene object can be understood as a scene object in the target scene within the range of the target rendering area. The target scene object may include a first object and a second object, wherein the first object is a scene object located in a first terrain area, and the second object is a scene object located in a terrain boundary area. That is, the first object is a scene object in the water, and the second object is a scene object on the river bank.
[0068] Optionally, the height of the first object may be higher than the height of the first terrain, or lower than the height of the first terrain. When the height of the first object is higher than the height of the first terrain, the waterline effect of the first object may be automatically achieved according to the height information. Specifically, the part of the first object above the water surface and the part below the water surface may be determined according to the height information, and the part above the water surface may be controlled not to be affected by the wet effect, while the part below the water surface may be affected by the wet effect, thereby achieving the waterline effect of the first object.
[0069] Optionally, the degree of influence of the second object may be determined according to the distance of the second object from the first terrain.
[0070] Exemplarily, when the second object is closer to the water surface, it is determined that the second object is more affected by moisture; when the second object is farther from the water surface, it is determined that the second object is less affected by moisture.
[0071] Furthermore, the side of the second object facing the water surface can be controlled to be affected by moisture, while the side facing away from the water surface is not affected by moisture.
[0072] Optionally, you can also use the rendering layer to flexibly control whether scene objects in the target rendering area are affected by the moisture effect.
[0073] For example, the target scene object can be added to or removed from the target rendering layer to control whether the target scene object is affected by or not affected by the wet effect. Specifically, the target scene object is a scene object within the target rendering area, and the target scene object can be determined according to the needs in the actual application.
[0074] Specifically, the rendering parameters can be used to simulate the rendering effect of terrain or scene objects affected by moisture. The rendering parameters can specifically include information such as smoothness, roughness, metalness, transparency, color, etc.
[0075] Optionally, the rendering parameters may be determined based on the position of the terrain or scene objects in the target rendering area. The rendering parameters may be determined based on information such as the depth of the water surface, the distance from the water surface or the shore, and the like.
[0076] For example, a soft transition effect can be achieved by setting the sharpness of the shore terrain material, and the color and smoothness of the terrain material can be set by the distance between the shore and the water surface, thereby improving the realism and naturalness of the wet effect.
[0077] Specifically, the rendering parameters may include rendering parameters of terrain materials, and may also include rendering parameters of affected scene objects.
[0078] By applying this embodiment, by determining the rendering parameters of the target scene objects affected by the terrain effect in the target rendering area, it is possible to achieve wet effect rendering of the terrain and scene objects based on the rendering parameters, thereby improving the wet effect rendering efficiency.
[0079] According to an optional embodiment of the present specification, rendering a target scene object based on rendering parameters may include the following steps: Generate scene decals corresponding to the target scene based on rendering parameters; Project the scene decals onto the target scene to obtain the target rendering effect of the target scene objects.
[0080] Specifically, the scene decal can be understood as a large decal corresponding to the entire target scene, and the scene decal includes rendering parameters corresponding to the affected terrain and scene objects in the target rendering area.
[0081] In practical applications, the scene decals can be projected onto the target scene through a decal projector, thereby achieving unified rendering of the wet effects of the affected terrain and scene objects.
[0082] Optionally, generating a scene decal corresponding to the target scene based on the rendering parameters may include: The rendering parameters corresponding to the affected terrain and scene objects in the target rendering area are saved in the scene decal.
[0083] Furthermore, the rendering parameters may include pixel information, and the first pixel information of each first vertex can be generated according to the rendering effect of each first vertex; the second pixel information of each second vertex can be generated according to the influence degree information of each second vertex; and the scene decal corresponding to the target scene can be generated based on the first pixel information and the second pixel information.
[0084] Specifically, the first pixel information is used to represent the wet rendering effect corresponding to each first vertex, and the second pixel information is used to represent the wet rendering effect corresponding to each second vertex.
[0085] Optionally, generating first pixel information of each first vertex according to a rendering effect of each first vertex may include: generating first pixel information of each first vertex according to a degree of smoothness of each first vertex.
[0086] Optionally, generating the second pixel information of each second vertex according to the affected degree information of each second vertex may include: generating the second pixel information of each second vertex according to the moisture degree of each second vertex.
[0087] Furthermore, the smoothness of each first vertex can be determined based on the height difference between each first vertex and the adjacent first vertex, and the depth of the water surface; the wetness of each second vertex can be determined based on the distance between the second vertex and the water surface.
[0088] It should be noted that the size of the scene decal can be adjusted according to the needs of the actual application.
[0089] By applying this embodiment, by generating scene decals corresponding to the target scene and projecting the rendering parameters corresponding to the wet effect into the big world in the form of decals, it is possible to achieve unified rendering of the wet effects on the terrain and objects, thereby improving the efficiency of rendering the wet effects. In this way, not only the influence of the wet effect on the terrain can be realized, but also the influence of the wet effect on the objects on the terrain can be realized, and flexible control of the effect of the wet effect on the objects can be achieved.
[0090] In one or more optional embodiments of the present specification, the decal projector can move with the player, and the decal size can be adjusted at will. According to the position of the player in the target scene, the scene decal can be generated at runtime and projected through the decal projector, so that the decal can be projected to the corresponding visual coordinate position wherever the player walks, improving the flexibility of the wet effect rendering.
[0091] According to an optional embodiment of the present specification, before obtaining the first position information and height information of the first terrain and the second position information of the second terrain in the target scene, the following steps may also be included: Get the object position of the virtual object in the target scene.
[0092] Specifically, the position of the object can be determined in real time according to the position of the player in the big world. The virtual object can be understood as the object played by the player in the game, which can be the player's corresponding character, or the player's mecha, armored vehicle, etc.
[0093] Accordingly, obtaining first position information and height information of a first terrain and second position information of a second terrain in a target scene includes: According to the visual field corresponding to the object position, first position information and height information of the first terrain within the visual field and second position information of the second terrain are obtained.
[0094] Optionally, the field of view corresponding to the object position may be determined according to the shooting range of a virtual camera in the target scene.
[0095] By applying this embodiment, by obtaining the first position information and height information of the first terrain and the second position information of the second terrain within the field of view according to the field of view corresponding to the object position, it is possible to collect water surface model information and ground surface model information within the field of view corresponding to the player's current position, thereby collecting height mask maps and area mask maps for the player's current field of view, and further controlling the area affected by the wet effect within the player's field of view; by generating scene decals and projecting them to the player's visual coordinate position, it is possible to achieve the effect of decals following the player's movement, thereby improving the efficiency and flexibility of wet effect rendering.
[0096] By applying this embodiment, first position information and height information of a first terrain and second position information of a second terrain in a target scene are obtained, wherein the second terrain is adjacent to the first terrain; a target rendering area is determined according to the first position information, the second position information and the height information, wherein the target rendering area is an area of the first terrain and the second terrain that is affected by the terrain effect of the first terrain; and the terrain effect is rendered for the target rendering area.
[0097] In this way, by determining the target rendering area according to the first position information, the second position information and the height information, the height range affected by the terrain effect of the first terrain can be controlled based on the height information, and the area range affected by the terrain effect of the first terrain can be controlled based on the first position information and the second position information, thereby improving the efficiency and flexibility of determining the target rendering area; by rendering the terrain effect for the target rendering area, the terrain effect can be rendered for the target rendering area as a whole, without the need to add additional rendering channels for each piece of terrain, which can save storage space and improve rendering efficiency. At the same time, it is also possible to flexibly control whether objects in the target rendering area are affected by the terrain effect.
[0098] The following combination Figure 2-Figure 7 Taking the application of the terrain effect rendering method provided in this specification in the realization of the wet river bank effect as an example, the terrain effect rendering method is further described. Figure 2 A flowchart of a method for rendering terrain effects provided in an embodiment of the present specification is shown, which specifically includes the following steps.
[0099] Step 202: Based on the pre-baked terrain map for the entire world, sample a height map stored in a high-precision format.
[0100] Specifically, the height map contains the height information of the water surface.
[0101] In practical applications, based on the terrain map pre-baked in Houdini, a 2k single-channel 16-bit format map including the water surface height can be sampled for the entire world as a height map.
[0102] See also Figure 3 , Figure 3 A schematic diagram of a water surface model of a method for rendering terrain effects provided by an embodiment of this specification is shown. Figure 3 As shown, the water surface model includes multiple patches, and the vertices on each patch are vertices located on the water surface. The height map can be obtained by reading the height value of each vertex.
[0103] See also Figure 4a , Figure 4a FIG. 1 is a schematic diagram showing a water surface height mask of a method for rendering terrain effects provided by an embodiment of the present specification. Figure 4a As shown, the "Y-shaped" mask part is used to indicate the range of the water surface area, and each point in the range has corresponding height information.
[0104] See also Figure 4b , Figure 4b FIG. 1 is a schematic diagram showing the position of each terrain in a water surface height mask provided by an embodiment of the present specification. Figure 4bAs shown, each terrain has its corresponding position information in the big world, and the position information reflects the specific position of each small terrain in the big world. According to the water surface height mask map, it can be judged whether each small terrain is located in the water surface area.
[0105] Step 204: Based on the pre-baked terrain map for the entire large world, the distance between the water surface and the shore is calculated to obtain a signed distance field mask map.
[0106] See also Figure 5a , Figure 5a FIG. 1 is a schematic diagram showing a water surface SDF mask of a method for rendering terrain effects provided by an embodiment of the present specification. Figure 5a As shown in the figure, the "Y-shaped" mask part is used to indicate the range of the water surface area and the river bank area in the target scene. The range located in the water surface area and the river bank area is the range that may be affected by the wet effect.
[0107] According to the signed distance field mask map, the range of the wet effect can cover the river bank at the edge of the surface model, thereby simulating the wet effect of the river bank and improving the realism of the large world terrain.
[0108] See also Figure 5b , Figure 5b FIG. 1 is a schematic diagram showing the position of each terrain in a water surface SDF mask provided by an embodiment of the present specification. Figure 5b As shown, each terrain has its corresponding position information in the big world, and the position information reflects the specific position of each small terrain in the big world. According to the distance field mask map, it can be determined whether each small terrain is located in the water surface area or the river bank area.
[0109] Step 206: Multiply the height map and the signed distance field mask map to obtain a wet area mask with the water surface height.
[0110] See also Figure 6 , Figure 6 A schematic diagram of a wet effect of a method for rendering terrain effects provided by an embodiment of the present specification is shown. Specifically, a bridge is built on a water surface area, wherein the bridge deck is located above the water surface, and the bridge piers are partially located above the water surface and partially located below the water surface. The bridge deck and the bridge piers located above the water surface are not affected by the wet effect, while the bridge piers located below the water surface are affected by the wet effect, so that a natural waterline effect can be presented at the bridge piers.
[0111] According to the wet area mask carrying the water surface height, the waterline effect of the object in the water surface can be automatically realized, and the part above the water surface height is controlled to be unaffected by the wet effect, while the part below the water surface height is affected by the wet effect.
[0112] Through the wet area mask, not only can the scope of the affected area be controlled, but the waterline effect of each scene object within the range can also be automatically achieved.
[0113] Furthermore, by adding or removing scene objects within the affected area from the rendering layer, it is also possible to control whether each scene object is affected by the moisture effect individually, which not only enables control of the terrain, but also control of the scene objects, thereby improving the flexibility of moisture effect rendering.
[0114] Step 208: Generate decals for the entire large world according to the wet area mask, and project the decals into the large world through a decal projector.
[0115] In actual applications, the player's visual position information can be obtained in real time to obtain the pixel information of the decal at the visual position, so that the decal projector can move with the player and project the decal into the player's field of view. The decal projector can be configured according to the preset art effects, or according to the scene size of the big world, the terrain range of the water surface and the shore terrain.
[0116] It should be noted that the decal size can be adjusted according to the needs of the actual application, and the affected objects in the terrain can also be controlled by the rendering layer.
[0117] See also Figure 7 , Figure 7 A schematic diagram of turning on and off a moisture effect provided by an embodiment of this specification is shown.
[0118] When the wet area mask is generated based on the height map and the signed distance field mask map, the material performance can be changed by controlling the color, roughness, smoothness, metalness and other information of the affected material in the wet area mask, so as to simulate the smooth wet effect caused by water immersion in the material. By adding information such as color, roughness, smoothness, and metalness to the decal, the wet effect can be turned on or off to achieve one-click display or hiding of the wet effect of the large world.
[0119] like Figure 7 As shown, when the wet effect is turned on, the portion of the target scene that is masked in the wet area will present a smooth wet effect as a whole; when the wet effect is turned off, the wet effect in the target scene will be hidden as a whole and will not be displayed.
[0120] That is, when the moisture effect is turned off, the water surface, the shore, and objects in the water and on the shore are not affected by the moisture effect; when the moisture effect is turned on, the water surface, the shore, and objects in the water and on the shore can be affected by the moisture effect.
[0121] By applying this embodiment, by sampling a height map including water surface height information for the large world, the range and height of the water surface area can be determined; by calculating the shortest distance from each position on the water surface to the shore for the large world, a signed distance field SDF mask map can be obtained, thereby controlling the range of the water surface and the river bank; by taking the intersection of the height map and the signed distance field SDF mask map, a wet effect mask map carrying height information can be obtained, thereby controlling the range of the area affected by the wet effect, achieving a soft transition of the wet effect on the river bank and the waterline effect of objects in the water, thereby improving the realism and naturalness of the wet effect; by controlling the color, roughness, smoothness, metallicity and other information of the affected material in the wet area mask, a large decal for the large world is generated, so that the decal follows the player's movement, which can not only achieve the influence of the wet effect on the terrain, but also achieve the influence of the wet effect on the objects on the terrain, thereby improving the flexibility of wet effect rendering and improving the wet effect rendering efficiency.
[0122] Corresponding to the above method embodiment, this specification also provides an embodiment of a rendering device for terrain effects. Figure 8 FIG. 1 is a schematic diagram showing a structure of a device for rendering terrain effects provided by an embodiment of the present specification. Figure 8 As shown, the device comprises: The acquisition module 802 is configured to acquire first position information and height information of a first terrain and second position information of a second terrain in a target scene, wherein the second terrain is adjacent to the first terrain.
[0123] The determination module 804 is configured to determine a target rendering area according to the first position information, the second position information and the height information, wherein the target rendering area is an area of the first terrain and the second terrain that is affected by the terrain effect of the first terrain.
[0124] Rendering module 806: configured to render terrain effects for a target rendering area.
[0125] Optionally, the acquisition module 802 is further configured to: Determine a first terrain model corresponding to the first terrain, and obtain first position information and height information of the first terrain model in the target scene; A second terrain model corresponding to the second terrain is determined, and second position information of a terrain boundary area between the second terrain model and the first terrain model is obtained, wherein the terrain boundary area is located at an edge of the second terrain model.
[0126] Optionally, the determination module 804 is further configured to: According to the height information, a height mask image is obtained; Obtaining a regional mask map according to the first position information and the second position information, wherein the regional mask map includes the first terrain and a terrain boundary area between the first terrain and the second terrain; Based on the height mask and the area mask, the target rendering area is determined.
[0127] Optionally, the determination module 804 is further configured to: Store the height information into the height mask map according to the preset precision format.
[0128] Optionally, the second location information is location information of a terrain boundary area; the determination module 804 is further configured to: Determine the first vertex position of each first vertex on the first terrain according to the first position information; Determine the second vertex position of each second vertex in the terrain boundary area according to the second position information; The distance information between each first vertex and each second vertex is calculated to obtain a region mask graph.
[0129] Optionally, the determination module 804 is further configured to: Take the intersection of the height mask map and the area mask map to obtain the target mask map; Determine the target rendering area based on the target mask map.
[0130] Optionally, the rendering module 806 is further configured to: Determine rendering parameters of target scene objects affected by terrain effects within the target rendering area; Renders the target scene object based on the rendering parameters.
[0131] Optionally, the rendering module 806 is further configured to: Generate scene decals corresponding to the target scene based on rendering parameters; Project the scene decals onto the target scene to obtain the target rendering effect of the target scene objects.
[0132] Optionally, the acquisition module 802 is further configured to: Obtaining the object position of the virtual object in the target scene; According to the visual field corresponding to the object position, first position information and height information of the first terrain within the visual field and second position information of the second terrain are obtained.
[0133] By applying the embodiments of the present specification, by determining the target rendering area according to the first position information, the second position information and the height information, the height range affected by the terrain effect of the first terrain can be controlled based on the height information, and the area range affected by the terrain effect of the first terrain can be controlled based on the first position information and the second position information, thereby improving the efficiency and flexibility of determining the target rendering area; by rendering the terrain effect for the target rendering area, the terrain effect rendering can be performed on the entire target rendering area without adding additional rendering channels for each piece of terrain, which can save storage space and improve rendering efficiency. At the same time, it is also possible to flexibly control whether objects in the target rendering area are affected by the terrain effect.
[0134] The above is a schematic scheme of a terrain effect rendering device of this embodiment. It should be noted that the technical scheme of the terrain effect rendering device and the technical scheme of the terrain effect rendering method described above belong to the same concept, and the details of the terrain effect rendering device that are not described in detail can all be referred to the description of the technical scheme of the terrain effect rendering method described above.
[0135] Fig. 9 The structure block diagram of a computing device 900 provided according to an embodiment of the present specification is shown. The components of the computing device 900 include but are not limited to a memory 910 and a processor 920. The processor 920 is connected to the memory 910 via a bus 930, and a database 950 is used to store data.
[0136] The computing device 900 also includes an access device 940 that enables the computing device 900 to communicate via one or more networks 960. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 940 may include one or more of any type of network interface (e.g., a network interface card (NIC)) that is wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world-wide interoperability for microwave access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, and a near field communication (NFC).
[0137] In one embodiment of the present specification, the above components of the computing device 900 and Fig. 9 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Fig. 9 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0138] The computing device 900 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 900 may also be a mobile or stationary server.
[0139] The processor 920 is used to execute the following computer executable instructions, which, when executed by the processor, implement the steps of the method for rendering the above-mentioned terrain effect.
[0140] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above-mentioned method for rendering terrain effects belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above-mentioned method for rendering terrain effects.
[0141] An embodiment of the present specification further provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the steps of the above-mentioned method for rendering terrain effects.
[0142] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above-mentioned method for rendering terrain effects belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the above-mentioned method for rendering terrain effects.
[0143] An embodiment of the present specification also provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned method for rendering terrain effects when executed by a processor.
[0144] The above is a schematic solution of a computer program product of this embodiment. It should be noted that the technical solution of the computer program product and the technical solution of the above-mentioned method for rendering terrain effects belong to the same concept, and the details not described in detail in the technical solution of the computer program product can be referred to the description of the technical solution of the above-mentioned method for rendering terrain effects.
[0145] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0146] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0147] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of this specification are not limited by the order of the actions described, because according to the embodiments of this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of this specification.
[0148] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0149] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to only the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that technicians in the relevant technical field can well understand and use this specification. This specification is only limited by the claims and their full scope and equivalents.
Claims
1. A method for rendering terrain effects, characterized in that: include: Acquire first position information and height information of a first terrain and second position information of a second terrain in a target scene, wherein the second terrain is adjacent to the first terrain; Determine a target rendering area according to the first position information, the second position information, and the height information, wherein the target rendering area is an area of the first terrain and the second terrain that is affected by the terrain effect of the first terrain; Rendering the terrain effect for the target rendering area.
2. The method according to claim 1, characterized in that: The step of obtaining first position information and height information of a first terrain and second position information of a second terrain in a target scene includes: Determine a first terrain model corresponding to the first terrain, and obtain first position information and height information of the first terrain model in the target scene; A second terrain model corresponding to the second terrain is determined, and second position information of a terrain boundary area between the second terrain model and the first terrain model is obtained, wherein the terrain boundary area is located at an edge of the second terrain model.
3. The method according to claim 1, characterized in that The determining a target rendering area according to the first position information, the second position information and the height information includes: According to the height information, obtaining a height mask image; Obtaining a regional mask map according to the first position information and the second position information, wherein the regional mask map includes the first terrain and a terrain boundary area between the first terrain and the second terrain; The target rendering area is determined based on the height mask map and the area mask map.
4. The method according to claim 3, characterized in that: The step of obtaining a height mask map according to the height information includes: The height information is stored in the height mask map according to a preset precision format.
5. The method according to claim 3, characterized in that: The second location information is location information of the terrain boundary area; The step of obtaining a regional mask map according to the first position information and the second position information includes: Determine, according to the first position information, first vertex positions of each first vertex on the first terrain; Determine the second vertex position of each second vertex in the terrain boundary area according to the second position information; The distance information between each of the first vertices and each of the second vertices is calculated to obtain the region mask graph.
6. The method according to any one of claims 3 to 5, characterized in that: The step of determining the target rendering area based on the height mask map and the area mask map comprises: Taking the intersection of the height mask map and the area mask map to obtain a target mask map; The target rendering area is determined according to the target mask map.
7. The method according to claim 1, characterized in that Rendering the terrain effect for the target rendering area includes: Determine rendering parameters of a target scene object affected by the terrain effect within the target rendering area; Based on the rendering parameters, the target scene object is rendered.
8. The method according to claim 7, characterized in that The rendering of the target scene object based on the rendering parameters includes: Based on the rendering parameters, generating a scene decal corresponding to the target scene; The scene decal is projected onto the target scene to obtain a target rendering effect of the target scene object.
9. The method according to claim 1, characterized in that: Before acquiring the first position information and height information of the first terrain and the second position information of the second terrain in the target scene, the method further includes: Obtaining an object position of a virtual object in the target scene; The step of obtaining first position information and height information of a first terrain and second position information of a second terrain in a target scene includes: According to the field of view corresponding to the object position, first position information and height information of the first terrain and second position information of the second terrain within the field of view are acquired.
10. A device for rendering terrain effects, characterized in that: include: An acquisition module is configured to acquire first position information and height information of a first terrain and second position information of a second terrain in a target scene, wherein the second terrain is adjacent to the first terrain; a determination module configured to determine a target rendering area according to the first position information, the second position information and the height information, wherein the target rendering area is an area of the first terrain and the second terrain that is affected by a terrain effect of the first terrain; The rendering module is configured to render the terrain effect for the target rendering area.
11. A computing device, characterized in that: include: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the method for rendering terrain effects according to any one of claims 1 to 9 are implemented.
12. A computer-readable storage medium, characterized in that: It stores a computer program / instruction, which, when executed by a processor, implements the steps of the method for rendering terrain effects described in any one of claims 1-9.
13. A computer program product, characterized in that The method comprises a computer program / instruction, which, when executed by a processor, implements the steps of the method for rendering terrain effects as described in any one of claims 1 to 9.
