Model rendering method and device, electronic equipment and computer readable storage medium

By obtaining material capture maps and spectral maps, combining the normal vectors of the three-dimensional model, determining and fusing laser effect parameters, the problem of unreal laser effect and high rendering overhead in the existing technology is solved, and efficient rendering of real laser effects is achieved.

CN120374822APending Publication Date: 2025-07-25NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510450603.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-10
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

When the prior art realizes laser effects, it is impossible to achieve real effects at the same time and the rendering overhead is large, especially by superimposing two independent materials, resulting in excessive rendering overhead.

Method used

By obtaining the material capture map, the screen normal vector and world normal vector of the three-dimensional model are based on the spectral map, the diffraction spectrum color parameters and laser effect parameters are determined, and the laser effect parameters are fused to obtain the laser effect parameters, and finally the three-dimensional model is rendered.

Benefits of technology

Real laser effect is achieved, while significantly reducing rendering overhead, reducing rendering state switching overhead between multi-material layers, and improving rendering efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120374822A_ABST
    Figure CN120374822A_ABST
Patent Text Reader

Abstract

The invention discloses a model rendering method and device, electronic equipment and a computer readable storage medium. According to the embodiment of the invention, a material capture map is acquired; based on the screen normal vector of the to-be-rendered three-dimensional model, sampling the material capture map to obtain a sampled color value; determining diffraction spectrum color parameters based on the sampled color values and the spectrum chartlet, and performing fusion processing on the diffraction spectrum color parameters and initial color parameters of the three-dimensional model to obtain first laser effect parameters of the three-dimensional model; determining a second laser effect parameter of the three-dimensional model based on the world normal vector and the spectrum map of the three-dimensional model; performing fusion processing on the first laser effect parameter and the second laser effect parameter to obtain a laser effect parameter; and the three-dimensional model is rendered based on the laser effect parameters to obtain the target three-dimensional model with the laser effect, so that the rendering overhead can be reduced while the authenticity of the laser effect is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular, to a model rendering method, apparatus, electronic device, and computer-readable storage medium. Background Art

[0002] In today's rapidly developing games, the progress of visual effects not only brings an unprecedented immersive experience to players, but also becomes an important symbol to distinguish the artistic value and technical achievements of a game. Among them, the visual effects can include laser effects.

[0003] Currently, the game rendering technologies for implementing laser effects mainly include two types. One is achieved through the Fresnel effect, and the other is achieved by superimposing two independent materials. However, when implementing the laser effect through the Fresnel effect, a real laser effect cannot be achieved. Although a real laser effect can be achieved by superimposing two independent materials, the rendering overhead consumed by the method of superimposing two independent materials is relatively large. Summary of the Invention

[0004] Embodiments of this application provide a model rendering method, apparatus, electronic device, and computer-readable storage medium, which can reduce the rendering overhead while achieving a real laser effect.

[0005] In a first aspect, an embodiment of this application provides a model rendering method, and the method includes:

[0006] Obtain a material capture texture map;

[0007] Based on the screen normal vector of the three-dimensional model to be rendered, perform sampling processing on the material capture texture map to obtain a sampled color value;

[0008] Based on the sampled color value and the spectral texture map, determine the diffraction spectrum color parameter, and perform fusion processing on the diffraction spectrum color parameter and the initial color parameter of the three-dimensional model to obtain the first laser effect parameter of the three-dimensional model;

[0009] Based on the world normal vector of the three-dimensional model and the spectral texture map, determine the second laser effect parameter of the three-dimensional model;

[0010] Perform fusion processing on the first laser effect parameter and the second laser effect parameter to obtain a laser effect parameter;

[0011] Based on the laser effect parameter, perform rendering processing on the three-dimensional model to obtain a target three-dimensional model with a laser effect.

[0012] In a second aspect, an embodiment of this application further provides a model rendering apparatus, and the apparatus includes:

[0013] A texture acquisition module for acquiring a material capture texture;

[0014] A texture sampling module for sampling the material capture texture based on the screen normal vector of the three-dimensional model to be rendered, and obtaining a sampled color value;

[0015] A first determination module for determining a diffraction spectrum color parameter based on the sampled color value and a spectral map, and performing a fusion process on the diffraction spectrum color parameter and the initial color parameter of the three-dimensional model to obtain a first laser effect parameter of the three-dimensional model;

[0016] A second determination module for determining a second laser effect parameter of the three-dimensional model based on the world normal vector of the three-dimensional model and the spectral map;

[0017] A fusion process module for performing a fusion process on the first laser effect parameter and the second laser effect parameter to obtain a laser effect parameter;

[0018] A model rendering module for rendering the three-dimensional model based on the laser effect parameter to obtain a target three-dimensional model with a laser effect.

[0019] In a third aspect, an embodiment of the present application further provides an electronic device, including a memory storing multiple instructions; the processor loads the instructions from the memory to execute any model rendering method provided by the embodiment of the present application.

[0020] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, where the computer-readable storage medium stores multiple instructions, and the instructions are suitable for being loaded by a processor to execute any model rendering method provided by the embodiment of the present application.

