Method, device and electronic equipment for generating virtual model

By determining the direction of sight between the virtual camera and the model and combining the rendering and combining processing, the target model is generated, and the major system resource overhead caused by the complex jelly effect processing in the existing technology is solved, and an efficient and real jelly effect is achieved.

CN114494548BActive Publication Date: 2025-04-25NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111603106.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-24
Publication Date
2025-04-25
Estimated Expiration
2041-12-24

AI Technical Summary

Technical Problem

The jelly effect processing method used in the prior art for making virtual models is complex, resulting in large system resource overhead and unreal effects, making it difficult to meet the needs of mobile games and other applications.

Method used

By acquiring at least one model, the line of sight direction between the virtual camera and the model is determined, the model is rendered separately according to the line of sight direction, the rendered model is obtained, and the combination process is performed to generate a target model to adjust the lighting information on the model surface based on the position changes of the virtual camera.

Benefits of technology

The jelly effect production with a lower overhead is achieved, which avoids the major system resource overhead caused by complex processing methods in the prior art, and improves the authenticity and user experience of the model during movement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114494548B_ABST
    Figure CN114494548B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, device and electronic device for generating a virtual model. The method comprises: obtaining at least one model, wherein the at least one model is used to generate a target model in combination; determining the sight line direction between a virtual camera and the at least one model; rendering the at least one model according to the sight line direction to obtain at least one rendered model; combining and processing the at least one rendered model to generate the target model, so as to adjust the illumination information of the surface of the target model based on the position change of the virtual camera in the scene. The present invention solves the technical problem of large system resource overhead caused by the complexity of the processing method for producing the jelly effect of the virtual model in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer vision, and in particular to a method and device for generating a virtual model and electronic equipment. Background Art

[0002] Currently, there are often some short-lived effects in mobile games, such as bullets that flash by. In order to reflect the real picture, these virtual models that move or vibrate quickly relative to the camera are often added with jelly effects. However, the current processing methods for these virtual models are relatively complicated, which not only has low benefits, but also consumes a lot of system resources.

[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0004] The embodiments of the present invention provide a method, device and electronic device for generating a virtual model, so as to at least solve the technical problem of large system resource overhead caused by the complex processing method for the jelly effect of making the virtual model in the prior art.

[0005] According to one aspect of an embodiment of the present invention, there is provided a method for generating a virtual model, comprising: acquiring at least one model, wherein the at least one model is used to combine and generate a target model; determining a sight line direction between a virtual camera and the at least one model; rendering the at least one model according to the sight line direction to obtain at least one rendered model; and combining the at least one rendered model to generate a target model, so as to adjust the lighting information on the surface of the target model based on the position change of the virtual camera in the scene.

[0006] Furthermore, at least one model includes at least a first model and a second model, and the first model and the second model are nested to form a target model, wherein a shape of the first model is similar to a shape of the second model, and a volume of the first model is greater than a volume of the second model.

[0007] Furthermore, the method for generating a virtual model also includes: determining a camera position of a virtual camera in a scene; and obtaining a first sight line direction corresponding to the first model according to a direction vector between the camera position and each vertex of the first model.

[0008] Furthermore, the method for generating a virtual model also includes: determining a first normal direction corresponding to each vertex in the first model; determining a first reflection result corresponding to the first model based on the first sight direction and the first normal direction; inverting the first reflection result to obtain a second reflection result; obtaining a first transparency value of the first model from the second reflection result; blurring the edge of the first model based on the first transparency value, and generating a texture of the first model based on a preset texture map to obtain a rendered first model.

[0009] Furthermore, the method for generating a virtual model also includes: determining a camera position of the virtual camera in the scene; and obtaining a second sight line direction corresponding to the second model according to a direction vector between the camera position and each vertex of the second model.

[0010] Furthermore, the method for generating a virtual model also includes: determining a second normal direction corresponding to each vertex in the second model; determining a third reflection result corresponding to the second model based on the second sight line direction and the second normal direction; obtaining a second transparency value of the second model from the third reflection result; blurring the edge of the second model based on the second transparency value, and generating a texture of the second model based on a preset texture map to obtain a rendered second model.

