Model rendering method and device, electronic equipment and storage medium

By generating a patch model in game development and adjusting its orientation to always face the camera, and using preset texture maps to reduce the number of texture maps, the problem of difficult to simulate the effects of round objects such as pearls and waste resources in traditional methods is solved, and more efficient model rendering and resource utilization is achieved.

CN119648894APending Publication Date: 2025-03-18NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411546725.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-31
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

In game development, traditional model plus material production methods are difficult to effectively simulate the real effects of round objects such as pearls, and when the number of models is large, it will lead to waste of storage and rendering resources. At the same time, when using billboard technology, a material cannot support multiple pearl effects, resulting in increased memory and performance.

Method used

By generating a patch model in the virtual space and adjusting the orientation of the patch model based on the shooting direction of the virtual camera, making it face the camera forever. Then, use the preset texture map to record a variety of textures that may be used in the face model, thereby reducing the number of texture maps corresponding to different textures.

Benefits of technology

This method reduces the number of texture maps corresponding to different textures, reduces the data storage pressure of the device and the performance consumption during the rendering process, and improves the efficiency of model rendering and resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119648894A_ABST
    Figure CN119648894A_ABST
Patent Text Reader

Abstract

The invention provides a model rendering method and device, electronic equipment and a storage medium. At least one patch model is generated at a to-be-processed model position in a virtual space; adjusting the orientation of at least one patch model based on the shooting direction of the virtual camera, so that the virtual camera shoots towards the front side of the patch model; based on the to-be-rendered texture corresponding to the at least one patch model and a preset texture map, rendering the patch model; the texture to be rendered is at least one texture in multiple textures; the preset texture map is generated based on the texture maps corresponding to the multiple textures. According to the method, the patch model is generated through the bulletin board technology, and various textures possibly used by the patch model are recorded through the texture maps, so that sampling can be performed from the preset texture maps, the corresponding textures are rendered for the patch model, the number of the texture maps corresponding to different textures is reduced, and the processing efficiency is improved. And the data storage pressure of the equipment and the performance consumption in the rendering process are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of rendering technology, and in particular to a model rendering method, device, electronic device and storage medium. Background Art

[0002] In game development, "skin" is a common art design requirement. Skins can usually meet the needs of players to have different visual experiences for the same character or object. Character clothing accessories can also be considered as part of the "skin". Pearls, as a common accessory, are mostly made by model plus material. In the modeling process, more faces are often required to simulate the rounded effect of pearls, otherwise there will be unrealistic problems with angular edges. However, when the number of model faces is large, more storage and rendering resources are required. Billboard technology can be used to make pearls into a patch composed of four vertices, and the patch can be rotated according to the camera's observation position in the material, so that it always faces the camera. However, the material of billboard technology is single, and one billboard material cannot support multiple pearl effects. When there are multiple billboard requirements, multiple corresponding materials need to be created, which will increase memory and performance exponentially. Summary of the invention

[0003] In view of this, the purpose of the present disclosure is to provide a model rendering method, device, electronic device and storage medium to reduce the number of texture maps corresponding to different textures, reduce the data storage pressure of the device and the performance consumption during the rendering process.

[0004] In the first aspect, the embodiment of the present disclosure provides a model rendering method, the method comprising: generating at least one patch model at the position of the model to be processed in the virtual space; at least one patch model has corresponding multiple textures; a virtual camera is set in the virtual space; based on the shooting direction of the virtual camera, adjusting the orientation of at least one patch model so that the virtual camera shoots toward the front of the patch model; rendering the patch model based on the texture to be rendered corresponding to the at least one patch model and the preset texture map; the texture to be rendered is at least one of the multiple textures; the preset texture map is generated based on the texture maps corresponding to the multiple textures. In the second aspect, the embodiment of the present disclosure provides a model rendering device, the device comprising: a model generation module, used to generate at least one patch model at the position of the model to be processed in the virtual space; at least one patch model has corresponding multiple textures; a virtual camera is set in the virtual space; an orientation adjustment module, used to adjust the orientation of at least one patch model based on the shooting direction of the virtual camera so that the virtual camera shoots toward the front of the patch model; a rendering module, used to render the patch model based on the texture to be rendered corresponding to the at least one patch model and the preset texture map; the texture to be rendered is at least one of the multiple textures; the preset texture map is generated based on the texture maps corresponding to the multiple textures.

[0005] In a third aspect, an embodiment of the present invention provides an electronic device, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned model rendering method.

[0006] In a fourth aspect, an embodiment of the present invention provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the above-mentioned model rendering method.

[0007] The embodiments of the present invention bring the following beneficial effects:

[0008] The above-mentioned model rendering method, device, electronic device and storage medium generate at least one patch model at the position of the model to be processed in the virtual space; based on the shooting direction of the virtual camera, adjust the orientation of at least one patch model so that the virtual camera shoots toward the front of the patch model; render the patch model based on the texture to be rendered corresponding to at least one patch model and the preset texture map; the texture to be rendered is at least one texture among multiple textures; the preset texture map is generated based on the texture maps corresponding to the multiple textures. In this method, the patch model is generated by billboard technology, and the multiple textures that may be used by the patch model are recorded by texture maps, so that the preset texture map can be sampled and the corresponding texture can be rendered for the patch model, which reduces the number of texture maps corresponding to different textures, reduces the data storage pressure of the device and the performance consumption during the rendering process.

[0009] Other features and advantages of the present disclosure will be described in the following description, and partly become apparent from the description, or understood by practicing the present disclosure. The purpose and other advantages of the present disclosure are realized and obtained by the structures particularly pointed out in the description, claims and drawings.

[0010] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the specific embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.

[0012] Figure 1 A flowchart of a model rendering method provided by an embodiment of the present disclosure;

[0013] Figure 2 A schematic diagram of a mapping area in a preset texture map provided by an embodiment of the present disclosure;

[0014] Figure 3 A schematic diagram of a mapping area in another preset texture map provided in an embodiment of the present disclosure;

[0015] Figure 4 A schematic diagram of a preset mask map provided in an embodiment of the present disclosure;

[0016] Figure 5 Schematic diagram of various pearl effects displayed by multiple facet models provided in an embodiment of the present disclosure;

[0017] Figure 6 A schematic diagram of the structure of a model rendering device provided in an embodiment of the present disclosure;

[0018] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0019] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.

[0020] In game development, skin is a common art design requirement. Skin usually exists to meet the needs of players to have different visual experiences for the same character or object. Traditional clothing production processes mostly use the model plus material production method. For example, the round shape of pearls often requires a large number of vertices and faces in the modeling process to achieve a rounded effect; when the number of vertices / faces is not enough, the edges of the circle will be angular, and the effect will be very different. The skin effect produced by this method is often single and cannot better adapt to the needs of multiple shapes.

[0021] In practical applications, billboard technology can be used to make pearls into patches composed of four vertices, and the patches can be rotated according to the camera's observation position in the material to always face the camera. However, the material of billboard technology is also single, and one billboard material cannot support multiple pearl effects. If there is a need for billboards with multiple textures, it will lead to an exponential increase in memory and performance.

[0022] Based on this, the embodiments of the present disclosure provide a model rendering method, device, electronic device and storage medium, and the technology can be applied to scenarios that require model rendering.

[0023] See also Figure 1 First, a model rendering method provided by an embodiment of the present invention is introduced. The method comprises the following steps:

[0024] Step S102, generating at least one patch model at the position of the model to be processed in the virtual space; the at least one patch model has corresponding multiple textures; and a virtual camera is set in the virtual space.

[0025] The above-mentioned patch model can be one or more, which can be specifically determined based on the object simulated by the model to be processed. For example, when the model to be processed simulates a pearl necklace, if it is preset that there are multiple pearls on the pearl necklace, a patch model can be generated for each pearl. If the necklace is set to have a silver chain with only one pearl pendant on it, a patch model can be generated for the pearl pendant. When the patch model includes multiple, the arrangement order between the multiple patch models is also determined based on the object they simulate, and is not limited here. The above-mentioned position of the model to be processed is usually the position where the model to be processed needs to be displayed in the virtual space, which can be set based on demand.

[0026] For a patch model, multiple textures can be set for it. When rendering the patch model, you can only choose one of the multiple textures to render, or you can render different types of textures from the multiple textures to the patch model at different times to show the changing effect. When there are multiple patch models, each patch model can have only one texture. When different patch models correspond to different types of textures, multiple patch models have multiple textures. Each patch model or part of the patch models in the multiple patch models can also have multiple textures, which is not limited here.

[0027] Step S104: adjusting the orientation of at least one mesh model based on the shooting direction of the virtual camera so that the virtual camera shoots toward the front of the mesh model.

[0028] The shooting direction of the virtual camera in the virtual space usually corresponds to the orientation of the virtual camera. Since the texture displayed by the mesh model can only be captured when the virtual camera is facing the mesh model, the orientation of the mesh model needs to be adjusted to be opposite to the orientation of the virtual space. Otherwise, the virtual camera may capture the side of the mesh model, which will display a thin sheet, resulting in a poor viewing experience.

[0029] When adjusting the orientation of a patch model, you can usually adjust the position of each patch model's vertices. When the patch model is small, the distance between vertices is small, and the line connecting each vertex and the virtual camera can be adjusted to roughly match the orientation of the virtual camera. When the patch model is large, you also need to specifically calculate the position of each vertex so that the center of the patch model after the vertex position adjustment faces the virtual camera, so that the virtual camera can shoot directly at the patch model.

[0030] Step S106, rendering the patch model based on a texture to be rendered corresponding to at least one patch model and a preset texture map; the texture to be rendered is at least one of the multiple textures; the preset texture map is generated based on the texture maps corresponding to the multiple textures.

[0031] The above-mentioned preset texture map is usually generated based on texture maps corresponding to multiple textures. Each texture map is usually square. The preset texture map is also square. The square image used to generate the preset texture map can be divided into multiple square image areas, and the sizes of each image area are usually the same or different, and there is no specific limitation. The multiple texture maps corresponding to the multiple textures can be resized separately so that their sizes can adapt to the divided graphic areas, and then the display content of the texture map is pasted to the divided image areas.

[0032] As described above, the texture to be rendered is a texture among multiple textures. When it is necessary to render the texture to be rendered for a patch model, the corresponding area in the preset texture map can be sampled, and the patch model can be rendered based on the sampling result. In practical applications, multiple textures can be rendered sequentially to the patch model through a preset texture map. It is also possible to render multiple patch models into different types of textures through a preset texture map.

[0033] The above-mentioned model rendering method generates at least one patch model at the position of the model to be processed in the virtual space; based on the shooting direction of the virtual camera, adjusts the orientation of at least one patch model so that the virtual camera shoots toward the front of the patch model; renders the patch model based on the texture to be rendered corresponding to at least one patch model and the preset texture map; the texture to be rendered is at least one of multiple textures; the preset texture map is generated based on the texture maps corresponding to the multiple textures. In this method, the patch model is generated by billboard technology, and the multiple textures that may be used by the patch model are recorded by texture maps, so that the preset texture map can be sampled to render the corresponding texture for the patch model, which reduces the number of texture maps corresponding to different textures, reduces the data storage pressure of the device and the performance consumption during the rendering process.

[0034] In practical applications, the preset texture map is usually divided into multiple map areas based on the type of texture corresponding to the at least one patch model; the multiple map areas include a target map area corresponding to each texture. As mentioned above, the at least one patch model can refer to one patch model or multiple patch models.

[0035] The type of texture corresponding to the at least one patch model may be predetermined or obtained by statistics. For example, when there are multiple patch models, each patch model has a corresponding texture. The number of different textures among the multiple textures of the multiple patch models may be counted, and then used as the number of types of textures corresponding to the multiple patch models.

[0036] The above-mentioned multiple mapping areas are usually arranged in a preset texture map in the form of a square matrix. The square matrix is ​​determined based on the type of texture corresponding to at least one patch model. The number of elements in the square matrix is ​​greater than or equal to the number of types of multiple textures; each mapping area corresponds to an element in the square matrix. In specific implementation, a target mapping area can be randomly determined for each texture, and different textures correspond to different target mapping areas.

[0037] For example, when the number of textures is 2, 3, or 4, the matrix is ​​a 2×2 matrix. Then, based on the elements in the target matrix, the preset texture map is divided into multiple map regions; each map region corresponds to one element. Figure 2 As shown, when the square matrix is ​​a 2×2 square matrix, the preset texture map is divided into four map areas. Figure 2 In the figure, the square area where 1, 2, 3, and 4 are located represents a mapping area. Figure 3 As shown, when the square matrix is ​​a 3×3 square matrix, the preset texture map is divided into 9 map areas. Figure 3 In the figure, the square area where 1, 2, 3, 4, 5, 6, 7, 8, and 9 are located represents a mapping area respectively.

[0038] After determining the target map area corresponding to the texture, the texture displayed in the texture map can be directly assigned to the target map area, thereby generating the texture in the target map area, and determining the preset texture map displaying multiple textures as the preset texture map.

[0039] In some cases, the at least one patch model has multiple masks corresponding to it. Each mask also has a corresponding mask map, and a preset mask map can be generated based on the mask maps corresponding to the multiple masks. Similar to the generation process of the preset texture map, the preset mask map needs to be divided into multiple map areas, and then each mask map is adjusted to the corresponding map area, so as to generate the preset mask map. Figure 4 As shown, based on the three mask maps on the left, the preset mask map shown on the right can be generated.

[0040] The following embodiment provides a specific method for adjusting the orientation of at least one mesh model based on the shooting direction of the virtual camera so that the virtual camera shoots toward the front of the mesh model.