[0021] In the embodiment of the present application, a material capture texture map is obtained. Based on the screen normal vector of the three-dimensional model to be rendered, the material capture texture map is sampled to obtain a sampled color value. Based on the sampled color value and the spectral texture map, a diffractive spectral color parameter is determined. The diffractive spectral color parameter and the initial color parameter of the three-dimensional model are fused to obtain the first laser effect parameter of the three-dimensional model. Based on the world normal vector of the three-dimensional model and the spectral texture map, the second laser effect parameter of the three-dimensional model is determined. The first laser effect parameter and the second laser effect parameter are fused to obtain a laser effect parameter. Based on the laser effect parameter, the three-dimensional model is rendered to obtain a target three-dimensional model with a laser effect, realizing the determination of the laser effect parameter through the material capture texture map, simulating the real optical behavior of the laser surface microstructure changing with the light source position and the viewing angle, thereby realizing a real laser effect, and without determining the laser effect parameter through multiple material texture maps, the rendering overhead of the model can be reduced. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present application. For those skilled in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0023] Figure 1 is a schematic flowchart of an embodiment of the model rendering method provided by the embodiment of the present application;

[0024] Figure 2 is a scene diagram of the material capture texture map provided in the embodiment of the present application;

[0025] Figure 3 is a schematic diagram of the spectral texture map provided in the embodiment of the present application;

[0026] Figure 4 is a schematic diagram of the visual effect indicated by the initial color parameter, the visual effect indicated by the first laser effect parameter, the visual effect indicated by the second laser effect parameter, and the laser effect provided in the embodiment of the present application;

[0027] Figure 5 is a schematic structural diagram of the model rendering device provided by the embodiment of the present application;

[0028] Figure 6 is a schematic structural diagram of the electronic device provided by the embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0029] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of protection of the present application.

[0030] Before explaining the embodiments of the present application in detail, some terms related to the embodiments of the present application will be explained.

[0031] Among them, in the description of the embodiments of the present application, terms such as "first" and "second" may be used in this article to describe various concepts, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units does not necessarily limit to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0032] The embodiments of the present application provide a model rendering method, device, electronic device and computer-readable storage medium. Specifically, the model rendering method of the embodiments of the present application can be executed by an electronic device, where the electronic device can be a terminal or a server and other devices.

[0033] The terminal can be a smart phone, a tablet computer, a notebook computer, a touch screen, a game console, a personal computer (PC), a personal digital assistant (PDA) and other terminal devices. The terminal can also include a client, and the client can be a game application client, a browser client carrying a game program or an instant messaging client, etc.

[0034] The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery network (CDN), and big data and artificial intelligence platforms.

[0035] The following will be described in detail with reference to the accompanying drawings. It should be noted that the description order of the following embodiments does not limit the preferred order of the embodiments. Although the logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in an order different from that shown in the drawings.

[0036] In this embodiment, a terminal is taken as an example for illustration. This embodiment provides a model rendering method. As Figure 1 shown, the specific process of this model rendering method can be as follows:

[0037] 101. Obtain a material capture texture map.

[0038] Among them, the material capture texture map (Material Capture) can also be called a Matcap texture map. It is a real-time material rendering technology based on normal space mapping. The core idea is to simulate complex lighting effects through a pre-integrated spherical material texture map. The material capture texture map can be, for example, as Figure 2 shown.

[0039] Optionally, the terminal can obtain the material capture texture map from the local storage space, or the terminal can also obtain the material capture texture map from other devices. This embodiment does not make a limitation here.

[0040] Optionally, the terminal can obtain the material capture texture map when receiving a rendering instruction for a three-dimensional model to be rendered, or the terminal can also obtain the material capture texture map when obtaining the three-dimensional model to be rendered. This embodiment does not make a limitation here.

[0041] 102. Sample the material capture texture map based on the screen normal vector of the three-dimensional model to be rendered to obtain a sampled color value.

[0042] Among them, the three-dimensional model refers to a digital three-dimensional geometric body used to generate images or animations in computer graphics. It is a virtual object defined by mathematical descriptions and data structures, usually composed of vertices, edges, faces, and related attributes (such as textures, normals, etc.). The screen normal vector refers to the normal vector of the three-dimensional model in the screen space.

[0043] In the model loading stage of the rendering pipeline, the model data of the three-dimensional model to be rendered can be obtained. The model data includes the vertex coordinates of the three-dimensional model, the normal vector of the three-dimensional model in the model space, and the texture coordinates, etc. The terminal can first convert the normal vector of the three-dimensional model in the model space into the normal vector of the three-dimensional model in the world space through the world transformation matrix, and then convert the normal vector of the three-dimensional model in the world space into the normal vector of the three-dimensional model in the screen space through the view matrix to obtain the screen normal vector.

[0044] After obtaining the screen normal vector, the terminal can convert the XY components of the screen normal vector into UV texture coordinates, and then sample the material capture map based on the UV texture coordinates to obtain the sampled color value.

[0045] Since the texture coordinates obtained based on the screen normal vector can be automatically adjusted with the rotation of the viewing angle, as if the normal is always aligned with the current viewing direction, therefore, the color values sampled from the material capture map based on the texture coordinates are also different. When the camera angle changes, the sampled color values can form a continuous dispersion change on the surface of the 3D model, simulating the unique iridescent gradient characteristic of the laser material, thereby realizing the simulation of the real optical behavior of the microscopic structure of the laser surface changing with the light source position and viewing angle.

[0046] 103. Determine the diffraction spectrum color parameters based on the sampled color values and the spectral map, and perform a fusion process on the diffraction spectrum color parameters and the initial color parameters of the 3D model to obtain the first laser effect parameter of the 3D model.

[0047] Among them, the spectral map can also be called a rainbow gradient texture map, and the spectral map can be, for example, as Figure 3 shown. The diffraction spectrum color parameters are used to describe the optical performance of the tiny planes of the laser material under the diffraction and interference of ambient light in different directions. The initial color parameters are used to indicate the inherent color of the 3D model. The first laser effect parameter can also be called the base ambient light laser effect parameter.

