Model rendering method and device, electronic equipment and readable storage medium
By performing geometric transformation and interpolation processing on the map area of the virtual model, the problem of repetition in map tiling is solved, the visual effect is improved, and the surface color of the virtual model is randomly different.
Patent Information
- Application Number
- CN202411755852.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-04-11
AI Technical Summary
In computer graphics processing, the repeated addressing mode (Wrap) is used when tiling the map, which can easily produce a strong sense of repetition and reduce the visual effect, especially on large-area models.
By determining the model map of the virtual model and repeating the addressing sampling based on its original UV data, the first color data of different map areas is obtained. Randomly generate random numbers and random rotation angles of the map area, perform geometric transformation, and obtain transformed UV data. Then sample the model map to obtain the second color data, and insert the target color data by inserting the value, and finally render the virtual model based on the target color data.
By randomizing the UV data difference in the map area and interpolation of sampling results, the repetition of map tiling is eliminated, the visual effect is improved, and the colors of different map areas on the virtual model surface are randomly different.
Smart Images

Figure CN119810293A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a model rendering method, a model rendering device, an electronic device, and a computer-readable storage medium. Background Art
[0002] Tiling is a commonly used technique in computer graphics processing. It refers to the process of repeatedly arranging an image or texture until the entire model surface is filled. This technique is usually used on large-area models.
[0003] In the process of texture tiling, the repeated addressing mode (Wrap) is usually used for texture sampling, that is, the address 0 to 1 is repeated after the UV exceeds 1. However, this method is easy to produce a strong sense of repetition and reduce the visual effect when applied to large-area models. Summary of the invention
[0004] The present disclosure provides a model rendering method, a model rendering device, an electronic device and a computer-readable storage medium to solve or at least partially solve the above problems, as follows.
[0005] In a first aspect, the present disclosure provides a model rendering method, the method comprising:
[0006] Determine a model map of the virtual model;
[0007] According to the original UV data of the virtual model, the model map is repeatedly addressed and sampled to obtain first color data of different map areas on the surface of the virtual model, wherein the map area is an area on the surface of the virtual model mapped by a single model map;
[0008] Determine the random number corresponding to the mapping area;
[0009] Determine a random rotation angle corresponding to the mapping area according to a random number corresponding to the mapping area;
[0010] According to the random rotation angle and the random number corresponding to the mapping area, the original UV data of the mapping area is geometrically transformed to obtain the transformed UV data of the mapping area;
[0011] Sampling the model map according to the transformed UV data of the map area to obtain second color data of the map area;
[0012] Interpolating the first color data and the second color data of the mapping area to obtain target color data of the mapping area;
[0013] The virtual model is rendered and displayed according to the target color data of each mapping area on the surface of the virtual model.
[0014] In a second aspect, the present disclosure further provides a model rendering device, the device comprising:
[0015] A first determination module, used to determine a model map of a virtual model;
[0016] A first sampling module is used to repeatedly address and sample the model map according to the original UV data of the virtual model to obtain first color data of different map areas on the surface of the virtual model, wherein the map area is an area on the surface of the virtual model mapped by a single model map;
[0017] A second determination module, used to determine the random number corresponding to the mapping area;
[0018] A third determination module is used to determine the random rotation angle corresponding to the mapping area according to the random number corresponding to the mapping area;
[0019] A geometric transformation module, used for performing geometric transformation on the original UV data of the mapping area according to the random rotation angle and random number corresponding to the mapping area, so as to obtain the transformed UV data of the mapping area;
[0020] A second sampling module, used for sampling the model map according to the transformed UV data of the map area to obtain second color data of the map area;
[0021] An interpolation module, used for interpolating the first color data and the second color data of the mapping area to obtain target color data of the mapping area;
[0022] The display module is used to render and display the virtual model according to the target color data of each mapping area on the surface of the virtual model.
[0023] In a third aspect, the present disclosure further provides an electronic device, comprising: a processor, a memory, and computer program instructions stored in the memory and executable on the processor;
[0024] When the processor executes the computer program instructions, the model rendering method described in the first aspect above is implemented.
[0025] In a fourth aspect, the present disclosure further provides a computer-readable storage medium, in which computer program instructions are stored. When the computer program instructions are executed by a processor, they are used to implement the model rendering method described in the first aspect above.
[0026] The exemplary embodiments of the present disclosure have the following beneficial effects:
[0027] The model rendering method provided by the present disclosure first determines the model map of the virtual model; according to the original UV data of the virtual model, repeatedly addresses and samples the model map to obtain the first color data of different map areas on the surface of the virtual model, wherein the map area is an area where the surface of the virtual model is mapped using a single model map; determines the random number corresponding to the map area; determines the random rotation angle corresponding to the map area according to the random number corresponding to the map area; according to the random rotation angle and the random number corresponding to the map area, geometrically transforms the original UV data of the map area to obtain the transformed UV data of the map area; according to the transformed UV data of the map area, samples the model map to obtain the second color data of the map area; interpolates the first color data and the second color data of the map area to obtain the target color data of the map area; and renders and displays the virtual model according to the target color data of each map area on the surface of the virtual model. In the present disclosure, for a mapping area on the surface of a virtual model mapped with a single model map, the original UV data of the mapping area can be geometrically transformed by using a random rotation angle and a random number corresponding to the mapping area, so that the UV data of different mapping areas on the surface of the virtual model have random differences. Then, for different mapping areas, the model map sampling results before and after the UV transformation are interpolated to obtain the target color data of the different mapping areas, and the virtual model is rendered and displayed accordingly. In this way, the colors of different mapping areas on the surface of the virtual model can have random differences, thereby improving the sense of repetition caused by simple repeated tiling of the model map and improving the visual effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 is a flow chart of a model rendering method provided by one of the embodiments of the present disclosure;
[0029] Figure 2 is a schematic diagram of a rounding result of original UV data of a mapping area provided by one of the embodiments of the present disclosure;
[0030] Figure 3 It is a schematic diagram of outputting a model map of a virtual model based on a diffuse reflection map of the virtual model through a node, provided by one of the embodiments of the present disclosure;
[0031] Figure 4 is a schematic diagram of brush stroke mask shapes corresponding to different mapping areas provided by one embodiment of the present disclosure;
[0032] Figure 5 is a block diagram of a model rendering device provided by one of the embodiments of the present disclosure;
[0033] Figure 6 It is a logical structure diagram of an electronic device for implementing model rendering provided by one of the embodiments of the present disclosure. DETAILED DESCRIPTION
[0034] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the present disclosure for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, each other embodiment obtained by those skilled in the art without making creative work belongs to the scope of protection of the present disclosure.
[0035] The terms "a", "an", "the" and "said" are used in this specification to indicate the presence of one or more elements / components / etc.; the terms "including" and "having" are used to express an open-ended inclusion and mean that additional elements / components / etc. may exist in addition to the listed elements / components / etc.; the terms "first" and "second" etc. are used only as labels and are not intended to limit the quantity of their objects.
[0036] It should be understood that in the embodiments of the present disclosure, "at least one" means one or more, and "more than one" means two or more. "And / or" is merely a way to describe the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and subsequent associated objects are in an "or" relationship. "Including A, B and / or C" means including any one, any two, or any three of A, B, and C.
[0037] It should be understood that in the embodiments of the present disclosure, "B corresponding to A", "B corresponding to A", "A corresponds to B", or "B corresponds to A" means that B is associated with A, and B can be determined according to A. Determining B according to A does not mean that B is determined only according to A, and B can also be determined according to A and / or other information.
[0038] The model rendering method in one embodiment of the present disclosure can be run on a local terminal device or a server. When the model rendering method is run on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.
[0039] In an optional implementation, various cloud applications can be run under the cloud interaction system, such as cloud games. Taking cloud games as an example, cloud games refer to a game mode based on cloud computing. In the operation mode of cloud games, the running body of the game program and the game screen presentation body are separated. The storage and operation of the model rendering method are completed on the cloud game server. The role of the client device is used for receiving and sending data and presenting the game screen. For example, the client device can be a display device with data transmission function close to the user side, such as a mobile terminal, a TV, a computer, a handheld computer, etc.; but the cloud game server in the cloud is responsible for information processing. When playing the game, the player operates the client device to send operation instructions to the cloud game server. The cloud game server runs the game according to the operation instructions, encodes and compresses the game screen and other data, and returns it to the client device through the network. Finally, the client device decodes and outputs the game screen.
[0040] In an optional embodiment, taking a game as an example, a local terminal device stores a game program and is used to present a game screen. The local terminal device is used to interact with the player through a graphical user interface, that is, the game program is downloaded and installed by an electronic device and run conventionally. The local terminal device may provide the graphical user interface to the player in a variety of ways, for example, it may be rendered and displayed on a display screen of the terminal, or provided to the player through a holographic projection. For example, the local terminal device may include a display screen and a processor, the display screen is used to present a graphical user interface, the graphical user interface includes a game screen, and the processor is used to run the game, generate a graphical user interface, and control the display of the graphical user interface on the display screen.
[0041] In a possible implementation, an embodiment of the present disclosure provides a model rendering method, which provides a graphical user interface through a terminal device, wherein the terminal device can be the local terminal device mentioned above, or can be a client device in the cloud interaction system mentioned above.
[0042] Before describing the embodiments of the present disclosure in detail, the related concepts and related technologies of the present disclosure are firstly further introduced.
[0043] 1. Related concepts
[0044] Texture sampling: refers to the process of collecting pixel colors from a texture image in computer graphics. This process involves mapping the pixels of the texture image to the surface of the 3D model so that these pixel colors can be used when rendering. Texture sampling is an important step in 3D graphics rendering, which determines the visual effect of the model surface.
[0045] Tiling: It is a commonly used technique in computer graphics processing, mainly used to repeatedly arrange an image or texture.
[0046] Diffuse Map: Also known as diffuse color map, it is a basic texture that represents the color of an object's surface. In a Lambertian shader, the Diffuse Map usually contains the color and shadow information of the object, which directly affects the appearance of the object under different lighting conditions.
[0047] 2. Related technologies
[0048] In the process of rendering models, texture sampling often uses a repeated addressing mode (Wrap), that is, the address 0 to 1 is repeated after the UV exceeds 1. However, this method is easy to produce a strong sense of repetition and reduce the visual effect when applied to large-area models.
[0049] Currently, there are three related technologies to improve the repetitiveness of texture tiling:
[0050] The first is lattice noise sampling, which is similar to lattice noise (Perlin, Simplex). It finds the 4 integer coordinates of the UV of the current fragment, performs hash operations or samples NoiseMap (noise map), uses this value to guide the texture sampling at 4 points, and finally uses bilinear interpolation to composite the results. The first method is simple to implement and requires 4-5 samplings (5 times if NoiseMap is used). The disadvantage is that the texture is virtual and has a strong sense of smearing. There are similar solutions: find the 9 integer coordinates near the UV of the current fragment and then calculate the distance to it, and use it as a weight for weighted averaging. Its effect cannot guarantee uniformity in brightness and requires 9-10 samplings.
[0051] The second type is noise index sampling, which treats a NoiseMap as an IndexMap and maps its value to the sampling results of different offsets. The biggest problem is that it does not rely on the structure of the texture, and the resulting area is relatively fragmented.
[0052] The third type is hexagonal sampling, which uses an algorithm to generate tiled hexagons for the entire UV space. The transition is generated with hash or noise. The UV is determined by calculation to determine which area it is located in, and different rotations and translations are performed and then fused through hexagons. 3-4 samplings are required.
[0053] The above-mentioned related technologies have at least one of the following disadvantages:
[0054] 1. It requires repeated sampling, which consumes a lot of performance and is not easy to implement on mobile terminals;
[0055] 2. Not relying on texture structure, the texture on the model is fragmented or vague;
[0056] 3. It is difficult to adapt to models with obvious brush stroke styles, which will break the continuity of the brush strokes.
[0057] Figure 1 A model rendering method provided by one embodiment of the present disclosure is shown. Figure 1 As shown, the method includes the following steps S101 to S108.
[0058] Step S101: Determine a model map of a virtual model.
[0059] In this step, a corresponding model map may be determined for the virtual model.
[0060] In one of the embodiments of the present disclosure, the model map may be a diffuse reflection map.
[0061] In one embodiment of the present disclosure, the virtual model may be a virtual model that needs to reflect a texture repetition effect. Exemplarily, the virtual model includes one or more of the following: a ground model, a wall model. Exemplarily, both the ground model and the wall model may be a plane model or a curved surface model. Optionally, when the virtual model is a ground model, the model map may be a ground diffuse reflection map. Optionally, when the virtual model is a wall model, the model map may be a wall diffuse reflection map.
[0062] Step S102: Repeatedly address and sample the model map according to the original UV data of the virtual model to obtain first color data of different map areas on the surface of the virtual model, wherein the map area is an area on the surface of the virtual model mapped with a single model map.
[0063] The original UV data of the virtual model is the original UV coordinates of the virtual model. The original UV coordinates define the model vertices of the model texture on the surface of the virtual model to ensure that the model texture can be correctly mapped to the virtual model.
[0064] In this step, the model map can be repeatedly addressed and sampled (wrapped) according to the original UV data of the virtual model, so as to obtain the color data of the pixels mapped in the model map of each model vertex on the surface of the virtual model, such as RGB data. Since the repeated addressing mode is used for sampling, the model map needs to be tiled on the surface of the virtual model, wherein the area on the surface of the virtual model that maps a single model map is a mapping area on the surface of the virtual model, and therefore, the color data obtained by the above sampling can be divided into the first color data of different mapping areas on the surface of the virtual model according to the mapping area to which it belongs. Among them, the first color data of the mapping area refers to the set of the first color data of each model vertex in the mapping area.
[0065] Step S103: Determine the random number corresponding to the mapping area.
[0066] In this step, corresponding random numbers may be determined for different mapping areas respectively, so that different mapping areas have different random numbers.
[0067] In one of the embodiments of the present disclosure, the random number corresponding to the mapping area can be determined according to the original UV data of the mapping area. In this embodiment, the random number of the mapping area is determined based on the original UV data of the mapping area, and according to the sampling mode of the repeated addressing mode, the UV data ranges of different mapping areas (i.e., the UV coordinate ranges are different), so different mapping areas can have different random numbers, so as to avoid different mapping areas having the same random number, resulting in the same display results for different mapping areas.
[0068] In one embodiment of the present disclosure, the original UV data of the mapping area can be rounded to obtain a UV value corresponding to the mapping area, and then a pseudo-random number corresponding to the mapping area is generated according to the UV value to obtain a random number corresponding to the mapping area. In this way, a random and identical random number can be generated for each UV interval where the mapping area is located, so that the same mapping area has a unique random number, and different mapping areas have different random numbers. Figure 2 As shown, the UV interval of a certain map area is U=[0,1), in the grid defined by V=[0,1), and any UV data in this UV interval can be rounded to the same UV value, that is, U=0, V=0; the UV interval of a certain map area is U=[4,5), in the grid defined by V=[1,2), and any UV data in this UV interval can be rounded to the same UV value, that is, U=4, V=1.
[0069] The same mapping area has a unique random number to ensure that the same geometric transformation is used for the original UV data of the same mapping area. Different mapping areas have different random numbers to ensure that different geometric transformations are used for the original UV data of different mapping areas. This allows different mapping areas to have different randomness based on the mapping tiling, thereby improving the monotonous effect of simple repeated tiling of the map.
[0070] Optionally, the raw UV data of the texture area can be rounded off by using a floor function, which takes the integer part less than or equal to the input value. If the input value is already an integer, the result of the floor function is the integer itself.
[0071] Optionally, generating a pseudo-random number corresponding to the map area according to the UV value can be implemented by a random function. Exemplarily, the random function can obtain a random number by operating the input UV value through a sine function sin and a dot multiplication dot, and the output value of the random function can be sin(dot(st.xy,float2(12.9898,78.233)))*43758.5453123, where st.xy needs to be substituted with the UV value.
[0072] Step S104: determining a random rotation angle corresponding to the mapping area according to the random number corresponding to the mapping area.
[0073] In this step, the random rotation angle corresponding to the mapping area can be determined according to the random number corresponding to the mapping area. Different random numbers will result in different random rotation angles.
[0074] In one of the embodiments of the present disclosure, the product of a random number corresponding to the mapping area and a preset angle may be determined as the random rotation angle corresponding to the mapping area.
[0075] In one of the embodiments of the present disclosure, the random number corresponding to the mapping area can be determined according to the original UV data of the mapping area, and the random rotation angle is determined based on the random number. Therefore, in this embodiment, different mapping areas can have different random rotation angles to avoid different mapping areas having the same random rotation angle, resulting in the same display results for different mapping areas.
[0076] Step S105: performing geometric transformation on the original UV data of the mapping area according to the random rotation angle and the random number corresponding to the mapping area to obtain transformed UV data of the mapping area.
[0077] In this step, the geometric transformation may include a rotation transformation and a translation transformation. The original UV data of the mapping area can be rotated according to a random rotation angle corresponding to the mapping area (the random rotation angle is used as the rotation amount), and the original UV data of the mapping area can be translated according to a random number corresponding to the mapping area (the random number is used as the translation amount).
[0078] Optionally, a 2×2 rotation matrix can be constructed according to the random rotation angle rotateAngle corresponding to the mapping area. The rotation matrix is (cos(rotateAngle), -sin(rotateAngle), sin(rotateAngle), cos(rotateAngle)). Then, the rotation matrix is multiplied by the original UV data of the mapping area to obtain the rotationally transformed UV data of the mapping area. Then, the rotationally transformed UV data of the mapping area is added to the random number corresponding to the mapping area to obtain the rotation + translation transformed UV data of the mapping area, that is, the transformed UV data of the mapping area.
[0079] The UV data of each mapping area on the surface of the virtual model has changed, which means that the mapping relationship between the model map and the virtual model has changed.
[0080] Step S106: sampling the model map according to the transformed UV data of the map area to obtain second color data of the map area.
[0081] In this step, the model map can be sampled again according to the transformed UV data of the map area to obtain the second color data of the map area. The second color data of the map area refers to the set of second color data of each model vertex in the map area. Since different map areas on the virtual model surface are UV coordinate transformed based on different random numbers and random rotation angles, the second color data sampled from the model map for different map areas will have a certain degree of randomness.
[0082] Step S107: interpolate the first color data and the second color data of the mapping area to obtain target color data of the mapping area.
[0083] In this step, the first color data and the second color data of the same mapping area can be interpolated to obtain the target color data of the mapping area, wherein the target color data of the mapping area refers to the set of target color data of each model vertex in the mapping area.
[0084] Step S108: Rendering and displaying the virtual model according to the target color data of each mapping area on the surface of the virtual model.
[0085] The target color data of the mapping area is also the color of the mapping area presented in the graphical user interface. In this step, the virtual model can be displayed in the graphical user interface based on the target color data of each mapping area on the virtual model surface. Specifically, for the model vertices on the virtual model surface, the target color data of the model vertex can be directly used for display. For the position points on the virtual model surface located between the model vertices, the target color data of multiple model vertices adjacent to the position point can be interpolated and displayed based on the interpolated color data.
[0086] The model rendering method provided by the present disclosure first determines the model map of the virtual model; according to the original UV data of the virtual model, repeatedly addresses and samples the model map to obtain the first color data of different map areas on the surface of the virtual model, wherein the map area is an area where the surface of the virtual model is mapped using a single model map; determines the random number corresponding to the map area; determines the random rotation angle corresponding to the map area according to the random number corresponding to the map area; according to the random rotation angle and the random number corresponding to the map area, geometrically transforms the original UV data of the map area to obtain the transformed UV data of the map area; according to the transformed UV data of the map area, samples the model map to obtain the second color data of the map area; interpolates the first color data and the second color data of the map area to obtain the target color data of the map area; and renders and displays the virtual model according to the target color data of each map area on the surface of the virtual model. In the present disclosure, for a mapping area on the surface of a virtual model mapped with a single model map, the original UV data of the mapping area can be geometrically transformed by using a random rotation angle and a random number corresponding to the mapping area, so that the UV data of different mapping areas on the surface of the virtual model have random differences. Then, for different mapping areas, the model map sampling results before and after the UV transformation are interpolated to obtain the target color data of the different mapping areas, and the virtual model is rendered and displayed accordingly. In this way, the colors of different mapping areas on the surface of the virtual model can have random differences, thereby improving the sense of repetition caused by simple repeated tiling of the model map and improving the visual effect.
[0087] In one embodiment of the present disclosure, step S101 can be implemented by the following steps S1011 to S1012.
[0088] Step S1011: generating a brushstroke mask map with a color gradient according to a diffuse reflection map preconfigured for the virtual model;
[0089] Step S1012: storing the brush stroke mask map in the transparency channel of the diffuse reflection map to obtain a model map of the virtual model.
[0090] Exemplarily, in this embodiment, the model map of the virtual model can be output based on the diffuse map of the virtual model through the node in the SubstanceDesigner software.
[0091] Reference Figure 3 First, use the GreyScale Conversion node to obtain the grayscale value of the diffuse reflection map of the virtual model. A color image consists of three color channels: red, green, and blue (RGB). A grayscale image has only one channel, which represents brightness. The Grayscale Conversion node converts the RGB value of the diffuse reflection map to a grayscale value by weighted averaging to obtain a grayscale image of the diffuse reflection map. Optionally, the following formula can be used to convert the RGB value of the diffuse reflection map to a grayscale value: Gray = 0.299*R+0.587*G+0.114*B.
[0092] Then use the Level node to adjust the input black and white points and output black and white points of the diffuse map grayscale image, as well as the gamma value. These operations can affect the contrast and brightness distribution of the diffuse map grayscale image, making the brush strokes of the diffuse map sharper and more obvious, making it easier to extract a mask that conforms to the stylized brush strokes later.
[0093] Then, through the blend node, the Parabloid shape defined by the Shape node (this shape has the characteristics of being bright in the center and gradually darkening around) is mixed with the graphics result processed by the Level node to obtain a color gradient brushstroke mask map. The diffuse map and the brushstroke mask map are stored in the model map through the color channel and the transparency channel respectively. The brushstroke mask map is used to achieve a gradual transition of the brushstrokes expressed by the diffuse map in the model map of the mapped map area, so that the brushstrokes of the model map mapping adjacent map areas can achieve a natural transition and avoid breaking the continuity of the brushstrokes.
[0094] Afterwards, the color gradient brush mask map is stored in the Alpha channel (ie, transparency channel) of the diffuse map through the AlphaMerge node, and then the model map with the color gradient brush mask map stored in the Alpha channel can be output.
[0095] In one embodiment of the present disclosure, step S102 can be implemented by the following steps: according to the original UV data of the virtual model, the model map is repeatedly addressed and sampled to obtain the first color data and brushstroke mask data of different map areas on the surface of the virtual model.
[0096] Since the Alpha channel of the model texture stores a color-gradient brush mask image, repeating the addressing and sampling of the model texture can not only obtain the first color data (i.e., RGB values) of different texture regions on the virtual model surface, but also obtain the brush mask data (i.e., Alpha values) of different texture regions on the virtual model surface. That is, each texture region on the virtual model surface corresponds to a color-gradient brush mask image.
[0097] In one embodiment of the present disclosure, the method provided by the present disclosure may further include the following steps: randomly processing the brush mask shape corresponding to the texture region according to the brush mask data of the texture region and the corresponding random number to obtain the random brush mask data of the texture region.
[0098] The brush mask data of the texture region is also the pixel value of the pixel corresponding to each vertex in the texture region in the color-gradient brush mask image, where the pixel value range of the pixel in the brush mask image is [0, 1].
[0099] Optionally, the brush mask shape corresponding to the texture region can be randomly processed through the smoothstep function. The smoothstep(edge0, edge1, x) function includes three parameters. Among them, edge0 and edge1 represent two boundary values, and x represents the input value to be interpolated. The smoothstep function is mainly implemented through three steps: The first step is normalization, normalizing the input value x to the range of [0, 1], and the normalization result t = (x - edge0) / (edge1 - edge0); the second step is clipping, restricting t to the range of [0, 1] to ensure that the output value of the smoothstep function does not exceed this range, t = clamp(t, 0.0, 1.0), where the clamp function is used to limit a numerical value between the specified minimum and maximum values. If the current value is between the minimum and maximum values, the clamp function will return the current value. If the current value is less than the minimum value, the function returns the minimum value. If the current value is greater than the maximum value, the function returns the maximum value; the third step is to apply a cubic interpolation polynomial, and the output value of the smoothstep function = t * t * (3.0 - 2.0 * t).
[0100] When x <= edge0, the smoothstep function returns 0; when x >= edge1, the smoothstep function returns 1; when edge0 < x < edge1, as x increases, the return value of the smoothstep function gradually increases from 0 to 1.
[0101] In an exemplary embodiment, x can be substituted into the brush stroke mask data of the mapping area, edge0 can be substituted into RandomAngle*0.1+0.6, and edge1 can be substituted into 1-RandomAngle*0.1, where RandomAngle is the random number corresponding to the mapping area, and 0.1 and 0.6 are preset parameters that can be adjusted.
[0102] When edge0 and edge1 are close enough, a sharp mask similar to pure black and white will be generated. When edge0 and edge1 have a certain degree of randomness in different UV ranges, random and sharp brushstroke masks will be generated in different UV ranges.
[0103] Through the above processing, the random processing of the brush stroke mask shapes corresponding to different map areas can be achieved, and the brush stroke random mask data of different map areas can be obtained. Figure 4 , showing the brush stroke mask shapes corresponding to 3 different map areas, from Figure 4 It can be seen that compared with the Parabloid shape, the brush stroke mask shapes corresponding to these three map areas are all random and different.
[0104] In one embodiment of the present disclosure, step S107 can be implemented by the following steps: interpolating the first color data and the second color data of the mapping area according to the brush stroke random mask data of the mapping area to obtain the target color data of the mapping area.
[0105] In this embodiment, when interpolating the first color data and the second color data of a vertex in a mapping area of the virtual model surface, the mask value of the vertex in the random brush mask data of the mapping area can be used as the weight required for interpolation.
[0106] Optionally, the first color data and the second color data of the mapping area may be interpolated by a Lerp function, which is a commonly used interpolation method for smooth transition between two values. The basic form of the Lerp function is:
[0107] Lerp(a,b,w)=a+w*(ba)
[0108] Among them, a and b represent the two endpoint values of the interpolation, and w is the weight, which usually ranges from 0 to 1 and represents the interpolation ratio from a to b.
[0109] In this embodiment, a can be substituted into the first color data of a vertex in the mapping area, b can be substituted into the second color data of the vertex in the mapping area, and w can be substituted into the random brushstroke mask data of the vertex in the mapping area. The output value of the Lerp function is the target color data of the vertex in the mapping area.
[0110] The diffuse map to be applied to the virtual model can reflect the stylized brush strokes that need to be expressed on the surface of the virtual model through information such as texture. A brush stroke mask map with a color gradient is generated by extracting the brush strokes of the diffuse map and stored in the Alpha channel of the diffuse map. For different map areas on the surface of the virtual model, the brush stroke mask shape can be randomly processed to obtain different brush stroke mask shapes, which can be used as weights when performing data interpolation on the two sampling results of the model map generated based on the diffuse map. While retaining the stylized brush strokes of the diffuse map, the number of sampling times can be reduced, thereby reducing performance consumption.
[0111] In one of the embodiments of the present disclosure, the model map may include model maps corresponding to multiple time periods.
[0112] Exemplarily, the rendering scene of the virtual model needs to take into account the day and night changes. For example, if the virtual model needs to be rendered in a game with day and night changes, the model map may include a model map for the daytime period and a model map for the nighttime period. In an exemplary implementation, a diffuse reflection map for the daytime period and a diffuse reflection map for the nighttime period may be produced, and the two diffuse reflection maps may be processed according to the SD software nodes described in the above exemplary embodiments to obtain the model map for the daytime period and the model map for the nighttime period.
[0113] If the current moment t is within one of the multiple time periods Tx, then in step S102, the model map corresponding to one of the time periods Tx can be repeatedly addressed and sampled according to the original UV data of the virtual model to obtain the first color data corresponding to each of the different map areas on the surface of the virtual model in the one of the time periods Tx. If the current moment is within one of the multiple time periods Tx, then in step S106, the model map corresponding to one of the time periods Tx can be sampled according to the transformed UV data of the map area to obtain the second color data corresponding to the map area in the one of the time periods Tx. In step S107, the first color data and the second color data corresponding to the map area in the one of the time periods Tx can be interpolated to obtain the target color data corresponding to the map area at the current moment t.
[0114] If the current moment is within one of the multiple time periods, the model map corresponding to the time period may be sampled twice, namely, the repeated addressing sampling described in step S102 and the sampling described in step S107.
[0115] If the current moment t is between the adjacent first time period T1 and second time period T2 in the multiple time periods, that is, the current moment t is in the transition stage between the two adjacent time periods, then in step S102, the model maps corresponding to the first time period T1 and the second time period T2 can be repeatedly addressed and sampled according to the original UV data of the virtual model, so as to obtain the first color data corresponding to the first time period T1 of different map areas on the surface of the virtual model, and the first color data corresponding to the second time period T2 of different map areas on the surface of the virtual model. If the current moment t is between the adjacent first time period T1 and second time period T2 in the multiple time periods, then in step S106, the model maps corresponding to the first time period T1 and the second time period T2 can be sampled according to the transformed UV data of the map area, so as to obtain the second color data corresponding to the map area in the first time period T1, and the second color data corresponding to the map area in the second time period T2.
[0116] In step S107, the first color data and the second color data corresponding to the mapping area in the first time period T1 can be interpolated to obtain the target color data corresponding to the mapping area in the first time period T1; the first color data and the second color data corresponding to the mapping area in the second time period T2 can be interpolated to obtain the target color data corresponding to the mapping area in the second time period T2. The weights used in the above two interpolation steps are the random brushstroke mask data of the mapping area.
[0117] Then, the target color data corresponding to the mapping area in the first time period T1 and the target color data corresponding to the mapping area in the second time period T2 can be interpolated to obtain the target color data corresponding to the mapping area at the current time t. The weight used in the interpolation step is related to time, and the weight indicates that: the closer the time is to the first time period T1, the greater the proportion of the target color data corresponding to the mapping area in the first time period T1; the closer the time is to the second time period T2, the greater the proportion of the target color data corresponding to the mapping area in the second time period T2.
[0118] If the current moment is in the transition stage between two adjacent time periods among the multiple time periods, the model maps corresponding to the two adjacent time periods can be sampled twice respectively, namely the repeated addressing sampling described in step S102 and the sampling described in step S107, a total of four samplings.
[0119] Exemplarily, if the current moment is in the daytime period, the model map corresponding to the daytime period needs to be sampled twice; if the current moment is in the nighttime period, the model map corresponding to the nighttime period needs to be sampled twice; if the current moment is in the transition stage from the nighttime period to the daytime period, that is, the sunrise stage, the model map corresponding to the daytime period needs to be sampled twice, and the model map corresponding to the nighttime period needs to be sampled twice; if the current moment is in the transition stage from the daytime period to the nighttime period, that is, the sunset stage, the model map corresponding to the nighttime period needs to be sampled twice, and the model map corresponding to the daytime period needs to be sampled twice.
[0120] In the above example, only 2 texture samples are required for each frame during the day and night periods, while the sunrise and sunset phases are very short, and only 4 texture samples are required in these two phases.
[0121] Optionally, two macro switches can be used to determine whether to sample 1 or 2 model textures, and when sampling 1 texture, whether to sample the model texture of the daytime or the model texture of the nighttime. The value of the macro switch can be controlled by code and linked to the world time.
[0122] Exemplarily, two macro switches ENABLE_SUNSET and ENABLE_NIGHT can be preconfigured. When the macro switch ENABLE_SUNSET is 1, it means that the current state is in the transition phase of sunrise or sunset, and both the model map of the daytime period and the model map of the nighttime period need to be sampled. When the macro switch ENABLE_SUNSET is 0, it means that the current state is in the daytime period or the nighttime period, and the model map of the daytime period or the model map of the nighttime period needs to be sampled. When the macro switch ENABLE_NIGHT is 1, it means that the current state is in the nighttime period, and the model map of the nighttime period needs to be sampled. When the macro switch ENABLE_NIGHT is 0, it means that the current state is in the daytime period, and the model map of the daytime period needs to be sampled.
[0123] If the rendering scene of the model does not need to consider the influence of time-varying factors such as day and night changes, only one model map can be used. The exemplary embodiment provided by the present disclosure only needs to sample the model map twice, and can rely on the texture structure of the model map to improve the repetitive feeling of the model map tiling, and reduce the number of sampling times while retaining the stylized brushstrokes of the model map, thereby reducing performance consumption and facilitating implementation on mobile terminals.
[0124] The exemplary embodiment of the present disclosure can extract brush strokes based on the stylized model map to form a mask, store it in the alpha channel of the model map, and use it as a weight during the second sampling to increase the randomness of the sampling and reduce the number of sampling times. The exemplary embodiment of the present disclosure randomly samples the map within a limited range and obtains a random brush stroke mask to achieve the effect of reducing the sense of repetitiveness of the map while maintaining the continuity of the brush strokes and being able to land on the mobile terminal. In rendering scenes that need to control the change of day and night, compared to the repeated addressing sampling method used in related technologies (rendering requires 143us per frame), the exemplary embodiment of the present disclosure can further optimize the performance and reduce the rendering time per frame to 117.44us.
[0125] Corresponding to the model rendering method provided in the embodiment of the present disclosure, the embodiment of the present disclosure also provides a model rendering device. Figure 5 As shown, the device 700 includes:
[0126] A first determining module 701 is used to determine a model map of a virtual model;
[0127] A first sampling module 702 is used to repeatedly address and sample the model map according to the original UV data of the virtual model to obtain first color data of different map areas on the surface of the virtual model, wherein the map area is an area on the surface of the virtual model mapped by a single model map;
[0128] A second determination module 703, used to determine a random number corresponding to the mapping area;
[0129] A third determination module 704 is used to determine the random rotation angle corresponding to the mapping area according to the random number corresponding to the mapping area;
[0130] A geometric transformation module 705 is used to perform geometric transformation on the original UV data of the mapping area according to the random rotation angle and random number corresponding to the mapping area to obtain the transformed UV data of the mapping area;
[0131] A second sampling module 706 is used to sample the model map according to the transformed UV data of the map area to obtain second color data of the map area;
[0132] An interpolation module 707 is used to interpolate the first color data and the second color data of the mapping area to obtain target color data of the mapping area;
[0133] The display module 708 is used to render and display the virtual model according to the target color data of each mapping area on the surface of the virtual model.
[0134] Optionally, determining a model map of the virtual model includes:
[0135] Generate a brush mask map with color gradient according to the diffuse map pre-configured for the virtual model;
[0136] The brush stroke mask map is stored in the transparency channel of the diffuse reflection map to obtain the model map of the virtual model.
[0137] Optionally, the repeatedly addressing and sampling the model map according to the original UV data of the virtual model to obtain the first color data of different map areas on the surface of the virtual model includes:
[0138] Repeatedly addressing and sampling the model map according to the original UV data of the virtual model to obtain first color data and brushstroke mask data of different map areas on the surface of the virtual model;
[0139] The device is also used for:
[0140] According to the brush stroke mask data of the mapping area and the corresponding random number, the brush stroke mask shape corresponding to the mapping area is randomly processed to obtain the brush stroke random mask data of the mapping area.
[0141] Optionally, interpolating the first color data and the second color data of the mapping area to obtain target color data of the mapping area includes:
[0142] According to the brush stroke random mask data of the mapping area, the first color data and the second color data of the mapping area are interpolated to obtain the target color data of the mapping area.
[0143] Optionally, the model map includes model maps corresponding to multiple time periods respectively.
[0144] Optionally, the repeatedly addressing and sampling the model map according to the original UV data of the virtual model to obtain the first color data of different map areas on the surface of the virtual model includes:
[0145] If the current moment is within one of the multiple time periods, repeatedly addressing and sampling the model map corresponding to the one of the time periods according to the original UV data of the virtual model to obtain first color data corresponding to the one of the time periods for different map areas on the surface of the virtual model;
[0146] The step of sampling the model map according to the transformed UV data of the map area to obtain the second color data of the map area includes:
[0147] The model map corresponding to one of the time periods is sampled according to the transformed UV data of the map area to obtain the second color data corresponding to the map area in the one of the time periods.
[0148] Optionally, interpolating the first color data and the second color data of the mapping area to obtain target color data of the mapping area includes:
[0149] Interpolate the first color data and the second color data corresponding to the mapping area in one of the time periods to obtain the target color data corresponding to the mapping area at the current moment.
[0150] Optionally, the repeatedly addressing and sampling the model map according to the original UV data of the virtual model to obtain the first color data of different map areas on the surface of the virtual model includes:
[0151] If the current moment is between a first time period and a second time period that are adjacent to each other among the multiple time periods, the model maps corresponding to the first time period and the second time period are repeatedly addressed and sampled according to the original UV data of the virtual model to obtain first color data corresponding to different map areas on the surface of the virtual model in the first time period, and first color data corresponding to different map areas on the surface of the virtual model in the second time period;
[0152] The step of sampling the model map according to the transformed UV data of the map area to obtain the second color data of the map area includes:
[0153] According to the transformed UV data of the mapping area, the model maps corresponding to the first time period and the second time period are sampled respectively to obtain the second color data corresponding to the mapping area in the first time period and the second color data corresponding to the mapping area in the second time period.
[0154] Optionally, interpolating the first color data and the second color data of the mapping area to obtain target color data of the mapping area includes:
[0155] Interpolating the first color data and the second color data corresponding to the mapping area in the first time period to obtain the target color data corresponding to the mapping area in the first time period;
[0156] Interpolating the first color data and the second color data corresponding to the mapping area in the second time period to obtain the target color data corresponding to the mapping area in the second time period;
[0157] The target color data corresponding to the mapping area in the first time period and the target color data corresponding to the mapping area in the second time period are interpolated to obtain the target color data corresponding to the mapping area at the current moment.
[0158] Optionally, the virtual model includes one or more of the following: a ground model and a wall model.
[0159] The model rendering device provided by the present disclosure first determines the model map of the virtual model; according to the original UV data of the virtual model, repeatedly addresses and samples the model map to obtain the first color data of different map areas on the surface of the virtual model, wherein the map area is an area where the surface of the virtual model is mapped using a single model map; according to the random number corresponding to the map area, the random rotation angle corresponding to the map area is determined; according to the random rotation angle and the random number corresponding to the map area, the original UV data of the map area is geometrically transformed to obtain the transformed UV data of the map area; according to the transformed UV data of the map area, the model map is sampled to obtain the second color data of the map area; the first color data and the second color data of the map area are interpolated to obtain the target color data of the map area; according to the target color data of each map area on the surface of the virtual model, the virtual model is rendered and displayed. In the present disclosure, for a mapping area on the surface of a virtual model mapped with a single model map, the original UV data of the mapping area can be geometrically transformed by using a random rotation angle and a random number corresponding to the mapping area, so that the UV data of different mapping areas on the surface of the virtual model have random differences. Then, for different mapping areas, the model map sampling results before and after the UV transformation are interpolated to obtain the target color data of the different mapping areas, and the virtual model is rendered and displayed accordingly. In this way, the colors of different mapping areas on the surface of the virtual model can have random differences, thereby improving the sense of repetition caused by simple repeated tiling of the model map and improving the visual effect.
[0160] Next, an electronic device provided by an embodiment of the present disclosure is introduced. Figure 6 , Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. The electronic device 800 may be deployed with the model rendering device described in the embodiment of the present disclosure to implement the functions in the embodiment of the present disclosure. Specifically, the electronic device 800 includes: a receiver 801, a transmitter 802, a processor 803 and a memory 804 (the number of processors 803 in the electronic device 800 may be one or more, Figure 6In the example of FIG. 801 , the processor 803 may include an application processor 8031 and a communication processor 8032. In some embodiments of the present disclosure, the receiver 801, the transmitter 802, the processor 803 and the memory 804 may be connected via a bus or other means.
[0161] The memory 804 may include a read-only memory and a random access memory, and provides instructions and data to the processor 803. A portion of the memory 804 may also include a non-volatile random access memory (NVRAM). The memory 804 stores processor and operation instructions, executable modules or data structures, or subsets thereof, or extended sets thereof, wherein the operation instructions may include various operation instructions for implementing various operations.
[0162] The processor 803 controls the operation of the execution device. In a specific application, the various components of the execution device are coupled together through a bus system, wherein the bus system includes not only a data bus but also a power bus, a control bus, and a status signal bus, etc. However, for the sake of clarity, various buses are referred to as bus systems in the figure.
[0163] The method disclosed in the above embodiment of the present disclosure can be applied to the processor 803, or implemented by the processor 803. The processor 803 can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 803. The above processor 803 can be a general processor, a digital signal processor (digital signal processing, DSP), a microprocessor or a microcontroller, and can further include an application specific integrated circuit (application specific integrated circuit, ASIC), a field programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The processor 803 can implement or execute the methods, steps and logic block diagrams disclosed in the embodiment of the present disclosure. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiment of the present disclosure can be directly embodied as a hardware decoding processor to be executed, or a combination of hardware and software modules in the decoding processor can be executed. The software module may be located in a storage medium mature 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. The storage medium is located in the memory 804, and the processor 803 reads the information in the memory 804 and completes the steps of the above method in combination with its hardware.
[0164] The receiver 801 can be used to receive input digital or character information and generate signal input related to the relevant settings and function control of the execution device. The transmitter 802 can be used to output digital or character information through the first interface; the transmitter 802 can also be used to send instructions to the disk group through the first interface to modify the data in the disk group; the transmitter 802 can also include a display device such as a display screen.
[0165] In the embodiment of the present disclosure, the application processor 8031 in the processor 803 is used to execute the model rendering method in the embodiment of the present disclosure. It should be noted that the specific manner in which the application processor 8031 executes each step is based on the same concept as the various method embodiments in the present disclosure, and the technical effects it brings are the same as the various method embodiments in the present disclosure. For specific contents, please refer to the description in the method embodiments shown above in the present disclosure, and no further description will be given here.
[0166] The disclosed embodiment also provides a chip for running instructions, which is used to execute the technical solution of the model rendering method in the above embodiment.
[0167] The embodiment of the present disclosure further provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on a processor, the processor executes the technical solution of the model rendering method in the above embodiment.
[0168] The embodiments of the present disclosure also provide a computer program product, including a computer program, which is used to execute the technical solution of the model rendering method in the above embodiment when executed by a processor.
[0169] The computer readable storage medium mentioned above can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or dedicated server.
[0170] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
[0171] Although the present disclosure is disclosed as above in the form of a preferred embodiment, it is not intended to limit the present disclosure. Any person skilled in the art may make possible changes and modifications without departing from the spirit and scope of the present disclosure. Therefore, the scope of protection of the present disclosure shall be based on the scope defined by the claims of the present disclosure.
Claims
1. A model rendering method, characterized in that: The method comprises: Determine a model map of the virtual model; According to the original UV data of the virtual model, the model map is repeatedly addressed and sampled to obtain first color data of different map areas on the surface of the virtual model, wherein the map area is an area on the surface of the virtual model mapped by a single model map; Determine the random number corresponding to the mapping area; Determine a random rotation angle corresponding to the mapping area according to a random number corresponding to the mapping area; According to the random rotation angle and the random number corresponding to the mapping area, the original UV data of the mapping area is geometrically transformed to obtain the transformed UV data of the mapping area; Sampling the model map according to the transformed UV data of the map area to obtain second color data of the map area; Interpolating the first color data and the second color data of the mapping area to obtain target color data of the mapping area; The virtual model is rendered and displayed according to the target color data of each mapping area on the surface of the virtual model.
2. The method according to claim 1, characterized in that The step of determining a model map of a virtual model comprises: Generate a brush mask map with color gradient according to the diffuse map pre-configured for the virtual model; The brush stroke mask map is stored in the transparency channel of the diffuse reflection map to obtain the model map of the virtual model.
3. The method according to claim 2, characterized in that The method of repeatedly addressing and sampling the model map according to the original UV data of the virtual model to obtain first color data of different map areas on the surface of the virtual model includes: Repeatedly addressing and sampling the model map according to the original UV data of the virtual model to obtain first color data and brushstroke mask data of different map areas on the surface of the virtual model; The method further comprises: According to the brush stroke mask data of the mapping area and the corresponding random number, the brush stroke mask shape corresponding to the mapping area is randomly processed to obtain the brush stroke random mask data of the mapping area.
4. The method according to claim 3, characterized in that The interpolating the first color data and the second color data of the mapping area to obtain the target color data of the mapping area includes: According to the brush stroke random mask data of the mapping area, the first color data and the second color data of the mapping area are interpolated to obtain the target color data of the mapping area.
5. The method according to claim 1, characterized in that The model map includes model maps corresponding to multiple time periods.
6. The method according to claim 5, characterized in that The method of repeatedly addressing and sampling the model map according to the original UV data of the virtual model to obtain first color data of different map areas on the surface of the virtual model includes: If the current moment is within one of the multiple time periods, repeatedly addressing and sampling the model map corresponding to the one of the time periods according to the original UV data of the virtual model to obtain first color data corresponding to the one of the time periods for different map areas on the surface of the virtual model; The step of sampling the model map according to the transformed UV data of the map area to obtain the second color data of the map area includes: The model map corresponding to one of the time periods is sampled according to the transformed UV data of the map area to obtain the second color data corresponding to the map area in the one of the time periods.
7. The method according to claim 6, characterized in that The interpolating the first color data and the second color data of the mapping area to obtain the target color data of the mapping area includes: Interpolate the first color data and the second color data corresponding to the mapping area in one of the time periods to obtain the target color data corresponding to the mapping area at the current moment.
8. The method according to claim 5, characterized in that The method of repeatedly addressing and sampling the model map according to the original UV data of the virtual model to obtain first color data of different map areas on the surface of the virtual model includes: If the current moment is between a first time period and a second time period that are adjacent to each other among the multiple time periods, the model maps corresponding to the first time period and the second time period are repeatedly addressed and sampled according to the original UV data of the virtual model to obtain first color data corresponding to different map areas on the surface of the virtual model in the first time period, and first color data corresponding to different map areas on the surface of the virtual model in the second time period; The step of sampling the model map according to the transformed UV data of the map area to obtain the second color data of the map area includes: According to the transformed UV data of the mapping area, the model maps corresponding to the first time period and the second time period are sampled respectively to obtain the second color data corresponding to the mapping area in the first time period and the second color data corresponding to the mapping area in the second time period.
9. The method according to claim 8, characterized in that The interpolating the first color data and the second color data of the mapping area to obtain the target color data of the mapping area includes: Interpolating the first color data and the second color data corresponding to the mapping area in the first time period to obtain the target color data corresponding to the mapping area in the first time period; Interpolating the first color data and the second color data corresponding to the mapping area in the second time period to obtain the target color data corresponding to the mapping area in the second time period; The target color data corresponding to the mapping area in the first time period and the target color data corresponding to the mapping area in the second time period are interpolated to obtain the target color data corresponding to the mapping area at the current moment.
10. The method according to claim 1, characterized in that The virtual model includes one or more of the following: a ground surface model and a wall model.
11. A model rendering device, characterized in that: The device comprises: A first determination module, used to determine a model map of a virtual model; A first sampling module is used to repeatedly address and sample the model map according to the original UV data of the virtual model to obtain first color data of different map areas on the surface of the virtual model, wherein the map area is an area on the surface of the virtual model mapped by a single model map; A second determination module, used to determine the random number corresponding to the mapping area; A third determination module is used to determine the random rotation angle corresponding to the mapping area according to the random number corresponding to the mapping area; A geometric transformation module, used for performing geometric transformation on the original UV data of the mapping area according to the random rotation angle and random number corresponding to the mapping area, so as to obtain the transformed UV data of the mapping area; A second sampling module, used for sampling the model map according to the transformed UV data of the map area to obtain second color data of the map area; An interpolation module, used for interpolating the first color data and the second color data of the mapping area to obtain target color data of the mapping area; The display module is used to render and display the virtual model according to the target color data of each mapping area on the surface of the virtual model.
12. An electronic device, characterized in that: include: A processor, a memory, and computer program instructions stored on the memory and executable on the processor; When the processor executes the computer program instructions, the model rendering method as described in any one of claims 1 to 10 is implemented.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, they are used to implement the model rendering method as described in any one of claims 1 to 10 above.