[0041] The patch model includes a plurality of vertices, and the orientation of a patch model is usually adjusted by adjusting the position of the vertices in the patch model. When the size of the patch model is large, if the directions corresponding to the positions of the vertices in the model are all adjusted to be opposite to the shooting direction of the virtual camera, the patch model will be deformed. For each patch model in at least one patch model, the size of the patch model can be set to a first size; the first size is less than a preset size threshold. In short, the patch model is reduced, for example, it can be adjusted to be very small, so small that it can be regarded as a point. Then, based on the shooting direction of the virtual camera, the direction of the target line between the vertex of the patch model after the size setting and the virtual camera is determined. The target line direction is usually consistent with the shooting direction, and there may be a slight deviation, but the angle between the two directions should be less than the preset angle threshold. , and the positions of the plurality of vertices of the patch model are adjusted based on the target line direction, so that the line direction between the vertex and the virtual camera is as consistent as possible with the target line direction. After adjusting the orientation of the patch model, the size of the adjusted patch model can be enlarged to a second size based on the preset texture display requirements and the texture coordinate center corresponding to the patch model. In order to highlight the display effect of the patch model, the second size is usually greater than the above-mentioned size threshold. Since the texture coordinate center usually corresponds to the center of the patch model, the directions of other vertices of the patch model relative to the texture coordinate center can be controlled to remain unchanged, and the positions of the vertices can be adjusted to enlarge the patch model. Since the patch model is facing the virtual camera when the positions of the vertices are adjusted based on the target connection direction, the patch model is enlarged without changing the orientation of the patch model. The enlarged patch model is still facing the virtual camera, so the virtual camera can be made to shoot the patch model.

[0042] The following embodiments provide a specific method for rendering a patch model based on a to-be-rendered texture corresponding to at least one patch model and a preset texture map.

[0043] As described above, the at least one patch model may have a corresponding plurality of masks. Each mask also has a corresponding mask map, and a preset mask map may be generated based on the mask maps corresponding to the plurality of masks. When rendering the patch model, the patch model may be rendered based on the texture to be rendered, the preset texture map, and the preset mask map corresponding to at least one patch model. That is, the patch model may be rendered into a plurality of textures and a plurality of display shapes. Among them, for each vertex, it is necessary to determine the color parameter of the vertex based on the map area corresponding to the texture to be rendered in the preset texture map, and determine the transparency parameter of the vertex based on the map corresponding to the mask to be rendered in the preset mask map, and then determine the rendering parameter corresponding to the vertex based on the color parameter and the transparency parameter, so that the entire patch model is rendered based on the rendering parameters corresponding to the plurality of vertices.

[0044] When the preset texture map includes multiple map areas, and each map area displays a corresponding texture, it is necessary to determine the texture to be rendered corresponding to each patch model in at least one patch model. The texture to be rendered can be preset or set by the user. An option control for setting the texture to be rendered can be displayed through a graphical user interface, or a user can input a code instruction to generate a texture assignment command. In response to a texture assignment instruction for a first model in at least one patch model, a first texture corresponding to the texture assignment instruction is determined as the texture to be rendered corresponding to the first model; the first texture is a texture among the multiple textures.

[0045] After determining the texture to be rendered of the patch model, a target texture map corresponding to the mapping area corresponding to the texture to be rendered can be generated. At this time, the size of the target texture map is consistent with the size of the mapping area. However, when generating a preset texture map, the texture map of the texture corresponding to the patch model is reduced, and its texture data is saved in the mapping area of ​​the preset texture map. The texture map coordinates corresponding to the vertices of the patch model are usually for the texture map that has not been reduced. Therefore, it is necessary to enlarge the target texture map based on the texture map coordinates corresponding to the vertices of the patch model. Generally speaking, the target texture map is enlarged to the maximum, that is, the texture map size when the u coordinate is 0~1 and the v coordinate is 0~1. Then, the enlarged target texture map can be sampled based on the texture map coordinates corresponding to the vertices of the patch model, and then the patch model can be rendered based on the sampling results.

[0046] The texture mapping coordinates corresponding to the multiple vertices of the patch model may also be re-determined based on the mapping area corresponding to the texture to be rendered. The re-determined texture mapping coordinates are within the texture coordinate range of the mapping area corresponding to the texture to be rendered. Then, based on the texture mapping coordinates corresponding to the multiple vertices, sampling is performed in the mapping area corresponding to the texture to be rendered, and the patch model is further rendered based on the sampling results.

[0047] When the patch model needs to be rendered based on the preset mask texture, it is also necessary to determine the mask to be rendered corresponding to the patch model, and then determine the texture coordinates corresponding to multiple vertices of the patch model based on the texture area corresponding to the mask to be rendered; the texture coordinates are within the coordinate range of the texture area corresponding to the mask to be rendered. Then, based on the texture coordinates corresponding to the multiple vertices, sampling is performed in the texture area corresponding to the mask to be rendered, and the patch model is further rendered based on the sampling results.

[0048] The present disclosure also provides another model rendering method. Figure 1 This method takes the generation of the surface corresponding to the pearl as an example, taking into account both the visual effect and the system performance.

[0049] This method is implemented in the following ways:

[0050] 1 Make a square patch model for each pearl, and scale the midpoint of the patch to infinity.

[0051] Specifically, according to the needs of game planning and the effects of accessories designed in the original painting, during the modeling process, a square patch model is made at the position of the pearl, compressed to an infinitesimal size, and all the patches representing the pearl are given the same material.