[0048] The way to fuse the diffraction spectrum color parameters and the initial color parameters of the 3D model can be set according to the actual situation. For example, the diffraction spectrum color parameters and the initial color parameters of the 3D model can be fused by means of gamut fusion. The gamut fusion direction can be, for example, one of linear interpolation, additive mixing, and multiplicative mixing. This embodiment does not make a limitation here.

[0049] In some embodiments, determining the diffraction spectrum color parameters based on the sampled color values and the spectral map includes:

[0050] Perform a mapping process on the sampled color values to obtain the diffraction spectrum color parameters corresponding to the sampled color values in the spectral map.

[0051] Among them, the way to map the sampled color values can be set according to the actual situation. For example, the diffraction spectrum color parameters corresponding to the sampled color values in the spectral map can be obtained through a mapping table or a mapping function. This embodiment does not make a limitation here.

[0052] In this embodiment, by performing a mapping process on the sampled color values, the diffraction spectrum color parameters are obtained, realizing the obtaining of the diffraction spectrum color parameters through the mapping method, and improving the speed of obtaining the diffraction spectrum color parameters.

[0053] In some embodiments, based on the sampled color values and the spectral map, the diffraction spectral color parameters are determined, including:

[0054] Performing channel separation processing on the sampled color values to obtain sub-color values corresponding to at least two color channels;

[0055] Determining the initial diffraction spectral color parameters corresponding to the sub-color values in the spectral map;

[0056] Performing fusion processing on the initial diffraction spectral color parameters to obtain the diffraction spectral color parameters.

[0057] Among them, the color channels can be set according to the actual situation. For example, the color channels can include a first color channel, a second color channel, and a third color channel. The first color channel is, for example, the R channel, the second color channel is, for example, the G channel, and the third color channel is the B channel.

[0058] The sampled color values are composed of the channel values of at least two color channels. After performing channel separation processing on the sampled color values, the channel values of each color channel can be obtained, and the channel value of each color channel is the sub-color value corresponding to each color channel.

[0059] After obtaining the sub-color values, performing mapping processing on the sub-color values to obtain the initial diffraction spectral color parameters corresponding to the sub-colors in the spectral map, and performing fusion processing on the initial diffraction spectral color parameters of each color channel to obtain the diffraction spectral color parameters.

[0060] In this embodiment, performing channel separation processing on the sampled color values to obtain sub-color values corresponding to at least two color channels, determining the initial diffraction spectral color parameters corresponding to the sub-color values in the spectral map, and performing fusion processing on the initial diffraction spectral color parameters to obtain the diffraction spectral color parameters, realizing the determination of the diffraction spectral color parameters based on the sub-color values of each color channel, refining the dimension of determining the diffraction spectral color parameters, improving the accuracy of the diffraction spectral color parameters, and further improving the authenticity of the final laser effect.

[0061] In some embodiments, performing fusion processing on the initial diffraction spectral color parameters to obtain the diffraction spectral color parameters, including:

[0062] Obtaining the weight parameters corresponding to the color channels;

[0063] Based on the weight parameters, performing fusion processing on the initial diffraction spectral color parameters to obtain the diffraction spectral color parameters.

[0064] Among them, the weight parameters corresponding to each color channel can be preset coefficients, which can be set according to the actual situation, and are not limited in this embodiment.

[0065] Optionally, based on the weight parameter, the method of fusing the initial diffraction spectrum color parameters can be set according to the actual situation, which is not limited in this embodiment.

[0066] For example, the terminal can multiply the weight parameter corresponding to each color channel by the initial diffraction spectrum color parameter corresponding to that color channel and then add them up to obtain the diffraction spectrum color parameter.

[0067] For another example, the terminal can, based on the weight parameter corresponding to a certain color channel, fuse the initial diffraction spectrum color parameter corresponding to that color channel with the initial diffraction spectrum color parameter corresponding to another color channel to obtain a fusion result, and then, based on the weight parameter corresponding to the other color channel, fuse the fusion result with the initial diffraction spectrum color parameters corresponding to other color channels. This process is repeated until all the initial diffraction spectrum diffraction parameters are fused to obtain the diffraction spectrum color parameter.

[0068] In this embodiment, by obtaining the weight parameter corresponding to the color channel and fusing the initial diffraction spectrum color parameters based on the weight parameter to obtain the diffraction spectrum color parameter, the user can set the weight parameter according to their own needs, so that the obtained diffraction spectrum diffraction parameter is more in line with the user's requirements and the controllability of the laser effect is improved.

[0069] In some embodiments, the color channel includes a first color channel, a second color channel, and a third color channel. Fusing the initial diffraction spectrum color parameters based on the weight parameter to obtain the diffraction spectrum color parameter includes:

[0070] Based on the weight parameter corresponding to the first color channel, fusing the initial diffraction spectrum color parameter corresponding to the first color channel and the initial diffraction spectrum color parameter corresponding to the second color channel to obtain a first fusion color parameter;

[0071] Based on the weight parameter corresponding to the second color channel, fusing the first fusion color parameter and the initial diffraction spectrum color parameter corresponding to the third color channel to obtain the diffraction spectrum color parameter.

[0072] Among them, the first color channel can be any one of the R channel, the G channel, and the B channel. The second color channel can be any one of the R channel, the G channel, and the B channel. The third color channel can be any one of the R channel, the G channel, and the B channel. The first color channel, the second color channel, and the third color channel are all different. For example, the first color channel is the R channel, the second color channel is the G channel, and the third color channel is the B channel. Another example is that the first color channel is the G channel, the second color channel is the R channel, and the third color channel is the B channel.

[0073] It can be understood that in this embodiment, the weight parameter corresponding to the first color channel and the weight parameter corresponding to the second color channel are used for fusion processing, and it is not necessary to use the weight parameter corresponding to the third color channel for fusion processing. Therefore, the third color channel may or may not have a corresponding weight parameter. For the convenience of description, the weight parameter corresponding to the first color channel is called the first weight parameter, and the weight parameter corresponding to the second color channel is called the second weight parameter.

[0074] Optionally, the process of fusing the initial diffraction spectrum color parameter corresponding to the first color channel and the initial diffraction spectrum color parameter corresponding to the second color channel based on the weight parameter corresponding to the first color channel to obtain the first fusion color parameter can be as follows: Based on the first weight parameter, determine the first initial weight parameter. Multiply the initial diffraction spectrum color parameter corresponding to the first color channel by the first weight parameter to obtain a first result. Multiply the first initial weight parameter by the initial diffraction spectrum diffraction parameter corresponding to the second color channel to obtain a second result. Add the first result and the second result to obtain the first fusion color parameter, where the sum of the first weight parameter and the first initial weight parameter is 1.

[0075] The process of fusing the first fusion color parameter and the initial diffraction spectrum color parameter corresponding to the third color channel based on the weight parameter corresponding to the second color channel to obtain the diffraction spectrum color parameter can be as follows: Based on the second weight parameter, determine the second initial weight parameter. Multiply the first fusion color parameter by the second weight parameter to obtain a third result. Multiply the second initial weight parameter by the initial diffraction spectrum diffraction parameter corresponding to the third color channel to obtain a fourth result. Add the third result and the fourth result to obtain the diffraction spectrum color parameter, where the sum of the second weight parameter and the second initial weight parameter is 1.

[0076] In this embodiment, based on the weight parameters corresponding to the first color channel, the initial diffraction spectrum color parameters corresponding to the first color channel and the initial diffraction spectrum color parameters corresponding to the second color channel are fused to obtain the first fused color parameter. Based on the weight parameters corresponding to the second color channel, the first fused color parameter and the initial diffraction spectrum color parameters corresponding to the third color channel are fused to obtain the diffraction spectrum color parameters, realizing mixing the initial diffraction spectrum color parameters in sequence according to the weight parameters with a certain color channel as the base to obtain the diffraction spectrum color parameters, and further improving the authenticity of the laser effect obtained based on the diffraction spectrum color parameters.

[0077] 104. Determine the second laser effect parameter of the 3D model based on the world normal vector and the spectral texture map of the 3D model.

[0078] Among them, the world normal vector refers to the normal vector of the 3D model in the world space. The second laser effect parameter can also be called the specular laser effect parameter. The terminal can sample the spectral texture map based on the world normal vector to obtain the second laser effect parameter.

[0079] In some embodiments, determining the second laser effect parameter of the 3D model based on the world normal vector and the spectral texture map of the 3D model includes:

[0080] Determine the half-angle vector between the camera vector and the illumination vector of the 3D model;

[0081] Determine the target color value based on the half-angle vector and the world normal vector of the 3D model;

[0082] Determine the second laser effect parameter of the 3D model based on the target color value and the spectral texture map.

[0083] Among them, the camera vector of the 3D model refers to the vector starting from a certain point on the 3D model and pointing to the camera. The half-angle vector refers to the unit vector starting from a certain point on the 3D model and pointing to the intermediate direction between the light source direction and the viewing direction, where the light source direction is the direction indicated by the illumination vector and the viewing direction is the direction indicated by the camera vector. Specifically, the illumination vector and the camera vector can be added to obtain the target vector, and then the target vector is divided by the magnitude of the target vector to obtain the half-angle vector.

[0084] After obtaining the half-angle vector, the half-angle vector and the world normal vector are normalized and dot-multiplied to obtain the intensity distribution information of the specular area on the laser material surface. The intensity distribution information of the specular area on the laser material surface is the target color value. Finally, based on the target color value, the spectral texture map is sampled to obtain the second laser effect parameter.

[0085] In this embodiment, the half-way vector between the camera vector and the illumination vector of the 3D model is determined. Based on the half-way vector and the world normal vector of the 3D model, the target color value is determined. Based on the target color value and the spectral texture map, the second laser effect parameter of the 3D model is determined, realizing using the normalized dot product result of the half-way vector and the world normal vector as the highlight area, so as to obtain the second laser effect parameter characterizing the laser effect of the highlight area.

[0086] In some embodiments, determining the second laser effect parameter of the 3D model based on the target color value and the spectral texture map includes:

[0087] Performing a normalization mapping process on the target color value to obtain the mapped color value;

[0088] Using the mapped color value as the sampling coordinate to sample the spectral texture map to obtain the sampled spectral value;

[0089] Based on the sampled spectral value, determining the second laser effect parameter of the 3D model.

[0090] Among them, the normalization mapping process refers to mapping the target color value to a value between [0, 1]. Performing a normalization mapping process on the target color value to correspond to the change gradient of the highlight energy from the edge to the center. The sampled spectral value is the dispersion color value of the highlight area.

[0091] Since a continuous dispersion band from red light to blue-violet light is preset in the spectral texture map, therefore, using the mapped color value as the sampling coordinate to sample the spectral texture map can make the highlight area present a wavelength separation effect with the viewing angle. Specifically, a high mapped color value can sample the long-wave red parameter, a low mapped color value can sample the short-wave blue-violet parameter, and the intermediate area is a smooth transition color parameter between the long-wave red and the short-wave blue-violet determined according to the Fresnel effect.

[0092] In this embodiment, performing a normalization mapping process on the target color value to obtain the mapped color value, using the mapped color value as the sampling coordinate to sample the spectral texture map to obtain the sampled spectral value, and based on the sampled spectral value, determining the second laser effect parameter of the 3D model, realizing mapping the highlight area to a multi-order dynamic color value, then using the multi-order dynamic color value to sample the spectral texture map to obtain the dispersion color value of the highlight area, and finally based on the dispersion color value of the highlight area, determining the second laser effect parameter of the 3D model, further enhancing the authenticity of the laser effect obtained based on the second laser effect parameter.

[0093] In some embodiments, the sampled spectral value can be used as the second laser effect parameter of the 3D model, or, based on the sampled spectral value, determining the second laser effect parameter of the 3D model includes:

[0094] Perform a power operation on the sampled spectral values to obtain the second laser effect parameter of the three-dimensional model.

[0095] Among them, the sampled spectral values can be used as the base number, and the preset parameter can be used as the exponent for the power operation. The preset parameter is a pre-set value, and the user can set it according to their own needs.

[0096] In this embodiment, performing a power operation on the sampled spectral values to obtain the second laser effect parameter of the three-dimensional model realizes sharpening or softening the edges of the sampled spectral values through the power operation, so that while ensuring the physical optical laws, a controllable color offset space can be provided for the user.

[0097] 105. Perform a fusion process on the first laser effect parameter and the second laser effect parameter to obtain the laser effect parameter.

[0098] Among them, the way to perform the fusion process on the first laser effect parameter and the second laser effect parameter can be set according to the actual situation. For example, the first laser effect parameter and the second laser effect parameter can be fused through linear interpolation or additive mixing. This embodiment does not make a limitation here.

[0099] In this embodiment, based on the material capture map and the spectral map, the first laser effect parameter is obtained, and based on the spectral map, the second laser effect parameter is obtained. Then, the first laser effect parameter and the second laser effect parameter are fused to obtain the laser effect parameter with a complete laser effect having optical gradient characteristics, improving the authenticity of the laser effect.

[0100] In some embodiments, performing a fusion process on the first laser effect parameter and the second laser effect parameter to obtain the laser effect parameter includes:

[0101] Perform a normalization mapping process on the second laser effect parameter to obtain the target weight;

[0102] Based on the target weight, perform a fusion process on the first laser effect parameter and the second laser effect parameter to obtain the laser effect parameter.

[0103] Among them, the normalization mapping process refers to mapping the second laser effect parameter to a value in [0, 1]. Optionally, if the second laser effect parameter itself is a value in [0, 1], the normalization mapping process can be omitted. The laser effect parameter is used to indicate the visual effect of the laser material.

[0104] After the terminal obtains the target weight, based on the target weight, perform a linear interpolation process on the first laser effect parameter and the second laser effect parameter to obtain the laser effect parameter.

[0105] In this embodiment, by means of the target weight, the first laser effect parameter and the second laser effect parameter are non-uniformly superimposed, so that not only can the base color continuity of the ambient reflection be retained, but also the energy attenuation of the spectral dispersion in the highlight area can be simulated, and the user can also adjust the target weight to dynamically adjust the color shift.

[0106] 106. Render the three-dimensional model based on the laser effect parameter to obtain a target three-dimensional model with a laser effect.

[0107] Among them, the laser effect refers to the visual effect with a laser material. The laser effect is, for example, the visual effect of a holographic logo, the visual effect of rainbow metal, or the visual effect of a dynamic grating map.

[0108] For example, the visual effect indicated by the initial color parameter of the three-dimensional model can be as shown in Figure 4 401, the visual effect indicated by the first laser effect parameter can be as shown in Figure 4 402, the visual effect indicated by the second laser effect parameter can be as shown in Figure 4 403, and the visual effect indicated by the laser effect parameter (i.e., the laser effect) can be as shown in Figure 4 404.

[0109] In the related art, if the laser effect is achieved through the Fresnel effect, it cannot reflect the real optical behavior of the light source position change or the surface microstructure (such as the concave-convex diffraction grating), the color tomography and repetition occur, and the static spectrogram cannot cover the continuous dispersion change in the wide-angle or dynamic perspective, resulting in color jumps or pattern repetitions, so that the real laser effect cannot be achieved. If the laser effect is achieved by superimposing two independent materials (the material of physically based rendering (PBR) + the top-layer laser dyeing material), although the real laser effect can be achieved, however, the double-layer material rendering will frequently switch the drawing state, resulting in an excessive number of programmable shader instructions and a large rendering overhead, and when the scene contains multiple dynamic light sources, the calculation amount of the light contribution of the laser effect layer increases exponentially.

[0110] In this embodiment, based on the screen normal vector of the three-dimensional model to be rendered, the material capture texture is sampled to obtain the sampled color value. Based on the sampled color value and the spectral texture, the diffractive spectral color parameter is determined, and the diffractive spectral color parameter and the initial color parameter of the three-dimensional model are fused to obtain the first laser effect parameter of the three-dimensional model. Based on the world normal vector of the three-dimensional model and the spectral texture, the second laser effect parameter of the three-dimensional model is determined. The first laser effect parameter and the second laser effect parameter are fused to obtain the laser effect parameter. Based on the laser effect parameter, the three-dimensional model is rendered to obtain the target three-dimensional model with the laser effect, realizing the determination of the laser effect parameter through the material capture texture and simulating the real optical behavior of the microscopic structure of the laser surface changing with the light source position and the viewing angle, so as to achieve a real laser effect. And there is no need to determine the rendering state switching overhead between multiple material textures for the laser effect parameter, significantly reducing the GPU instruction scheduling load, thereby reducing the model rendering overhead. In addition, the model rendering method of this embodiment can be implemented on different platforms and has cross-platform compatibility (adapting to the host / mobile terminal). While ensuring a high-precision laser effect, it has wide applicability for rendering three-dimensional models in various games.

[0111] As can be seen from the above, in the embodiment of this application, the material capture texture is obtained. Based on the screen normal vector of the three-dimensional model to be rendered, the material capture texture is sampled to obtain the sampled color value. Based on the sampled color value and the spectral texture, the diffractive spectral color parameter is determined, and the diffractive spectral color parameter and the initial color parameter of the three-dimensional model are fused to obtain the first laser effect parameter of the three-dimensional model. Based on the world normal vector of the three-dimensional model and the spectral texture, the second laser effect parameter of the three-dimensional model is determined. The first laser effect parameter and the second laser effect parameter are fused to obtain the laser effect parameter. Based on the laser effect parameter, the three-dimensional model is rendered to obtain the target three-dimensional model with the laser effect, realizing the determination of the laser effect parameter through the material capture texture and simulating the real optical behavior of the microscopic structure of the laser surface changing with the light source position and the viewing angle, so as to achieve a real laser effect. And there is no need to determine the laser effect parameter through multiple material textures, which can reduce the model rendering overhead.

[0112] To better implement the above method, the embodiment of this application also provides a model rendering device. This model rendering device can be specifically integrated in an electronic device. For example, in this embodiment, taking the model rendering device specifically integrated in the terminal as an example, the model rendering device of the embodiment of this application will be described in detail. This embodiment provides a model rendering device, as Figure 5 shown, the model rendering device may include:

[0113] A texture acquisition module 501 for acquiring a material capture texture.

[0114] A texture sampling module 502 for sampling the material capture texture based on the screen normal vector of the 3D model to be rendered, obtaining a sampled color value.

[0115] A first determination module 503 for determining a diffraction spectrum color parameter based on the sampled color value and a spectral map, and performing a fusion process on the diffraction spectrum color parameter and the initial color parameter of the 3D model to obtain a first laser effect parameter of the 3D model.

[0116] A second determination module 504 for determining a second laser effect parameter of the 3D model based on the world normal vector of the 3D model and the spectral map.

[0117] A fusion processing module 505 for performing a fusion process on the first laser effect parameter and the second laser effect parameter to obtain a laser effect parameter.

[0118] A model rendering module 506 for rendering the 3D model based on the laser effect parameter to obtain a target 3D model with a laser effect.

[0119] In some embodiments, the first determination module 503 is specifically configured to:

[0120] Perform channel separation processing on the sampled color value to obtain sub-color values corresponding to at least two color channels;

[0121] Determine the initial diffraction spectrum color parameter corresponding to the sub-color value in the spectral map;

[0122] Perform a fusion process on the initial diffraction spectrum color parameter to obtain a diffraction spectrum color parameter.

[0123] In some embodiments, the first determination module 503 is specifically configured to:

[0124] Obtain a weight parameter corresponding to the color channel;

[0125] Based on the weight parameter, perform a fusion process on the initial diffraction spectrum color parameter to obtain a diffraction spectrum color parameter.

[0126] In some embodiments, the color channels include a first color channel, a second color channel, and a third color channel. The first determination module 503 is specifically configured to:

[0127] Based on the weight parameter corresponding to the first color channel, perform a fusion process on the initial diffraction spectrum color parameter corresponding to the first color channel and the initial diffraction spectrum color parameter corresponding to the second color channel to obtain a first fusion color parameter;

[0128] Based on the weight parameter corresponding to the second color channel, perform a fusion process on the first fusion color parameter and the initial diffraction spectrum color parameter corresponding to the third color channel to obtain the diffraction spectrum color parameter.

[0129] In some embodiments, the second determination module 504 is specifically configured to:

[0130] Determine the half-way vector between the camera vector and the illumination vector of the three-dimensional model;

[0131] Based on the half-way vector and the world normal vector of the three-dimensional model, determine the target color value;

[0132] Based on the target color value and the spectral texture map, determine the second laser effect parameter of the three-dimensional model.

[0133] In some embodiments, the second determination module 504 is specifically configured to:

[0134] Perform a normalization mapping process on the target color value to obtain the mapped color value;

[0135] Use the mapped color value as the sampling coordinate to sample the spectral texture map to obtain the sampled spectral value;

[0136] Based on the sampled spectral value, determine the second laser effect parameter of the three-dimensional model.

[0137] In some embodiments, the second determination module 504 is specifically configured to:

[0138] Perform a power operation process on the sampled spectral value to obtain the second laser effect parameter of the three-dimensional model.

[0139] In some embodiments, the fusion processing module 505 is specifically configured to:

[0140] Perform a normalization mapping process on the second laser effect parameter to obtain the target weight;

[0141] Based on the target weight, perform a fusion process on the first laser effect parameter and the second laser effect parameter to obtain the laser effect parameter.

[0142] In specific implementation, the above-mentioned modules can be implemented as independent entities, or can be combined arbitrarily to be implemented as the same or several entities. For the specific implementation manners and corresponding beneficial effects of the above-mentioned modules, reference can be made to the method embodiments described above, which will not be elaborated here.

[0143] Accordingly, an embodiment of the present application further provides an electronic device, which may be a terminal, and the terminal may be a terminal device such as a smart phone, a tablet computer, a notebook computer, a touch screen, a game console, a personal computer (PC), a personal digital assistant (PDA), etc. As Figure 6 shown, Figure 6 is a schematic structural diagram of the electronic device provided by the embodiment of the present application. The electronic device 600 includes a processor 601 with one or more processing cores, a memory 602 with one or more computer-readable storage media, and a computer program stored in the memory 602 and executable on the processor. Among them, the processor 601 is electrically connected to the memory 602. Those skilled in the art can understand that the structure of the electronic device shown in the figure does not constitute a limitation on the electronic device, and it may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0144] The processor 601 is the control center of the electronic device 600, connecting various parts of the entire electronic device 600 through various interfaces and lines. By running or loading software programs and / or modules stored in the memory 602, and calling data stored in the memory 602, it executes various functions of the electronic device 600 and processes data, thereby overall monitoring the electronic device 600.

[0145] In the embodiment of the present application, the processor 601 in the electronic device 600 will load the instructions corresponding to the processes of one or more application programs into the memory 602 according to the following steps, and the processor 601 will run the application programs stored in the memory 602 to implement various functions, such as:

[0146] Obtain a material capture map;

[0147] Based on the screen normal vector of the three-dimensional model to be rendered, sample the material capture map to obtain a sampled color value;

[0148] Based on the sampled color value and the spectral map, determine the diffraction spectral color parameters, and fuse the diffraction spectral color parameters with the initial color parameters of the three-dimensional model to obtain the first laser effect parameter of the three-dimensional model;

[0149] Based on the world normal vector of the three-dimensional model and the spectral map, determine the second laser effect parameter of the three-dimensional model;

[0150] Fuse the first laser effect parameter and the second laser effect parameter to obtain the laser effect parameter;

[0151] Render the 3D model based on the laser effect parameters to obtain a target 3D model with a laser effect.

[0152] For the specific implementation manners of the above operations and the corresponding beneficial effects, refer to the detailed description of the model rendering method above, which will not be elaborated here.

[0153] Optionally, as Figure 6 shown, the electronic device 600 further includes: a touch display screen 603, a radio frequency circuit 604, an audio circuit 605, an input unit 606, and a power supply 607. Among them, the processor 601 is electrically connected to the touch display screen 603, the radio frequency circuit 604, the audio circuit 605, the input unit 606, and the power supply 607 respectively. Those skilled in the art can understand that Figure 6 the structure of the electronic device shown in

[0154] The touch display screen 603 can be used to display a graphical user interface and receive operation instructions generated by a user's interaction with the graphical user interface. The touch display screen 603 may include a display panel and a touch panel. Among them, the display panel can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the electronic device. These graphical user interfaces can be composed of graphics, text, icons, videos, and any combination thereof. Optionally, the display panel can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. The touch panel can be used to collect touch operations of the user on or near it (such as operations of the user using a finger, a stylus, or any suitable object or accessory on or near the touch panel), and generate corresponding operation instructions, and the operation instructions execute the corresponding program. Optionally, the touch panel can include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the touch position of the user and detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the processor 601, and can receive and execute commands sent by the processor 601. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it transmits it to the processor 601 to determine the type of touch event. Subsequently, the processor 601 provides a corresponding visual output on the display panel according to the type of touch event. In the embodiments of the present application, the touch panel and the display panel can be integrated into the touch display screen 603 to implement input and output functions. However, in some embodiments, the touch panel and the touch panel can be implemented as two independent components to implement input and output functions. That is, the touch display screen 603 can also be used as part of the input unit 606 to implement the input function.

[0155] The radio frequency circuit 604 can be used to transmit and receive radio frequency signals to establish wireless communication with a network device or other electronic devices through wireless communication, and transmit and receive signals with the network device or other electronic devices.

[0156] The audio circuit 605 can be used to provide an audio interface between the user and the electronic device through a speaker and a microphone. The audio circuit 605 can transmit the electrical signal converted from the received audio data to the speaker, and the speaker converts it 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 605 and then converted into audio data. After the audio data is output to the processor 601 for processing, it is transmitted through the radio frequency circuit 604 to, for example, another electronic device, or the audio data is output to the memory 602 for further processing. The audio circuit 605 may also include an earphone jack to provide communication between a peripheral earphone and the electronic device.

[0157] The input unit 606 can be used to receive input numerical, character information or user feature information (such as fingerprint, iris, face information, etc.), and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.

[0158] The power supply 607 is used to supply power to each component of the electronic device 600. Optionally, the power supply 607 can be logically connected to the processor 601 through a power management system, so as to realize functions such as management of charging, discharging, and power consumption management through the power management system. The power supply 607 can also include any components such as one or more DC or AC power supplies, a recharge system, a power failure detection circuit, a power converter or inverter, and a power status indicator.

[0159] Although Figure 6 not shown in [description], the electronic device 600 may further include a camera, a sensor, a Wi-Fi module, a Bluetooth module, etc., which will not be elaborated here.

[0160] In the above embodiments, the descriptions of each embodiment have their own focuses. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0161] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions, or by controlling relevant hardware through instructions. The instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0162] For this reason, an embodiment of the present application provides a computer-readable storage medium, in which multiple computer programs are stored. The computer programs can be loaded by a processor to execute any model rendering method provided by the embodiment of the present application. For example, the computer program can execute the following steps:

[0163] Obtain a material capture map;

[0164] Based on the screen normal vector of the three-dimensional model to be rendered, sample the material capture map to obtain a sampled color value;

[0165] Based on the sampled color value and the spectral map, determine the diffraction spectral color parameters, and fuse the diffraction spectral color parameters with the initial color parameters of the three-dimensional model to obtain the first laser effect parameter of the three-dimensional model;