[0011] Furthermore, the method for generating a virtual model also includes: combining at least one model according to the nesting order of at least one model to obtain an initial model; obtaining a preset highlight map; and performing highlight processing on the initial model based on the highlight map to obtain a target model.

[0012] According to another aspect of an embodiment of the present invention, a device for generating a virtual model is also provided, including: an acquisition module, used to acquire at least one model, wherein the at least one model is used to combine and generate a target model; a determination module, used to determine the line of sight direction between a virtual camera and at least one model; a rendering module, used to render at least one model according to the line of sight direction, respectively, to obtain at least one rendered model; and a combination module, used to combine the at least one rendered model to generate a target model, so as to adjust the lighting information on the surface of the target model based on the position change of the virtual camera in the scene.

[0013] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned method for generating a virtual model when running.

[0014] According to another aspect of an embodiment of the present invention, an electronic device is also provided, which includes one or more processors; a storage device for storing one or more programs, which, when the one or more programs are executed by the one or more processors, enables the one or more processors to run the programs, wherein the programs are configured to execute the above-mentioned method for generating a virtual model when running.

[0015] In an embodiment of the present invention, a target model is obtained by combining models rendered according to the sight line direction, and the sight line direction between the virtual camera and the at least one model is determined by acquiring at least one model, thereby rendering at least one model according to the sight line direction to obtain at least one rendered model, and then combining the at least one rendered model to generate the target model, so as to adjust the illumination information of the target model surface based on the position change of the virtual camera in the scene. At least one model is used to combine and generate the target model.

[0016] In the above process, since the target model is configured to be composed of multiple models, and each model is rendered according to the line of sight, the problem of high system overhead caused by using textures to produce jelly effects in the prior art is avoided. Furthermore, by combining and processing at least one rendered model to generate a target model to obtain a model with a jelly effect, the problem of high system overhead caused by using complex processing methods such as RayMarching technology to produce jelly effects is effectively avoided. In addition, in the present application, by rendering at least one model according to the line of sight, each model obtained can present a real effect when moving, thereby improving the user experience.

[0017] It can be seen that the solution provided in the present application achieves the purpose of combining the models rendered according to the line of sight direction to obtain the target model, thereby achieving the technical effect of producing jelly effects with lower overhead, and further solving the technical problem of high system resource overhead caused by the complex processing method of jelly effects used to produce virtual models in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0019] Figure 1 is a schematic diagram of an optional method for generating a virtual model according to an embodiment of the present invention;

[0020] Figure 2 is a schematic diagram of an optional first model or a second model according to an embodiment of the present invention;

[0021] Figure 3 is a schematic diagram of an optional nesting of a first model and a second model according to an embodiment of the present invention;

[0022] Figure 4 is a schematic diagram of an optional lake surface reflection and refraction according to an embodiment of the present invention;

[0023] Figure 5 is a schematic diagram of an optional line of sight and a normal line according to an embodiment of the present invention;

[0024] Figure 6 is a schematic diagram of an optional rendered second model according to an embodiment of the present invention;

[0025] Figure 7 is a schematic diagram of an optional initial model according to an embodiment of the present invention;

[0026] Figure 8 It is a schematic diagram of an optional virtual model generating device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0027] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0029] In the prior art, the jelly effect of the virtual model is usually achieved in the following manner:

[0030] (1) Use the particle system to launch a single or sequence of jelly images to simulate the jelly bullet effect.

[0031] (2) Use RayMarching technology to achieve the jelly effect.

[0032] Among them, the first technology uses a single-frame texture or sequence diagram to simulate the jelly effect, which makes the lighting of the jelly effect dull and lifeless, and the lighting information on the model will not change with the change of the lens, giving people a stiff and rigid feeling. The second technology, although it uses RayMarching technology to simulate the dynamic aspects of the jelly effect more naturally, it is very expensive and not suitable for mobile terminals, and the effect has a short existence time, high resource overhead, and low cost performance. In addition, if PBR (Physically-Based Rendering) or a more complex shader is used, it will also cause problems such as high system resource overhead, low benefits, and low cost performance. Therefore, in order to solve the above problems, a method for generating a virtual model is provided in the present application.

[0033] According to an embodiment of the present invention, an embodiment of a method for generating a virtual model is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0034] Figure 1 is a schematic diagram of an optional method for generating a virtual model according to an embodiment of the present invention, such as Figure 1 As shown, the method comprises the following steps:

[0035] Step S102, obtaining at least one model, wherein the at least one model is used to combine and generate a target model.

[0036] In step S102, at least one model may be obtained through electronic equipment, application system, computing equipment, etc. In this embodiment, at least one model is obtained through a computing device. Before obtaining at least one model, the computing device may build at least one model based on 3ds max software or other modeling software.

[0037] Optionally, the computing device may combine models to generate a target model based on a one-to-one nesting of models, or may combine models to generate a target model based on a plurality of models wrapped around one model, or may combine models to generate a target model based on a single model wrapped around multiple models, or in other ways.

[0038] It should be noted that by setting the target model to be composed of multiple models, that is, setting the target model to a multi-level structure, the multi-level visual expression of the jelly effect can be effectively matched, thereby facilitating the subsequent realization of the jelly effect.

[0039] Step S104: determining a sight line direction between the virtual camera and at least one model.

[0040] In step S104, the sight line direction between the virtual camera and at least one model may be the sight line direction between the virtual camera and each vertex on the model, or may be the sight line direction between the virtual camera and some of the vertices on the model.

[0041] It should be noted that in actual applications, the effect that the model should present is different due to different viewing directions. Therefore, by determining the viewing direction between the virtual camera and at least one model, the subsequent rendering of the model is facilitated, thereby making the effect presented by the model more realistic.

[0042] Step S106, rendering at least one model according to the sight direction to obtain at least one rendered model.

[0043] In step S106, the rendering performed by the computing device on at least one model may be used to set the transparency of the model, or may be used to set the local color of the model, set the local brightness of the model, or set other factors affecting the rendering effect of the model. At the same time, the computing device may render each model in the same or different manner, and at least one of the rendered models obtained is different from the other models.

[0044] It should be noted that, by rendering at least one model according to the sight direction, each model obtained can present a realistic effect when in motion, thereby improving the user experience.

[0045] Step S108: Combining the at least one rendered model to generate a target model, so as to adjust the illumination information of the surface of the target model based on the position change of the virtual camera in the scene.

[0046] In step S108, the computing device can combine the rendered models based on the aforementioned one-to-one nesting or one-to-many / many-to-one wrapping or other methods to generate a target model with a multi-level structure. On the one hand, the computing device can set a relatively transparent model on the outside, and set a model with local brightness or local color on the inside of the relatively transparent model to achieve a jelly effect. On the other hand, the computing device can also nest two relatively transparent models to achieve a jelly effect. In addition, the computing device can also combine the rendered models in other ways to achieve a jelly effect.

[0047] Furthermore, since there is a model that is rendered based on the sight direction, when the position of the virtual camera changes, the jelly effect presented by the target model will also change accordingly.

[0048] It should be noted that by combining the rendered models to generate a target model to obtain a model with a jelly effect, on the one hand, it can avoid the problem of high system overhead caused by using textures or complex processing methods such as RayMarching technology to produce jelly effects in the prior art; on the other hand, it can also make the lighting information on the model change with the change of the lens, thereby improving the authenticity of the jelly effect.

[0049] Based on the scheme defined in the above steps S102 to S108, it can be known that in the embodiment of the present invention, the target model is obtained by combining the models rendered according to the sight line direction, and the sight line direction between the virtual camera and the at least one model is determined by acquiring at least one model, thereby rendering at least one model according to the sight line direction to obtain at least one rendered model, and then combining the at least one rendered model to generate the target model, so as to adjust the illumination information of the target model surface based on the position change of the virtual camera in the scene. Among them, at least one model is used to combine and generate the target model.

[0050] It is easy to notice that in the above process, since the target model is configured to be composed of multiple models, and each model is rendered according to the line of sight, the problem of high system overhead caused by using textures to produce jelly effects in the prior art is avoided. Furthermore, by combining and processing at least one rendered model to generate a target model to obtain a model with a jelly effect, the problem of high system overhead caused by using complex processing methods such as RayMarching technology to produce jelly effects is effectively avoided. In addition, in the present application, by rendering at least one model according to the line of sight, each model obtained can present a real effect when in motion, thereby improving the user experience.

[0051] It can be seen that the solution provided in the present application achieves the purpose of combining the models rendered according to the line of sight direction to obtain the target model, thereby achieving the technical effect of producing jelly effects with lower overhead, and further solving the technical problem of high system resource overhead caused by the complex processing method of jelly effects used to produce virtual models in the prior art.

[0052] In an optional embodiment, at least one model includes at least a first model and a second model, and the first model and the second model are nested to form a target model, wherein the shape of the first model is similar to that of the second model, and the volume of the first model is greater than that of the second model.

[0053] Optionally, in this embodiment, the computing device produces a jelly effect on the bullet. The computing device can pre-create a first model and a second model, and nest the rendered first model and the second model to form a bullet model with a jelly effect (ie, a target model).

[0054] Specifically, the computing device may first draw a cylinder in the 3ds max software, and then adjust the shape using the FFd deformer to obtain the first model or the second model, wherein the first model and the second model may be Figure 2 The computing device can then copy and shrink the first model to obtain the second model, or copy and enlarge the second model to obtain the first model. The computing device then nests the larger first model on the second model. The nesting effect is as follows: Figure 3 As shown, the default mapping coordinates are grouped into a group to be imported into an engine for rendering the first model and the second model. The nesting relationship between the first model and the second model can be coaxial nesting (i.e., the axes coincide) or non-coaxial nesting.

[0055] It should be noted that by nesting the first model and the second model into a target model, it is easy to achieve the production of the jelly effect, while effectively reducing the amount of calculation and thus reducing resource usage.

[0056] In an optional embodiment, the computing device may first determine the camera position of the virtual camera in the scene, and then obtain the first line of sight direction corresponding to the first model based on the direction vector between the camera position and each vertex of the first model to determine the line of sight direction between the virtual camera and the first model.

[0057] Optionally, the computing device may determine the camera position of the virtual camera by obtaining the relative position or absolute position of the virtual camera in the scene. Similarly, the computing device may determine the model position of the first model by obtaining the relative position or absolute position of the first model in the scene, and then determine the vertex position of each vertex on the first model based on the model position.

[0058] Furthermore, by connecting the camera position with the positions of each vertex on the first model, the direction vector between the camera position and each vertex of the first model can be determined, and the obtained multiple direction vectors are the first sight directions between the virtual camera and the first model.

[0059] It should be noted that by obtaining the first sight line direction corresponding to the first model according to the direction vector between the camera position and each vertex of the first model, the first sight line direction can be determined quickly and accurately.

[0060] In an optional embodiment, the computing device may render the first model according to the sight direction based on the following method to obtain a rendered first model.

[0061] Optionally, the computing device first determines the first normal direction corresponding to each vertex in the first model, and then determines the first reflection result corresponding to the first model based on the first line of sight direction and the first normal direction, and then inverts the first reflection result to obtain a second reflection result, and obtains the first transparency value of the first model from the second reflection result. Finally, the edge of the first model is blurred based on the first transparency value, and the texture of the first model is generated based on a preset texture map, thereby obtaining the rendered first model.

[0062] Among them, firstly, the principle of determining the first reflection result corresponding to the first model based on the first sight line direction and the first normal direction is explained. Specifically, its core principle is the Fresnel effect. When light propagates from a medium with a refractive index of n1 to another medium with a refractive index of n2, reflection and refraction of light may occur simultaneously at the junction of the two. Figure 4 is a schematic diagram of an optional lake surface reflection and refraction according to an embodiment of the present invention, such as Figure 4 As shown, taking the phenomenon that occurs in real life as an example, people often go for a walk by the lake. The lake surface in the same place can be observed from different positions, and the effects presented in different positions are always different. For example, the lake water can be seen clearly from a close distance, but the lake surface is sparkling from a distance. This phenomenon occurs because when the line of sight is perpendicular to the interface, the reflection is weak, and when the line of sight and the interface form a certain angle, the smaller the angle, the more obvious the reflection. The Fresnel effect expresses the relationship between the above angle and the reflected light through a mathematical formula (refraction will also have an impact). The formula of the Fresnel equation is as follows:

[0063] R(θ)=R(0)+(1-R(0))*(1-cos(θ))^5

[0064] R(0)=(n1-n2) 2 / (n1+n2) 2

[0065] In the above equation, θ usually refers to the angle between the half-angle vector formed by adding the light source direction (the vector from the vertex to the light source) and the camera direction (the vector from the vertex to the camera) and the camera direction vector when there is light. If the influence of light is not considered, the half-angle vector can be replaced by the model normal, that is, the angle between the camera direction vector and the normal vector. R(0) represents the Fresnel reflection at 0 angle, n1 is the refractive index when the light source is usually air or vacuum, and n2 is the refractive index of the surface material. The refractive index varies depending on the material, such as: the refractive index of vacuum is 1.0, air is 1.000293, water is 1.333333, and diamond is 2.417. At present, computing devices will ignore the influence of refractive index when writing shading effects that describe the Fresnel effect, that is, set n1=n2, then R(θ) is equal to R(θ)=(1-cos(θ))^5, so as to reduce the amount of calculation. From the above description, it is not difficult to see that the Fresnel effect is affected by the angle between the line of sight and the surface. The smaller the angle with the surface, the stronger the reflection. Therefore, using this conclusion in the formula can be converted into: the larger the angle between the line of sight and the normal, the stronger the reflection. Specifically, the verification of this conclusion is as follows: Figure 5 is a schematic diagram of an optional sight line and normal line according to an embodiment of the present invention, such as Figure 5 As shown, when transitioning from point A to point B, the angle between the line of sight and the normal will become larger and larger. Assuming that the angle between AP and the normal NA at point A is 0, and the angle between BP and the normal NB at point B is 120 degrees (2π / 3), by substituting into the formula, we can obtain R(0)=0, R(2π / 3)=(1+0.5)^5≈7.6. This proves the conclusion that the larger the angle between the line of sight and the normal, the stronger the reflection. This further explains the rationality of determining the first reflection result corresponding to the first model based on the first line of sight direction and the first normal direction.

[0066] Specifically, the computing device may calculate the dot product based on each vertex normal (i.e., the first normal direction) and each sight line direction (i.e., the first sight line direction) of the first model in the scene to obtain the first reflection result. Optionally, the computing device may implement the calculation of the first reflection result based on the following code in the nx2 software:

[0067] float fresnel = dot(V,N);

[0068] return fresnel;

[0069] Wherein, V represents the first sight line direction, and N represents the first normal direction.

[0070] Furthermore, the computing device may implement inversion processing of the first reflection result based on the following code in the nx2 software to obtain the second reflection result:

[0071] float fresnel=1-dot(V,N);

[0072] Afterwards, the computing device directly outputs the second reflection result as an alpha value as the first transparency value of the first model, thereby blurring the edge of the first model based on the first transparency value. Optionally, the computing device may also perform power calculation in the aforementioned process to control the intensity of blurring the edge of the first model.

[0073] Next, the computing device may obtain a preset texture map from a database or other storage device to at least determine the texture of the first model. Meanwhile, the computing device may also determine the color of the first model based on the preset texture map, thereby obtaining the rendered first model.

[0074] It should be noted that by determining the first reflection result corresponding to the first model according to the first sight line direction and the first normal direction, accurate calculation of the first reflection result is achieved, thereby making the first transparency value determined based on the first reflection result more in line with the actual application scenario. Furthermore, by blurring the edge of the first model according to the first transparency value, transparent processing of the first model is achieved, so that the rendered first model can well show the characteristics of the jelly effect.

[0075] In an optional embodiment, the computing device may first determine the camera position of the virtual camera in the scene, and then obtain the second line of sight direction corresponding to the second model based on the direction vector between the camera position and each vertex of the second model to determine the line of sight direction between the virtual camera and the second model.

[0076] Optionally, the computing device can determine the camera position of the virtual camera by obtaining the relative position or absolute position of the virtual camera in the scene; similarly, the computing device can determine the model position of the second model by obtaining the relative position or absolute position of the second model in the scene, and then determine the vertex position of each vertex on the second model based on the model position.

[0077] Furthermore, by connecting the camera position with the positions of each vertex on the second model, the direction vector between the camera position and each vertex of the second model can be determined, and the obtained multiple direction vectors are the second sight lines between the virtual camera and the second model.

[0078] It should be noted that by obtaining the second sight line direction corresponding to the second model according to the direction vector between the camera position and each vertex of the second model, the second sight line direction can be determined quickly and accurately.

[0079] In an optional embodiment, the computing device may render the second model according to the sight direction based on the following method to obtain a rendered second model.

[0080] Optionally, the computing device first determines the second normal direction corresponding to each vertex in the second model, then determines the third reflection result corresponding to the second model based on the second line of sight direction and the second normal direction, and obtains the second transparency value of the second model from the third reflection result. Finally, the edge of the second model is blurred based on the second transparency value, and the texture of the second model is generated based on a preset texture map to obtain the rendered second model.

[0081] Specifically, the computing device may calculate the dot product based on each vertex normal (i.e., the second normal direction) and each sight line direction (i.e., the second sight line direction) of the second model in the scene to obtain the third reflection result. Optionally, the computing device may calculate the third reflection result based on the following code in the nx2 software:

[0082] float fresnel = dot(V,N);

[0083] return fresnel;

[0084] Wherein, V represents the second sight line direction, and N represents the second normal direction.

[0085] Afterwards, the computing device directly outputs the third reflection result as an alpha value as the first transparency value of the second model, thereby blurring the edge of the second model based on the second transparency value. Optionally, the computing device can also perform power calculation in the aforementioned process to control the intensity of blurring the edge of the second model.

[0086] Next, the computing device may obtain a preset texture map from a database or other storage device to at least determine the texture of the second model. At the same time, the color of the second model may also be determined based on the preset texture map, thereby obtaining a rendered second model. The schematic diagram of the rendered second model is shown in FIG. Figure 6 shown.

[0087] It should be noted that by determining the third reflection result corresponding to the second model according to the second sight line direction and the second normal direction, the third reflection result is accurately calculated, so that the second transparency value determined based on the third reflection result is more in line with the actual application scenario. Furthermore, by blurring the edge of the second model according to the second transparency value, the second model is made transparent, so that the rendered second model can well show the characteristics of the jelly effect.

[0088] In an optional embodiment, after the computing device obtains the rendered first model and the second model, the computing device may combine at least one model according to the nested order of at least one model to obtain an initial model. The schematic diagram of the initial model is as shown in FIG. Figure 7 Then, the preset highlight map is obtained, and finally, the initial model is subjected to highlight processing based on the highlight map to obtain the target model.

[0089] Specifically, in this embodiment, the computing device nests the rendered second model in the rendered first model, thereby obtaining an initial model with a jelly effect. Optionally, the computing device can obtain a preset highlight map from a database or other storage device, and emit a single or sequence highlight map based on the particle system to simulate highlights, thereby obtaining a target model with a jelly effect and highlights.

