Method, device, electronic device and storage medium for determining light map resolution
By automatically determining the resolution of the light map, using material grouping and the mesh UV density of the triangle mesh, the problem of inefficient lighting map resolution adjustment in the existing technology is solved, and the rendering quality and performance balance is achieved.
Patent Information
- Application Number
- CN202111641651.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-29
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2041-12-29
AI Technical Summary
In the prior art, the resolution of the light map requires manual adjustment by art engineers, resulting in inefficiency and high labor costs and difficulty in balancing rendering quality and performance.
By obtaining the material grouping of the model to be rendered and the mesh UV density of the target triangle mesh, combined with the influence of the specific gravity, the image resolution of the light map is automatically determined, ensuring the authenticity of the rendering results and balancing the game engine's study consumption.
It realizes automated lighting map resolution determination, improves rendering efficiency, saves labor costs, and optimizes the performance of the game engine while ensuring rendering quality.
Smart Images

Figure CN114299216B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for determining a light map resolution. Background Art
[0002] In the real-time rendering process, the game engine directly reads the lighting information in the light map to render the game model in real time. When the light map has a high resolution, the model to be rendered using the light map can obtain better lighting quality; correspondingly, when the light map has a low resolution, the lighting quality is sacrificed, so that the game engine can obtain good running performance during rendering. Therefore, the choice of light map resolution is crucial to the impact of picture quality and performance.
[0003] In previous rendering experience, the resolution of the light map needs to be manually adjusted by the art engineer, and the best resolution suitable for the light map is selected through repeated baking; however, the manual adjustment method is often very inefficient, and the repeated baking method also wastes a lot of time of the art engineer, indirectly increasing the labor cost. Summary of the invention
[0004] In view of this, the purpose of the present application is to provide a method, device, electronic device and storage medium for determining the resolution of a light map, which can determine the resolution of a light map suitable for a model to be rendered based on the mesh UV density of each target triangular mesh in the model to be rendered, thereby ensuring the authenticity of the rendering result of the model to be rendered and saving example consumption during the rendering process.
[0005] The embodiment of the present application provides a method for determining the resolution of a light map, the method comprising:
[0006] Obtaining a model to be rendered to which a light map needs to be added; wherein the model to be rendered includes at least one material group; the components included in the same material group have the same material type;
[0007] For each material group, the first UV density of the material group is determined by using the mesh UV density of each target triangular mesh in the material group and the first influence weight of each target triangular mesh in the material group; wherein the first influence weight is positively correlated with the mesh area of the target triangular mesh;
[0008] Determine the second UV density of the model to be rendered by using the first UV density of each material group and the second influence proportion of each material group in the model to be rendered; wherein the second influence proportion is positively correlated with the partition area of the material group;
[0009] An image resolution of the light map is determined based on the second UV density and the number of pixels per unit in the light map of the model to be rendered at a preset density level.
[0010] In a possible implementation manner, the determination method further includes:
[0011] According to the material types of the components constituting the model to be rendered, the components included in the model to be rendered are divided, and the components with the same material are divided into the same material group to obtain at least one material group constituting the model to be rendered; wherein the components are used to constitute the virtual object presented by the model to be rendered.
[0012] In a possible implementation, the target triangle mesh in each material group is determined by the following steps:
[0013] For each material group, a triangular mesh whose mesh area is greater than a preset area threshold among all the triangular meshes included in the material group is determined as a target triangular mesh.
[0014] In a possible implementation, the mesh area of each target triangular mesh is determined by the following steps:
[0015] For each target triangular mesh, obtain the vertex position coordinates of each vertex in the target triangular mesh in the three-dimensional coordinate system;
[0016] For each target triangular mesh, based on the vertex position coordinates of each vertex, the mesh area of the target triangular mesh in the three-dimensional coordinate system is determined by determinant calculation.
[0017] In a possible implementation, the mesh UV density of each target triangular mesh is determined by the following steps:
[0018] For each target triangular mesh, obtain the vertex UV coordinates of each vertex in the target triangular mesh in the UV coordinate system;
[0019] For each target triangle mesh, based on the vertex UV coordinates of each vertex, the UV area of the target triangle mesh in the UV coordinate system is determined by determinant calculation;
[0020] For each target triangular mesh, determine the triangle side length of the target triangular mesh in a three-dimensional coordinate system based on the mesh area, and determine the UV side length of the target triangular mesh in a UV coordinate system based on the UV area;
[0021] For each target triangular mesh, the mesh UV density of the target triangular mesh is determined according to the ratio between the triangle side length and the UV side length of the target triangular mesh.
[0022] In a possible implementation, determining the first UV density of the material group by using the mesh UV density of each target triangular mesh in the material group and the first influence proportion of each target triangular mesh in the material group includes:
[0023] Determine the partition area of the material group according to the mesh area sum of all target triangular meshes in the material group;
[0024] For each target triangular mesh in the material group, a ratio between a mesh area of the target triangular mesh and a partition area of the material group is determined as a first influence weight of the target triangular mesh under the material group;
[0025] According to the first influence ratio of each target triangle mesh, the first density sum of the mesh UV densities of all target triangle meshes in the material group is calculated;
[0026] The first UV density of the material group is determined according to the first density.
[0027] In a possible implementation, determining the second UV density of the model to be rendered by using the first UV density of each material group and the second influence proportion of each material group in the model to be rendered includes:
[0028] Determining a model area of the model to be rendered according to the sum of the partition areas of all material groups in the model to be rendered;
[0029] For each material group in the model to be rendered, determining a ratio between a model area of the model to be rendered and a partition area of the material group as a second influence weight of the material group in the model to be rendered;
[0030] According to the second influence ratio of each material group, the second density sum of the first UV densities of all material groups in the to-be-rendered model is calculated;
[0031] A second UV density of the model to be rendered is determined according to the second density.
[0032] In a possible implementation, determining the image resolution of the light map based on the second UV density and the number of unit pixels of the light map of the model to be rendered under the second UV density includes:
[0033] Determining an initial resolution of the light map according to a product of the second UV density and the number of unit pixels of the light map;
[0034] The initial resolution is adjusted to a power of 2 to obtain the image resolution of the light map.
[0035] The embodiment of the present application also provides a device for determining a light map resolution, the device comprising:
[0036] A model acquisition module, used for acquiring a model to be rendered to which a light map needs to be added; wherein the model to be rendered includes at least one material group; the material type of the components included in the same material group is the same;
[0037] A group density determination module, for each material group, using the mesh UV density of each target triangular mesh in the material group and the first influence weight of each target triangular mesh in the material group to determine the first UV density of the material group; wherein the first influence weight is positively correlated with the mesh area of the target triangular mesh;
[0038] A model density determination module, used to determine a second UV density of the model to be rendered by using a first UV density of each material group and a second influence weight of each material group in the model to be rendered; wherein the second influence weight is positively correlated with a partition area of the material group;
[0039] A resolution determination module is used to determine the image resolution of the light map based on the second UV density and the number of pixels per unit in the light map of the model to be rendered at a preset density level.
[0040] In a possible implementation manner, the determining device further includes a division module, and the division module is configured to:
[0041] According to the material types of the components constituting the model to be rendered, the components included in the model to be rendered are divided, and the components with the same material are divided into the same material group to obtain at least one material group constituting the model to be rendered; wherein the components are used to constitute the virtual object presented by the model to be rendered.
[0042] In a possible implementation, the group density determination module is used to determine the target triangular mesh in each material group by the following steps:
[0043] For each material group, a triangular mesh whose mesh area is greater than a preset area threshold among all the triangular meshes included in the material group is determined as a target triangular mesh.
[0044] In a possible implementation manner, the grouping density determination module is used to determine the mesh area of each target triangular mesh by the following steps:
[0045] For each target triangular mesh, obtain the vertex position coordinates of each vertex in the target triangular mesh in the three-dimensional coordinate system;
[0046] For each target triangular mesh, based on the vertex position coordinates of each vertex, the mesh area of the target triangular mesh in the three-dimensional coordinate system is determined by determinant calculation.
[0047] In a possible implementation, the grouping density determination module is used to determine the mesh UV density of each target triangular mesh by the following steps:
[0048] For each target triangular mesh, obtain the vertex UV coordinates of each vertex in the target triangular mesh in the UV coordinate system;
[0049] For each target triangle mesh, based on the vertex UV coordinates of each vertex, the UV area of the target triangle mesh in the UV coordinate system is determined by determinant calculation;
[0050] For each target triangular mesh, determine the triangle side length of the target triangular mesh in a three-dimensional coordinate system based on the mesh area, and determine the UV side length of the target triangular mesh in a UV coordinate system based on the UV area;
[0051] For each target triangular mesh, the mesh UV density of the target triangular mesh is determined according to the ratio between the triangle side length and the UV side length of the target triangular mesh.
[0052] In a possible implementation, when the grouping density determination module is used to determine the first UV density of the material grouping by using the mesh UV density of each target triangular mesh in the material grouping and the first influence proportion of each target triangular mesh in the material grouping, the grouping density determination module is used to:
[0053] Determine the partition area of the material group according to the mesh area sum of all target triangular meshes in the material group;
[0054] For each target triangular mesh in the material group, a ratio between a mesh area of the target triangular mesh and a partition area of the material group is determined as a first influence weight of the target triangular mesh under the material group;
[0055] According to the first influence ratio of each target triangle mesh, the first density sum of the mesh UV densities of all target triangle meshes in the material group is calculated;
[0056] The first UV density of the material group is determined according to the first density.
[0057] In a possible implementation, when the model density determination module is used to determine the second UV density of the model to be rendered by using the first UV density of each material group and the second influence proportion of each material group in the model to be rendered, the model density determination module is used to:
[0058] Determining a model area of the model to be rendered according to the sum of the partition areas of all material groups in the model to be rendered;
[0059] For each material group in the model to be rendered, determining a ratio between a model area of the model to be rendered and a partition area of the material group as a second influence weight of the material group in the model to be rendered;
[0060] According to the second influence ratio of each material group, the second density sum of the first UV densities of all material groups in the to-be-rendered model is calculated;
[0061] A second UV density of the model to be rendered is determined according to the second density.
[0062] In a possible implementation, when the resolution determination module is used to determine the image resolution of the light map based on the second UV density and the number of pixels per unit in the light map of the model to be rendered at a preset density level, the resolution determination module is used to:
[0063] Determining an initial resolution of the light map according to a product of the second UV density and the number of unit pixels of the light map;
[0064] The initial resolution is adjusted to a power of 2 to obtain the image resolution of the light map.
[0065] An embodiment of the present application also provides an electronic device, including: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate through the bus, and when the machine-readable instructions are executed by the processor, the steps of the method for determining the light map resolution as described above are performed.
[0066] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the method for determining the light map resolution as described above are executed.
[0067] The method, device, electronic device and storage medium for determining the resolution of a light map provided in the embodiment of the present application obtain a model to be rendered to which a light map is to be added; wherein the model to be rendered includes at least one material group; the material types of the components included in the same material group are the same; for each material group, the mesh UV density of each target triangular mesh in the material group and the first influence ratio of each target triangular mesh in the material group are used to determine the first UV density of the material group; wherein the first influence ratio is positively correlated with the mesh area of the target triangular mesh; the second UV density of the model to be rendered is determined by using the first UV density of each material group and the second influence ratio of each material group in the model to be rendered; wherein the second influence ratio is positively correlated with the partition area of the material group; based on the second UV density and the number of pixels per unit in the light map of the model to be rendered at a preset density level, the image resolution of the light map is determined. In this way, in the rendering process of the model to be rendered, the authenticity of the rendered model can be guaranteed, and the calculation example consumption of the game engine during the rendering process can be balanced.
[0068] In order to make the above-mentioned objects, features and advantages of the present application 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
[0069] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0070] Figure 1 A flowchart of a method for determining a light map resolution provided in an embodiment of the present application;
[0071] Figure 2 A schematic diagram of a first UV density determination process provided in an embodiment of the present application;
[0072] Figure 3 A schematic diagram of a second UV density determination process provided in an embodiment of the present application;
[0073] Figure 4 One of the structural schematic diagrams of a device for determining a light map resolution provided in an embodiment of the present application;
[0074] Figure 5 A second structural schematic diagram of a device for determining a light map resolution provided in an embodiment of the present application;
[0075] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0076] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application usually 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 application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, each other embodiment obtained by those skilled in the art without making creative work belongs to the scope of protection of the present application.
[0077] Research has found that in previous rendering experience, the resolution of light maps needs to be manually adjusted by art engineers. Specifically, art engineers need to use light maps of different resolutions to perform rendering attempts through repeated baking. After multiple rendering attempts, the best resolution suitable for rendering the model to be rendered is selected; however, this manual adjustment method is often very inefficient, and repeated and large-scale baking attempts also waste a lot of time of art engineers, indirectly increasing labor costs.
[0078] For a model to be rendered, since the material types of various components in the model to be rendered are different, in theory, in order to make components of each material type achieve the most realistic rendering effect, the image resolutions required to render components of different material types should be different. Then, it means that multiple light maps are required when rendering the model to be rendered. However, the increase in the number of maps will greatly increase the amount of data calculation of the game engine. Therefore, in order to reduce the load of the game engine, when performing light rendering on the model to be rendered, the same light map is required to render components of each material type in the model to be rendered.
[0079] When using the same light map to render components of different material types in a model to be rendered, a larger image resolution is usually selected for the light map to ensure the authenticity of each component in the rendered model. However, not all components in the model to be rendered require a larger image resolution to be realistically displayed, and a larger image resolution will also reduce the running performance of the game engine; therefore, the selection of the image resolution of the light map is crucial to the rendering quality of the model and the performance of the game engine.
[0080] Based on this, an embodiment of the present application provides a method for determining the resolution of a light map, which can determine the resolution of the light map used to render the model to be rendered according to the mesh UV density of the target triangular mesh in the model to be rendered, thereby ensuring the authenticity of the rendered model and balancing the instance consumption of the game engine during the rendering process.
[0081] See also Figure 1 , Figure 1 Flow chart of a method for determining light map resolution provided by an embodiment of the present application. Figure 1 As shown in , the method for determining the light map resolution provided in the embodiment of the present application includes:
[0082] S101, obtaining a model to be rendered to which a light map needs to be added; wherein the model to be rendered includes at least one material group; and the components included in the same material group have the same material type.
[0083] S102. For each material group, determine the first UV density of the material group using the mesh UV density of each target triangular mesh in the material group and the first influence ratio of each target triangular mesh in the material group; wherein the first influence ratio is positively correlated with the mesh area of the target triangular mesh.
[0084] S103, determining a second UV density of the model to be rendered by using the first UV density of each material group and the second influence ratio of each material group in the model to be rendered; wherein the second influence ratio is positively correlated with the partition area of the material group.
[0085] S104: Determine an image resolution of the light map based on the second UV density and the number of pixels per unit in the light map of the model to be rendered at a preset density level.
[0086] The method for determining the light map resolution provided in the embodiment of the present application can determine the first UV density of the material grouping more reasonably according to the mesh UV density of each target triangle mesh in the material grouping and the first influence weight of each target triangle mesh relative to the material grouping for different material groups in the model to be rendered; then, according to the first UV density of each material grouping in the model to be rendered and the second influence weight of each material grouping relative to the model to be rendered, determine the second UV density of the model to be rendered; finally, according to the second UV density of the model to be rendered and the number of pixels per unit in the light map of the model to be rendered at a preset map density level, determine the image resolution of the light map. In this way, the authenticity of the rendered model can be guaranteed, and the calculation example consumption of the game engine during the rendering process can be balanced.
[0087] The mesh area of the target triangular mesh refers to the triangle area of the target triangular mesh in the actual three-dimensional space.
[0088] The UV area of the target triangle mesh is the area of the target triangle mesh unfolded in the UV space.
[0089] The UV density of the target triangle mesh indicates how many units in actual 3D space correspond to one UV space unit.
[0090] For a model to be rendered, since the picture it presents needs to be diverse, the model to be rendered includes components of different material types; here, the components are used to compose virtual objects, virtual objects and virtual scenes in the picture represented by the model to be rendered; for example, when the virtual object included in the picture represented by the model to be rendered is a seat, the components that make up the "seat" may include a backrest, front legs, rear legs, armrests and seat surface, etc.
[0091] It should be noted that even different components of the same virtual object may have different material types. For example, for the above-mentioned chair, the armrests, front legs, and back legs may be made of wood, while the backrest and seat may be made of leather. Therefore, even if the model to be rendered only includes one virtual object, the image resolution of the light map of the model to be rendered needs to be determined in combination with the material type of the components of the virtual object.
[0092] For another example, the "bottle" model, the components that make up the "bottle" model include a bottle cap and a bottle body, the bottle cap is made of metal; the bottle body is made of glass.
[0093] In step S101, a model to be rendered to which a light map needs to be added is obtained. Here, the model to be rendered has been divided into at least one material group according to the material type of each component included, and the components included in the same material group have the same material type.
[0094] In one embodiment, the determination method also includes: dividing the components included in the model to be rendered according to the material types of the components constituting the model to be rendered, and dividing the components with the same material into the same material group to obtain at least one material group constituting the model to be rendered.
[0095] In this step, the model to be rendered is divided into material groups according to the material types of the components included in the model to be rendered; specifically, the material type of each component constituting the model to be rendered is determined; components with the same material type are divided into the same material group; in this way, at least one material group constituting the model to be rendered is obtained.
[0096] The components are used to compose the virtual objects presented by the model to be rendered.
[0097] Corresponding to the above embodiment, taking the model to be rendered as a "seat" model as an example, the armrests, front legs and rear legs with the same material type of "wood" can be divided into the same material group; correspondingly, the backrest and seat with the material type of "leather" can be divided into the same material group; in this way, two material groups can be obtained for the "seat" model, one is the wooden group (including armrests, front legs and rear legs); the other is the leather group (including the backrest and seat).
[0098] For the model to be rendered, the model to be rendered has been planned as a plurality of triangular meshes during rendering, and therefore, the UV density of the model to be rendered can be gradually calculated using the mesh UV density of each triangular mesh.
[0099] For a three-dimensional model to be rendered, there are two most important coordinate systems, one is the three-dimensional coordinate system of the three-dimensional space; the other is the UV coordinate system of the UV space; that is to say, each vertex of each triangular mesh in the model to be rendered has two coordinates, one is the vertex position coordinate in the three-dimensional coordinate system of the model to be rendered; the other is the vertex UV coordinate in the UV coordinate system of the model to be rendered.
[0100] For a model to be rendered, the number of triangular meshes it has is extremely large, but the mesh area of some triangular meshes is very small, so that these small triangular meshes will interfere with the calculation of the image resolution of the light map of the model to be rendered. Therefore, before calculating the image resolution of the light map, it is necessary to determine the target triangular mesh from all the triangular meshes of the model to be rendered.
[0101] In one embodiment, the target triangular mesh in each material group is determined by the following steps: for each material group, a triangular mesh whose mesh area is greater than a preset area threshold among all the triangular meshes included in the material group is determined as the target triangular mesh.
[0102] In this step, for each material grouping included in the model to be rendered, the triangular meshes in all the triangular meshes in the material group whose mesh area is greater than a preset area threshold are determined as target triangular meshes for subsequent calculations. In this way, triangular meshes that may interfere with the calculation results are filtered out, which helps to improve the accuracy of the calculation results.
[0103] In the process of rendering the model to be rendered, if the area of a certain material grouping is larger, it means that the proportion of this material grouping in the model to be rendered is larger, that is, the material type of most components in the model to be rendered is the material type corresponding to this material grouping. Therefore, the first UV density of this material grouping has a greater reference value, then, the second UV density of the model to be rendered should be closer to the first UV density of this material grouping; in this way, the determined image resolution of the light map can better balance the authenticity of the rendered model and the running performance of the game engine.
[0104] Similarly, for a material grouping, if the mesh area of a target triangular mesh is larger, it means that the target triangular mesh accounts for a larger proportion in the material grouping, that is, the target triangular mesh occupies the vast majority of the material grouping. Therefore, the mesh UV density of the target triangular mesh has a greater reference value. Then, the first UV density of the material grouping should be closer to the mesh UV density of the target triangular mesh.
[0105] Therefore, in step S102, for each material grouping in the model to be rendered, the first influence ratio of each target triangular mesh in the material group relative to the material group is determined; then based on the first influence ratio of each target triangular mesh and the mesh UV density of each target triangular mesh in the material group, the first UV density of the material group is more reasonably determined.
[0106] Here, the first influence ratio of any target triangular mesh in the material group is positively correlated with the mesh area of the target triangular mesh, that is, the larger the mesh area of the target triangular mesh, the greater the first influence ratio of the target triangular mesh relative to the material group; conversely, the smaller the mesh area of the target triangular mesh, the smaller the first influence ratio of the target triangular mesh relative to the material group.
[0107] In one embodiment, see Figure 2 , Figure 2 This is a schematic diagram of the first UV density determination process provided in the embodiment of the present application. Figure 2 As shown, step S102 includes:
[0108] Step S1021: Determine the partition area of the material group according to the sum of the mesh areas of all target triangular meshes in the material group.
[0109] In this step, for the material grouping, the sum of the mesh areas of all target triangular meshes in the material grouping is obtained; and the obtained sum of the mesh areas is determined as the partition area of the material grouping.
[0110] Specifically, the partition area of the material grouping is calculated using the following formula:
[0111]
[0112] Among them, SectionArea j TriArea is the partition area of the jth material group in the model to be rendered. i is the mesh area of the i-th target triangle mesh in the j-th material group, and n is the number of target triangle meshes in the j-th material group.
[0113] Step S1022: for each target triangular mesh in the material group, determine the ratio between the mesh area of the target triangular mesh and the partition area of the material group as the first influence weight of the target triangular mesh under the material group.
[0114] Here, for a material group, it is assumed that there are two target triangle meshes in the material group, target triangle mesh A and target triangle mesh B, the mesh area of target triangle mesh A is larger, and the mesh area of target triangle mesh B is smaller. At the same time, it is assumed that the mesh UV density of target triangle mesh A is smaller (when rendering, a light map with a lower image resolution is used for rendering to obtain a real rendering effect), and the mesh UV density of target triangle mesh B is larger (when rendering, a light map with a higher image resolution is used for rendering to obtain a real rendering effect). If the first UV density of the material group to which the two belong is determined by taking the average, then the first UV density of the material group is a relatively large value relative to the mesh UV density of the target triangle mesh A. Therefore, the image resolution of the light map determined by the first UV density is relatively large relative to the image resolution required for the target triangle mesh A.
[0115] Moreover, since the target triangle mesh (target triangle mesh B) that requires a higher resolution for rendering only occupies a small part in the material group, that is, most areas in the material group can obtain a more realistic rendering effect by using a light map with a lower image resolution. If the material group is rendered using the graphics resolution determined by taking the average, then the determined image resolution is relatively large relative to the image resolution required for most areas in the material group. This will undoubtedly increase the data processing capacity of the game engine and indirectly reduce the running performance of the game engine.
[0116] Therefore, in this case, in order to achieve the purpose of balancing the authenticity of the rendering result and the running performance of the game engine, the determined first UV density should be made closer to the mesh UV density of the target triangular mesh A.
[0117] Therefore, in the present application, in order to make the determined first UV density closer to the target triangular mesh with a larger mesh area, in step S1022, the mesh area of each target triangular mesh and the partition area of the material group to which the target triangular mesh belongs are used to determine the proportion weight of each target triangular mesh in the material group, that is, the first influence ratio of each target triangular mesh relative to the material group to which it belongs is determined.
[0118] Specifically, the first influence weight of each target triangle mesh in the material grouping is determined by the following formula:
[0119]
[0120] Among them, SectionWeight i SectionArea is the first influence ratio of the i-th target triangle mesh in the j-th material group to which it belongs. j is the partition area of the jth material group, TriArea i is the mesh area of the i-th target triangle mesh in the j-th material group.
[0121] Here, the first influence ratio is the normalized weight.
[0122] In one embodiment, the mesh area of each target triangular mesh is determined by the following steps: for each target triangular mesh, the vertex position coordinates of each vertex in the target triangular mesh in the three-dimensional coordinate system are obtained; for each target triangular mesh, based on the vertex position coordinates of each vertex, the mesh area of the target triangular mesh in the three-dimensional coordinate system is determined by a determinant calculation method.
[0123] In this step, for each target triangular mesh, when calculating its mesh area, the vertex position coordinates of each vertex in the three-dimensional coordinate system are obtained, and based on the vertex position coordinates of each vertex in the three-dimensional coordinate system, the mesh area of the target triangular mesh in the three-dimensional coordinate system is calculated by a determinant calculation method.
[0124] Specifically, the mesh area of the target triangular mesh is calculated by the following formula:
[0125]
[0126] Among them, TriArea i is the mesh area of the i-th target triangle mesh in the j-th material group, P 1 , P 2 , P 0 The vertex position coordinates of the three vertices of the target triangle mesh.
[0127] The vertex position coordinates of the three vertices of each target triangle mesh are determined according to the vertex index buffer of the target triangle mesh.
[0128] Step S1023: according to the first influence ratio of each target triangular mesh, obtain the first density sum of mesh UV densities of all target triangular meshes in the material group.
[0129] Step S1024: determine a first UV density of the material group according to the first density.
[0130] Specifically, the first UV density of the material group is calculated by the following formula:
[0131]
[0132] Among them, SectionUVDensity j The first UV density of the jth material group in the model to be dyed, TriUVDensity i SectionWeight is the mesh UV density of the i-th target triangle mesh in the j-th material group. i It is the first influence ratio of the i-th target triangle mesh in the j-th material group.
[0133] In one embodiment, the mesh UV density of each target triangular mesh is determined by the following steps: for each target triangular mesh, the vertex UV coordinates of each vertex in the target triangular mesh are obtained in the UV coordinate system; for each target triangular mesh, based on the vertex UV coordinates of each vertex, the UV area of the target triangular mesh in the UV coordinate system is determined by a determinant calculation method; for each target triangular mesh, the triangle side length of the target triangular mesh in the three-dimensional coordinate system is determined based on the mesh area, and the UV side length of the target triangular mesh in the UV coordinate system is determined based on the UV area; for each target triangular mesh, the mesh UV density of the target triangular mesh is determined according to the ratio between the triangle side length of the target triangular mesh and the UV side length.
[0134] In the field of gaming, the mesh UV density of a target triangular mesh is usually determined by calculating the ratio between the mesh area of the target triangular mesh in a three-dimensional coordinate system and the UV area of the target triangular mesh in a UV coordinate system.
[0135] However, the error of the mesh UV density determined by the area ratio method is relatively large. Therefore, in order to reduce the error in obtaining the mesh UV density, when obtaining the mesh UV density of the target triangular mesh, the present application determines the mesh UV density of the target triangular mesh by obtaining the ratio between the triangle side length of the target triangular mesh in the three-dimensional coordinate system and the UV side length of the target triangular mesh in the UV coordinate system.
[0136] First, for each target triangular mesh, when calculating its UV area, the vertex UV coordinates of each vertex in the UV coordinate system are obtained, and based on the vertex UV coordinates of each vertex in the UV coordinate system, the UV area of the target triangular mesh in the UV coordinate system is calculated by the determinant calculation method.
[0137] Specifically, the UV area of the target triangle mesh is calculated using the following formula:
[0138]
[0139] Among them, UVArea i is the UV area of the i-th target triangle mesh in the j-th material group, UV 1 、UV 2 、UV 0 The vertex UV coordinates of the three vertices of the target triangle mesh.
[0140] Then, based on the mesh area and UV area of each target triangular mesh, the triangle side length corresponding to the target triangular mesh in the three-dimensional coordinate system and the UV side length corresponding to the target triangular mesh in the UV coordinate system are approximately calculated by square root method.
[0141] Here, since the mesh UV density of the target triangular mesh is subsequently calculated by calculating the side length ratio, the constant term (1 / 2) involved in calculating the mesh UV density of the target triangular mesh can be ignored. At this time, the triangle side length of the target triangular mesh can be approximately equal to the square root of the mesh area; correspondingly, the UV side length of the target triangular mesh can be approximately equal to the square root of the UV area.
[0142] Finally, the mesh UV density of the target triangular mesh is determined by calculating the ratio between the triangle side length and the UV side length of the target triangular mesh.
[0143] Specifically, the mesh UV density of the target triangular mesh is calculated by the following formula:
[0144]
[0145] Among them, TriUVDensity iis the mesh UV density of the i-th target triangle mesh in the j-th material group, UVArea i is the UV area of the i-th target triangle mesh in the j-th material group, TriArea i is the mesh area of the i-th target triangle mesh in the j-th material group.
[0146] After determining the first UV density of each material group in the model to be rendered, the second UV density of the model to be rendered may be determined in combination with the second influence proportion of each material group in the model to be rendered.
[0147] In step S103, for each material group in the model to be rendered, the second influence weight of each material group relative to the model to be rendered is determined; and based on the first UV density of each material group in the model to be rendered and the second influence weight of each material group, the second UV density of the model to be rendered is determined.
[0148] Here, the second influence ratio of any material grouping in the model to be rendered is positively correlated with the partition area of the material grouping, that is, the larger the partition area of the material grouping, the greater the second influence ratio of the material grouping relative to the model to be rendered; conversely, the smaller the grid area of the material grouping, the smaller the second influence ratio of the material grouping relative to the model to be rendered.
[0149] In one embodiment, see Figure 3 , Figure 3 This is a schematic diagram of the second UV density determination process provided in the embodiment of the present application. Figure 3 As shown, step S103 includes:
[0150] Step S1031: Determine the model area of the model to be rendered according to the sum of the partition areas of all material groups in the model to be rendered.
[0151] In this step, for the model to be rendered, the sum of the partition areas of all material groups in the model to be rendered is obtained; and the obtained sum of the partition areas is determined as the model area of the model to be rendered.
[0152] Specifically, the model area of the model to be rendered is calculated using the following formula:
[0153]
[0154] Among them, ModelArea is the model area of the model to be rendered; SectionArea j is the partition area of the jth material group in the model to be rendered, and m is the number of material groups in the model to be rendered.
[0155] Step S1032: for each material group in the model to be rendered, determine the ratio between the model area of the model to be rendered and the partition area of the material group as the second influence proportion of the material group in the model to be rendered.
[0156] Here, for a model to be rendered, it is assumed that there are two material groups in the model to be rendered, material group C and material group D, the partition area of material group C is larger, and the partition area of material group D is smaller. At the same time, it is assumed that the first UV density of material group C is smaller (when rendering, a light map with a lower image resolution is used for rendering to obtain a real rendering effect), and the first UV density of material group D is larger (when rendering, a light map with a higher image resolution is used for rendering to obtain a real rendering effect). If the second UV density of the model to be rendered is determined by taking the average, then the second UV density of the model to be rendered is a relatively large value relative to the first UV density of material group C. Therefore, the image resolution of the light map determined by the second UV density is relatively large relative to the image resolution required by material group C.
[0157] Moreover, since the material group that requires a higher resolution for rendering (material group D) in the model to be rendered only occupies a small part, that is, most areas in the model to be rendered can obtain a more realistic rendering effect by using a light map with a lower image resolution. If the model to be rendered is rendered using the graphics resolution determined by taking the average, then the determined image resolution is relatively large relative to the image resolution required for most areas in the material group. This undoubtedly increases the data processing amount of the game engine and indirectly reduces the running performance of the game engine.
[0158] Therefore, in this case, in order to achieve the purpose of balancing the authenticity of the rendering result and the running performance of the game engine, the determined second UV density should be made closer to the first UV density of material group C.
[0159] Therefore, in the present application, in order to make the determined second UV density closer to the material grouping with a larger partition area, in step S1032, the partition area of each material grouping and the model area of the model to be rendered are used to determine a proportion weight of each material group in the model to be rendered, that is, the second influence proportion of each material group relative to the model to be rendered is determined.
[0160] Specifically, the second influence ratio of each material group in the model to be rendered is determined by the following formula:
[0161]
[0162] Among them, ModelWeight j SectionArea is the second influence ratio of the jth material group in the model to be rendered. j is the partition area of the jth material group, and ModelArea is the model area of the model to be rendered.
[0163] Here, the second influence ratio is a normalized weight.
[0164] Step S1033: according to the second influence ratio of each material group, obtain the second density sum of the first UV densities of all material groups in the to-be-rendered model.
[0165] Step S1034: determine a second UV density of the model to be rendered according to the second density.
[0166] Specifically, the second UV density of the model to be rendered is calculated by the following formula:
[0167]
[0168] Among them, ModelUVDensity is the second UV density of the model to be rendered, SectionUVDensity j ModelWeight is the first UV density of the jth material group in the model to be rendered. j It is the second influence ratio of the j-th material group in the model to be rendered.
[0169] In step S104, a preset density level set for the light map of the model to be rendered is determined; based on the second UV density of the model to be rendered and the number of pixels per unit in the light map of the model to be rendered at the preset density level, the image resolution of the light map of the model to be rendered is determined.
[0170] In one embodiment, step S104 includes: determining the initial resolution of the light map according to the product of the second UV density and the number of unit pixels of the light map; and adjusting the initial resolution to a power of 2 to obtain the image resolution of the light map.
[0171] In this step, the initial resolution of the light map is determined by calculating the product between the second UV density of the model to be rendered and the number of pixels per unit in the light map of the model to be rendered at a preset density level;
[0172] Specifically, the image resolution of the light map of the model to be rendered is calculated by the following formula:
[0173] ModelResolution=ModelUVDen sity*DensityLevel;
[0174] Among them, ModelResolution is the image resolution of the light map, ModelUVDensity is the second UV density of the model to be rendered, and DensityLevel is the number of pixels per unit in the light map of the model to be rendered at the preset density level.
[0175] For the game engine, the best reading efficiency can be achieved when the texture size of the read image is a power of 2. Therefore, in order to improve the reading efficiency of the game engine when reading light maps, the image resolution value needs to be transformed within a certain range during the calculation process.
[0176] If the initial resolution is not a power of 2, the initial resolution is adjusted to a power of 2, and the adjusted initial resolution is determined as the image resolution of the light map; to avoid the situation where the texture of the rendered model appears non-proportional deformation due to the use of light maps with image resolutions that are not a power of 2.
[0177] Specifically, the initial resolution is adjusted through the following procedures:
[0178]
[0179] The method for determining the resolution of a light map provided in an embodiment of the present application comprises obtaining a model to be rendered to which a light map is to be added; wherein the model to be rendered includes at least one material group; the material types of the components included in the same material group are the same; for each material group, the mesh UV density of each target triangular mesh in the material group and the first influence weight of each target triangular mesh in the material group are used to determine the first UV density of the material group; wherein the first influence weight is positively correlated with the mesh area of the target triangular mesh; the second UV density of the model to be rendered is determined using the first UV density of each material group and the second influence weight of each material group in the model to be rendered; wherein the second influence weight is positively correlated with the partition area of the material group; based on the second UV density and the number of pixels per unit in the light map of the model to be rendered at a preset density level, the image resolution of the light map is determined. In this way, in the rendering process of the model to be rendered, the authenticity of the rendered model can be guaranteed, and the calculation example consumption of the game engine during the rendering process can be balanced.
[0180] See also Figure 4 , Figure 5 , Figure 4This is one of the structural schematic diagrams of a device for determining a light map resolution provided in an embodiment of the present application. Figure 5 This is a second structural diagram of a device for determining a light map resolution provided in an embodiment of the present application. Figure 4 As shown in , the determining device 400 includes:
[0181] The model acquisition module 410 is used to acquire a model to be rendered to which a light map needs to be added; wherein the model to be rendered includes at least one material group; the material type of the components included in the same material group is the same;
[0182] The group density determination module 420 is used to determine, for each material group, a first UV density of the material group using the mesh UV density of each target triangle mesh in the material group and a first influence weight of each target triangle mesh in the material group; wherein the first influence weight is positively correlated with the mesh area of the target triangle mesh;
[0183] A model density determination module 430 is used to determine a second UV density of the model to be rendered by using the first UV density of each material group and the second influence ratio of each material group in the model to be rendered; wherein the second influence ratio is positively correlated with the partition area of the material group;
[0184] The resolution determination module 440 is used to determine the image resolution of the light map based on the second UV density and the number of pixels per unit in the light map of the model to be rendered at a preset density level.
[0185] Further, such as Figure 4 As shown, the determining device 400 further includes a dividing module 450, and the dividing module 450 is used to:
[0186] According to the material types of the components constituting the model to be rendered, the components included in the model to be rendered are divided, and the components with the same material are divided into the same material group to obtain at least one material group constituting the model to be rendered; wherein the components are used to constitute the virtual object presented by the model to be rendered.
[0187] Furthermore, the group density determination module 420 is used to determine the target triangle mesh in each material group through the following steps:
[0188] For each material group, a triangular mesh whose mesh area is greater than a preset area threshold among all the triangular meshes included in the material group is determined as a target triangular mesh.
[0189] Furthermore, the grouping density determination module 420 is used to determine the mesh area of each target triangular mesh by the following steps:
[0190] For each target triangular mesh, obtain the vertex position coordinates of each vertex in the target triangular mesh in the three-dimensional coordinate system;
[0191] For each target triangular mesh, based on the vertex position coordinates of each vertex, the mesh area of the target triangular mesh in the three-dimensional coordinate system is determined by determinant calculation.
[0192] Furthermore, the grouping density determination module 420 is used to determine the mesh UV density of each target triangular mesh through the following steps:
[0193] For each target triangular mesh, obtain the vertex UV coordinates of each vertex in the target triangular mesh in the UV coordinate system;
[0194] For each target triangle mesh, based on the vertex UV coordinates of each vertex, the UV area of the target triangle mesh in the UV coordinate system is determined by determinant calculation;
[0195] For each target triangular mesh, determine the triangle side length of the target triangular mesh in a three-dimensional coordinate system based on the mesh area, and determine the UV side length of the target triangular mesh in a UV coordinate system based on the UV area;
[0196] For each target triangular mesh, the mesh UV density of the target triangular mesh is determined according to the ratio between the triangle side length and the UV side length of the target triangular mesh.
[0197] Further, when the grouping density determination module 420 is used to determine the first UV density of the material grouping by using the mesh UV density of each target triangle mesh in the material grouping and the first influence proportion of each target triangle mesh in the material grouping, the grouping density determination module 420 is used to:
[0198] Determine the partition area of the material group according to the mesh area sum of all target triangular meshes in the material group;
[0199] For each target triangular mesh in the material group, a ratio between a mesh area of the target triangular mesh and a partition area of the material group is determined as a first influence weight of the target triangular mesh under the material group;
[0200] According to the first influence ratio of each target triangle mesh, the first density sum of the mesh UV densities of all target triangle meshes in the material group is calculated;
[0201] The first UV density of the material group is determined according to the first density.
[0202] Further, when the model density determination module 430 is used to determine the second UV density of the model to be rendered by using the first UV density of each material group and the second influence proportion of each material group in the model to be rendered, the model density determination module 430 is used to:
[0203] Determining a model area of the model to be rendered according to the sum of the partition areas of all material groups in the model to be rendered;
[0204] For each material group in the model to be rendered, determining a ratio between a model area of the model to be rendered and a partition area of the material group as a second influence weight of the material group in the model to be rendered;
[0205] According to the second influence ratio of each material group, the second density sum of the first UV densities of all material groups in the to-be-rendered model is calculated;
[0206] A second UV density of the model to be rendered is determined according to the second density.
[0207] Further, when the resolution determination module 440 is used to determine the image resolution of the light map based on the second UV density and the number of pixels per unit in the light map of the model to be rendered at a preset density level, the resolution determination module 440 is used to:
[0208] Determining an initial resolution of the light map according to a product of the second UV density and the number of unit pixels of the light map;
[0209] The initial resolution is adjusted to a power of 2 to obtain the image resolution of the light map.
[0210] The device for determining the resolution of a light map provided in an embodiment of the present application obtains a model to be rendered to which a light map is to be added; wherein the model to be rendered includes at least one material group; the material types of the components included in the same material group are the same; for each material group, the mesh UV density of each target triangular mesh in the material group and the first influence ratio of each target triangular mesh in the material group are used to determine the first UV density of the material group; wherein the first influence ratio is positively correlated with the mesh area of the target triangular mesh; the second UV density of the model to be rendered is determined by using the first UV density of each material group and the second influence ratio of each material group in the model to be rendered; wherein the second influence ratio is positively correlated with the partition area of the material group; based on the second UV density and the number of pixels per unit in the light map of the model to be rendered at a preset density level, the image resolution of the light map is determined. In this way, in the rendering process of the model to be rendered, the authenticity of the rendered model can be guaranteed, and the calculation example consumption of the game engine during the rendering process can be balanced.
[0211] See also Figure 6 , Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 6 As shown in , the electronic device 600 includes a processor 610 , a memory 620 and a bus 630 .
[0212] The memory 620 stores machine-readable instructions executable by the processor 610. When the electronic device 600 is running, the processor 610 communicates with the memory 620 via the bus 630. When the machine-readable instructions are executed by the processor 610, the above-mentioned Figure 1 The steps of the method for determining the light map resolution in the method embodiment shown, the specific implementation method can be found in the method embodiment, and will not be repeated here.
[0213] The embodiment of the present application also provides a computer-readable storage medium, which shows the steps of the method for determining the light map resolution in the method embodiment. The specific implementation method can be found in the method embodiment, which will not be repeated here.
[0214] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0215] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0216] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0217] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0218] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application can essentially be embodied in the form of a software product, or in other words, the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including several instructions for 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 application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0219] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-mentioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-mentioned embodiments within the technical scope disclosed in the present application, 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 application, and should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A method for determining a light map resolution, characterized in that: The determination method comprises: Obtaining a model to be rendered to which a light map needs to be added; wherein the model to be rendered includes at least one material group; the components included in the same material group have the same material type; For each material group, the first UV density of the material group is determined by using the mesh UV density of each target triangular mesh in the material group and the first influence ratio of each target triangular mesh in the material group; wherein the mesh UV density of each target triangular mesh is determined according to the ratio between the triangle side length of the target triangular mesh and the UV side length of the target triangular mesh; and the first influence ratio is positively correlated with the mesh area of the target triangular mesh; Determine the second UV density of the model to be rendered by using the first UV density of each material group and the second influence proportion of each material group in the model to be rendered; wherein the second influence proportion is positively correlated with the partition area of the material group; An image resolution of the light map is determined based on the second UV density and the number of pixels per unit in the light map of the model to be rendered at a preset density level.
2. The determination method according to claim 1, characterized in that: The determination method further comprises: According to the material types of the components constituting the model to be rendered, the components included in the model to be rendered are divided, and the components with the same material are divided into the same material group to obtain at least one material group constituting the model to be rendered; wherein the components are used to constitute the virtual object presented by the model to be rendered.
3. The determination method according to claim 1, characterized in that: The target triangle mesh in each material group is determined by the following steps: For each material group, a triangular mesh whose mesh area is greater than a preset area threshold among all the triangular meshes included in the material group is determined as a target triangular mesh.
4. The determination method according to claim 1, characterized in that: Determine the mesh area of each target triangle mesh by following these steps: For each target triangular mesh, obtain the vertex position coordinates of each vertex in the target triangular mesh in the three-dimensional coordinate system; For each target triangular mesh, based on the vertex position coordinates of each vertex, the mesh area of the target triangular mesh in the three-dimensional coordinate system is determined by determinant calculation.
5. The determination method according to claim 1, characterized in that: The mesh UV density of each target triangle mesh is determined by the following steps: For each target triangular mesh, obtain the vertex UV coordinates of each vertex in the target triangular mesh in the UV coordinate system; For each target triangle mesh, based on the vertex UV coordinates of each vertex, the UV area of the target triangle mesh in the UV coordinate system is determined by determinant calculation; For each target triangular mesh, determine the triangle side length of the target triangular mesh in a three-dimensional coordinate system based on the mesh area, and determine the UV side length of the target triangular mesh in a UV coordinate system based on the UV area; For each target triangular mesh, the mesh UV density of the target triangular mesh is determined according to the ratio between the triangle side length and the UV side length of the target triangular mesh.
6. The determination method according to claim 1, characterized in that: The determining the first UV density of the material group by using the mesh UV density of each target triangular mesh in the material group and the first influence proportion of each target triangular mesh in the material group includes: Determine the partition area of the material group according to the mesh area sum of all target triangular meshes in the material group; For each target triangular mesh in the material group, a ratio between a mesh area of the target triangular mesh and a partition area of the material group is determined as a first influence weight of the target triangular mesh under the material group; According to the first influence ratio of each target triangular mesh, the first density sum of mesh UV densities of all target triangular meshes in the material group is calculated; The first UV density of the material group is determined according to the first density.
7. The determination method according to claim 1, characterized in that: The determining the second UV density of the model to be rendered by using the first UV density of each material group and the second influence proportion of each material group in the model to be rendered includes: Determining a model area of the model to be rendered according to the sum of the partition areas of all material groups in the model to be rendered; For each material group in the model to be rendered, determining a ratio between a model area of the model to be rendered and a partition area of the material group as a second influence weight of the material group in the model to be rendered; According to the second influence ratio of each material group, the second density sum of the first UV densities of all material groups in the to-be-rendered model is calculated; A second UV density of the model to be rendered is determined according to the second density.
8. The determination method according to claim 1, characterized in that: The determining the image resolution of the light map based on the second UV density and the number of unit pixels of the light map of the model to be rendered under the second UV density includes: Determining an initial resolution of the light map according to a product of the second UV density and the number of unit pixels of the light map; The initial resolution is adjusted to a power of 2 to obtain the image resolution of the light map.
9. A device for determining light map resolution, characterized in that: The determining device comprises: A model acquisition module, used for acquiring a model to be rendered to which a light map needs to be added; wherein the model to be rendered includes at least one material group; the material type of the components included in the same material group is the same; A group density determination module, for each material group, using the mesh UV density of each target triangular mesh in the material group and the first influence weight of each target triangular mesh in the material group to determine the first UV density of the material group; wherein the mesh UV density of each target triangular mesh is determined according to the ratio between the triangle side length of the target triangular mesh and the UV side length of the target triangular mesh; the first influence weight is positively correlated with the mesh area of the target triangular mesh; A model density determination module, used to determine a second UV density of the model to be rendered by using a first UV density of each material group and a second influence weight of each material group in the model to be rendered; wherein the second influence weight is positively correlated with a partition area of the material group; A resolution determination module is used to determine the image resolution of the light map based on the second UV density and the number of pixels per unit in the light map of the model to be rendered at a preset density level.
10. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate through the bus, and the machine-readable instructions are executed by the processor to execute the steps of the method for determining the light map resolution as described in any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for determining the light map resolution according to any one of claims 1 to 8 are executed.