[0166] Based on the world normal vector of the three-dimensional model and the spectral map, determine the second laser effect parameter of the three-dimensional model;

[0167] Fuse the first laser effect parameter and the second laser effect parameter to obtain a laser effect parameter;

[0168] Render the three-dimensional model based on the laser effect parameter to obtain a target three-dimensional model with a laser effect.

[0169] For the specific implementation manners of the above operations and the corresponding beneficial effects, refer to the detailed description of the model rendering method above, and details are not described herein again.

[0170] Among them, the computer-readable storage medium may include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc, etc.

[0171] Since the computer program stored in the computer-readable storage medium can execute any model rendering method provided in the embodiments of the present application, the beneficial effects that can be achieved by any model rendering method provided in the embodiments of the present application can be realized. For details, refer to the previous embodiments and will not be elaborated herein again.

[0172] The above has introduced in detail a model rendering method, device, electronic device, and computer-readable storage medium provided by the embodiments of the present application. Specific examples are used in this article to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present application.

Claims

1. A model rendering method, characterized in that, The method includes: Obtaining a material capture texture map; Sampling the material capture texture map based on the screen normal vector of the 3D model to be rendered to obtain a sampled color value; Determining a diffraction spectrum color parameter based on the sampled color value and a spectral texture map, and performing a fusion process on the diffraction spectrum color parameter and the initial color parameter of the 3D model to obtain a first laser effect parameter of the 3D model; Determining a second laser effect parameter of the 3D model based on the world normal vector of the 3D model and the spectral texture map; Performing a fusion process on the first laser effect parameter and the second laser effect parameter to obtain a laser effect parameter; Performing a rendering process on the 3D model based on the laser effect parameter to obtain a target 3D model with a laser effect.

2. The model rendering method according to claim 1, wherein The determining a diffraction spectrum color parameter based on the sampled color value and a spectral texture map includes: Performing channel separation processing on the sampled color value to obtain sub-color values corresponding to at least two color channels; Determining an initial diffraction spectrum color parameter corresponding to the sub-color value in the spectral texture map; Performing a fusion process on the initial diffraction spectrum color parameter to obtain a diffraction spectrum color parameter.

3. The model rendering method according to claim 2, wherein The performing a fusion process on the initial diffraction spectrum color parameter to obtain a diffraction spectrum color parameter includes: Obtaining a weight parameter corresponding to the color channel; Performing a fusion process on the initial diffraction spectrum color parameter based on the weight parameter to obtain a diffraction spectrum color parameter.

4. The model rendering method according to claim 3, wherein, The color channel includes a first color channel, a second color channel, and a third color channel. The performing a fusion process on the initial diffraction spectrum color parameter based on the weight parameter to obtain a diffraction spectrum color parameter includes: Performing a fusion process on the initial diffraction spectrum color parameter corresponding to the first color channel and the initial diffraction spectrum color parameter corresponding to the second color channel based on the weight parameter corresponding to the first color channel to obtain a first fusion color parameter; Performing a fusion process on the first fusion color parameter and the initial diffraction spectrum color parameter corresponding to the third color channel based on the weight parameter corresponding to the second color channel to obtain a diffraction spectrum color parameter.

5. The model rendering method according to claim 1, wherein The determining a second laser effect parameter of the 3D model based on the world normal vector of the 3D model and the spectral texture map includes: Determining a half-way vector between the camera vector and the illumination vector of the 3D model; Determining a target color value based on the half-way vector and the world normal vector of the 3D model; Determining a second laser effect parameter of the 3D model based on the target color value and the spectral texture map.

6. The model rendering method according to claim 5, wherein The determining a second laser effect parameter of the 3D model based on the target color value and the spectral texture map includes: Performing a normalization mapping process on the target color value to obtain a mapped color value; Using the mapped color value as a sampling coordinate to sample the spectral texture map to obtain a sampled spectral value; Determining a second laser effect parameter of the 3D model based on the sampled spectral value.

7. The model rendering method according to claim 6, wherein Determining the second laser effect parameter of the three-dimensional model based on the sampled spectral values includes: Performing a power operation on the sampled spectral values to obtain the second laser effect parameter of the three-dimensional model.

8. The model rendering method according to any one of claims 1-7, characterized in that, The fusing the first laser effect parameter and the second laser effect parameter to obtain a laser effect parameter includes: Performing a normalization mapping process on the second laser effect parameter to obtain a target weight; Based on the target weight, fusing the first laser effect parameter and the second laser effect parameter to obtain a laser effect parameter.

9. A model rendering device, characterized in that, The device includes: A texture map acquisition module for acquiring a material capture texture map; A texture map sampling module for sampling the material capture texture map based on the screen normal vector of the three-dimensional model to be rendered to obtain sampled color values; A first determination module for determining a diffraction spectrum color parameter based on the sampled color values and a spectral texture map, and fusing the diffraction spectrum color parameter and the initial color parameter of the three-dimensional model to obtain the first laser effect parameter of the three-dimensional model; A second determination module for determining the second laser effect parameter of the three-dimensional model based on the world normal vector of the three-dimensional model and the spectral texture map; A fusion processing module for fusing the first laser effect parameter and the second laser effect parameter to obtain a laser effect parameter; A model rendering module for rendering the three-dimensional model based on the laser effect parameter to obtain a target three-dimensional model with a laser effect.

10. An electronic device, characterized in that, It includes a processor and a memory, and the memory stores multiple instructions; the processor loads the instructions from the memory to execute the model rendering method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores multiple instructions, and the instructions are suitable for being loaded by a processor to execute the model rendering method according to any one of claims 1 to 8.