CN115731339A - Virtual model rendering method and device, computer equipment and storage medium - Google Patents
Virtual model rendering method and device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN115731339A CN115731339A CN202211451051.7A CN202211451051A CN115731339A CN 115731339 A CN115731339 A CN 115731339A CN 202211451051 A CN202211451051 A CN 202211451051A CN 115731339 A CN115731339 A CN 115731339A
- Authority
- CN
- China
- Prior art keywords
- normal data
- virtual model
- target
- target vertex
- determining
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Image Generation (AREA)
Abstract
The embodiment of the application discloses a virtual model rendering method, a virtual model rendering device, computer equipment and a storage medium. The method comprises the following steps: the computer equipment determines a target vertex in a plurality of vertexes corresponding to the first virtual model and first normal data corresponding to the target vertex; acquiring preset normal data of the second virtual model, and transmitting the preset normal data to the first virtual model to obtain a first virtual model only containing the preset normal data; determining second normal data corresponding to the target vertex in a first virtual model only containing preset normal data; replacing the second normal data with the first normal data to obtain target normal data corresponding to the first virtual model; and finally, performing light effect rendering on the first virtual model according to the target normal data. Therefore, the rendering effect of the first virtual model is improved.
Description
Technical Field
The present application relates to the field of image processing technologies, and in particular, to a virtual model rendering method and apparatus, a computer device, and a storage medium.
Background
In some image rendering scenarios, the designer may apply the normal data of one model directly to another model, so as to perform subsequent illumination rendering processing on the other model, thereby saving the amount of computation for processing the other model.
However, when the normal data of one model is directly applied to another model in the related art, the original normal data of the other model is also covered, so that the lighting rendering effect of the other model is poor in detail.
Disclosure of Invention
The embodiment of the application provides a virtual model rendering method and device, computer equipment and a storage medium. The virtual model rendering method can improve the rendering effect of the virtual model.
In a first aspect, an embodiment of the present application provides a virtual model rendering method, including:
determining a target vertex in a plurality of vertexes corresponding to the first virtual model and first normal data corresponding to the target vertex;
acquiring preset normal data of the second virtual model, and transmitting the preset normal data to the first virtual model to obtain a first virtual model only containing the preset normal data;
determining second normal data corresponding to the target vertex in a first virtual model only containing preset normal data;
replacing the second normal data with the first normal data to obtain target normal data corresponding to the first virtual model;
and performing light effect rendering on the first virtual model according to the target normal data.
In a second aspect, an embodiment of the present application provides a virtual model rendering apparatus, including:
the first determining module is used for determining a target vertex in a plurality of vertexes corresponding to the first virtual model and first normal data corresponding to the target vertex;
the acquisition module is used for acquiring the preset normal data of the second virtual model and transmitting the preset normal data to the first virtual model to obtain the first virtual model only containing the preset normal data;
the second determining module is used for determining second normal data corresponding to the target vertex in the first virtual model only containing the preset normal data;
the replacing module is used for replacing the second normal data with the first normal data so as to obtain target normal data corresponding to the first virtual model;
and the rendering module is used for performing light effect rendering on the first virtual model according to the target normal data.
In a third aspect, an embodiment of the present application provides a computer-readable storage medium, where a plurality of instructions are stored, and the instructions are adapted to be loaded by a processor to perform steps in a virtual model rendering method provided in an embodiment of the present application.
In a fourth aspect, an embodiment of the present application provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor executes the computer program to implement the steps in the virtual model rendering method provided in the embodiment of the present application.
In the embodiment of the application, the computer device determines a target vertex in a plurality of vertices corresponding to the first virtual model and first normal data corresponding to the target vertex; acquiring preset normal data of the second virtual model, and transmitting the preset normal data to the first virtual model to obtain a first virtual model only containing the preset normal data; determining second normal data corresponding to the target vertex in a first virtual model only containing preset normal data; replacing the second normal data with the first normal data to obtain target normal data corresponding to the first virtual model; and finally, performing light effect rendering on the first virtual model according to the target normal data. According to the method and the device, the first virtual model is rendered by using the preset normal data of the second virtual model and the first normal data of the first virtual model, so that the rendering effect of the first virtual model is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the description below are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic view of an illumination scene provided in an embodiment of the present application.
Fig. 2 is a first flowchart of a virtual model rendering method according to an embodiment of the present disclosure.
Fig. 3 is a second flowchart of the virtual model rendering method according to the embodiment of the present application.
Fig. 4 is a schematic diagram of a first virtual model provided in an embodiment of the present application.
Fig. 5 is a schematic diagram of normal data transfer provided by an embodiment of the present application.
Fig. 6 is a first rendering schematic diagram of a first virtual model provided in an embodiment of the present application.
Fig. 7 is a second rendering schematic diagram of the first virtual model according to the embodiment of the present application.
Fig. 8 is a schematic structural diagram of a virtual model rendering apparatus according to an embodiment of the present application.
Fig. 9 is a schematic structural diagram of a computer device provided in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In some image rendering scenarios, the designer may apply the normal data of one model directly to another model, so as to perform subsequent illumination rendering processing on the other model, thereby saving the amount of computation for processing the other model.
However, when the normal data of one model is directly applied to another model in the related art, the original normal data of the other model is also covered, so that the lighting rendering effect of the other model is poor in detail.
For example, the shading on another model is not natural, and shadows appear where no shadows should appear, or light irradiation effects appear where no light is irradiated.
In order to solve the technical problem, embodiments of the present application provide a virtual model rendering method, apparatus, computer device, and storage medium. The virtual model rendering method can improve the rendering effect of the virtual model.
Referring to fig. 1, fig. 1 is a schematic view of an illumination scene according to an embodiment of the present disclosure.
In the real physical world, when light irradiates on the surface of an object, physical phenomena such as refraction and reflection of light occur. When the light source emits light, and the light irradiates one point on the surface of the object, the surface of the object can reflect the light to human eyes.
As shown in fig. 1, a light direction vector corresponding to the light direction is l, a sight direction vector corresponding to the sight direction is v, n is a normal direction vector corresponding to a normal of the surface of the object, the normal direction vector is perpendicular to the surface of the object, h is a half-range vector corresponding to the sight direction vector v and the light direction vector l, r is a reflection direction vector corresponding to the sight direction vector v, and the sight direction vector v reflects with the normal direction vector n as a reference, so as to obtain a reflection direction vector r.
In the embodiment of the application, the corresponding normal data, that is, the corresponding normal direction vector, is set for the first virtual model, so that when the subsequent light effect rendering is performed on the first virtual model, the light rendering effect of different areas of the first virtual model is realized, for example, some areas of the first virtual model have shadows and some areas have light irradiation, so that the light and shadow transition effect close to the real physical world is realized.
The normal data of the different vertices mentioned in the embodiments of the present application may also be artificially set normal directions.
Referring to fig. 2, fig. 2 is a first flowchart of a virtual model rendering method according to an embodiment of the present disclosure. The virtual model rendering method may include the steps of:
110. and determining a target vertex in the multiple vertexes corresponding to the first virtual model and first normal data corresponding to the target vertex.
In some embodiments, the first virtual model is a model to be rendered, and a plurality of vertices are corresponding to the first virtual model, and each vertex of the first virtual model has normal data corresponding thereto, for example, the normal data is a direction of a normal corresponding to each vertex.
In different areas and different positions of the first virtual model, the corresponding vertexes are different, and the normal data between the vertexes is different.
In some embodiments, the computer device may receive a selection instruction, select at least one target vertex from the plurality of vertices of the first virtual model, and obtain normal data corresponding to the at least one target vertex.
Specifically, the computer device may determine at least one target area in the first virtual model; and then determining the vertex in at least one target area as a target vertex, and determining first normal data corresponding to the target vertex from the original normal data of the first virtual model.
For example, a user may select different areas of the first virtual model, and then the computer device determines a target vertex from the vertices of the first virtual model according to the selected position, and obtains normal data corresponding to the target vertex.
After determining a target vertex of the multiple vertices corresponding to the first virtual model and first normal data corresponding to the target vertex, the computer device may determine identification information corresponding to the target vertex, and then store the identification information corresponding to the target vertex and the first normal data corresponding to the target vertex.
For example, the identification information corresponding to the target vertex and the first normal data corresponding to the target vertex are stored in a preset file of a corresponding data structure, so as to be used in a subsequent processing process. The identification information may be position information of the target vertex on the first virtual model, such as three-dimensional coordinates. The identification information may also be the identity information of the target vertices, such as a unique ID for each target vertex.
It should be noted that the first virtual model is provided with original normal data, which may be at least a part of normal data set in advance by a user, for example, normal data set for some areas on the first virtual model where light and shadow transition needs to be implemented, or normal data preset when the first virtual model is set.
120. And acquiring the preset normal data of the second virtual model, and transmitting the preset normal data to the first virtual model to obtain the first virtual model only containing the preset normal data.
In some embodiments, the preset normal data corresponding to the second virtual model may be normal data used by the second preset model in rendering. For example, after the second virtual model is rendered last time, normal data used when the second virtual model is rendered is retained, so that preset normal data is obtained.
In the first virtual model, if corresponding normal data is set for all the vertexes of the first virtual model, the calculation amount required is large, and in order to save the calculation amount, the computer device can directly apply the normal data of the second virtual model to the first virtual model. For example, the preset normal data is transmitted to the first virtual model by a normal transmission mode, so as to obtain the first virtual model only containing the preset normal data.
In the process of normal transmission, if the first virtual model contains original normal data, the computer device determines the original normal data of the first virtual model, and then covers the original normal data with the preset normal data, so as to obtain the first virtual model only containing the preset normal data. That is, only the preset normal data exists in the first virtual model after the normal transfer.
After the normal is transmitted to the first virtual model, if the preset normal data is directly used for rendering the first virtual model, the light and shadow effect of the actually rendered first virtual model is not fine enough, for example, the setting position between the illumination area and the shadow area in the rendered first virtual model is unreasonable, the place with illumination is a shadow, and the place with shadow is illumination. For another example, the transition between the illumination area and the shadow area is not natural enough, so that the light and shadow transition effect of the rendered first virtual model is not fine enough.
In order to solve this problem, in the embodiment of the present application, a part of the area in the first virtual model may be used by using the original normal data corresponding to the area. And in another partial region of the first virtual model, the preset normal data of the second virtual model may be adopted. Therefore, the target normal data of the first virtual model can be rapidly determined in the process of rendering the first virtual model, and meanwhile, the finally rendered first virtual model can have a good rendering effect, for example, the positions of the illumination area and the shadow area are reasonable, and the transition between the illumination area and the shadow area is more natural.
130. And determining second normal data corresponding to the target vertex in the first virtual model only containing the preset normal data.
In some embodiments, the computer device may determine, according to the identification information, a target vertex in the first virtual model that only includes the preset normal data, and then determine, from the preset normal data, second normal data corresponding to the target vertex.
For example, the computer device may obtain a preset file before the first virtual model does not perform normal line transfer, then obtain identification information in the preset file, determine a target vertex in the first virtual model only containing the preset normal line data according to the identification information, and finally determine second normal line data corresponding to the target vertex in the preset normal line data.
The second normal data corresponding to the target vertex and the first normal data corresponding to the target vertex are different.
140. And replacing the second normal data with the first normal data to obtain target normal data corresponding to the first virtual model.
In some embodiments, in order to enable a better rendering effect when the region corresponding to the target vertex of the first virtual model is subsequently subjected to illumination rendering, the computer device may replace the second normal data corresponding to the target vertex with the first normal data. That is, the second normal data of the target vertex is removed and then replaced with the first normal data.
Meanwhile, at other vertices in the first virtual model than the target vertex, the other vertices may adopt normal data in the preset normal data.
And finally, after replacing the normal data of the target vertex in the first virtual model only containing the preset normal data with the first normal data, obtaining target normal data corresponding to the first virtual model, wherein the target normal data is data required to be used when the first virtual model is finally rendered.
150. And performing light effect rendering on the first virtual model according to the target normal data.
In some embodiments, the computer device may set corresponding light effects for different regions of the first virtual model according to the target normal data, such as some regions set as shadow regions and some regions set as illumination regions.
Because the target vertex in the rendered first virtual model adopts the first normal data, the illumination effect of the target area corresponding to the target vertex is better, so that the first virtual model is more careful and natural in overall illumination, and the rendering effect of the first virtual model is improved.
In the embodiment of the application, the computer device determines a target vertex in a plurality of vertices corresponding to the first virtual model and first normal data corresponding to the target vertex; acquiring preset normal data of the second virtual model, and transmitting the preset normal data to the first virtual model to obtain a first virtual model only containing the preset normal data; determining second normal data corresponding to the target vertex in a first virtual model only containing preset normal data; replacing the second normal data with the first normal data to obtain target normal data corresponding to the first virtual model; and finally, performing light effect rendering on the first virtual model according to the target normal data. According to the method and the device, the first virtual model is rendered by using the preset normal data of the second virtual model and the first normal data of the first virtual model, so that the rendering effect of the first virtual model is improved.
For a more detailed understanding of the virtual model rendering method provided in the embodiment of the present application, please continue to refer to fig. 3, where fig. 3 is a second flow chart of the virtual model rendering method provided in the embodiment of the present application. The virtual model rendering method may include the steps of:
201. at least one target area is determined in the first virtual model.
In some embodiments, the computer device may receive a selection instruction, select at least one target vertex from the plurality of vertices of the first virtual model, and obtain normal data corresponding to the at least one target vertex.
For example, a user may select different areas of the first virtual model, and then the computer device determines a target vertex from the vertices of the first virtual model according to the selected position, and obtains normal data corresponding to the target vertex.
Referring to fig. 4, fig. 4 is a schematic diagram of a first virtual model according to an embodiment of the present disclosure.
As shown in fig. 4, the first virtual model includes a plurality of vertices, and the positions of the vertices in different regions are different, and the user can select the plurality of regions on the first virtual model to determine the target region.
As shown in FIG. 4, the first virtual model includes two target regions, each of which includes a corresponding target vertex.
For selection of the target region, one target region may be selected, or a plurality of target regions may be selected.
202. Determining a vertex in at least one target area as a target vertex, and determining first normal data corresponding to the target vertex from the original normal data of the first virtual model.
As shown in fig. 4, the computer device may determine a vertex in the corresponding target area as a target vertex, and then determine first normal data corresponding to the target vertex from the original normal data corresponding to the first virtual model.
For example, the computer device may obtain identification information of each target vertex, and then determine the first normal data from the original normal data according to the identification information.
In some embodiments, after the target vertices are determined, corresponding first normal data may also be set separately for each target vertex. For example, the computer device may obtain the normal data set by the user for each target vertex, and then determine the normal data as the first normal data corresponding to each target vertex.
203. And determining identification information corresponding to the target vertex, and storing the identification information corresponding to the target vertex and the first normal data corresponding to the target vertex.
The identification information may be position information of the target vertex on the first virtual model, such as three-dimensional coordinates. The identification information may also be the identity information of the target vertices, such as a unique ID for each target vertex.
In some embodiments, the computer device may store the identification information corresponding to the target vertex and the first normal data corresponding to the target vertex in a preset file of a corresponding data structure for use in a subsequent processing procedure.
For example, the preset file includes a point _ list variable and an origin _ normal variable, and the point _ list variable includes ID information, such as an ID value, of each target vertex. The origin _ normal variable includes normal data corresponding to each target vertex, for example, the computer device may determine first normal data from the original normal data corresponding to the first virtual model by using the ID information of each target vertex, and then store the first normal data in the origin _ normal variable, and store the ID information of each target vertex in the origin _ normal variable.
In some implementations, the computer device may establish a mapping relationship between the identification information of each target vertex and the first normal data, and then save the identification information of each target vertex and the first normal data according to the mapping relationship.
For example, a mapping relationship is correspondingly formed between the target vertex 1 and the first normal data 1, a mapping relationship is correspondingly formed between the target vertex N and the first normal data N, and the computer device may store the identification information of the target vertex and the first normal data according to the mapping relationship, so that the unique first normal data corresponding to the target vertex can be determined according to the identification information in the subsequent data search.
204. And acquiring the preset normal data of the second virtual model, and transmitting the preset normal data to the first virtual model to obtain the first virtual model only containing the preset normal data.
In some embodiments, the preset normal data corresponding to the second virtual model may be normal data used by the second virtual model when rendering is performed. For example, after the second virtual model is rendered last time, normal data used when the second virtual model is rendered is retained, so that preset normal data is obtained.
In the first virtual model, if corresponding normal data is set for all the vertexes of the first virtual model, the calculation amount required is large, and in order to save the calculation amount, the computer device can directly apply the normal data of the second virtual model to the first virtual model. For example, the preset normal data is transmitted to the first virtual model by a normal transmission mode, so as to obtain the first virtual model only containing the preset normal data.
In the process of normal transmission, if the first virtual model contains original normal data, the computer device determines the original normal data of the first virtual model, and then covers the original normal data with the preset normal data, so as to obtain the first virtual model only containing the preset normal data. That is, only the preset normal data exists in the first virtual model after the normal transfer.
Referring to fig. 5, fig. 5 is a schematic diagram of normal data transmission according to an embodiment of the present disclosure.
The computer device may first obtain the preset normal data of the second virtual model, obtain the original normal data of the first virtual model and the first virtual model, then transfer the preset normal data to the first virtual model through spherical normal transfer, and simultaneously remove the original normal data in the first virtual model by covering, thereby obtaining the first virtual model only containing the preset normal data.
205. And determining a target vertex in the first virtual model only containing the preset normal data according to the identification information.
In some embodiments, the number and position of vertices in the first virtual model containing only the preset normal data are unchanged, i.e. the identification information of vertices in the first virtual model containing only the preset normal data is unchanged.
Therefore, the computer device may determine the target vertex in the first virtual model containing only the preset normal data according to the identification information. For example, the target vertex is determined in the first virtual model containing only the preset normal data by ID information or position information.
206. And determining second normal data corresponding to the target vertex in the preset normal data.
The computer device may determine normal data corresponding to the target vertex from the preset normal data, and then determine the normal data as second normal data.
207. The second normal data is replaced with the first normal data.
In some embodiments, in order to enable a better rendering effect when the region corresponding to the target vertex of the first virtual model is subsequently subjected to illumination rendering, the computer device may replace the second normal data corresponding to the target vertex with the first normal data. That is, the second normal data of the target vertex is removed and then replaced with the first normal data.
208. Vertices other than the target vertex are determined in the first virtual model containing only the pre-set normal data.
For example, in the first virtual model containing only the preset normal data, there are 100 vertices, and after 30 vertices are determined as target vertices, the remaining 70 vertices are other vertices except the target vertices.
209. And determining third normal data corresponding to other vertexes in the preset normal data.
In some embodiments, the computer device may obtain identification information corresponding to other vertices, and then determine third normal data corresponding to other vertices in the preset normal data according to the identification information.
210. And determining the first normal data and the third normal data as target normal data corresponding to the first virtual model.
As can be seen from the above, the normal data corresponding to the target vertex of the first virtual model is the first normal data, and the normal data corresponding to the vertices other than the target vertex in the first virtual model is the third normal data. Normal data corresponding to all final vertexes of the first virtual model are obtained, that is, the first normal data and the third normal data are determined as target normal data corresponding to the first virtual model. And rendering the first virtual model through the target normal data in the subsequent rendering process.
211. And performing light effect rendering on the first virtual model according to the target normal data.
After the normal is transmitted to the first virtual model, if the preset normal data is directly used for rendering the first virtual model, the light and shadow effect of the actually rendered first virtual model is not fine enough, for example, the setting position between the illumination area and the shadow area in the rendered first virtual model is unreasonable, the place with illumination is a shadow, and the place with shadow is illumination. For another example, the transition between the illumination area and the shadow area is not natural enough, which results in a less detailed light-shadow transition effect of the rendered first virtual model.
Referring to fig. 6, fig. 6 is a first rendering schematic diagram of a first virtual model according to an embodiment of the present disclosure.
The first virtual model in fig. 6 is a rendered first virtual model obtained after rendering is performed directly using the preset normal data. Wherein in the target region, a shadow region exists in a region from the eyes to the nose, and no shadow region exists above the region from the eyes to the nose. This creates a light illumination effect that is not present in the real physical world, resulting in the illumination effect of the rendered first virtual model appearing unrealistic.
In order to solve this problem, in the embodiment of the present application, a part of the area in the first virtual model may be used by using the original normal data corresponding to the area. And in another partial region of the first virtual model, the preset normal data of the second virtual model may be adopted. Therefore, the target normal data of the first virtual model can be rapidly determined in the process of rendering the first virtual model, and meanwhile, the finally rendered first virtual model can have a good rendering effect, for example, the positions of the illumination area and the shadow area are reasonable, and the transition between the illumination area and the shadow area is more natural.
Referring to fig. 7, fig. 7 is a second rendering schematic diagram of the first virtual model according to the embodiment of the present disclosure.
The first virtual model in fig. 7 is a rendered first virtual model obtained after rendering using the target normal data. In the target region, there is no shaded region in the region from the eye to the nose as in fig. 6, and there is no shaded region above the region from the eye to the nose. Therefore, the physical world light irradiation effect close to reality is achieved, the illumination effect of the rendered first virtual model looks more real, and the rendering effect of the first virtual model is improved.
In an embodiment of the application, the computer device determines at least one target area in the first virtual model. And then determining a vertex in at least one target area as a target vertex, and determining first normal data corresponding to the target vertex from the original normal data of the first virtual model. And then determining the identification information corresponding to the target vertex, and storing the identification information corresponding to the target vertex and the first normal data corresponding to the target vertex.
And then acquiring preset normal data of the second virtual model, and transmitting the preset normal data to the first virtual model to obtain the first virtual model only containing the preset normal data. And determining a target vertex in the first virtual model only containing the preset normal data according to the identification information. And determining second normal data corresponding to the target vertex in the preset normal data.
And finally replacing the second normal data with the first normal data. Vertices other than the target vertex are determined in the first virtual model containing only the pre-set normal data. And determining third normal data corresponding to other vertexes in the preset normal data. And determining the first normal data and the third normal data as target normal data corresponding to the first virtual model. And performing light effect rendering on the first virtual model according to the target normal data. The first virtual model is rendered by using the preset normal data of the second virtual model and the first normal data of the first virtual model, so that the rendering effect of the first virtual model is improved.
Referring to fig. 8, fig. 8 is a schematic view illustrating a structure of a virtual model rendering apparatus according to an embodiment of the present disclosure. The virtual model rendering apparatus 300 may include:
the first determining module 310 is configured to determine a target vertex of the multiple vertices corresponding to the first virtual model and first normal data corresponding to the target vertex.
A first determining module 310, further configured to determine at least one target area in the first virtual model;
determining the vertex in the target area as a target vertex, and determining first normal data corresponding to the target vertex from the original normal data of the first virtual model.
The first determining module 310 is further configured to determine, after determining a target vertex of the multiple vertices corresponding to the first virtual model and first normal data corresponding to the target vertex, identification information corresponding to the target vertex;
and storing the identification information corresponding to the target vertex and the first normal data corresponding to the target vertex.
The first determining module 310 is further configured to establish a mapping relationship between the identification information of each target vertex and the first normal data;
and storing the identification information and the first normal data of each target vertex according to the mapping relation.
The obtaining module 320 is configured to obtain the preset normal data of the second virtual model, and transmit the preset normal data to the first virtual model to obtain the first virtual model only containing the preset normal data.
An obtaining module 320, further configured to determine original normal data of the first virtual model;
and covering the original normal data with the preset normal data to obtain a first virtual model only containing the preset normal data.
The second determining module 330 is configured to determine second normal data corresponding to the target vertex in the first virtual model only including the preset normal data.
The second determining module 330 is further configured to determine a target vertex in the first virtual model only containing the preset normal data according to the identification information;
and determining second normal data corresponding to the target vertex in the preset normal data.
The replacing module 340 is configured to replace the second normal data with the first normal data to obtain target normal data corresponding to the first virtual model.
A replacement module 340, further configured to replace the second normal data with the first normal data;
determining other vertexes except the target vertex in a first virtual model only containing preset normal data;
determining third normal data corresponding to other vertexes in the preset normal data;
and determining the first normal data and the third normal data as target normal data corresponding to the first virtual model.
And a rendering module 350, configured to perform light effect rendering on the first virtual model according to the target normal data.
In the embodiment of the application, the computer device determines a target vertex in a plurality of vertices corresponding to the first virtual model and first normal data corresponding to the target vertex; acquiring preset normal data of the second virtual model, and transmitting the preset normal data to the first virtual model to obtain a first virtual model only containing the preset normal data; determining second normal data corresponding to the target vertex in a first virtual model only containing preset normal data; replacing the second normal data with the first normal data to obtain target normal data corresponding to the first virtual model; and finally, performing light effect rendering on the first virtual model according to the target normal data. According to the method and the device, the first virtual model is rendered by using the preset normal data of the second virtual model and the first normal data of the first virtual model, so that the rendering effect of the first virtual model is improved.
Correspondingly, the embodiment of the present application further provides a Computer device, where the Computer device may be a terminal or a server, and the terminal may be a terminal device such as a smart phone, a tablet Computer, a notebook Computer, a touch screen, a game machine, a Personal Computer (PC), a Personal Digital Assistant (PDA), and the like. As shown in fig. 9, fig. 9 is a schematic structural diagram of a computer device according to an embodiment of the present application. The computer apparatus 400 includes a processor 401 having one or more processing cores, a memory 402 having one or more computer-readable storage media, and a computer program stored on the memory 402 and executable on the processor. The processor 401 is electrically connected to the memory 402. Those skilled in the art will appreciate that the computer device configurations illustrated in the figures are not meant to be limiting of computer devices and may include more or fewer components than those illustrated, or some components may be combined, or a different arrangement of components.
The processor 401 is a control center of the computer apparatus 400, connects various parts of the entire computer apparatus 400 using various interfaces and lines, performs various functions of the computer apparatus 400 and processes data by running or loading software programs and/or modules stored in the memory 402 and calling data stored in the memory 402, thereby integrally monitoring the computer apparatus 400.
In this embodiment, the processor 401 in the computer device 400 loads instructions corresponding to processes of one or more applications into the memory 402 according to the following steps, and the processor 401 executes the applications stored in the memory 402, thereby implementing various functions:
determining a target vertex in a plurality of vertexes corresponding to the first virtual model and first normal data corresponding to the target vertex;
acquiring preset normal data of the second virtual model, and transmitting the preset normal data to the first virtual model to obtain a first virtual model only containing the preset normal data;
determining second normal data corresponding to the target vertex in a first virtual model only containing preset normal data;
replacing the second normal data with the first normal data to obtain target normal data corresponding to the first virtual model;
and performing light effect rendering on the first virtual model according to the target normal data.
The processor 401 is also configured to implement the functions of:
after determining a target vertex in a plurality of vertices corresponding to the first virtual model and first normal data corresponding to the target vertex, determining identification information corresponding to the target vertex;
and storing the identification information corresponding to the target vertex and the first normal data corresponding to the target vertex.
The processor 401 is also configured to implement the functions of:
determining a target vertex in a first virtual model only containing preset normal data according to the identification information;
and determining second normal data corresponding to the target vertex in the preset normal data.
The processor 401 is also configured to implement the functions of:
establishing a mapping relation between the identification information of each target vertex and the first normal data;
and storing the identification information and the first normal data of each target vertex according to the mapping relation.
The processor 401 is also configured to implement the functions of:
replacing the second normal data with the first normal data;
determining other vertexes except the target vertex in a first virtual model only containing preset normal data;
determining third normal data corresponding to other vertexes in the preset normal data;
and determining the first normal data and the third normal data as target normal data corresponding to the first virtual model.
The processor 401 is also configured to implement the functions of:
determining original normal data of the first virtual model;
and covering the original normal data with the preset normal data to obtain a first virtual model only containing the preset normal data.
The processor 401 is also configured to implement the functions of:
determining at least one target area in the first virtual model;
determining the vertex in the target area as a target vertex, and determining first normal data corresponding to the target vertex from the original normal data of the first virtual model.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiment of the application, the computer device determines a target vertex in a plurality of vertices corresponding to the first virtual model and first normal data corresponding to the target vertex; acquiring preset normal data of the second virtual model, and transmitting the preset normal data to the first virtual model to obtain a first virtual model only containing the preset normal data; determining second normal data corresponding to the target vertex in a first virtual model only containing preset normal data; replacing the second normal data with the first normal data to obtain target normal data corresponding to the first virtual model; and finally, performing light effect rendering on the first virtual model according to the target normal data. According to the method and the device, the first virtual model is rendered by using the preset normal data of the second virtual model and the first normal data of the first virtual model, so that the rendering effect of the first virtual model is improved.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
Optionally, as shown in fig. 9, the computer device 400 further includes: touch-sensitive display screen 403, radio frequency circuit 404, audio circuit 405, input unit 406 and power 407. The processor 401 is electrically connected to the touch display 403, the rf circuit 404, the audio circuit 405, the input unit 406, and the power source 407 respectively. Those skilled in the art will appreciate that the computer device configuration illustrated in FIG. 9 does not constitute a limitation of computer devices, and may include more or fewer components than those illustrated, or some components may be combined, or a different arrangement of components.
The touch display screen 403 may be used for displaying a graphical user interface and receiving operation instructions generated by a user acting on the graphical user interface. The touch display screen 403 may include a display panel and a touch panel. The display panel may be used, among other things, to display information entered by or provided to a user and various graphical user interfaces of the computer device, which may be made up of graphics, text, icons, video, and any combination thereof. Alternatively, the Display panel may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. The touch panel may be used to collect touch operations of a user (for example, operations of the user on or near the touch panel by using a finger, a stylus pen, or any other suitable object or accessory) and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Alternatively, the touch panel may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 401, and can receive and execute commands sent by the processor 401. The touch panel may overlay the display panel, and when the touch panel detects a touch operation thereon or nearby, the touch panel may transmit the touch operation to the processor 401 to determine the type of the touch event, and then the processor 401 may provide a corresponding visual output on the display panel according to the type of the touch event. In the embodiment of the present application, the touch panel and the display panel may be integrated into the touch display screen 403 to realize input and output functions. However, in some embodiments, the touch panel and the touch panel can be implemented as two separate components to perform the input and output functions. That is, the touch display screen 403 may also be used as a part of the input unit 406 to implement an input function.
In the embodiment of the present application, an application program is executed by the processor 401 to generate a graphical user interface on the touch display screen 403. The touch display screen 403 is used for presenting a graphical user interface and receiving an operation instruction generated by a user acting on the graphical user interface.
The rf circuit 404 may be used for transceiving rf signals to establish wireless communication with a network device or other computer device via wireless communication, and for transceiving signals with the network device or other computer device.
The audio circuit 405 may be used to provide an audio interface between a user and a computer device through speakers, microphones. The audio circuit 405 may transmit the electrical signal converted from the received audio data to a speaker, and convert the electrical signal into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 405 and converted into audio data, which is then processed by the audio data output processor 401, and then sent to, for example, another computer device via the radio frequency circuit 404, or output to the memory 402 for further processing. Audio circuitry 405 may also include an earbud jack to provide communication of peripheral headphones with the computer device.
The input unit 406 may be used to receive input numbers, character information, or user characteristic information (e.g., fingerprint, iris, facial information, etc.), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
The power supply 407 is used to power the various components of the computer device 400. Optionally, the power source 407 may be logically connected to the processor 401 through a power management system, so as to implement functions of managing charging, discharging, power consumption management, and the like through the power management system. The power supply 407 may also include one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, or any other component.
Although not shown in fig. 9, the computer device 400 may further include a camera, a sensor, a wireless fidelity module, a bluetooth module, etc., which are not described in detail herein.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions, or by instructions controlling associated hardware, which may be stored in a computer-readable storage medium and loaded and executed by a processor.
To this end, the present application provides a computer-readable storage medium, in which a plurality of computer programs are stored, and the computer programs can be loaded by a processor to execute the steps in any of the virtual model rendering methods provided by the embodiments of the present application. For example, the computer program may perform the steps of:
determining a target vertex in a plurality of vertexes corresponding to the first virtual model and first normal data corresponding to the target vertex;
acquiring preset normal data of the second virtual model, and transmitting the preset normal data to the first virtual model to obtain a first virtual model only containing the preset normal data;
determining second normal data corresponding to the target vertex in a first virtual model only containing preset normal data;
replacing the second normal data with the first normal data to obtain target normal data corresponding to the first virtual model;
and performing light effect rendering on the first virtual model according to the target normal data.
The computer program may further perform the steps of:
after determining a target vertex in a plurality of vertexes corresponding to the first virtual model and first normal data corresponding to the target vertex, determining identification information corresponding to the target vertex;
and storing the identification information corresponding to the target vertex and the first normal data corresponding to the target vertex.
The computer program may further perform the steps of:
determining a target vertex in a first virtual model only containing preset normal data according to the identification information;
and determining second normal data corresponding to the target vertex in the preset normal data.
The computer program may further perform the steps of:
establishing a mapping relation between the identification information of each target vertex and the first normal data;
and storing the identification information and the first normal data of each target vertex according to the mapping relation.
The computer program may further perform the steps of:
replacing the second normal data with the first normal data;
determining other vertexes except the target vertex in a first virtual model only containing preset normal data;
determining third normal data corresponding to other vertexes in the preset normal data;
and determining the first normal data and the third normal data as target normal data corresponding to the first virtual model.
The computer program may further perform the steps of:
determining original normal data of the first virtual model;
and covering the original normal data with the preset normal data to obtain a first virtual model only containing the preset normal data.
The computer program may further perform the steps of:
determining at least one target area in the first virtual model;
determining the vertex in the target area as a target vertex, and determining first normal data corresponding to the target vertex from the original normal data of the first virtual model.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to the related descriptions of other embodiments.
In the embodiment of the application, the computer device determines a target vertex in a plurality of vertices corresponding to the first virtual model and first normal data corresponding to the target vertex; acquiring preset normal data of the second virtual model, and transmitting the preset normal data to the first virtual model to obtain a first virtual model only containing the preset normal data; determining second normal data corresponding to the target vertex in a first virtual model only containing preset normal data; replacing the second normal data with the first normal data to obtain target normal data corresponding to the first virtual model; and finally, performing light effect rendering on the first virtual model according to the target normal data. According to the method and the device, the first virtual model is rendered by using the preset normal data of the second virtual model and the first normal data of the first virtual model, so that the rendering effect of the first virtual model is improved.
Wherein the storage medium may include: read Only Memory (ROM), random Access Memory (RAM), magnetic or optical disks, and the like.
Since the computer program stored in the storage medium may execute the steps of any one of the virtual model rendering methods provided in the embodiments of the present application, beneficial effects that can be achieved by any one of the virtual model rendering methods provided in the embodiments of the present application may be achieved, for details, see the foregoing embodiments, and are not described herein again.
The virtual model rendering method, the virtual model rendering device, the computer device, and the storage medium provided in the embodiments of the present application are described in detail above, and a specific example is applied in the present application to explain the principle and the implementation of the present application, and the description of the above embodiments is only used to help understanding the method and the core idea of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.
Claims (10)
1. A method of virtual model rendering, comprising:
determining a target vertex in a plurality of vertexes corresponding to a first virtual model and first normal data corresponding to the target vertex;
acquiring preset normal data of a second virtual model, and transmitting the preset normal data to the first virtual model to obtain a first virtual model only containing the preset normal data;
determining second normal data corresponding to the target vertex in a first virtual model only containing the preset normal data;
replacing the second normal data with the first normal data to obtain target normal data corresponding to the first virtual model;
and carrying out light effect rendering on the first virtual model according to the target normal data.
2. The virtual model rendering method of claim 1, wherein after the determining a target vertex of the plurality of vertices corresponding to the first virtual model and the first normal data corresponding to the target vertex, the method further comprises:
determining identification information corresponding to the target vertex;
and storing the identification information corresponding to the target vertex and the first normal data corresponding to the target vertex.
3. The virtual model rendering method according to claim 2, wherein the determining second normal data corresponding to the target vertex in the first virtual model only including the preset normal data includes:
determining the target vertex in a first virtual model only containing the preset normal data according to the identification information;
and determining second normal data corresponding to the target vertex in the preset normal data.
4. The virtual model rendering method according to claim 2, wherein the number of the target vertices is multiple, and the saving the identification information corresponding to the target vertices and the first normal data corresponding to the target vertices includes:
establishing a mapping relation between the identification information of each target vertex and the first normal data;
and storing the identification information and the first normal data of each target vertex according to the mapping relation.
5. The virtual model rendering method of claim 1, wherein the replacing the second normal data with the first normal data to obtain target normal data corresponding to the first virtual model comprises:
determining other vertexes except the target vertex in a first virtual model only containing the preset normal data;
determining third normal data corresponding to the other vertexes in the preset normal data;
replacing the second normal data with the first normal data;
and determining the first normal data and the third normal data as target normal data corresponding to the first virtual model.
6. The virtual model rendering method according to claim 1, wherein the transmitting the preset normal data into the first virtual model to obtain a first virtual model only including the preset normal data includes:
determining raw normal data for the first virtual model;
and covering the original normal data with the preset normal data to obtain a first virtual model only containing the preset normal data.
7. The virtual model rendering method of claim 1, wherein the determining a target vertex of the plurality of vertices corresponding to the first virtual model and the first normal data corresponding to the target vertex comprises:
determining at least one target area in the first virtual model;
determining a vertex in the at least one target area as the target vertex, and determining first normal data corresponding to the target vertex from the original normal data of the first virtual model.
8. A virtual model rendering apparatus, comprising:
the first determination module is used for determining a target vertex in a plurality of vertexes corresponding to a first virtual model and first normal data corresponding to the target vertex;
the acquisition module is used for acquiring preset normal data of a second virtual model and transmitting the preset normal data to the first virtual model to obtain a first virtual model only containing the preset normal data;
a second determining module, configured to determine second normal data corresponding to the target vertex in a first virtual model only including the preset normal data;
a replacing module, configured to replace the second normal data with the first normal data to obtain target normal data corresponding to the first virtual model;
and the rendering module is used for performing light effect rendering on the first virtual model according to the target normal data.
9. A computer device, comprising:
a memory storing executable program code, a processor coupled with the memory;
the processor calls the executable program code stored in the memory to perform the steps in the virtual model rendering method of any of claims 1 to 7.
10. A storage medium storing instructions adapted to be loaded by a processor to perform the steps of the virtual model rendering method of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211451051.7A CN115731339A (en) | 2022-11-18 | 2022-11-18 | Virtual model rendering method and device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211451051.7A CN115731339A (en) | 2022-11-18 | 2022-11-18 | Virtual model rendering method and device, computer equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115731339A true CN115731339A (en) | 2023-03-03 |
Family
ID=85296718
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211451051.7A Pending CN115731339A (en) | 2022-11-18 | 2022-11-18 | Virtual model rendering method and device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115731339A (en) |
-
2022
- 2022-11-18 CN CN202211451051.7A patent/CN115731339A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113052947B (en) | Rendering method, rendering device, electronic equipment and storage medium | |
CN112370783B (en) | Virtual object rendering method, device, computer equipment and storage medium | |
CN112465945B (en) | Model generation method and device, storage medium and computer equipment | |
WO2023213037A1 (en) | Hair virtual model rendering method and apparatus, computer device, and storage medium | |
CN112206517A (en) | Rendering method, device, storage medium and computer equipment | |
CN108665510B (en) | Rendering method and device of continuous shooting image, storage medium and terminal | |
CN113409468A (en) | Image processing method and device, electronic equipment and storage medium | |
CN116797631A (en) | Differential area positioning method, differential area positioning device, computer equipment and storage medium | |
CN117455753B (en) | Special effect template generation method, special effect generation device and storage medium | |
CN117582661A (en) | Virtual model rendering method, device, medium and equipment | |
CN113487662A (en) | Picture display method and device, electronic equipment and storage medium | |
CN117593493A (en) | Three-dimensional face fitting method, three-dimensional face fitting device, electronic equipment and storage medium | |
CN116385615A (en) | Virtual face generation method, device, computer equipment and storage medium | |
CN113350792B (en) | Contour processing method and device for virtual model, computer equipment and storage medium | |
CN115761091A (en) | Game picture rendering method and device, electronic equipment and storage medium | |
CN116091745A (en) | Model transformation method, device, computer readable storage medium and computer equipment | |
CN115731339A (en) | Virtual model rendering method and device, computer equipment and storage medium | |
CN117523136B (en) | Face point position corresponding relation processing method, face reconstruction method, device and medium | |
CN112819938B (en) | Information processing method, device and computer readable storage medium | |
CN114416234B (en) | Page switching method and device, computer equipment and storage medium | |
CN115222863A (en) | Rendering method, device, medium and equipment of virtual model | |
CN115272432A (en) | Model information processing method, device, storage medium and computer equipment | |
CN115564880A (en) | Coloring method, coloring device, computer equipment and storage medium | |
CN115861519A (en) | Rendering method and device of hair model, computer equipment and storage medium | |
CN116328298A (en) | Virtual model rendering method and device, computer equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |