Method and apparatus for generating texture of mountain body model
By using UV coordinate sampling, vertex normal weight mixing and texture area segmentation in mountain model texture generation, the problems of high cost of mountain model texture generation and low reduction in the existing technology are solved, and high-precision texture restoration effect is achieved.
Patent Information
- Application Number
- CN202111652835.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2041-12-30
AI Technical Summary
The existing mountain model texture generation methods have problems with high production cost and low reduction degree, and it is difficult to restore high-quality textures of Chinese painting style mountains.
UV coordinates are obtained based on the three-dimensional spatial position coordinates of the target mountain model, sampling the basic texture map of the mountain, combining the vertex normal weight for texture mixing, segmenting the texture map into multiple areas and allocating factors to achieve high-precision texture mapping.
It improves the accuracy of the restoration of the mountain texture, reduces the production cost, and realizes high-quality texture restoration of the Chinese painting style mountain.
Smart Images

Figure CN114359468B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer graphics, and in particular to a texture generation method and device for a mountain model. Background Art
[0002] With the rise of the national style cultural trend, more and more games and animations are gradually developing from shoddy production to fine production. In traditional Chinese style calligraphy and painting works, landscape themes account for a large proportion. Therefore, in games with Chinese painting style as the theme, the scene production often requires accurate restoration of traditional landscape paintings. The idea of rendering mountains in the style of Chinese painting is mainly to render the internal texture. The rendering of the internal texture must follow the various types of brushstrokes in traditional Chinese painting (i.e., the painting method of expressing the vein texture of rocks, peaks and tree bark). Therefore, in Chinese painting style games with many mountain content, it is difficult to restore the texture of this type of mountain with high quality.
[0003] In existing three-dimensional game works, the textures drawn on ordinary mountain models can usually be generated by hand-painting mapping materials based on the texture coordinates (UV) of the model, which will undoubtedly increase the cost of art production and reduce the flexibility of use. Or use ready-made Chinese painting style mapping materials to overlay brushstroke textures, but due to the high requirements for the production of brushstroke textures, this method often causes a series of problems such as seam breaks and map stretching in the brushstroke texture overlay performance part due to the block and stretching during UV expansion, that is, it is impossible to accurately restore the texture of this type of mountain model. In other words, the existing methods of generating mountain model textures have the problems of high production cost and low restoration degree. Summary of the invention
[0004] The purpose of the present invention is to provide a texture generation method and device for a mountain model, so as to alleviate the technical problems of high production cost and low restoration degree existing in the prior art.
[0005] In order to achieve the above purpose, the technical solution adopted by the embodiment of the present invention is as follows:
[0006] In a first aspect, an embodiment of the present invention provides a texture generation method for a mountain model, comprising: obtaining UV coordinates of each two-dimensional plane in the three-dimensional space corresponding to the target mountain model based on the position coordinates of the target mountain model in the three-dimensional space;
[0007] The mountain basic texture map is sampled respectively according to the UV coordinates to obtain the texture of the target mountain model in each dimensional direction of the three-dimensional space;
[0008] According to the weights of the normal vectors of the vertices of the target mountain model in each dimension direction of the three-dimensional space, perform blending processing on the textures of the target mountain model in each dimension direction of the three-dimensional space to generate a target texture map;
[0009] Based on the height information of the target mountain model, divide the target texture map into at least two regions, and respectively assign corresponding influencing factors to the at least two regions, so as to perform texture mapping on the target mountain model based on the target texture map; wherein, the influencing factor is used to represent the number of texture strokes in the corresponding region.
[0010] In some possible implementation manners, the method further includes: generating a texture resource library by scanning a traditional Chinese painting image, where the texture resource library includes mountain element maps in the style of traditional Chinese painting that match the traditional Chinese painting image; preprocessing the mountain element maps in the painting style to generate an initial texture pattern; performing a four-way continuous tiling process on the initial texture pattern to generate a basic mountain texture map.
[0011] In some possible implementation manners, the method further includes: determining the weights of the normal vectors in each dimension direction based on the orientation information of the normal vectors of the vertices of the target mountain model.
[0012] In some possible implementation manners, the dividing the target texture map into at least two regions based on the height information of the target mountain model and respectively assigning corresponding influencing factors to the at least two regions includes: dividing the sampling result of the second texture map into a top sampling region and a bottom sampling region based on the height information of the target mountain model; assigning a first influencing factor to the top sampling region and a second influencing factor to the bottom sampling region;
[0013] Performing texture mapping on the target mountain model based on the target texture map includes: multiplying the map region corresponding to the top sampling region in the target texture map by the first influencing factor to generate a top texture map sampling result; multiplying the map region corresponding to the bottom sampling region in the target texture map by the second influencing factor to generate a bottom texture map sampling result; performing texture mapping on the target mountain model based on the top texture map sampling result and the bottom texture map sampling result.
[0014] In some possible implementation manners, the first influencing factor is less than the second influencing factor, so as to achieve that the number of brushstroke textures in the top sampling region is greater than the number of brushstroke textures in the bottom sampling region.
[0015] In some possible implementation manners, the above height information includes the height values of each vertex of the above target mountain body model from the bottom to the top of the mountain; the area from the top plane of the above target mountain body model to the first dividing plane is determined as the first mountain body area, and the above top sampling area is determined according to the above first mountain body area; the area from the bottom plane of the above target mountain body model to the above first dividing plane is determined as the second mountain body area, and the above bottom sampling area is determined according to the above second mountain body area; the distance between the above first dividing plane and the bottom plane of the above target mountain body model is three quarters of the total height of the above target mountain body model.
[0016] In some possible implementation manners, before sampling the above mountain body base texture map according to the above UV coordinates, the method further includes: rotating the UV coordinates in the above three-dimensional space according to a first preset parameter to generate rotated UV coordinates; the above first preset parameter includes at least one of the following: rotation center coordinates, rotation angle, and rotation order.
[0017] In some possible implementation manners, the method further includes: offsetting the above UV coordinates in the above three-dimensional space according to a second preset parameter to generate offset UV coordinates; the above second preset parameter includes at least one of the following: offset center coordinates, offset displacement, and offset order.
[0018] In some possible implementation manners, the method further includes: scaling the above UV coordinates in the above three-dimensional space according to a third preset parameter to generate scaled UV coordinates; the above third preset parameter includes at least one of the following: scaling center coordinates, scaling ratio, and scaling order.
[0019] In a second aspect, an embodiment of the present invention provides a texture generation device for a mountain body model, and the device includes: a coordinate acquisition module, configured to obtain the UV coordinates corresponding to the above target mountain body model on each two-dimensional plane in the above three-dimensional space based on the position coordinates of the three-dimensional space of the above target mountain body model;
[0020] a sampling module, configured to sample the mountain body base texture map according to the above UV coordinates to obtain the texture of the above target mountain body model in each dimension direction in the above three-dimensional space;
[0021] a target texture map generation module, configured to perform a blending process on the texture of the above target mountain body model in each dimension direction in the above three-dimensional space according to the weights of the normal vectors of the vertices of the above target mountain body model in each dimension direction in the above three-dimensional space to generate a target texture map;
[0022] A segmentation module, configured to segment the target texture map into at least two regions based on the height information of the above-mentioned target mountain model, and assign corresponding influencing factors to the at least two regions respectively, so as to implement texture mapping of the target mountain model based on the target texture map; wherein, the influencing factor is used to represent the number of texture strokes in the corresponding region.
[0023] In a third aspect, an embodiment of the present invention provides an electronic device, including a memory and a processor. A computer program that can run on the processor is stored in the memory. When the processor executes the computer program, the steps of the method described in any one of the above first aspects are implemented.
[0024] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium. The computer-readable storage medium stores machine-executable instructions. When the computer-executable instructions are called and run by the processor, the computer-executable instructions cause the processor to run the method described in any one of the above first aspects.
[0025] The present invention provides a method and device for generating the texture of a mountain model. The method includes: first, obtaining the UV coordinates of the target mountain model on each two-dimensional plane in three-dimensional space; sampling the mountain base texture map according to the UV coordinates respectively to obtain the texture of the target mountain model in each dimension direction in three-dimensional space; then, according to the weights of the normal vectors of the vertices of the target mountain model in each dimension direction in three-dimensional space, performing a blending process on the texture of the target mountain model in each dimension direction in three-dimensional space to generate a target texture map; finally, segmenting the target texture map into at least two regions based on the height information and assigning corresponding influencing factors, so as to implement texture mapping of the target mountain model based on the target texture map. Through the above method, the technical problems of high production cost and low reduction degree of the texture of the mountain model in the prior art can be alleviated, the brush texture of the mountain is highly restored, and the effect of improving the reduction accuracy of the mountain texture is achieved. Description of the Drawings
[0026] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for use in the description of the specific embodiments or the prior art. Obviously, the following drawings are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0027] Figure 1 It is a schematic flowchart of a method for generating the texture of a mountain model provided by an embodiment of the present invention;
[0028] Figure 2Schematic diagram of the display effect of a method for generating textures of a mountain body model provided by an embodiment of the present invention;
[0029] Figure 3 Schematic diagram of the rotation display effect of a method for generating textures of a mountain body model provided by an embodiment of the present invention;
[0030] Figure 4 Schematic diagram of the scaling display effect of a method for generating textures of a mountain body model provided by an embodiment of the present invention;
[0031] Figure 5 Schematic diagram of the structure of a device for generating textures of a mountain body model provided by an embodiment of the present invention;
[0032] Figure 6 Schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Detailed implementation manners
[0033] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. Usually, the components of the embodiments of the present invention described and illustrated in the accompanying drawings here can be arranged and designed in various different configurations.
[0034] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed present invention, but merely represents selected embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the scope of protection of the present invention.
[0035] It should be noted that similar reference numerals and letters denote similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. The following describes some embodiments of the present invention in detail with reference to the accompanying drawings. Without conflict, the following embodiments and the features in the embodiments can be combined with each other.
[0036] In existing 3D game works, the textures drawn on ordinary mountain models are usually generated by hand-painting texture materials according to the spatial 3D position coordinates (UV coordinates) of the models, which will undoubtedly increase the cost of art production and reduce the flexibility of use; or ready-made Chinese painting style texture materials are used for brushstroke texture map overlay. However, due to the high requirements for the production of brushstroke textures, this method often causes a series of problems such as seam breaks and texture stretching in the part of the brushstroke texture overlay due to block division and stretching during UV unwrapping, that is, the textures of this type of mountain model cannot be accurately restored. That is to say, the existing methods for generating mountain model textures have problems of high production cost and low reduction degree.
[0037] Based on this, the embodiments of the present invention provide a method for generating mountain model textures to alleviate the problems of high production cost and low reduction degree existing in the existing methods for generating mountain model textures.
[0038] For the convenience of understanding this embodiment, first, a method for generating mountain model textures disclosed in the embodiments of the present invention will be introduced in detail. Refer to Figure 1 the flowchart of a method for generating mountain model textures shown in the figure. This method can be executed by an electronic device and mainly includes the following steps S110 to step S140:
[0039] S110: Based on the position coordinates of the three-dimensional space of the target mountain model, obtain the UV coordinates of the target mountain model corresponding to each two-dimensional plane in the three-dimensional space;
[0040] Among them, the target mountain model can be established in advance through 3D modeling software, and the established target mountain model includes a number of mesh vertex information. Further, since the vertex information includes: the three-dimensional space coordinates of the vertex and the normal orientation information of the vertex, the UV coordinates of each vertex in each two-dimensional plane of the three dimensions (that is, the X, Y, and Z directions) of the space can be determined in the shader according to the three-dimensional space coordinates of the vertex. That is to say, the position coordinates of the three-dimensional space include the three-dimensional position coordinates of each vertex in the three dimensions within the three-dimensional space coordinates.
[0041] It should be noted that in the coordinate description of this solution, the three-dimensional space coordinates can be the model space coordinates where the target mountain model is located or the world space coordinates. The three dimensions are the X dimension, the Y dimension, and the Z dimension respectively, and the corresponding two-dimensional planes include: the YZ plane, the XZ plane, and the ZY plane.
[0042] S120: Sample the mountain base texture map according to the UV coordinates respectively to obtain the textures of the target mountain model in each dimension direction of the three-dimensional space;
[0043] S130: Blend the textures of the target mountain model in each dimension of the three-dimensional space according to the weights of the normal vectors of the vertices of the target mountain model in the directions of each dimension of the three-dimensional space, and generate a target texture map.
[0044] Among them, the weights of the normal vectors of the above vertices in the directions of each dimension of the three-dimensional space can be determined by the orientation information of the normal vectors of the vertices of the target mountain model. For example, if the normal vector of a vertex points upward along the Y-axis and is perpendicular to the XZ plane, then the weight of this vertex for the XZ plane is relatively large.
[0045] Blending the textures of the target mountain model in each dimension of the three-dimensional space means: multiplying the pixel values of the vertices in the three dimensions by the corresponding weights respectively and then accumulating them to obtain the target texture map.
[0046] S140: Based on the height information of the target mountain model, divide the target texture map into at least two regions, and assign corresponding influencing factors to the at least two regions respectively, so as to realize texture mapping of the target mountain model based on the target texture map.
[0047] Among them, the influencing factor is used to represent the number of texture strokes in the corresponding region. The texture stroke is a line drawn using various techniques of traditional Chinese painting, such as the texture stroke method (a painting method used to represent the vein textures of mountain rocks, peaks, and tree trunks).
[0048] In one embodiment, before step S110, the above method may further include: obtaining a basic mountain texture map; specifically including:
[0049] (1) By scanning Chinese painting images, generate a texture resource library; the texture resource library includes mountain element maps in the style of Chinese painting that match the Chinese painting images.
[0050] (2) Preprocess the mountain element maps in the painting style to generate an initial texture pattern.
[0051] (3) Perform a four-way continuous tiling process on the initial texture pattern to generate a basic mountain texture map.
[0052] In the embodiment of the present invention, the above basic mountain texture map can be obtained according to the texture resource library, and the texture resource library can be obtained by scanning picture albums, photos, etc. containing mountain elements in the style of Chinese painting. That is to say, an existing picture album in the style of Chinese painting can be used, scanned and preprocessed such as desaturation and cropping to obtain a preset pattern, and this preset pattern is the mountain texture map that conforms to the style of Chinese painting.
[0053] The basic mountain texture map can be a four-way continuous tiling texture of the preset pattern. That is, perform edge splicing, diffusion of edge information, and blurring and fusion of edge information on the preset pattern to obtain the basic mountain texture map from the preset pattern.
[0054] In one embodiment, in the above step S140, based on the height information of the target mountain model, the target texture map is divided into at least two regions, and corresponding influencing factors are assigned to the at least two regions respectively, including:
[0055] (1) Based on the height information of the target mountain model, the target texture map is divided into a top sampling region and a bottom sampling region;
[0056] (2) A first influencing factor is assigned to the top sampling region, and a second influencing factor is assigned to the bottom sampling region. Among them, the first influencing factor is less than the second influencing factor, so as to make the number of brushstroke textures in the top sampling region greater than that in the bottom sampling region.
[0057] In the above step S140, texture mapping is performed on the target mountain model based on the target texture map, including:
[0058] (1) Multiply the map region corresponding to the top sampling region in the target texture map by the first influencing factor to generate a top texture map sampling result;
[0059] (2) Multiply the map region corresponding to the bottom sampling region in the target texture map by the second influencing factor to generate a bottom texture map sampling result;
[0060] (3) Based on the top texture map sampling result and the bottom texture map sampling result, perform texture mapping on the target mountain model.
[0061] As a specific example, the height information includes the height value of each vertex of the target mountain model from the bottom of the mountain to the top of the mountain. The region from the top plane of the target mountain model to the first dividing plane is determined as the first mountain region, and the top sampling region is determined according to the first mountain region; the region from the bottom plane of the target mountain model to the first dividing plane is determined as the second mountain region, and the bottom sampling region is determined according to the second mountain region; the distance between the first dividing plane and the bottom plane of the target mountain model is three-quarters of the total height of the target mountain model (see Figure 2 ).
[0062] Among them, the influencing factor can be used to represent the number of texture brushstrokes in the corresponding region; as a specific example, when the influencing factor is set to 0, the number of texture brushstrokes in the corresponding region does not decrease; when the influencing factor is set to 1, the texture brushstrokes are reduced to the greatest extent. Since the influencing factors at the bottom and top of the mountain are different and are controlled by two influencing factors respectively, Figure 2 The left diagram on the right shows the effect without height assignment, and the detail levels at the top and bottom of the mountain are approximately the same; the bottom brushstroke details in the right diagram are less, and the top brushstroke details are more, further conforming to the painting style of Chinese ink painting.
[0063] In some possible embodiments, before sampling the mountain base texture map according to the UV coordinates in step S120, the above method may further include: rotating the UV coordinates in three-dimensional space according to a first preset parameter to generate rotated UV coordinates; the first preset parameter includes at least one of the following: rotation center coordinates, rotation angle, and rotation order.
[0064] As a specific example, refer to Figure 3 As shown, the right image is the effect of rotating the left image 90 degrees in the X dimension (i.e., the YZ plane dimension) with a preset UV center (0.5, 0.5). It can be seen that the pen stroke direction of the mountain texture in the left image is towards the lower left, and the pen stroke direction of the mountain texture in the rotated right image is towards the lower right.
[0065] In some possible embodiments, the above method may further include: offsetting the UV coordinates in three-dimensional space according to a second preset parameter to generate offset UV coordinates; the second preset parameter includes at least one of the following: offset center coordinates, offset displacement, and offset order.
[0066] In some possible embodiments, the method further includes: scaling the UV coordinates in three-dimensional space according to a third preset parameter to generate scaled UV coordinates; the third preset parameter includes at least one of the following: scaling center coordinates, scaling ratio, and scaling order.
[0067] As a specific example, refer to Figure 4 As shown, the right image is the effect of scaling the left image with a preset second parameter. It can be seen that the brush stroke spots of the mountain texture in the scaled right image are larger than those of the mountain texture in the left image.
[0068] By implementing the above method to rotate, offset, and scale the spatial three-dimensional position coordinates in three dimensions, higher control flexibility can be provided for generating the mountain model texture. And set the mountain height value according to the parameters, and distribute the texture detail density from top to bottom according to the vertex Y-axis position in the model space to conform to the visual performance of the Chinese painting style rules.
[0069] This embodiment provides a method for generating the texture of a mountain body model. The method includes: first, obtaining the UV coordinates of the target mountain body model on each two-dimensional plane in the three-dimensional space; sampling the mountain body base texture map according to the UV coordinates respectively to obtain the texture of the target mountain body model in each dimension direction in the three-dimensional space; then, according to the weights of the normal vectors of the vertices of the target mountain body model in each dimension direction in the three-dimensional space, performing a blending process on the texture of the target mountain body model in each dimension direction in the three-dimensional space to generate a target texture map; finally, based on the height information, dividing the target texture map into at least two regions and assigning corresponding influencing factors to achieve texture mapping of the target mountain body model based on the target texture map. Through the above method, the technical problems of high production cost and low reduction degree of the texture of the mountain body model in the prior art can be alleviated, the brushstrokes texture of the mountain body can be highly restored, and the effect of improving the reduction accuracy of the mountain body texture is achieved.
[0070] In addition, the embodiment of the present application also provides a device for generating the texture of a mountain body model. Refer to Figure 5 , the device includes:
[0071] A coordinate acquisition module 510, configured to obtain the UV coordinates of the target mountain body model corresponding to each two-dimensional plane in the three-dimensional space based on the position coordinates of the target mountain body model in the three-dimensional space;
[0072] A sampling module 520, configured to sample the mountain body base texture map according to the UV coordinates respectively to obtain the texture of the target mountain body model in each dimension direction in the three-dimensional space;
[0073] A target texture map generation module 530, configured to perform a blending process on the texture of the target mountain body model in each dimension direction in the three-dimensional space according to the weights of the normal vectors of the vertices of the target mountain body model in each dimension direction in the three-dimensional space to generate a target texture map;
[0074] A segmentation module 540, configured to divide the target texture map into at least two regions based on the height information of the target mountain body model, and respectively assign corresponding influencing factors to the at least two regions to achieve texture mapping of the target mountain body model based on the target texture map; wherein, the influencing factor is used to represent the number of texture brushstrokes in the corresponding region.
[0075] In one embodiment, the device further includes: a mountain body base texture map generation module, configured to generate a texture resource library by scanning a traditional Chinese painting image. The texture resource library includes mountain body element maps in the style of traditional Chinese painting that match the traditional Chinese painting image; preprocessing the mountain body element maps in the painting style to generate an initial texture pattern; and performing a four-way continuous tiling process on the initial texture pattern to generate a mountain body base texture map.
[0076] In one embodiment, the device further includes: a normal weight determination module, configured to determine the weights of the normal in each dimensional direction based on the orientation information of the normal of the vertices of the target mountain model.
[0077] In one embodiment, the segmentation module is further configured to: based on the height information of the target mountain model, segment the second texture map sampling result into a top sampling area and a bottom sampling area; assign a first influencing factor to the top sampling area and a second influencing factor to the bottom sampling area; multiply the map area corresponding to the top sampling area in the target texture map by the first influencing factor to generate a top texture map sampling result; multiply the map area corresponding to the bottom sampling area in the target texture map by the second influencing factor to generate a bottom texture map sampling result; perform texture mapping on the target mountain model based on the top texture map sampling result and the bottom texture map sampling result.
[0078] Wherein, the first influencing factor is less than the second influencing factor to achieve that the number of brushstrokes textures in the top sampling area is greater than that in the bottom sampling area.
[0079] As a specific example, the height information includes the height value of each vertex of the target mountain model from the bottom of the mountain to the top of the mountain; determine the first mountain area for the area from the top plane of the target mountain model to the first segmentation plane, and determine the top sampling area according to the first mountain area; determine the second mountain area for the area from the bottom plane of the target mountain model to the first segmentation plane, and determine the bottom sampling area according to the second mountain area; the distance between the first segmentation plane and the bottom plane of the target mountain model is three-quarters of the total height of the target mountain model.
[0080] In one embodiment, the device further includes: a rotation module, configured to rotate the UV coordinates in three-dimensional space according to a first preset parameter to generate rotated UV coordinates; the first preset parameter includes at least one of the following: rotation center coordinates, rotation angle, and rotation order.
[0081] In one embodiment, the device further includes: an offset module, configured to offset the UV coordinates in three-dimensional space according to a second preset parameter to generate offset UV coordinates; the second preset parameter includes at least one of the following: offset center coordinates, offset displacement, and offset order.
[0082] In one embodiment, the device further includes: a scaling module, configured to scale the UV coordinates in three-dimensional space according to a third preset parameter to generate scaled UV coordinates; the third preset parameter includes at least one of the following: scaling center coordinates, scaling ratio, and scaling order.
[0083] This embodiment provides a method and apparatus for generating the texture of a mountain body model. The method includes: First, based on the three-dimensional spatial position coordinates of the target mountain body model, sampling the basic texture map of the mountain body to generate a first texture map sampling result; Then, according to the weights of the normal vectors of the vertices of the target mountain body model in the three-dimensional space coordinates, distributing the first texture map sampling result to generate a second texture map sampling result; Then, based on the height information of the target mountain body model, dividing the second texture map sampling result into at least two regions, and respectively assigning corresponding influencing factors to the at least two regions to achieve the texture mapping of the target mountain body model. Through the above method, the technical problems of high production cost and low reduction degree existing in the prior art can be alleviated, the brush texture of the mountain body can be highly restored, and the effect of improving the restoration accuracy of the mountain body texture is achieved.
[0084] Figure 6 FIG. 4 is a schematic structural diagram of an electronic device provided by an embodiment of the present application. The electronic device 400 includes: a processor 40, a memory 41, a bus 42, and a communication interface 43. The processor 40, the communication interface 43, and the memory 41 are connected through the bus 42. The processor 40 is configured to execute an executable module stored in the memory 41, such as a computer program.
[0085] Among them, the memory 41 may include a high-speed random access memory (RAM, Random Access Memory), and may also include a non-volatile memory, such as at least one disk memory. Through at least one communication interface 43 (which may be wired or wireless), a communication connection between the system network element and at least one other network element can be realized, and the Internet, a wide area network, a local area network, a metropolitan area network, etc. can be used.
[0086] The bus 42 may be an ISA bus, a PCI bus, an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For the sake of convenience of representation, Figure 6 only a bidirectional arrow is used in FIG. 4, but it does not mean that there is only one bus or one type of bus.
[0087] Among them, the memory 41 is used to store a program. After receiving an execution instruction, the processor 40 executes the program. The method executed by the device defined by the flow process disclosed in any one of the foregoing embodiments of the present invention can be applied to the processor 40 or implemented by the processor 40.
[0088] The processor 40 may be an integrated circuit chip with the ability to process signals. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in the processor 40 or the instructions in the form of software. The above-mentioned processor 40 may be a general-purpose processor, including a central processing unit (CPU for short), a network processor (NP for short), etc.; it may also be a digital signal processor (DSP for short), an application specific integrated circuit (ASIC for short), a field-programmable gate array (FPGA for short) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present invention can be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of the hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory 41, and the processor 40 reads the information in the memory 41 and combines its hardware to complete the steps of the above method.
[0089] Corresponding to the above method, an embodiment of the present application further provides a computer-readable storage medium, and the computer-readable storage medium stores machine-executable instructions. When the computer-executable instructions are called and run by a processor, the computer-executable instructions cause the processor to run the steps of the above method.
[0090] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only illustrative. For example, the division of the units is only a logical function division, and there may be other division methods in actual implementation. For another example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other may be through some communication interfaces, and the indirect coupling or communication connection of the devices or units may be in an electrical, mechanical or other form.
[0091] The unit described as a separation component may or may not be physically separated. The component shown as a unit may or may not be a physical unit, that is, it may be located in one place or may be distributed over multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0092] In addition, each functional unit in the embodiments provided in this application may be integrated in a processing unit, may exist separately as individual physical units, or two or more units may be integrated in one unit.
[0093] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, an electronic device, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes.
[0094] It should be noted that similar reference numerals and letters indicate similar items in the drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. In addition, the terms "first", "second", "third", etc. are only used for distinguishing descriptions and cannot be understood as indicating or implying relative importance.
[0095] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some or all of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of various embodiments of the present invention.
Claims
1. A method for generating the texture of a mountain body model, characterized in that, it includes: Based on the position coordinates of the three-dimensional space of the target mountain body model, obtain the UV coordinates of the target mountain body model corresponding to each two-dimensional plane in the three-dimensional space; Sample the mountain body base texture map according to the UV coordinates respectively to obtain the textures of the target mountain body model in each dimension direction of the three-dimensional space; According to the weights of the normal vectors of the vertices of the target mountain body model in each dimension direction of the three-dimensional space, multiply the pixel values of the vertices in the three dimensions of the three-dimensional space by the corresponding dimension weights respectively and accumulate them to generate a target texture map; Based on the height information of the target mountain body model, divide the target texture map into a top sampling area and a bottom sampling area; assign a first influencing factor to the top sampling area and a second influencing factor to the bottom sampling area; Multiply the map area corresponding to the top sampling area in the target texture map by the first influencing factor to generate a top texture map sampling result; Multiply the map area corresponding to the bottom sampling area in the target texture map by the second influencing factor to generate a bottom texture map sampling result; Based on the top texture map sampling result and the bottom texture map sampling result, perform texture mapping on the target mountain body model; wherein, the influencing factor is used to represent the number of texture strokes in the corresponding area.
2. The method for generating the texture of a mountain body model according to claim 1, characterized in that, the method further includes: By scanning a traditional Chinese painting image, generate a texture resource library, and the texture resource library includes mountain body element maps in the style of traditional Chinese painting that match the traditional Chinese painting image; Preprocess the mountain body element maps in the painting style to generate an initial texture pattern; Perform a four-way continuous tiling process on the initial texture pattern to generate a mountain body base texture map.
3. The method for generating the texture of a mountain body model according to claim 1, characterized in that, the method further includes: Determine the weights of the normal vectors in each dimension direction based on the orientation information of the normal vectors of the vertices of the target mountain body model.
4. The method for generating the texture of a mountain body model according to claim 1, characterized in that, the first influencing factor is less than the second influencing factor to achieve that the number of brushstroke textures in the top sampling area is greater than the number of brushstroke textures in the bottom sampling area.
5. The method for generating the texture of a mountain body model according to claim 4, characterized in that, the height information includes the height values of each vertex of the target mountain body model from the bottom of the mountain to the top of the mountain; Determine the area from the top plane of the target mountain body model to the first dividing plane as the first mountain body area, and determine the top sampling area according to the first mountain body area; Determine the area from the bottom plane of the target mountain body model to the first dividing plane as the second mountain body area, and determine the bottom sampling area according to the second mountain body area; The distance between the first dividing plane and the bottom plane of the target mountain body model is three-quarters of the total height of the target mountain body model.
6. The method for generating the texture of a mountain body model according to claim 1, It is characterized in that before sampling the mountain base texture map according to the UV coordinates respectively, the method further includes: rotating the UV coordinates in the three-dimensional space according to a first preset parameter to generate rotated UV coordinates; the first preset parameter includes at least one of the following: rotation center coordinates, rotation angle, and rotation order.
7. The method for generating the texture of the mountain body model according to claim 1, It is characterized in that the method further includes: offsetting the UV coordinates in the three-dimensional space according to a second preset parameter to generate offset UV coordinates; the second preset parameter includes at least one of the following: offset center coordinates, offset displacement, and offset order.
8. The method for generating the texture of the mountain body model according to claim 1, It is characterized in that the method further includes: scaling the UV coordinates in the three-dimensional space according to a third preset parameter to generate scaled UV coordinates; the third preset parameter includes at least one of the following: scaling center coordinates, scaling ratio, and scaling order.
9. A device for generating the texture of a mountain body model, It is characterized in that including: a coordinate acquisition module, configured to obtain the UV coordinates of the target mountain body model corresponding to each two-dimensional plane in the three-dimensional space based on the position coordinates of the three-dimensional space of the target mountain body model; a sampling module, configured to sample the mountain base texture map according to the UV coordinates respectively to obtain the texture of the target mountain body model in each dimension direction of the three-dimensional space; a target texture map generation module, configured to multiply the pixel values of the vertices in the three dimensions of the three-dimensional space by the weights of the normal vectors of the vertices of the target mountain body model in the respective dimension directions of the three-dimensional space and accumulate them to generate a target texture map; a segmentation module, configured to segment the target texture map into a top sampling area and a bottom sampling area based on the height information of the target mountain body model; assign a first influencing factor to the top sampling area and a second influencing factor to the bottom sampling area; multiplying the map area corresponding to the top sampling area in the target texture map by the first influencing factor to generate a top texture map sampling result; multiplying the map area corresponding to the bottom sampling area in the target texture map by the second influencing factor to generate a bottom texture map sampling result; performing texture mapping on the target mountain body model based on the top texture map sampling result and the bottom texture map sampling result; wherein, the influencing factor is used to represent the number of texture brushstrokes in the corresponding area.
10. An electronic device, including a memory and a processor, and a computer program capable of running on the processor is stored in the memory, It is characterized in that when the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.
11. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores machine-executable instructions that, when called and executed by a processor, cause the processor to execute the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Fast algorithm for anisotropic texture sampling
US20060119608A1
Methods and Apparatus for Procedural Directional Texture Generation
US20130121608A1