[0052] In the model making software, you can use the mouse to drag directly through the viewport to make intuitive changes to the effect. However, you can also adjust it by changing the size value, such as changing the original size of 5 to 0.0001. There is no specific requirement for the modified size. If the model size is too large, the four vertices of the square face are far apart. When calculating the vertex direction later, the direction difference of the four vertices will be large, resulting in the square face composed of the four vertices not being very accurate in direction and not facing the camera accurately.

[0053] 2. Using the texture coordinate (uv) channel, arrange the texture coordinate maps of each face model in NxN mode in uv channel 2. Ignore the differences in shape and color in uv channel 1, overlap the uv of all pearl faces, and spread them out.

[0054] The uv channel is a set of data in a static mesh that is used to map the vertex data of the mesh into 2D space (2D coordinate system). These mappings define how the 2D texture map is "wrapped" onto the 3D geometry when the mesh is rendered. The uv1 and uv2 of the same model can store different texture maps and vertex texture map coordinates. Rendering the same model according to different uv channels will have different rendering effects.

[0055] According to the original design, overlap the second set of UVs of pearls of the same shape and color, and arrange them in N*N format in the global UV. For example, if there are 20 pearls and four types of pearls in the original design, arrange them in a 2*2 format and overlap the UVs of pearls of the same style.

[0056] In UV channel 1, overlap the UVs of all the pearl patches and center them to maximize the display.

[0057] 3 In the material, rotate the direction to the camera's viewing direction based on each vertex. After the direction is determined, use vertex offset to enlarge the pearl patch to the required size.

[0058] Specifically, we can first calculate the vertex positions and rotate the model vertices to the direction of the camera so that the pearl patches always face the camera, and there will be no problems with side blemishes or pearl deformation.

[0059] 4 Use the texture merging method to merge and optimize the texture's color and shape.

[0060] The model is enlarged based on the center point of uv channel 0 (the number of uv in the game engine is calculated from 0, and uv channel 0 here is the first set of UV in the modeling software). Because according to the uv distribution in the third step above, the uv midpoint is the midpoint of the model, the pearl patch can be enlarged in place to ensure that the patch will not be offset. The pearl effect generated by the patch model is as follows Figure 5 shown.

[0061] This method can combine pearl effects of various shapes and colors into one material, saving the number of materials, reducing performance consumption, and ensuring that the effect will not be affected; reducing the number of faces of the model, reducing the number of textures, and reducing the pressure on game memory and storage; the shape and color effects of the pearl are realized through an N*N arranged texture, and different colors and shapes can be displayed by simply mapping to uv1; the versatility and compatibility of the material are expanded, and switches are added to each function. It can be switched between single color, single shape and multiple colors, multiple shapes.

[0062] This method reduces the number of faces in the model, saves game storage and memory usage, makes game resources lighter, and is easier for players to download and install. Especially on mobile devices, performance is significantly improved. It also reduces the number of materials, thereby reducing drawing calls (drawCall) and optimizing overall performance. This method also expands the scope of application of a single material, improving the versatility of materials and resource utilization efficiency.

[0063] For the above method embodiments, see Figure 6 A model rendering device is shown, the device comprising:

[0064] The model generation module 602 is used to generate at least one patch model at the position of the model to be processed in the virtual space; the at least one patch model has corresponding multiple textures; a virtual camera is set in the virtual space;

[0065] The orientation adjustment module 604 is used to adjust the orientation of at least one mesh model based on the shooting direction of the virtual camera so that the virtual camera shoots toward the front of the mesh model;

[0066] The rendering module 606 is used to render the patch model based on a texture to be rendered corresponding to at least one patch model and a preset texture map; the texture to be rendered is at least one of a plurality of textures; the preset texture map is generated based on texture maps corresponding to the plurality of textures.

[0067] The above-mentioned model rendering device generates at least one patch model at the position of the model to be processed in the virtual space; adjusts the orientation of at least one patch model based on the shooting direction of the virtual camera so that the virtual camera shoots toward the front of the patch model; renders the patch model based on the texture to be rendered corresponding to the at least one patch model and the preset texture map; the texture to be rendered is at least one of multiple textures; the preset texture map is generated based on the texture maps corresponding to the multiple textures. In this method, the patch model is generated by the billboard technology, and the multiple textures that may be used by the patch model are recorded by the texture map, so that the preset texture map can be sampled from the preset texture map to render the corresponding texture for the patch model, which reduces the number of texture maps corresponding to different textures, reduces the data storage pressure of the device and the performance consumption during the rendering process.

[0068] The preset texture map is divided into a plurality of map regions based on the type of texture corresponding to at least one patch model; the plurality of map regions include a target map region corresponding to each texture.

[0069] The above-mentioned multiple mapping areas are arranged in a preset texture map in the form of a square matrix; the square matrix is ​​determined based on the type of texture corresponding to at least one patch model; the number of elements in the square matrix is ​​greater than or equal to the number of types of multiple textures; each mapping area corresponds to an element in the square matrix.

