Method and device for generating face sheet, storage medium and electronic device
Patent Information
- Application Number
- CN202211573815.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-08
- Publication Date
- 2026-09-15
- Estimated Expiration
- 2042-12-08
AI Technical Summary
[0006]本公开的目的在于提供一种面片树的生成方法及装置、计算机可读存储介质及电子设备,进而至少在一定程度上改善面片树生成效率低下、生成质量较差的问题
[0012]由上述技术方案可知,本公开示例性实施例中的面片树的生成方法、面片树的生成装置,以及实现所述面片树的生成方法的计算机可读存储介质及电子设备,至少具备以下优点和积极效果:
Smart Images

Figure CN116030169B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and more specifically, to a method for generating a patch tree, an apparatus for generating a patch tree, a computer-readable storage medium, and an electronic device. Background Technology
[0002] In game scenes, virtual object models can be used to represent game visuals, such as using vegetation models to represent vegetation in the game, such as flowers, grass, and trees.
[0003] Taking a virtual tree model in a game as an example, it can be created and rendered using polygons. The relevant technology involves pre-determining the shooting angle and adjusting the light source in SpeedTree (a 3D tree modeling software), generating color maps, and then outputting normal maps, ambient light maps, etc. Next, polygons are created in 3D rendering software such as 3ds Max or Maya. Based on the color maps, the outer contours of the polygons are then reduced to generate a polygon tree.
[0004] However, when the lighting angle and shooting angle change, or when the effect of the previously generated ambient light map is not satisfactory, this method requires readjusting the lighting in SpeedTree and re-outputting. It is difficult to adjust the effect of the ambient light map in real time, resulting in low generation efficiency and poor generation quality of the patch tree.
[0005] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0006] The purpose of this disclosure is to provide a method and apparatus for generating patch trees, a computer-readable storage medium and an electronic device, thereby improving, to at least some extent, the problems of low efficiency and poor quality in generating patch trees.
[0007] Other features and advantages of this disclosure will become apparent from the following detailed description, or may be learned in part from practice of this disclosure.
[0008] According to a first aspect of this disclosure, a method for generating a patch tree is provided, comprising: acquiring a three-dimensional model tree; determining a polygon of leaf models enclosing the three-dimensional model tree; for each leaf vertex of the leaf models, determining a normalized distance from the leaf vertex to the surface of the polygon; acquiring an input distance interval and an ambient light intensity range, wherein the distance interval represents the maximum and minimum distances between a light source and a leaf vertex within the distance range indicated by the normalized distance, and the ambient light intensity range represents the ambient light intensity of the leaf vertex indicated by the maximum distance and the leaf vertex indicated by the minimum distance; determining the position of a light source based on the maximum and minimum distances; interpolating the ambient light intensity of the leaf models based on the light source position and the ambient light intensity range to obtain ambient light intensity data of the leaf models; and generating a patch tree corresponding to the three-dimensional model tree based on the ambient light intensity data.
[0009] According to a second aspect of this disclosure, an apparatus for generating a patch tree is provided, comprising: a polygon determination module configured to acquire a three-dimensional model tree and determine a polygon of a leaf model enclosing the three-dimensional model tree; a distance determination module configured to determine, for each leaf vertex of the leaf model, a normalized distance from the leaf vertex to the surface of the polygon; an input data acquisition module configured to acquire an input distance interval and an ambient light intensity range, wherein the distance interval represents the maximum and minimum distances between a light source and a leaf vertex within the distance range indicated by the normalized distance, and the ambient light intensity range represents the ambient light intensity of the leaf vertex indicated by the maximum distance and the leaf vertex indicated by the minimum distance; an ambient light intensity data determination module configured to determine the position of a light source based on the maximum and minimum distances, and to perform ambient light intensity interpolation on the leaf model based on the light source position and the ambient light intensity range to obtain ambient light intensity data of the leaf model; and a patch tree generation module configured to generate a patch tree corresponding to the three-dimensional model tree based on the ambient light intensity data.
[0010] According to a third aspect of this disclosure, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method for generating a patch tree as described in the first aspect of the above embodiments.
[0011] According to a fourth aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a storage device for storing one or more programs, which, when executed by the one or more processors, cause the one or more processors to implement the patch tree generation method as described in the first aspect of the above embodiments.
[0012] As can be seen from the above technical solutions, the method for generating a patch tree, the apparatus for generating a patch tree, and the computer-readable storage medium and electronic device for implementing the method for generating a patch tree in the exemplary embodiments of this disclosure have at least the following advantages and positive effects: In some embodiments of this disclosure, by wrapping a leaf model with a polygon, the normalized distance from the leaf vertex to the polygon surface can be obtained. Based on this normalized distance, the position of the light source can be simulated according to the distance range input by the user, and the intensity of the light source can be determined according to the ambient light intensity range input by the user, thereby determining the ambient light data of the leaves of the model tree. Compared with related technologies, on the one hand, the user can adjust the input distance range and ambient light intensity range to change the generated ambient light data in real time, thereby adjusting the ambient light effect of the patch tree in real time and improving the generation quality of the patch tree; on the other hand, the user only needs to adjust the input distance range and ambient light intensity range to generate patch trees with different effects in real time, improving the generation efficiency of the patch tree.
[0013] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0014] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0015] Figure 1 This diagram illustrates a flowchart of a method for generating a patch tree according to an exemplary embodiment of the present disclosure. Figure 2 This diagram illustrates a flowchart of a method for determining a polygonal body that encloses a leaf model in an exemplary embodiment of this disclosure. Figure 3 This diagram illustrates a scenario in which leaf vertices are wrapped in an exemplary embodiment of the present disclosure. Figure 4 This diagram illustrates a polygon generated in an exemplary embodiment of the present disclosure. Figure 5 This diagram illustrates a flowchart of a method for determining the normalized distance from a leaf vertex to the surface of a polygon in an exemplary embodiment of this disclosure. Figure 6 An ambient light map is shown in an exemplary embodiment of this disclosure, obtained according to different distance ranges and ambient light intensity ranges.
[0016] Figure 7 A flowchart illustrating a method for generating a patch tree to be processed according to an exemplary embodiment of the present disclosure is shown. Figure 8 This diagram illustrates a model tree of facets to be processed corresponding to different adjustable shapes and different numbers of faces in an exemplary embodiment of this disclosure; Figure 9 A flowchart illustrating a method for calculating fusion normals according to an exemplary embodiment of this disclosure is shown. Figure 10A This illustration shows a leaf model obtained based on vertex normals in an exemplary embodiment of the present disclosure; Figure 10B This illustration shows a leaf model obtained based on fusion normals in an exemplary embodiment of this disclosure; Figure 11 This diagram illustrates a flowchart of a method for generating a patch tree based on fused normals according to an exemplary embodiment of the present disclosure. Figure 12 A flowchart illustrating a method for generating a hybrid texture map in an exemplary embodiment of this disclosure is shown. Figure 13 A flowchart illustrating another method for generating a patch tree according to an exemplary embodiment of this disclosure is shown. Figure 14 This diagram illustrates the structure of a patch tree generation apparatus in an exemplary embodiment of the present disclosure. Figure 15 A schematic diagram of the structure of an electronic device in an exemplary embodiment of this disclosure is shown. Detailed Implementation
[0017] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this disclosure more comprehensive and complete, and to fully convey the concept of the example embodiments to those skilled in the art. The described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a full understanding of embodiments of this disclosure. However, those skilled in the art will recognize that the technical solutions of this disclosure can be practiced with one or more of the specific details omitted, or other methods, components, apparatus, steps, etc., can be employed. In other instances, well-known technical solutions are not shown or described in detail to avoid obscuring various aspects of this disclosure.
[0018] The terms “a,” “an,” “the,” and “the” are used in this specification to indicate the presence of one or more elements / components / etc.; the terms “including” and “having” are used to indicate an open-ended inclusion and to mean that there may be other elements / components / etc. in addition to the listed elements / components / etc.; the terms “first” and “second” are used only as markings and are not a limitation on the number of objects.
[0019] Furthermore, the accompanying drawings are merely illustrative of this disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities.
[0020] Due to limitations in the performance of mobile devices, most game vegetation on mobile devices is created and rendered using a pixel-based approach.
[0021] In related technologies, the shooting angle is determined in advance in SpeedTree (a 3D tree modeling software), the light source is adjusted, a color map is generated, and then the normal map, ambient light map, etc. are output. Next, in 3D rendering software such as Max or Maya, new patches are created, and the outer contour of the patches is reduced according to the color map to generate a patch tree.
[0022] However, SpeedTree can only output vertex normal maps, which leads to chaotic lighting and shadows on vegetation patches during subsequent lighting calculations, resulting in a lack of clear volume and poor rendering quality. Furthermore, related technologies are only suitable for scenes with pre-determined shooting and lighting angles. The generated Ambient Occlusion (AO) and Subsurface-Scattering (SSS) maps have low controllability. If the AO map effect is unsatisfactory in subsequent processing, the lighting or shooting angle needs to be adjusted in SpeedTree before re-outputting the map. Real-time adjustment of the AO map display effect is not possible. Moreover, related technologies require manual comparison and trimming of the outline in 3ds Max for model trees of different sizes and shapes, making it impossible to quickly adjust the number of vertices and the shape of the patch outlines. This results in low generation efficiency and low generation quality for patch trees.
[0023] Furthermore, since the rendering requirements for distant game scenes are not high, the aforementioned method can be used to create and render a Billboard patch tree (a tree created from a planar model that is always rendered facing the camera) for virtual model trees. However, for close-up game scenes, the rendering requirements for the patch tree are much higher, so the patch trees generated by the solutions in related technologies cannot be used for close-up game scenes.
[0024] Based on this, in the embodiments of this disclosure, a method for generating a patch tree is first provided, which at least to some extent overcomes the defects existing in the above-mentioned related technologies.
[0025] Figure 1 This diagram illustrates a flowchart of a method for generating a patch tree in an exemplary embodiment of this disclosure. (See reference...) Figure 1 The method includes: Step S110: Obtain the 3D model tree and determine the polygon of the leaf model that encloses the 3D model tree; Step S120: For each leaf vertex of the leaf model, determine the normalized distance from the leaf vertex to the surface of the polygon. Step S130: Obtain the input distance interval and ambient light intensity range. The distance interval represents the maximum and minimum distances between the light source and the leaf apex within the distance range indicated by the normalized distance. The ambient light intensity range represents the ambient light intensity of the leaf apex indicated by the maximum distance and the leaf apex indicated by the minimum distance. Step S140: Determine the position of the light source based on the maximum distance and the minimum distance, and perform ambient light intensity interpolation on the leaf model based on the position of the light source and the ambient light intensity range to obtain the ambient light intensity data of the leaf model; Step S150: Generate a patch tree corresponding to the three-dimensional model tree based on the ambient light intensity data.
[0026] exist Figure 1 In the technical solution provided by the illustrated embodiment, by wrapping the leaf model with a polygon, the normalized distance from the leaf vertex to the surface of the polygon can be obtained. Based on this normalized distance, the position of the light source can be simulated according to the distance range input by the user, and the intensity of the light source can be determined according to the ambient light intensity range input by the user, thereby determining the ambient light data of the leaves in the model tree. Compared with related technologies, on the one hand, the user can adjust the input distance range and ambient light intensity range to change the generated ambient light data in real time, thereby adjusting the ambient light effect of the patch tree in real time and improving the generation quality of the patch tree; on the other hand, the user only needs to adjust the input distance range and ambient light intensity range to generate patch trees with different effects in real time, improving the generation efficiency of the patch tree.
[0027] The following are Figure 1 The specific implementation methods of each step in the illustrated embodiment are described in detail below: In step S110, a three-dimensional model tree is obtained, and the polygon of the leaf model that encloses the three-dimensional model tree is determined.
[0028] In one exemplary implementation, a 3D model tree can be created using 3D modeling software, such as SpeedTree. The created 3D model tree is then saved in a file format required by the 3D computer graphics software, allowing the 3D model tree file to be imported into the 3D computer graphics software.
[0029] Taking Houdini, a 3D computer graphics software, as an example, the 3D model tree created in SpeedTree can be exported and saved in a file format required by Houdini, such as .obj (a 3D model file format) or FBX (an FBX file is a 3D model saved in Autodesk Filmbox format). Then, the .obj or FBX format 3D model tree file created in SpeedTree can be imported into Houdini to obtain the 3D model tree.
[0030] In one exemplary implementation, while importing the created 3D model tree into the 3D computer graphics software, the basic textures of the created 3D model tree, such as material textures, can also be imported into the 3D computer graphics software.
[0031] When rendering a patch tree, the leaves need to have a stronger sense of three-dimensionality compared to the trunk and branches. Therefore, high-quality rendering of patch trees is mainly aimed at enhancing the volume of the leaves.
[0032] The LOD (Level of Detail) nodes in the 3D model tree contain the ID ranges of different materials used in the previous material mapping process. For example, the leaves use the basic color map of leaves, and the trunk uses the basic color map of the trunk. In SpeedTree, vertices using the same color map are assigned a range of IDs. For instance, vertices numbered 1-500 use the leaf color map, and vertices numbered 501-1000 use the trunk color map. Based on this data, vertices 1-500 can be identified as leaves, and vertices 501-1000 as trunks. Thus, the leaf and trunk parts in the 3D model tree can be quickly distinguished based on this ID range.
[0033] In an exemplary scenario, different 3D model trees may have different styles, such as some 3D model trees being tall, some being short, some being thick, and some being thin. After obtaining the 3D model tree, its length, width, and height can be scaled proportionally so that the virtual camera can capture the complete appearance of the 3D model tree, and the 3D model tree in the output texture is displayed in the center and the texture space is utilized to the maximum extent.
[0034] Based on this, a specific implementation of step S110 may include: obtaining an initial three-dimensional model tree, adjusting the size of the initial three-dimensional model tree to completely and maximally map the three-dimensional model tree into a cube of a preset size to obtain a target three-dimensional model tree; and determining the polygon of the leaf model that encloses the target three-dimensional model tree.
[0035] For example, the initial 3D model tree imported into Houdini software can be scaled proportionally in length, width and height. Without changing the style of the initial model tree, it can be scaled to a cube of a preset size, and the entire 3D model tree can be seen in the cube. The complete 3D model tree can be displayed in the cube at the maximum display size.
[0036] The preset size of the cube can be customized according to needs or experience, but it should not be set too small. If it is too small, the model tree will also be scaled to a very small size, which is not conducive to observing the real-time adjustment effects of the ambient light map and normal map of the model tree.
[0037] For example, one specific implementation of step S110 may include: obtaining a three-dimensional model tree, and wrapping the leaf vertices of the three-dimensional model tree with a preset wrapping shape to determine the polygonal body that wraps the leaf model of the three-dimensional model tree. The preset wrapping shape includes a sphere.
[0038] Figure 2 This diagram illustrates a flowchart of a method for determining a polygonal body that encloses a leaf model in an exemplary embodiment of this disclosure. (See reference...) Figure 2 The method may include steps S210 to S220. Specifically: in step S210, a three-dimensional model tree is obtained, and each leaf vertex of the three-dimensional model tree is wrapped with a sphere of a preset size; in step S220, the wrapping result is converted into a point cloud to determine the polygon of the leaf model wrapping the three-dimensional model tree.
[0039] For example, each vertex of the leaf model can be wrapped with a sphere of a preset size to obtain the polygonal outline of the leaf model. A schematic diagram of the wrapped vertex outline is shown below. Figure 3As shown. For example, a sphere can be created and then copied to each leaf vertex to obtain the outline of the entire leaf portion, which is still surrounded by several small spheres. To obtain the overall outer outline, a VDB (Volume Data Base, a voxel storage format) node can be used to convert it into a polygon outline, resulting in a polygon that encompasses the entire leaf area. The obtained polygon can be represented as follows. Figure 4 As shown.
[0040] Referring again to Figure 1, in step S120, for each leaf vertex of the leaf model, the normalized distance from the leaf vertex to the surface of the polygon is determined.
[0041] Figure 5 This diagram illustrates a flowchart of a method for determining the normalized distance from a leaf vertex to the surface of a polygon in an exemplary embodiment of this disclosure. (Refer to...) Figure 5 The method may include steps S510 to S530.
[0042] In step S510, a directed distance field is created within the polygon.
[0043] For example, an SDF (Signed Distance Field) can be created within the transformed VDB volume. A directed distance field can be understood as a signed distance field that records the distance from each voxel to the surface of the polygon.
[0044] In step S520, based on the sampling function, the leaf vertices are sampled in the directed distance field to obtain the directed distance from each leaf vertex to the surface of the polygon.
[0045] For example, the SDF volume can be sampled using a sampling function, such as the volumesample function, to obtain the directed distance from the leaf vertex to the surface of the polygon.
[0046] In step S530, the directed distance of each leaf vertex is normalized according to the maximum and minimum values of the directed distances to obtain the normalized distance from each leaf vertex to the surface of the polygon.
[0047] The normalization process can be understood as mapping the directed distances of all leaf vertices to the interval [0, 1].
[0048] For example, a non-linear mapping can be used to map the directed distances of all leaf vertices to the interval [0, 1]. For instance, if the distance from a vertex to the surface of the polygon is negative, it means the vertex is inside the surface, and therefore light cannot reach it. In this case, all leaf vertices with directed distances less than 0 can have their directed distances directly mapped to 0. For other leaf vertices with directed distances greater than or equal to 0, their directed distances can be directly mapped to the interval [0, 1] based on their maximum and minimum values. This allows for the normalization of the directed distances from all leaf vertices to the polygon surface.
[0049] By normalizing the data, the distances from all leaf vertices to the polygon surface can be mapped to the interval [0, 1]. This allows us to define the minimum distance from the light source to the leaf vertex as 0 and the maximum distance as 1, thus simulating the light source's position by taking values within the range [0, 1]. When the user selects different values within [0, 1], the simulated light source position will differ, prompting real-time adjustments to the generated ambient occlusion map.
[0050] Continue to refer to Figure 1 In step S130, the input distance range and ambient light intensity range are obtained.
[0051] In one exemplary embodiment, the distance interval represents the maximum and minimum distances between the light source and the leaf apex within the distance range indicated by the normalized distance, and the ambient light intensity range represents the ambient light intensity at the leaf apex indicated by the maximum distance and the leaf apex indicated by the minimum distance.
[0052] For example, a first input box, a second input box, a third input box, and a fourth input box can be pre-configured in the display panel of a computer graphics software. The input data in the first input box can be used to indicate the minimum value of the distance range, the data in the second input box can indicate the maximum value of the distance range, the input data in the third input box can be used to indicate the ambient light intensity received by the leaf vertex corresponding to the minimum distance entered in the first input box, and the input data in the fourth input box can be used to indicate the ambient light intensity received by the leaf vertex corresponding to the maximum distance entered in the second input box.
[0053] For example, the user can input distance data in the first and second input boxes as needed, and the distance range input by the user can be determined based on the data input in the first and second input boxes. In step S120, the distance from the leaf vertex to the polygon surface has been normalized so that the maximum distance between the light source and the leaf vertex is 1 and the minimum distance is 0. Therefore, the input data in the first and second input boxes can take values in the range [0,1]. The user can input ambient light intensity data in the third and fourth input boxes, and the range of ambient light intensity can be determined based on the input data in the second and fourth input boxes. Here, ambient light intensity can be understood as AO (Ambient Occlusion) intensity, and the input data in the third and fourth input boxes can also take values in the range [0,1].
[0054] In one exemplary application scenario, the user can input different ambient light intensity ranges and different distance intervals to adjust the ambient light intensity data determined in step S140, thereby generating different ambient light maps in subsequent steps. Through the input boxes and normalized distances, the generated ambient light map can be adjusted in real time based on the user-input data, without needing to pre-set the light source position and illumination intensity, thus improving the generation efficiency and quality of the ambient light map.
[0055] Continue to refer to Figure 1 In step S140, the position of the light source is determined according to the maximum distance and the minimum distance, and the ambient light intensity is interpolated on the leaf model based on the position of the light source and the range of ambient light intensity to obtain the ambient light intensity data of the leaf model.
[0056] Taking an example where the data entered in the first input box is 0.3, the data entered in the second input box is 0.9, the data entered in the third input box is 0.8, and the data entered in the fourth input box is 0.4, 0.3 represents the distance between the leaf vertex closest to the light source and the light source, and 0.9 represents the distance between the leaf vertex farthest from the light source and the light source, respectively. Therefore, the position of the light source can be determined based on the minimum and maximum distances. 0.8 represents the light intensity received by the leaf vertex closest to the light source, indicated by the minimum distance entered in the first input box, and 0.4 represents the light intensity received by the leaf vertex farthest from the light source, indicated by the maximum distance entered in the second input box. Based on the light intensity received by the leaf vertex closest to the light source and the leaf vertex farthest from the light source, the intensity of the light source can be determined.
[0057] Once the location and intensity of the light source are determined, the light intensity received by other leaf vertices can be interpolated between the light intensity received by the leaf vertices indicated by the maximum and minimum distances to obtain the ambient light intensity gradient data for the entire leaf portion of the 3D model tree.
[0058] In one exemplary implementation, the ambient light intensity data generated in step S140 is used to generate an ambient light map, i.e., an AO map. When the distance range input by the user changes, the position of the light source also changes. When the position of the light source changes, the generated ambient light data also changes, thus allowing the generated AO map to be adjusted in real time. Similarly, when the range of ambient light intensity input by the user changes, the intensity of the light source changes. When the intensity of the light source changes, the generated ambient light data also changes, thus allowing the generated AO map to be adjusted in real time. Figure 6 An ambient light map obtained according to different distance ranges and ambient light intensity ranges is shown in an exemplary embodiment of this disclosure. (Reference) Figure 6 The generated AO maps differ depending on the distance range and the ambient light intensity range.
[0059] In other words, in this disclosure, users can adjust one or more of the input distance range and the input ambient light intensity range according to their needs to adjust the generated AO map in real time, thereby improving the generation efficiency and quality of the AO map.
[0060] Continue to refer to Figure 1 In step S150, a patch tree corresponding to the three-dimensional model tree is generated based on the ambient light intensity data.
[0061] One exemplary implementation of step S150 may include: generating an ambient light map based on ambient light intensity data, and generating a patch tree corresponding to the 3D model tree based on the ambient light map and the patch tree to be processed corresponding to the 3D model tree. The patch tree to be processed can be understood as a patch tree without an ambient light map.
[0062] For example, after generating an ambient light map based on ambient light data, the ambient light map can be fused with a pre-generated patch tree to be processed to generate a patch tree corresponding to the 3D model tree.
[0063] In one exemplary implementation, the tile tree includes a tile tree within a game scene, which is captured and displayed using a virtual camera. The tile tree may include a Billboard tile tree.
[0064] For example, Figure 7 This diagram illustrates a flowchart of a method for generating a patch tree to be processed according to an exemplary embodiment of this disclosure. (See reference...) Figure 7 The method may include steps S710 to S730. Wherein: In step S710, the three-dimensional model tree is mapped onto the first plane and the second plane along the positive and negative directions of the virtual camera's viewing line of sight, respectively, to obtain the first plane tree and the second plane tree accordingly.
[0065] Taking the virtual camera positioned along the Z-axis in the Hdouni software's coordinate system as an example, the 3D model tree can be mapped along the positive direction of the Z-axis onto a first plane to obtain the first planar tree, and mapped along the negative direction of the Z-axis onto a second plane to obtain the second planar tree. For instance, the 3D model tree can be completely placed within a cube with six faces. When the virtual camera is positioned along the Z-axis, the first and second planar trees can be determined based on the mapping of the 3D model tree onto the positive and negative planes of the cube's Z-axis.
[0066] In step S720, the first planar tree and the second planar tree are merged to obtain a third planar tree.
[0067] For example, the first planar tree and the second planar tree can be merged. This can avoid mapping defects in single-face mapping, ensure that the angle mapping results are more accurate, and improve the quality of the generated patch tree.
[0068] In step S730, the third planar tree is mapped onto a mesh plane, and the portion outside the outline of the third planar tree is removed in the mesh plane to generate the patch tree to be processed corresponding to the three-dimensional model tree.
[0069] For example, the third-plane tree can be mapped again onto a subdivided grid plane, with the number of grids customizable as needed. Then, using the polyreduce node, the shape of the third-plane tree mapped onto the grid plane is preserved while removing the portion of the third-plane tree outside its outline in the grid plane, thus obtaining the mapped Billboard patch tree.
[0070] In one exemplary implementation, a fifth and sixth input box can be configured in the Houdini software panel. The input data in the fifth input box is associated with the shape adjustment parameters of the patch tree, and the input data in the sixth input box is associated with the face count adjustment parameters of the patch tree. This allows the user to adjust the shape and number of each patch in the generated patch tree through the fifth and sixth input boxes.
[0071] Figure 8 This diagram illustrates a model tree of facets to be processed corresponding to different adjustable shapes and different numbers of faces, as shown in an exemplary embodiment of this disclosure. Figure 8 In the example, the first patch tree has 100 patches, the second and third patch trees have 18 patches each, the patch shape adjustment parameter for the first and second patch trees is 6.1, and the value for the third patch tree is 3.2. The more patches there are, the more closely the shape of the generated patch tree will resemble the third patch tree. Reducing the number of patches allows for fine-tuning the style of the patch tree by adjusting the patch shapes. This provides artists with greater freedom and flexibility in adjusting the patch trees.
[0072] For example, an ambient light map can be generated from ambient light data to create a 3D model tree; then, the ambient light map and the patch tree to be processed can be merged to generate the patch tree corresponding to the 3D model tree.
[0073] In one exemplary embodiment, as described above, the initial 3D model tree is resized within a cube of a preset size, ensuring that the 3D model tree is centered within the cube. This also ensures that the generated ambient occlusion map is centered. Furthermore, the image coordinates of the patch tree to be processed can be adjusted in 3D computer graphics software, such as Houdini, so that the patch tree is centered in the image coordinate system, i.e., the UV coordinate system. This allows for a more seamless merging of the patch tree and the ambient occlusion map, preventing misalignment and further improving the quality of the generated patch tree.
[0074] Considering the chaotic and irregular orientation of the leaves in the model tree, with the vertex normals of each leaf pointing in various directions, the rendered lighting and shadows are messy and the sense of volume is poor. Therefore, for a patch tree, the leaves are the key element. Improving the volume of the leaves can enhance the overall volume of the patch tree and improve the rendering quality.
[0075] Based on this, the blending normals of the leaf parts can also be determined in this disclosure to enhance the rendering volume of the leaf parts. For example, Figure 9 This diagram illustrates a flowchart of a method for calculating fusion normals according to an exemplary embodiment of this disclosure. (See also:) Figure 9 The method may include steps S910 to S920. Wherein: In step S910, the vertex normals of the polygon are calculated.
[0076] You can wrap the leaves with geometry to achieve a better sense of volume and lighting effects. Spheres have very regular and uniform normals, resulting in good lighting calculations. Therefore, you can use a sphere to wrap the leaves. However, for a more accurate wrapping outline, you can copy the created sphere to each leaf vertex in Houdinit to wrap each vertex individually. This will give you an outline composed of several small spheres wrapping the leaves. Then, use a VDB node to directly convert it into a polygon outline, resulting in the outermost wrapping outline that best fits the leaves.
[0077] The polygon in step S910 can be understood as the polygon determined in step S110 above. For details on how to determine the polygon, please refer to the aforementioned content; further explanation is not provided here.
[0078] Once the polygon including the 3D model tree is determined, the vertex normals of the polygon can be calculated.
[0079] In step S920, the input fusion coefficients are obtained, and the vertex normals of the polygon and the vertex normals of the leaf vertices are fused based on the fusion coefficients to obtain the fused normals of the leaf model.
[0080] For example, the vertex normals of the leaf vertices in the leaf model can be merged with the vertex normals of the polygon to obtain a merged normal. This way, the rendered leaf parts of the patch tree can have a strong sense of three-dimensionality, while retaining some of the vertex normal orientation data of the leaf itself, so as to render a more realistic leaf effect.
[0081] In one exemplary implementation, a seventh input box can be configured in the Houdinit panel, and the input data in the seventh input box can be used to indicate the blending coefficient between the vertex normals of the polygon and the vertex normals of the leaf itself.
[0082] For example, the aforementioned polygon can be converted into a point cloud (a set of point shape contours) using a correlation function. Within this point cloud, calculations are performed on a range of up to 100 points, with position as the search attribute and a radius of 50. This calculation is repeated for each point. Then, the correlation function is used to filter the calculated points, yielding the final polygon contour vertex normals. Using the correlation function, linear interpolation is performed on the vertex normals of the polygon contour and the vertex normals of each leaf within the range [0,1] to fuse the polygon's vertex normals and the leaf's vertex normals. In other words, the fusion coefficient ranges from [0,1]. When the fusion coefficient is 0, the fused normal is the polygon's vertex normal; when the fusion coefficient is 1, the fused normal is the leaf's own vertex normal. Any value between 0 and 1 allows for the linear fusion of the polygon's vertex normals and the leaf's own vertex normals to obtain the fused normal.
[0083] Figure 10A This illustration shows a leaf model obtained based on the vertex normals of the leaf itself, according to an exemplary embodiment of the present disclosure. Figure 10B This illustration shows a leaf model obtained based on fusion normals in an exemplary embodiment of this disclosure. From Figure 10A and Figure 10B The comparison shows that the leaf model obtained by fusing normals has a more three-dimensional and regular feel.
[0084] After obtaining the blending normal, a patch tree corresponding to the 3D model tree can be generated based on the blending normal and the ambient light intensity data obtained in step S140.
[0085] As previously mentioned, the patch tree in this disclosure includes a patch tree in a game scene, which is displayed by capturing images of the game scene using a virtual camera. For example, Figure 11 This diagram illustrates a flowchart of a method for generating a patch tree based on fused normals according to an exemplary embodiment of this disclosure. (See also:) Figure 11 The method may include steps S1110 to S1140. Wherein: In step S1110, the fusion normal is transformed from the model space where the 3D model tree is located to the observation space where the virtual camera is located to obtain the target fusion normal.
[0086] Normals are typically stored in tangent space, which offers greater flexibility, such as compression. However, considering that the Billboard patch tree is always rendered facing the camera, lighting results can be calculated in view space. Therefore, normals can be directly transferred to view space and output as textures. Compared to related techniques that use normal maps in tangent space or vertex normal maps for rendering, directly converting normals to view space improves rendering efficiency, lighting calculation effects, and overall rendering quality.
[0087] In the material node that generates the normal map, the blended normals can be transformed from the model space where the 3D model tree is located to the observation space where the virtual camera is located through relevant nodes, so as to obtain the target blended normals in the observation space.
[0088] In step S1120, the target fusion normal is mapped to the pixel color space to obtain a normal map of the observation space.
[0089] To obtain a normal map, the target's blended normals can be mapped to pixel space, thus obtaining a normal map in view space.
[0090] For example, the target blending normals have all been normalized, meaning that the components of the target blending normals in each coordinate axis of the 3D coordinate system are between [-1, 1], while the pixel color components are between [0, 1]. This can be done based on preset rules, such as pixel = normal. 0.5 + 0.5 maps the target blending normal to pixel space, storing the target blending normal in the color texture to obtain a normal map in view space. Here, `normal` represents the blending normal, and `pixel` represents the stored value of the blending normal mapped to pixel space.
[0091] In step S1130, an ambient light map of a 3D model tree is generated based on the ambient light data.
[0092] In step S1140, a patch tree corresponding to the 3D model tree is generated based on the ambient light map and the normal map of the viewing space.
[0093] For example, relevant nodes can be connected in the material module to store the calculated ambient light data and the data after mapping the target blended normals to the pixel color space into the vertex color of the leaf model, thereby generating the corresponding ambient light map and view space normal map. Based on the ambient light map and view space normal map, a patch tree corresponding to the 3D model tree can then be generated.
[0094] In one exemplary embodiment, a specific implementation of step S1140 may include: mapping the 3D model tree along the positive and negative directions of the virtual camera's viewing line of sight onto a first plane and a second plane, respectively, to obtain a first plane tree and a second plane tree; merging the first plane tree and the second plane tree to obtain a third plane tree; mapping the third plane tree onto a mesh plane, and removing the portion outside the outline of the third plane tree in the mesh plane to generate a patch tree to be processed corresponding to the 3D model tree; and generating a patch tree corresponding to the 3D model tree based on the ambient light map, the normal map of the viewing space, and the patch tree to be processed.
[0095] The specific implementation method for generating the patch tree to be processed can be referred to the above. Figure 7 This will not be elaborated upon here.
[0096] For example, the patch tree to be processed can be mapped based on the ambient light map and the normal map of the view space to generate the patch tree corresponding to the 3D model tree.
[0097] In one exemplary implementation, camera rendering parameters can also be exposed in the adjustment panel of 3D computer graphics software, so that artists can quickly adjust rendering angles, resolutions, etc., to further improve the rendering quality and efficiency of patch trees.
[0098] In one exemplary implementation, a 3S (SubSurface-Scattering) map can also be generated, and the 3S map and the AO map can be mixed to generate a hybrid map. Based on the hybrid map, a patch tree corresponding to the 3D model tree can be generated, further improving the rendering effect of the patch tree.
[0099] For example, Figure 12 This diagram illustrates a flowchart of a method for generating a hybrid texture map according to an exemplary embodiment of this disclosure. (See reference...) Figure 12 The method may include steps S1210 to S1230. Specifically: in step S1210, an ambient light map is generated based on the ambient light data; in step S1220, a subsurface scattering map is generated based on the ambient light map; and in step S1230, a blending map is generated based on the ambient light map stored in the first color channel and the subsurface scattering map stored in the second color channel.
[0100] For example, the calculated ambient light intensity data can be stored in the vertex colors of the leaf model to generate an ambient light intensity map, or AO map, based on the ambient light intensity data stored in the vertex colors. Then, the AO map is converted into a 3S map through relevant nodes, and the AO map is stored in the first color channel, such as the B channel, while the 3S map is stored in the second color channel, such as the G channel, to blend the 3S map and the AO map, thereby generating a blended map.
[0101] Wherein, the first color channel is any one of the R channel, G channel, and B channel in the RGB color channel, and the second color channel is any one of the R channel, G channel, and B channel that is different from the first color channel. This exemplary embodiment does not make any special limitation in this regard.
[0102] Storing the AO (Area of Effect) map and 3S (3S) map in different map channels can save map resources. Since both the AO and 3S maps are grayscale images, outputting them separately (i.e., two separate maps) wastes map channels. For example, the R, G, and B channel data of the AO map are identical, and the R, G, and B channel data of the 3S map are also identical. Therefore, to better utilize map channels and save map resources, the AO map can be stored in the first color channel, and the 3S map in the second color channel, each occupying one color channel, allowing them to be blended to generate a blended map.
[0103] For example, a patch tree corresponding to a 3D model tree can be generated based on a blended texture. For instance, a patch tree to be processed corresponding to a 3D model tree can be generated by applying a blended texture to the blended texture.
[0104] As mentioned earlier, for the Billboard patch tree, the leaves have a rather chaotic and irregular orientation, with the normals of each leaf's vertices pointing in various directions. This results in poor rendering, messy lighting, and a lack of volume. When rendering close-up scenes, the leaves are the focus, and their volume needs to be significantly enhanced. In contrast, the trunk and branches have far fewer vertices than the leaves. The trunk and branches are more complete and form a unified whole, with more consistent normal directions. Therefore, the vertex normals of the trunk and branches can be used directly for rendering. Of course, target blending normals for the trunk or branches can also be generated as needed; this exemplary implementation does not impose any special limitations on this.
[0105] Based on this Figure 13 This diagram illustrates a flowchart of another method for generating a patch tree according to an exemplary embodiment of this disclosure. (See reference...) Figure 13The method may include steps S1310 to S1340. Specifically: in step S1310, a base color map of the 3D model tree is obtained; in step S1320, vertex normal maps of the trunk model and the branches model are generated based on their respective vertex normals; in step S1330, an ambient light map of the 3D model tree is generated based on the ambient light intensity data; and in step S1340, a patch tree corresponding to the 3D model tree is generated based on the base color map, the ambient light map, the vertex normal maps of the trunk model and the branches model.
[0106] A base color map of the 3D model tree can be pre-generated, as described above. Then, based on the vertex ID range, the branches and trunk of the 3D model tree are distinguished. The vertex normals of the branches and trunk are then obtained, generating vertex normal maps for the trunk and branches. Based on the blend map, base color map, normal maps of the leaves in view space, and vertex normal maps of the trunk and branches, the patch tree to be processed is textured to generate the patch tree corresponding to the 3D model tree.
[0107] In this disclosure, 3D model trees of different sizes and shapes can be processed uniformly to quickly generate the corresponding patch tree according to the user's needs, without the need for manual modification or pruning of the patch tree, and the final patch tree can be generated directly.
[0108] At the same time, the generated AO map can be adjusted in real time by adjusting the input distance range and light intensity range, the real-time light angle and light intensity, and the shooting angle can also be adjusted in real time to adjust the generated AO map, thus improving the generation efficiency of patch trees.
[0109] Furthermore, the blended normals determined by the vertex normals of the polygon can enhance the three-dimensionality and regularity of the rendered foliage, improving the overall rendering quality. Moreover, considering that the Billboard is always rendered facing the camera, to maximize the rendering effect, the normal map in view space is rendered directly. This ensures a unified lighting direction for the vegetation across the entire surface during subsequent lighting calculations, resulting in a clear sense of volume and further improving the rendering quality of the surface tree, making it suitable for close-up rendering.
[0110] Those skilled in the art will understand that all or part of the steps of the above embodiments are implemented as a computer program executed by a CPU. When the computer program is executed by the CPU, it performs the functions defined by the method provided by the present invention. The program can be stored in a computer-readable storage medium, such as a read-only memory, a magnetic disk, or an optical disk.
[0111] Furthermore, it should be noted that the above figures are merely illustrative representations of the processes included in the method according to exemplary embodiments of the present invention, and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.
[0112] Figure 14 This diagram illustrates the structure of a patch tree generation apparatus in an exemplary embodiment of this disclosure. (See reference...) Figure 14 The device 1400 may include a polygon determination module 1410, a distance determination module 1420, an input data acquisition module 1430, an ambient light intensity data determination module 1440, and a patch tree generation module 1450. Wherein: The polygon determination module 1410 is configured to acquire a three-dimensional model tree and determine the polygons that enclose the leaf models of the three-dimensional model tree. The distance determination module 1420 is configured to determine the normalized distance from each leaf vertex of the leaf model to the surface of the polygon. The input data acquisition module 1430 is configured to acquire the input distance interval and ambient light intensity range, wherein the distance interval represents the maximum and minimum distances between the light source and the leaf apex within the distance range indicated by the normalized distance, and the ambient light intensity range represents the ambient light intensity of the leaf apex indicated by the maximum distance and the leaf apex indicated by the minimum distance. The ambient light intensity data determination module 1440 is configured to determine the light source position based on the maximum distance and the minimum distance, and to perform ambient light intensity interpolation on the leaf model based on the light source position and the ambient light intensity range to obtain the ambient light intensity data of the leaf model. The patch tree generation module is configured to generate a patch tree corresponding to the 3D model tree based on the ambient light intensity data.
[0113] In some exemplary embodiments of this disclosure, based on the foregoing embodiments, the polygon determination module 1410 may be specifically configured to: acquire a three-dimensional model tree, and wrap the leaf vertices of the three-dimensional model tree with a preset wrapping shape to determine the polygon wrapping the leaf model of the three-dimensional model tree.
[0114] In some exemplary embodiments of this disclosure, based on the foregoing embodiments, the preset wrapping shape includes a sphere; the step of obtaining a three-dimensional model tree, which involves wrapping the leaf vertices of the three-dimensional model tree with the preset wrapping shape to determine the polygonal body that wraps the leaf model of the three-dimensional model tree, includes: obtaining a three-dimensional model tree, wrapping each leaf vertex of the three-dimensional model tree with a sphere of a preset size respectively; and performing point cloud conversion on the wrapping result to determine the polygonal body that wraps the leaf model of the three-dimensional model tree.
[0115] In some exemplary embodiments of this disclosure, based on the foregoing embodiments, the distance determination module 1420 may be specifically configured to: create a directed distance field within the polygon; sample leaf vertices within the directed distance field based on a sampling function to obtain the directed distance from each leaf vertex to the surface of the polygon; and normalize the directed distance of each leaf vertex according to the maximum and minimum values of the directed distances to obtain the normalized distance from each leaf vertex to the surface of the polygon.
[0116] In some exemplary embodiments of this disclosure, based on the foregoing embodiments, the patch tree includes a patch tree in a game scene. The game scene is captured by a virtual camera to display the game scene. Based on this, the patch tree generation module 1450 can be specifically configured to: generate an ambient light map of the 3D model tree based on the ambient light data; map the 3D model tree along the positive and negative directions of the virtual camera's viewing line of sight onto a first plane and a second plane respectively to obtain a first plane tree and a second plane tree; merge the first plane tree and the second plane tree to obtain a third plane tree; map the third plane tree onto a mesh plane, and remove the portion outside the outline of the third plane tree in the mesh plane to generate a patch tree to be processed corresponding to the 3D model tree; and generate a patch tree corresponding to the 3D model tree based on the ambient light map and the patch tree to be processed.
[0117] In some exemplary embodiments of this disclosure, based on the foregoing embodiments, the patch tree generation module 1450 may also be specifically configured to: calculate the vertex normals of the polygon; obtain the input fusion coefficients; fuse the vertex normals of the polygon and the vertex normals of the leaf vertices based on the fusion coefficients to obtain the fused normals of the leaf model; and generate the patch tree corresponding to the three-dimensional model tree according to the ambient light intensity data and the fused normals.
[0118] In some exemplary embodiments of this disclosure, based on the foregoing embodiments, the patch tree includes a patch tree in a game scene, and the game scene is captured by a virtual camera to display the game scene; the step of generating the patch tree corresponding to the 3D model according to the ambient light intensity data and the blending normal includes: converting the blending normal from the model space where the 3D model tree is located to the observation space where the virtual camera is located to obtain a target blending normal; mapping the target blending normal to a pixel color space to obtain a normal map of the observation space; generating an ambient light map of the 3D model tree according to the ambient light data; and generating the patch tree corresponding to the 3D model tree according to the ambient light map and the normal map of the observation space.
[0119] In some exemplary embodiments of this disclosure, based on the foregoing embodiments, generating the patch tree corresponding to the 3D model tree according to the ambient light map and the normal map of the observation space includes: mapping the 3D model tree along the positive and negative directions of the virtual camera's viewing line of sight onto a first plane and a second plane respectively, to obtain a first plane tree and a second plane tree accordingly; merging the first plane tree and the second plane tree to obtain a third plane tree; mapping the third plane tree onto a mesh plane, and removing the portion outside the outline of the third plane tree in the mesh plane to generate the patch tree to be processed corresponding to the 3D model tree; and generating the patch tree corresponding to the 3D model tree according to the ambient light map, the normal map of the observation space, and the patch tree to be processed.
[0120] In some exemplary embodiments of this disclosure, based on the foregoing embodiments, the patch tree generation module 1450 may further be specifically configured to: generate an ambient light map based on the ambient light data; generate a subsurface scattering map based on the ambient light map; generate a blended map based on the ambient light map stored in the first color channel and the subsurface scattering map stored in the second color channel; and generate a patch tree corresponding to the three-dimensional model tree based on the blended map.
[0121] In some exemplary embodiments of this disclosure, based on the foregoing embodiments, the polygon determination module 1410 may be specifically configured to: obtain an initial three-dimensional model tree, adjust the size of the initial three-dimensional model tree to completely and maximally map the three-dimensional model tree into a cube of a preset size to obtain a target three-dimensional model tree; and determine the polygon of the leaf model that encloses the target three-dimensional model tree.
[0122] In some exemplary embodiments of this disclosure, based on the foregoing embodiments, the patch tree generation module 1450 may also be specifically configured to: obtain the base color map of the three-dimensional model tree; generate corresponding vertex normal maps of the trunk model and the branch model based on the vertex normals of the trunk model and the branch model of the three-dimensional model, respectively; generate the ambient light map of the three-dimensional model tree according to the ambient light intensity data; and generate the patch tree corresponding to the three-dimensional model tree according to the base color map, the ambient light map, the vertex normal map of the trunk model and the vertex normal map of the branch model.
[0123] The specific details of each module in the above-mentioned patch tree generation device have been described in detail in the corresponding patch tree generation method, so they will not be repeated here.
[0124] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0125] Furthermore, although the steps of the method in this disclosure are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.
[0126] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, mobile terminal, or network device, etc.) to execute the methods according to the embodiments of this disclosure.
[0127] In exemplary embodiments of this disclosure, a computer storage medium capable of implementing the above-described methods is also provided. It stores a program product capable of implementing the methods described in this specification. In some possible embodiments, various aspects of this disclosure may also be implemented as a program product including program code, which, when run on a terminal device, causes the terminal device to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this disclosure.
[0128] The program product for implementing the above methods according to embodiments of this disclosure can be a portable compact disc read-only memory (CD-ROM) and include program code, and can run on a terminal device, such as a personal computer. However, the program product of this disclosure is not limited thereto. In this document, the readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0129] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0130] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.
[0131] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0132] Program code for performing the operations of this disclosure can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0133] Furthermore, in an exemplary embodiment of this disclosure, an electronic device capable of implementing the above-described method is also provided.
[0134] Those skilled in the art will understand that various aspects of this disclosure can be implemented as a system, method, or program product. Therefore, various aspects of this disclosure can be specifically implemented in the following forms: a completely hardware implementation, a completely software implementation (including firmware, microcode, etc.), or a combination of hardware and software aspects, collectively referred to herein as a "circuit," "module," or "system."
[0135] The following reference Figure 15 To describe an electronic device 1500 according to such an embodiment of the present disclosure. Figure 15 The electronic device 1500 shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments disclosed herein.
[0136] like Figure 15 As shown, the electronic device 1500 is manifested in the form of a general-purpose computing device. The components of the electronic device 1500 may include, but are not limited to: at least one processing unit 1510, at least one storage unit 1520, and a bus 1530 connecting different system components (including storage unit 1520 and processing unit 1510).
[0137] The storage unit stores program code that can be executed by the processing unit 1510, causing the processing unit 1510 to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this disclosure. For example, the processing unit 1510 can perform actions such as... Figure 1 The steps shown are as follows.
[0138] Storage unit 1520 may include readable media in the form of volatile storage units, such as random access memory (RAM) 15201 and / or cache memory 15202, and may further include read-only memory (ROM) 15203.
[0139] Storage unit 1520 may also include a program / utility 15204 having a set (at least one) of program modules 15205, such program modules 15205 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.
[0140] Bus 1530 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.
[0141] Electronic device 1500 can also communicate with one or more external devices 1600 (e.g., keyboard, pointing device, Bluetooth device, etc.), one or more devices that enable a user to interact with electronic device 1500, and / or any device that enables electronic device 1500 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 1550. Furthermore, electronic device 1500 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 1560. As shown, network adapter 1560 communicates with other modules of electronic device 1500 via bus 1530. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 1500, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0142] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.
[0143] Furthermore, the above figures are merely illustrative of the processes included in the method according to exemplary embodiments of this disclosure and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.
[0144] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.
Claims
1. A method for generating a patch tree, characterized in that, include: Obtain the 3D model tree and determine the polygons of the leaf models that enclose the 3D model tree; For each vertex of the leaf model, the normalized distance from the leaf vertex to the surface of the polygon is determined; Obtain the input distance interval and ambient light intensity range, wherein the distance interval represents the maximum and minimum distances between the light source and the leaf apex within the distance range indicated by the normalized distance, and the ambient light intensity range represents the ambient light intensity of the leaf apex indicated by the maximum distance and the leaf apex indicated by the minimum distance; The position of the light source is determined based on the maximum distance and the minimum distance. The ambient light intensity is interpolated on the leaf model based on the position of the light source and the range of ambient light intensity to obtain the ambient light intensity data of the leaf model. Based on the ambient light intensity data, generate the patch tree corresponding to the 3D model tree; The patch tree includes a patch tree in the game scene, which is captured by a virtual camera to display the game scene. Generating the patch tree corresponding to the 3D model tree based on the ambient light intensity data includes: generating an ambient light map of the 3D model tree based on the ambient light intensity data; mapping the 3D model tree along the positive and negative directions of the virtual camera's viewing line onto a first plane and a second plane respectively to obtain a first plane tree and a second plane tree; merging the first plane tree and the second plane tree to obtain a third plane tree; mapping the third plane tree onto a mesh plane, and removing the portion outside the outline of the third plane tree in the mesh plane to generate the patch tree to be processed corresponding to the 3D model tree; and generating the patch tree corresponding to the 3D model tree based on the ambient light map and the patch tree to be processed.
2. The method for generating a patch tree according to claim 1, characterized in that, The process of obtaining the 3D model tree and determining the polygon of the leaf model that encloses the 3D model tree includes: A 3D model tree is obtained, and the leaf vertices of the 3D model tree are wrapped with a preset wrapping shape to determine the polygon of the leaf model that wraps the 3D model tree.
3. The method for generating a patch tree according to claim 2, characterized in that, The preset wrapping shape includes a sphere; the process of obtaining a 3D model tree, which involves wrapping the vertices of the leaves of the 3D model tree based on the preset wrapping shape to determine the polygonal body that wraps the leaf model of the 3D model tree, includes: Obtain a 3D model tree, and wrap each leaf vertex of the 3D model tree with a sphere of a preset size; The packaged result is transformed into a point cloud to determine the polygon of the leaf model of the 3D model tree.
4. The method for generating a patch tree according to claim 1, characterized in that, Determining the normalized distance from each leaf vertex to the surface of the polygon for each leaf vertex of the leaf model includes: A directed distance field is created within the polygon; Based on the sampling function, the leaf vertices are sampled within the directed distance field to obtain the directed distance from each leaf vertex to the surface of the polygon. Based on the maximum and minimum values of the directed distances, the directed distances of each leaf vertex are normalized to obtain the normalized distance from each leaf vertex to the surface of the polygon.
5. The method for generating a patch tree according to claim 1, characterized in that, The step of generating the patch tree corresponding to the 3D model tree based on the ambient light intensity data includes: Calculate the vertex normals of the polygon; Obtain the input fusion coefficient, and based on the fusion coefficient, fuse the vertex normals of the polygon and the vertex normals of the leaf vertices to obtain the fused normals of the leaf model; Based on the ambient light intensity data and the fusion normal, a patch tree corresponding to the 3D model tree is generated.
6. The method for generating a patch tree according to claim 5, characterized in that, The tile tree includes the tile tree in the game scene, and the game scene is captured by a virtual camera to display the game scene; The step of generating a patch tree corresponding to the 3D model based on the ambient light intensity data and the fused normal includes: The fused normals are transformed from the model space where the 3D model tree is located to the observation space where the virtual camera is located to obtain the target fused normals; The target fusion normal is mapped onto the pixel color space to obtain a normal map of the view space; Based on the ambient light intensity data, an ambient light map of the 3D model tree is generated; Based on the ambient light map and the normal map of the observation space, a patch tree corresponding to the 3D model tree is generated.
7. The method for generating a patch tree according to claim 6, characterized in that, The step of generating the patch tree corresponding to the 3D model tree based on the ambient light map and the normal map of the viewing space includes: The three-dimensional model tree is mapped along the positive and negative directions of the virtual camera's viewing line of sight onto the first plane and the second plane respectively, so as to obtain the first plane tree and the second plane tree accordingly; Merge the first planar tree and the second planar tree to obtain the third planar tree; The third planar tree is mapped onto a mesh plane, and the portion outside the outline of the third planar tree is removed in the mesh plane to generate the patch tree to be processed corresponding to the three-dimensional model tree; Based on the ambient light map, the normal map of the observation space, and the patch tree to be processed, a patch tree corresponding to the 3D model tree is generated.
8. The method for generating a patch tree according to any one of claims 1 to 7, characterized in that, The step of generating the patch tree corresponding to the 3D model tree based on the ambient light intensity data includes: An ambient light map is generated based on the ambient light intensity data; Based on the ambient light map, a subsurface scattering map is generated; A blending map is generated based on the ambient light map stored in the first color channel and the subsurface scattering map stored in the second color channel; Based on the hybrid texture, a patch tree corresponding to the 3D model tree is generated.
9. The method for generating a patch tree according to any one of claims 1 to 7, characterized in that, The step of obtaining the 3D model tree and determining the polygon of the leaf model that encloses the 3D model tree includes: Obtain an initial 3D model tree, and adjust the size of the initial 3D model tree so that the 3D model tree is completely and maximally mapped into a cube of a preset size to obtain the target 3D model tree; Identify the polygon of the leaf model that encloses the target 3D model tree.
10. The method for generating a patch tree according to any one of claims 1 to 7, characterized in that, The step of generating the patch tree corresponding to the 3D model tree based on the ambient light intensity data includes: Obtain the base color map of the 3D model tree; Based on the vertex normals of the trunk model and the branch model of the three-dimensional model, respectively, the vertex normal maps of the trunk model and the branch model are generated. Based on the ambient light intensity data, an ambient light map of the 3D model tree is generated; Based on the base color map, the ambient light map, the vertex normal map of the trunk model, and the vertex normal map of the branch model, a patch tree corresponding to the 3D model tree is generated.
11. A device for generating a patch tree, characterized in that, include: The polygon determination module is configured to acquire a 3D model tree and determine the polygons that enclose the leaf models of the 3D model tree. The distance determination module is configured to determine the normalized distance from each leaf vertex of the leaf model to the surface of the polygon. The input data acquisition module is configured to acquire the input distance range and ambient light intensity range, wherein the distance range represents the maximum and minimum distances between the light source and the leaf apex within the distance range indicated by the normalized distance, and the ambient light intensity range represents the ambient light intensity of the leaf apex indicated by the maximum distance and the leaf apex indicated by the minimum distance. An ambient light intensity data determination module is configured to determine the light source position based on the maximum distance and the minimum distance, and to perform ambient light intensity interpolation on the leaf model based on the light source position and the ambient light intensity range to obtain the ambient light intensity data of the leaf model. The patch tree generation module is configured to generate a patch tree corresponding to the 3D model tree based on the ambient light intensity data. The patch tree includes a patch tree in the game scene, which is captured by a virtual camera to display the game scene. Generating the patch tree corresponding to the 3D model tree based on the ambient light intensity data includes: generating an ambient light map of the 3D model tree based on the ambient light intensity data; mapping the 3D model tree along the positive and negative directions of the virtual camera's viewing line onto a first plane and a second plane respectively to obtain a first plane tree and a second plane tree; merging the first plane tree and the second plane tree to obtain a third plane tree; mapping the third plane tree onto a mesh plane, and removing the portion outside the outline of the third plane tree in the mesh plane to generate the patch tree to be processed corresponding to the 3D model tree; and generating the patch tree corresponding to the 3D model tree based on the ambient light map and the patch tree to be processed.
12. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 10.
13. An electronic device, characterized in that, include: One or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the method as described in any one of claims 1 to 10.
Citation Information
Patent Citations
Processing method and device of ambient occlusion (AO)
CN107633544A
Information processing method and device of crown-shaped model, electronic equipment and storage medium
CN114445532A