[0090] Optionally, since the bullet special effect only exists for a very short time, highlight processing of the initial model based on the highlight map can effectively reduce the amount of calculation of the computing device, thereby improving the realism of the model while ensuring the working efficiency of the computing device.

[0091] It should be noted that this application constructs two layers of models, the outer model uses a Fresnel effect and a highlight superposition blending mode, and the inner model uses 1 minus Fresnel as a transparent channel. By using some small production techniques and combining simple shaders to achieve a jelly effect that meets the functional requirements of the project, a low-cost jelly effect is achieved. On the one hand, this application has better results than traditional mapping, and on the other hand, it has better performance than complex physical materials.

[0092] It can be seen that the solution provided in the present application achieves the purpose of combining the models rendered according to the line of sight direction to obtain the target model, thereby achieving the technical effect of producing jelly effects with lower overhead, and further solving the technical problem of high system resource overhead caused by the complex processing method of jelly effects used to produce virtual models in the prior art.

[0093] According to an embodiment of the present invention, an embodiment of a device for generating a virtual model is provided, wherein: Figure 8 is a schematic diagram of an optional virtual model generation device according to an embodiment of the present invention, such as Figure 8 As shown, the device comprises:

[0094] An acquisition module 802 is used to acquire at least one model, wherein the at least one model is used to combine and generate a target model;

[0095] A determination module 804 is used to determine a sight line direction between the virtual camera and at least one model;

[0096] A rendering module 806, configured to render at least one model according to the sight line direction to obtain at least one rendered model;

[0097] The combination module 808 is used to combine the at least one rendered model to generate a target model, so as to adjust the illumination information of the surface of the target model based on the position change of the virtual camera in the scene.

[0098] It should be noted that the above-mentioned acquisition module 802, determination module 804, rendering module 806 and combination module 808 correspond to steps S102 to S108 in the above-mentioned embodiments, and the examples and application scenarios implemented by the four modules are the same as those of the corresponding steps, but are not limited to the contents disclosed in the above-mentioned method embodiments.

[0099] Optionally, at least one model includes at least a first model and a second model, and the first model and the second model are nested to form a target model, wherein a shape of the first model is similar to a shape of the second model, and a volume of the first model is greater than a volume of the second model.

[0100] Optionally, the determination module 804 also includes: a first sub-determination module, used to determine the camera position of the virtual camera in the scene; and a first processing module, used to obtain a first sight direction corresponding to the first model based on a direction vector between the camera position and each vertex of the first model.

[0101] Optionally, the rendering module 806 also includes: a second sub-determination module, used to determine the first normal direction corresponding to each vertex in the first model; a third sub-determination module, used to determine the first reflection result corresponding to the first model based on the first line of sight direction and the first normal direction; a second processing module, used to invert the first reflection result to obtain a second reflection result; a first sub-acquisition module, used to obtain the first transparency value of the first model from the second reflection result; a third processing module, used to blur the edge of the first model based on the first transparency value, and generate the texture of the first model based on a preset texture map to obtain the rendered first model.

[0102] Optionally, the determination module 804 also includes: a fourth sub-determination module, used to determine the camera position of the virtual camera in the scene; and a fourth processing module, used to obtain a second sight line direction corresponding to the second model based on a direction vector between the camera position and each vertex of the second model.

[0103] Optionally, the rendering module 806 also includes: a fifth sub-determination module, used to determine the second normal direction corresponding to each vertex in the second model; a sixth sub-determination module, used to determine the third reflection result corresponding to the second model based on the second line of sight direction and the second normal direction; a fifth processing module, used to obtain the second transparency value of the second model from the third reflection result; and a sixth processing module, used to blur the edge of the second model based on the second transparency value, and generate the texture of the second model based on a preset texture map to obtain the rendered second model.

[0104] Optionally, the combination module 808 also includes: a seventh processing module, used to combine at least one model according to the nested order of at least one model to obtain an initial model; a second sub-acquisition module, used to obtain a preset highlight map; and an eighth processing module, used to perform highlight processing on the initial model based on the highlight map to obtain a target model.