[0070] The above-mentioned at least one patch model has corresponding multiple masks; the preset mask map is generated based on the mask maps corresponding to the multiple masks; the rendering module is also used to: render the patch model based on the texture to be rendered, the preset texture map, the mask to be rendered and the preset mask map corresponding to at least one patch model.

[0071] The above-mentioned preset texture map includes multiple mapping areas; the mapping areas display corresponding textures; the patch model includes multiple vertices; the rendering module is also used to: determine the texture to be rendered corresponding to each patch model in at least one patch model; render the patch model based on the mapping area corresponding to the texture to be rendered and the texture mapping coordinates corresponding to multiple vertices of the patch model.

[0072] The above-mentioned rendering module is also used to: generate a target texture map corresponding to the mapping area corresponding to the texture to be rendered; based on the texture mapping coordinates corresponding to the vertices of the patch model, enlarge the target texture map; based on the texture mapping coordinates corresponding to the vertices of the patch model, sample the enlarged target texture map; based on the sampling results, render the patch model.

[0073] The above device also includes: a texture specifying module, which is used to respond to a texture specifying instruction for a first model in at least one patch model, and determine the first texture corresponding to the texture specifying instruction as the texture to be rendered corresponding to the first model; the first texture is one of multiple textures.

[0074] The patch model includes a plurality of vertices; the orientation adjustment module is also used to: for each patch model in at least one patch model, set the size of the patch model to a first size; the first size is less than a preset size threshold; based on the shooting direction of the virtual camera, determine the direction of the target connection line between the vertices of the patch model after the size is set and the virtual camera; adjust the positions of the plurality of vertices of the patch model based on the target connection direction; based on the preset texture display requirements and the texture coordinate center corresponding to the patch model, enlarge the size of the adjusted patch model to a second size. Preset mask map Preset mask map is based on the map area corresponding to the texture to be rendered

[0075] This embodiment also provides an electronic device, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned model rendering method, for example:

[0076] At least one patch model is generated at the position of the model to be processed in the virtual space; the at least one patch model has corresponding multiple textures; a virtual camera is set in the virtual space; based on the shooting direction of the virtual camera, the orientation of at least one patch model is adjusted so that the virtual camera shoots towards the front of the patch model; based on the texture to be rendered corresponding to the at least one patch model and a preset texture map, the patch model is rendered; the texture to be rendered is at least one texture among the multiple textures; the preset texture map is generated based on the texture maps corresponding to the multiple textures.

[0077] In the above method, a patch model is generated through billboard technology, and various textures that may be used by the patch model are recorded through texture maps, so that sampling can be performed from the preset texture maps to render the corresponding texture for the patch model, reducing the number of texture maps corresponding to different textures, reducing the data storage pressure of the device and the performance consumption during the rendering process.

[0078] Optionally, the preset texture map is divided into a plurality of map areas based on the type of texture corresponding to at least one patch model; the plurality of map areas include a target map area corresponding to each texture.

[0079] Optionally, the above-mentioned multiple mapping areas are arranged in a preset texture map in the form of a square matrix; the square matrix is ​​determined based on the type of texture corresponding to at least one patch model; the number of elements in the square matrix is ​​greater than or equal to the number of types of multiple textures; and each mapping area corresponds to an element in the square matrix.

[0080] Optionally, at least one of the above-mentioned patch models has corresponding multiple masks; the preset mask map is generated based on the mask maps corresponding to the multiple masks; the patch model is rendered based on the texture to be rendered corresponding to at least one patch model and the preset texture map, including: rendering the patch model based on the texture to be rendered, the preset texture map, the mask to be rendered and the preset mask map corresponding to at least one patch model.

[0081] Optionally, the above-mentioned preset texture map includes multiple mapping areas; the mapping areas display corresponding textures; the patch model includes multiple vertices; based on the texture to be rendered corresponding to at least one patch model and the preset texture map, the patch model is rendered, including: determining the texture to be rendered corresponding to each patch model in at least one patch model; rendering the patch model based on the mapping area corresponding to the texture to be rendered and the texture mapping coordinates corresponding to multiple vertices of the patch model.

[0082] Optionally, the step of rendering the patch model based on the mapping area corresponding to the texture to be rendered and the texture mapping coordinates corresponding to the vertices of the patch model includes: generating a target texture map corresponding to the mapping area corresponding to the texture to be rendered; enlarging the target texture map based on the texture mapping coordinates corresponding to the vertices of the patch model; sampling the enlarged target texture map based on the texture mapping coordinates corresponding to the vertices of the patch model; and rendering the patch model based on the sampling result.

[0083] Optionally, the method further includes: responding to a texture designation instruction for a first model in at least one patch model, determining a first texture corresponding to the texture designation instruction as a texture to be rendered corresponding to the first model; the first texture is one of a plurality of textures.