[0105] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is further provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned method for generating a virtual model when running.

[0106] According to another aspect of an embodiment of the present invention, an electronic device is also provided, which includes one or more processors; a storage device for storing one or more programs, which, when the one or more programs are executed by the one or more processors, enables the one or more processors to run the programs, wherein the program is configured to execute the above-mentioned method for generating a virtual model when running.

[0107] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0108] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0109] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be 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 interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0110] 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 units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0111] In addition, each functional unit in each embodiment of the present invention 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. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0112] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions 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 invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.

[0113] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A method for generating a virtual model, characterized in that: include: Acquire at least one model, wherein the at least one model is used to combine and generate a target model; determining a line of sight direction between the virtual camera and the at least one model; Rendering the at least one model according to the sight direction to obtain at least one rendered model; The at least one rendered model is combined to generate the target model, so as to adjust the illumination information of the surface of the target model based on the position change of the virtual camera in the scene.

2. The method according to claim 1, characterized in that The at least one model includes at least a first model and a second model, and the first model and the second model are nested to form the target model, wherein the shape of the first model is similar to that of the second model, and the volume of the first model is greater than that of the second model.

3. The method according to claim 2, characterized in that Determining a sight line direction between a virtual camera and the at least one model includes: Determining a camera position of the virtual camera in the scene; A first sight direction corresponding to the first model is obtained according to a direction vector between the camera position and each vertex of the first model.

4. The method according to claim 3, characterized in that Rendering the at least one model according to the sight direction to obtain the at least one rendered model includes: Determine a first normal direction corresponding to each vertex in the first model; Determine a first reflection result corresponding to the first model according to the first sight line direction and the first normal direction; Performing inversion processing on the first reflection result to obtain a second reflection result; Acquire a first transparency value of the first model from the second reflection result; The edge of the first model is blurred based on the first transparency value, and the texture of the first model is generated based on a preset texture map to obtain a rendered first model.

5. The method according to claim 2, characterized in that: Determining a sight line direction between a virtual camera and the at least one model includes: Determining a camera position of the virtual camera in the scene; A second sight line direction corresponding to the second model is obtained according to a direction vector between the camera position and each vertex of the second model.

6. The method according to claim 5, characterized in that Rendering the at least one model according to the sight direction to obtain the at least one rendered model includes: Determining a second normal direction corresponding to each vertex in the second model; Determine a third reflection result corresponding to the second model according to the second sight line direction and the second normal direction; Acquire a second transparency value of the second model from the third reflection result; The edge of the second model is blurred based on the second transparency value, and the texture of the second model is generated based on a preset texture map to obtain a rendered second model.

7. The method according to claim 2, characterized in that Combining the at least one rendered model to generate the target model includes: Combining the at least one model according to the nesting order of the at least one model to obtain an initial model; Get the preset specular map; The initial model is subjected to highlight processing based on the highlight map to obtain the target model.

8. A virtual model generation device, characterized in that: include: An acquisition module, used to acquire at least one model, wherein the at least one model is used to combine and generate a target model; A determination module, configured to determine a sight line direction between the virtual camera and the at least one model; A rendering module, used for rendering the at least one model according to the sight line direction to obtain at least one rendered model; A combination module is used to combine the at least one rendered model to generate the target model, so as to adjust the illumination information of the surface of the target model based on the position change of the virtual camera in the scene.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the method for generating a virtual model as claimed in any one of claims 1 to 7 when executed.

10. An electronic device, characterized in that: The electronic device includes one or more processors; a storage device for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to run the programs, wherein the programs are configured to execute the method for generating a virtual model described in any one of claims 1 to 7 when running.

Citation Information

Patent Citations

  • Real-time focus-changing light tracing rendering engine

    CN107665501A

  • Illumination map making and game model rendering method, and device and electronic equipment

    CN111632378A