[0084] Optionally, the above-mentioned patch model includes multiple vertices; based on the shooting direction of the virtual camera, the orientation of at least one patch model is adjusted, including: for each patch model in the at least one patch model, the size of the patch model is set to a first size; the first size is less than a preset size threshold; based on the shooting direction of the virtual camera, the direction of the target connection line between the vertices of the patch model after the size is set and the virtual camera is determined; based on the target connection direction, the positions of multiple vertices of the patch model are adjusted; based on the preset texture display requirements and the texture coordinate center corresponding to the patch model, the size of the adjusted patch model is enlarged to a second size. Preset mask map The preset mask map is based on the map area corresponding to the texture to be rendered

[0085] See also Figure 7As shown, the electronic device includes a processor 100 and a memory 101. The memory 101 stores machine executable instructions that can be executed by the processor 100. The processor 100 executes the machine executable instructions to implement the above-mentioned model rendering method.

[0086] Further, Figure 7 The electronic device shown further includes a bus 102 and a communication interface 103 , and the processor 100 , the communication interface 103 and the memory 101 are connected via the bus 102 .

[0087] The memory 101 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 103 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 102 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0088] The processor 100 may 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 100. The above processor 100 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present disclosure can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The method disclosed in conjunction with the embodiments of the present disclosure can be directly embodied as a hardware decoding processor for execution, or it can be executed by a combination of hardware and software modules in the decoding processor. 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 101, and the processor 100 reads the information in the memory 101 and completes the method of the above embodiment in combination with its hardware.

[0089] This embodiment also provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the above-mentioned model rendering method.

[0090] A model rendering method, device, and electronic device provided in the embodiments of the present disclosure include a computer-readable storage medium storing program code, and the program code includes instructions that can be used to execute the methods described in the previous method embodiments, for example:

[0091] At least one patch model is generated at the position of the model to be processed in the virtual space; the at least one patch model has corresponding multiple textures; a virtual camera is set in the virtual space; based on the shooting direction of the virtual camera, the orientation of at least one patch model is adjusted so that the virtual camera shoots towards the front of the patch model; based on the texture to be rendered corresponding to the at least one patch model and a preset texture map, the patch model is rendered; the texture to be rendered is at least one texture among the multiple textures; the preset texture map is generated based on the texture maps corresponding to the multiple textures.

[0092] In the above method, a patch model is generated through billboard technology, and various textures that may be used by the patch model are recorded through texture maps, so that sampling can be performed from the preset texture maps to render the corresponding texture for the patch model, reducing the number of texture maps corresponding to different textures, reducing the data storage pressure of the device and the performance consumption during the rendering process.

[0093] Optionally, the preset texture map is divided into a plurality of map areas based on the type of texture corresponding to at least one patch model; the plurality of map areas include a target map area corresponding to each texture.

[0094] Optionally, the above-mentioned multiple mapping areas are arranged in a preset texture map in the form of a square matrix; the square matrix is ​​determined based on the type of texture corresponding to at least one patch model; the number of elements in the square matrix is ​​greater than or equal to the number of types of multiple textures; and each mapping area corresponds to an element in the square matrix.

[0095] Optionally, at least one of the above-mentioned patch models has corresponding multiple masks; the preset mask map is generated based on the mask maps corresponding to the multiple masks; the patch model is rendered based on the texture to be rendered corresponding to at least one patch model and the preset texture map, including: rendering the patch model based on the texture to be rendered, the preset texture map, the mask to be rendered and the preset mask map corresponding to at least one patch model.

[0096] Optionally, the above-mentioned preset texture map includes multiple mapping areas; the mapping areas display corresponding textures; the patch model includes multiple vertices; based on the texture to be rendered corresponding to at least one patch model and the preset texture map, the patch model is rendered, including: determining the texture to be rendered corresponding to each patch model in at least one patch model; rendering the patch model based on the mapping area corresponding to the texture to be rendered and the texture mapping coordinates corresponding to multiple vertices of the patch model.

[0097] Optionally, the step of rendering the patch model based on the mapping area corresponding to the texture to be rendered and the texture mapping coordinates corresponding to the vertices of the patch model includes: generating a target texture map corresponding to the mapping area corresponding to the texture to be rendered; enlarging the target texture map based on the texture mapping coordinates corresponding to the vertices of the patch model; sampling the enlarged target texture map based on the texture mapping coordinates corresponding to the vertices of the patch model; and rendering the patch model based on the sampling result.

[0098] Optionally, the method further includes: responding to a texture designation instruction for a first model in at least one patch model, determining a first texture corresponding to the texture designation instruction as a texture to be rendered corresponding to the first model; the first texture is one of a plurality of textures.

[0099] Optionally, the above-mentioned patch model includes multiple vertices; based on the shooting direction of the virtual camera, the orientation of at least one patch model is adjusted, including: for each patch model in the at least one patch model, the size of the patch model is set to a first size; the first size is less than a preset size threshold; based on the shooting direction of the virtual camera, the direction of the target connection line between the vertices of the patch model after the size is set and the virtual camera is determined; based on the target connection direction, the positions of multiple vertices of the patch model are adjusted; based on the preset texture display requirements and the texture coordinate center corresponding to the patch model, the size of the adjusted patch model is enlarged to a second size. Preset mask map The preset mask map is based on the map area corresponding to the texture to be rendered

[0100] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0101] In addition, in the description of the embodiments of the present disclosure, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present disclosure can be understood according to specific circumstances.

[0102] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.

[0103] In the description of the present disclosure, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present disclosure and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present disclosure. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0104] Finally, it should be noted that the above embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above embodiments, those skilled in the art should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims

1. A model rendering method, characterized in that: include: Generating at least one patch model at the position of the model to be processed in the virtual space; the at least one patch model has corresponding multiple textures; A virtual camera is provided in the virtual space; Based on the shooting direction of the virtual camera, adjusting the orientation of the at least one mesh model so that the virtual camera shoots toward the front of the mesh model; Rendering the patch model based on the texture to be rendered corresponding to the at least one patch model and a preset texture map; the texture to be rendered is at least one of the multiple textures; The preset texture map is generated based on the texture maps corresponding to the multiple textures.

2. The method according to claim 1, characterized in that The preset texture map is divided into a plurality of map areas based on the type of texture corresponding to the at least one patch model; the plurality of map areas include a target map area corresponding to each texture.

3. The method according to claim 2, characterized in that The multiple mapping areas are arranged in the preset texture map in the form of a square matrix; the square matrix is ​​determined based on the type of texture corresponding to the at least one patch model; the number of elements in the square matrix is ​​greater than or equal to the number of types of the multiple textures; each mapping area corresponds to one of the elements in the square matrix.

4. The method according to claim 1, characterized in that: The at least one patch model has corresponding multiple masks; the preset mask map is generated based on the mask maps corresponding to the multiple masks; Rendering the patch model based on the to-be-rendered texture corresponding to the at least one patch model and a preset texture map, comprising: The patch model is rendered based on the texture to be rendered corresponding to the at least one patch model, the preset texture map, the mask to be rendered and the preset mask map.

5. The method according to claim 1, characterized in that The preset texture map includes a plurality of map areas; the map areas display corresponding textures; The patch model includes a plurality of vertices; Rendering the patch model based on the to-be-rendered texture corresponding to the at least one patch model and a preset texture map, comprising: Determine a texture to be rendered corresponding to each patch model in the at least one patch model; The patch model is rendered based on a mapping area corresponding to the texture to be rendered and texture mapping coordinates corresponding to vertices of the patch model.

6. The method according to claim 1, characterized in that The step of rendering the patch model based on the mapping area corresponding to the texture to be rendered and the texture mapping coordinates corresponding to the vertices of the patch model comprises: Generate a target texture map corresponding to the map area corresponding to the texture to be rendered; Based on the texture map coordinates corresponding to the vertices of the patch model, enlarging the target texture map; Based on the texture map coordinates corresponding to the vertices of the patch model, sampling the amplified target texture map; Based on the sampling result, the patch model is rendered.

7. The method according to claim 1, characterized in that The method further comprises: In response to a texture designation instruction for a first model in the at least one patch model, a first texture corresponding to the texture designation instruction is determined as a texture to be rendered corresponding to the first model; the first texture is one of the multiple textures.

8. The method according to claim 1, characterized in that The patch model includes a plurality of vertices; Adjusting the orientation of the at least one patch model based on the shooting direction of the virtual camera includes: For each patch model in the at least one patch model, setting the size of the patch model to a first size; the first size is smaller than a preset size threshold; Based on the shooting direction of the virtual camera, determining the direction of the connection line between the vertices of the patch model after the size is set and the target of the virtual camera; Adjusting positions of a plurality of vertices of the patch model based on the target line direction; Based on a preset texture display requirement and a texture coordinate center corresponding to the patch model, the adjusted size of the patch model is enlarged to a second size.

9. A model rendering device, characterized in that: include: A model generation module, used to generate at least one patch model at the position of the model to be processed in the virtual space; the at least one patch model has corresponding multiple textures; A virtual camera is arranged in the virtual space to generate at least one patch model at the position of the model to be processed in the virtual space; An orientation adjustment module, configured to adjust the orientation of the at least one mesh model based on the shooting direction of the virtual camera, so that the virtual camera shoots toward the front of the mesh model; A rendering module, configured to render the patch model based on a texture to be rendered corresponding to the at least one patch model and a preset texture map; the texture to be rendered is at least one of the multiple textures; The preset texture map is generated based on the texture maps corresponding to the multiple textures.

10. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the model rendering method according to any one of claims 1 to 8.

11. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the model rendering method according to any one of claims 1 to 8.