Model rendering method, device, electronic device and storage medium

By calculating the target parameters of the virtual model and performing area division and color transition processing in non-realistic rendering mode, the problem of insufficient picture expressiveness in non-realistic rendering mode is solved, and the simulation of lighting effects and improvement of picture expressiveness are achieved.

CN115501589BActive Publication Date: 2025-09-26NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211188239.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-28
Publication Date
2025-09-26
Estimated Expiration
2042-09-28

AI Technical Summary

Technical Problem

In non-realistic rendering mode, the game screen is less expressive and it is not possible to enhance the screen effect by setting virtual light sources.

Method used

By obtaining the absolute world position of each pixel on the virtual model, calculating the target parameters, dividing the first and second areas, and performing smooth transition processing based on the color parameters of the areas, rendering using the target color parameters, and simulating the lighting effect.

Benefits of technology

In non-realistic rendering mode, the expressiveness of the picture is enhanced through color gradients, lighting effects are simulated, and the visual experience of the game screen is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115501589B_ABST
    Figure CN115501589B_ABST
Patent Text Reader

Abstract

The embodiments of the present application disclose a model rendering method, device, electronic device and storage medium; the method includes: obtaining the absolute world position of the virtual model to be processed; calculating the target parameters corresponding to each pixel point based on the input position parameters and the absolute world position; dividing the virtual model to be processed into a first area and a second area based on the target parameters corresponding to each pixel point; based on the first color parameters corresponding to the first area and the second color parameters corresponding to the second area, performing smooth transition processing on the boundary area between the first area and the second area to obtain the target color parameters; using the target color parameters, rendering the virtual model to be processed to obtain a virtual model with a color gradient effect, thereby improving the expressiveness of the rendered picture.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] With the popularization of computers and mobile smart terminals, games have become a common form of entertainment. As the scale of the game market continues to expand, users' requirements for game graphics are getting higher and higher. In physically based rendering, game developers can set virtual light sources to illuminate virtual models. The virtual models in the rendered images can show lighting effects, thereby enhancing the expressiveness of the images.

[0003] However, there is still a non-realistic rendering mode in game development. In this mode, it is impossible to enhance the expressiveness of the picture by setting a virtual light source, resulting in poor expressiveness of the picture obtained in the non-realistic rendering mode. Summary of the Invention

[0004] The embodiments of the present application provide a model rendering method, device, electronic device and storage medium, which can improve the expressiveness of the image obtained in the non-realistic rendering mode.

[0005] The present invention provides a model rendering method, including:

[0006] Acquire the absolute world position of the virtual model to be processed, where the absolute world position includes the world position of each pixel point on the virtual model to be processed;

[0007] Calculating a target parameter corresponding to each pixel point based on the input position parameter and the absolute world position, wherein the target parameter indicates a relative position of the pixel point and the position parameter;

[0008] Dividing the virtual model to be processed into a first area and a second area based on the target parameter corresponding to each pixel point;

[0009] Based on a first color parameter corresponding to the first area and a second color parameter corresponding to the second area, performing a smooth transition process on a boundary area between the first area and the second area to obtain a target color parameter;

[0010] The target color parameter is used to render the virtual model to be processed.

[0011] The present invention also provides a model rendering device, including:

[0012] An acquisition module, configured to acquire an absolute world position of the virtual model to be processed, wherein the absolute world position includes a world position of each pixel point on the virtual model to be processed;

[0013] a calculation module, configured to calculate a target parameter corresponding to each pixel point based on an input position parameter and the absolute world position, wherein the target parameter indicates a relative position of the pixel point to the position parameter;

[0014] a dividing module, configured to divide the virtual model to be processed into a first area and a second area based on a target parameter corresponding to each pixel point;

[0015] a smoothing module, configured to perform a smooth transition process on a boundary area between the first area and the second area based on a first color parameter corresponding to the first area and a second color parameter corresponding to the second area, to obtain a target color parameter;

[0016] A rendering module is used to render the virtual model to be processed using the target color parameters.

[0017] An embodiment of the present application also provides an electronic device, including a memory storing multiple instructions; the processor loads instructions from the memory to execute the steps in any one of the model rendering methods provided in the embodiment of the present application.

[0018] An embodiment of the present application also provides a computer-readable storage medium, which stores multiple instructions, and the instructions are suitable for a processor to load to execute the steps in any model rendering method provided in the embodiment of the present application.

[0019] The embodiment of the present application can obtain the world position of each pixel on the virtual model to be processed, and calculate the target parameter corresponding to each pixel in combination with the input position parameter, and then divide the virtual model to be processed into a first area and a second area based on the target parameter; then, based on the first color parameter corresponding to the first area and the second color parameter corresponding to the second area, a smooth transition process is performed on the boundary area between the first area and the second area to obtain the target color parameter, and the target color parameter is used to render the virtual model to be processed so as to achieve a color gradient effect on the virtual model to be processed. Among them, the input position parameter can determine the division of the first area and the second area, that is, the position of the color gradient effect is different when the input position parameter is different, so that in the non-realistic rendering mode, the expressiveness of the rendered picture can be enhanced by color gradient at any position. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0021] Figure 1 This is a scene diagram of the model rendering method provided in an embodiment of the present application;

[0022] Figure 2 This is a flow chart of the model rendering method provided in the embodiment of the present application;

[0023] Figure 3 This is a schematic diagram of the regional division provided in the embodiment of the present application;

[0024] Figure 4 This is a schematic diagram of the overlap of the virtual mask and the virtual model to be processed provided by an embodiment of the present application;

[0025] Figure 5 This is another schematic diagram of the overlap of the virtual mask and the virtual model to be processed provided by an embodiment of the present application;

[0026] Figure 6 This is a schematic diagram of the color gradient effect when the virtual mask is not enabled according to an embodiment of the present application;

[0027] Figure 7 This is a schematic diagram of the color gradient effect when the virtual mask is enabled according to an embodiment of the present application;

[0028] Figure 8 is a flowchart of a model rendering method provided by another embodiment of the present application;

[0029] Figure 9 is a schematic diagram of a sequencer provided in an embodiment of the present application;

[0030] Figure 10 This is a schematic diagram of the structure of the model rendering device provided in an embodiment of the present application;

[0031] Figure 11 It is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0032] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without making creative efforts are within the scope of protection of this application.

[0033] Embodiments of the present application provide a model rendering method, device, electronic device, and storage medium.

[0034] The model rendering device can be integrated into an electronic device, such as a terminal or a server. The terminal can be a mobile phone, tablet computer, smart Bluetooth device, laptop computer, or personal computer (PC); the server can be a single server or a server cluster consisting of multiple servers.

[0035] In some embodiments, the model rendering device can also be integrated into multiple electronic devices. For example, the model rendering device can be integrated into multiple servers, and the model rendering method of the present application can be implemented by multiple servers.

[0036] For example, reference Figure 1 , shows a schematic diagram of an application scenario for implementing a model rendering method provided by an embodiment of the present application. The scenario may include a terminal device 1000, a server 2000, a database 3000, and a network 4000. The terminal 1000 held by the user can be connected to the server 2000 through the network 4000. Among them, the terminal device 1000 is any device with computing hardware that can support and execute software products corresponding to the page display; the server 2000 can be a single server or a server cluster; the network 4000 can be a wireless network or a wired network, such as a wireless network such as a wireless local area network (WLAN), a local area network (LAN), a cellular network, a 2G network, a 3G network, a 4G network, a 5G network, etc. In addition, different terminal devices 1000 can also use their own Bluetooth network or hotspot network to connect to other terminals or to the server 2000. The database 3000 is used to store data generated when the user uses the terminal device 1000 to render the model.

[0037] When the terminal device 1000 executes the model rendering method, the terminal device 1000 can obtain the absolute world position of the virtual model to be processed, and the absolute world position includes the world position of each pixel point on the virtual model to be processed; according to the input position parameter and the absolute world position, calculate the target parameter corresponding to each pixel point, and the target parameter indicates the relative position of the pixel point and the position parameter; based on the target parameter corresponding to each pixel point, divide the virtual model to be processed into a first area and a second area; based on the first color parameter corresponding to the first area and the second color parameter corresponding to the second area, perform smooth transition processing on the boundary area between the first area and the second area to obtain the target color parameter; use the target color parameter to render the virtual model to be processed.

[0038] It's important to note that physically based rendering (PBR) leverages real-world principles and theories, using various mathematical methods to derive, simplify, or simulate a series of rendering equations. This approach then relies on computer hardware and graphics APIs to render images that approximate real-world conditions. In PBR mode, virtual light sources can typically be set to simulate real-world lighting environments, allowing virtual models under these virtual light sources to exhibit delicate lighting effects, enhancing the expressiveness of rendered images.

[0039] Non-photorealistic Rendering (NPR) mode is a rendering mode relative to the PBR model, which mainly simulates artistic effects and is also called stylized rendering. In NPR mode, the rendering code is usually customized and will not participate in the PBR rendering logic at the bottom of the engine, resulting in the virtual model in NPR mode not being affected by the virtual light source. In order to make the virtual model in NPR mode also present the lighting effect, the solution provided in the embodiment of the present application can be adopted to simulate the lighting effect of the virtual model under the virtual light source through the effect of color gradient to enhance the expressiveness of the picture rendered in NPR mode. The following are detailed descriptions.

[0040] In this embodiment, a model-based rendering method is provided, such as Figure 2 As shown, the specific process of the model rendering method can be as follows:

[0041] S110 : Acquire the absolute world position of the virtual model to be processed, where the absolute world position includes the world position of each pixel point on the virtual model to be processed.

[0042] The virtual model to be processed refers to a virtual model waiting to be processed, and the absolute world position refers to the world position of a pixel. The absolute world position of the virtual model to be processed may include the world position of each pixel on the virtual model to be processed.

[0043] The world position of each pixel refers to the position coordinates of each pixel in the world coordinate system, where the world coordinate system is a global coordinate system, that is, any virtual model in the virtual scene where the virtual model to be processed is located can find the corresponding position coordinates in the world coordinate system.

[0044] It is understood that there are multiple pixels on the virtual model to be processed, and the absolute world position includes the world position of each pixel on the virtual model to be processed. Therefore, the absolute world position is the collection of the world positions of multiple pixels. For example, if there are n pixels on the virtual model to be processed, the absolute world position of the virtual model to be processed may include the world positions of n pixels.

[0045] S120. Calculate a target parameter corresponding to each pixel point based on the input position parameter and the absolute world position, where the target parameter indicates a relative position of the pixel point and the position parameter.

[0046] Position parameters are parameters that developers input based on actual needs and can be used to control the position of the simulated light effect (i.e., gradient effect) on the virtual model being processed. These position parameters can include translation parameters, rotation parameters, and scale parameters. Translation parameters can be used to control the position of the gradient effect, rotation parameters can be used to control the angle of the gradient effect, and scale parameters can be used to control the size of the gradient effect.

[0047] The input position parameter can be used to indicate a location point in the world coordinate system, and the target parameter can be used to indicate the relative position of a pixel point on the virtual model to be processed and the location point. The relative position can be the angle between the vector corresponding to the pixel point and the vector corresponding to the location point.

[0048] After obtaining the input position parameters, the target parameters corresponding to each pixel on the virtual model to be processed can be calculated based on the position parameters and the absolute world position. In some embodiments, a first vector corresponding to each pixel can be calculated based on the world position of a preset point and the world position of each pixel on the virtual model to be processed; a second vector can be determined based on the input position parameters; and the dot product of the first vector corresponding to each pixel and the second vector can be calculated to obtain the target parameter corresponding to each pixel.

[0049] The preset point may be a pre-set point, which may be the origin of the world coordinate system or another point. The specific setting may be based on actual needs. In the embodiment of the present application, the preset point is used as the origin of the world coordinate system as an example for detailed description. The first vector is a vector constructed based on the world position of the pixel point, and the second vector is a vector constructed based on the input position parameter.

[0050] Based on the world position of the preset point and the world position of each pixel on the virtual model to be processed, a first vector corresponding to each pixel can be calculated. For example, the preset point is denoted as point O, and the pixels on the virtual model to be processed are denoted as a set A, which may include pixels A1, A2, A3, ..., and An. When calculating the first vector corresponding to each pixel, the world position of each pixel can be subtracted from the world position of the preset point.

[0051] For example, if the world position of point O is (0,0,0,0) and the world position of pixel A1 is (x1,y1,z1,α1), then the vector OA1 pointing from point O to point A1 is (x1-0,y1-0,z1-0,α1-0). Using this calculation method, we can get the first vector corresponding to each pixel.

[0052] Determine a second vector based on an input position parameter. The input position parameter may indicate a position point in a world coordinate system. Determine the second vector by placing an arrow component at the input position parameter and determining the second vector based on a direction indicated by the arrow component.

[0053] An arrow component refers to an arrow. The direction vector corresponding to the direction indicated by the arrow component can be directly determined as the second vector. The direction vector corresponding to the direction indicated by the arrow component usually refers to the forward vector of the arrow component. In specific implementation, the arrow component can be processed through the GetForwardVector node to obtain the second vector.

[0054] After obtaining the second vector and the first vector corresponding to each pixel, in order to calculate the relative position of the input position parameter and the pixel, the angle between each first vector and the second vector may be calculated.

[0055] As an implementation method, the dot product between the first vector and the second vector can be calculated, where the dot product refers to the cosine value of the angle between the first vector and the second vector. Therefore, by calculating the dot product, the angle between the first vector and the second vector can be determined.

[0056] For example, if vector OA1 is (x1, y1, z1, α1) and vector OB is (x0, y0, z0, α0), then the dot product between OA1 and OB can be expressed as: dot(OA1, OB) = x1 x0 + y1 y0 + z1 z0 + α1 α0. This calculation method can be used to calculate the target parameters corresponding to each pixel.

[0057] In some embodiments, the target parameter indicates the relative position of the pixel point and the position parameter, and the relative position may refer to determining the positional relationship between the pixel point and the virtual plane corresponding to the position parameter, for example, the pixel point is on the virtual plane corresponding to the position parameter, or the pixel point is on one side of the virtual plane corresponding to the position parameter, or the pixel point is on the other side of the virtual plane corresponding to the position parameter, wherein the first side and the second side are the two sides of the virtual plane, respectively.

[0058] Thus, the plane equation of the virtual plane corresponding to the position parameter can be determined first. For example, the intersection of the first vector and the second vector can be calculated first, and then the plane equation of the virtual plane can be calculated based on the second vector and the intersection. The virtual plane passes through the intersection and is perpendicular to the second vector. After obtaining the plane equation of the virtual plane, the world position of each pixel can be substituted into the plane equation to obtain the target parameter.

[0059] S130 : Divide the virtual model to be processed into a first area and a second area based on the target parameter corresponding to each pixel point.

[0060] The first region and the second region are regions on the virtual model to be processed, wherein the first region and the second region are regions divided based on the target parameters corresponding to the pixels. For example, the first region may be defined as the region containing all pixels in the virtual model to be processed whose target parameters are greater than a preset parameter, and the second region may be defined as the region containing all pixels in the virtual model to be processed whose target parameters are less than the preset parameter.

[0061] Among them, the target parameter calculated by the dot product method can represent the cosine value of the angle between the first vector and the second vector. Based on mathematical knowledge, it is known that the cosine value is greater than 0 in the interval [0,π / 2), less than 0 in the interval (π / 2,π), and equal to 0 at π / 2. Therefore, if the dot product is greater than 0, it indicates that the angle between the first vector and the second vector is an acute angle; if the dot product is less than 0, it indicates that the angle between the first vector and the second vector is an obtuse angle; if the dot product is equal to 0, it indicates that the angle between the first vector and the second vector is a right angle.

[0062] The preset parameter can be set to 0, and pixels with a dot product greater than 0 can be recorded as first pixels, and pixels with a dot product less than 0 can be recorded as second pixels. Then, the area formed by all the first pixels on the virtual model to be processed is determined as the first area, and the area formed by all the second pixels on the virtual model to be processed is determined as the second area.

[0063] To understand the division between the first and second regions, please refer to Figure 3 , shows a schematic diagram of region division. Among them, vector OB is the second vector, vector OA1 is the first vector corresponding to a pixel point, and the intersection of the first vector and the second vector is point O. At this time, a virtual plane β can be introduced, which passes through point O and is perpendicular to vector OB. If the dot product between vector OB and vector OA1 is greater than 0, it indicates that the angle between vector OB and vector OA1 is an acute angle, and point A1 is located above the virtual plane β, as shown in the figure. Figure 3A1 is shown in . If the dot product between vector OB and vector OA1 is less than 0, the angle between vector OB and vector OA1 is obtuse, and point A1 is located below virtual plane β. If the dot product between vector OB and vector OA1 is equal to 0, the angle between vector OB and vector OA1 is right angle, and point A1 is located on virtual plane β.

[0064] That is, the virtual model to be processed can be divided into a first area and a second area by using the virtual plane β as a dividing plane.

[0065] If the target parameter is a value calculated using the plane equation of the virtual plane, the positional relationship between the pixel point and the virtual plane can be determined directly based on the target parameter. For example, if the plane equation of the virtual plane is ax+by+cz+d=0, the world position of each pixel point can be substituted into ax+by+cz+d to calculate the target parameter. If the target parameter is greater than 0, it indicates that the pixel point is on one side of the virtual plane; if the target parameter is less than 0, it indicates that the pixel point is on the other side of the virtual plane; if the target parameter is equal to 0, it indicates that the pixel point is on the virtual plane. Similarly, the virtual model to be processed can be divided into a first area and a second area according to the virtual plane.

[0066] S140 : Based on a first color parameter corresponding to the first area and a second color parameter corresponding to the second area, perform a smooth transition process on a boundary area between the first area and the second area to obtain a target color parameter.

[0067] After calculating the target parameters corresponding to each pixel point, the virtual model to be processed can be divided into a first area and a second area. Based on the above process of dividing the first area and the second area, it can be known that the boundary area between the first area and the second area is the virtual plane β.

[0068] In some embodiments, in order to calculate the target color parameters, a maximum parameter and a minimum parameter can be obtained; based on the maximum parameter and the minimum parameter, the color parameters of the boundary area between the first area and the second area are interpolated to obtain the interpolated color parameters; based on the first color parameter corresponding to the first area and the second color parameter corresponding to the second area, the interpolated color parameters are updated to obtain the target color parameters.

[0069] When calculating the target color parameter, the smoothstep function can be used. The smoothstep function allows interpolation between 0 and 1, and can set minimum and maximum thresholds. The smoothstep function can include a maximum parameter and a minimum parameter, where the maximum parameter defines the upper boundary of the interpolation; the minimum parameter defines the lower boundary of the interpolation.

[0070] Among them, if the maximum value parameter is recorded as max, the minimum value parameter is recorded as min, the source data for interpolation is recorded as x, and the output of the smoothstep function is recorded as y, the specific calculation of the smoothstep function can be expressed as the following formula:

[0071] x=clamp((x-min) / (max-min));

[0072] y=3x 2 -2x 3 ;

[0073] Based on the above formula, the color parameters of the boundary area can be interpolated. If x is less than the minimum parameter, smoothstep returns 0; if x is greater than the maximum parameter, smoothstep returns 1. 0 defaults to black, and 1 defaults to white. This allows for a smooth transition from 1 to 0.

[0074] After processing the smoothstep function, the interpolated color parameters can be obtained. At this time, the virtual model to be processed can present two colors, black and white, among which the boundary area between black and white presents a color gradient effect, that is, the interpolated color parameters can achieve a black and white color gradient effect.

[0075] To achieve different color gradients, you can obtain the first color parameter corresponding to the first area and the second color parameter corresponding to the second area. Both the first and second color parameters can be set according to actual needs. The interpolated color parameters are updated using the first and second color parameters to obtain the target color parameters. In other words, smoothstep interpolates between black and white by default. After obtaining the first and second color parameters, you can interpolate between the first and second color parameters to obtain the target color parameters.

[0076] As an implementation method, the target parameter corresponding to each pixel point obtained by calculation can be used as the source data for interpolation processing of smoothstep, and then interpolation processing is performed in the boundary area with black and white to achieve black and white color gradient, and then the first color value and the second color value are written through the gradient mask to achieve color gradient from the first color value to the second color value.

[0077] S150: Rendering the virtual model to be processed using the target color parameters.

[0078] After the target color parameters are calculated, the target color parameters can be used to render the virtual model to be processed, thereby obtaining the virtual model to be processed with a color gradient effect.

[0079] It's important to note that the above methods are all implemented within the material functions of virtual models. In game development, each type of virtual model uses a single parent material. For example, all character virtual models share the same parent material, and all prop virtual models share the same parent material. Modifying a material's contents will affect all virtual models using that parent material. However, in game development, you may only need to enable gradient effects for the materials of some virtual models.

[0080] Therefore, in some embodiments, a gradient effect can be enabled for the material of a virtual model within a specific area based on a virtual mask. For example, when rendering a virtual model to be processed using target color parameters, a virtual mask can be generated on the virtual model to be processed based on the absolute world position and the input mask parameters; a target rendering area can be determined on the virtual model to be processed based on the virtual mask; and the target color parameters can be used to render the virtual model to be processed within the target rendering area.

[0081] The mask is also called a mask. The essence of the mask is to calculate 0 and 1 through the material to determine whether the model is displayed or not. 0 means display and 1 means no display. The input mask parameters refer to the parameters related to the mask input by the developer. The mask used in the embodiment of the present application is a 3D rectangular mask. In actual use, it can be adjusted according to actual needs and is not specifically limited here.

[0082] As an implementation, the Boxmask-3D function can be used to draw a rectangular mask in a specific space using vector operations in three-dimensional space. To generate a virtual mask, mask parameters may include the absolute world position, the world position of the mask, the mask volume, and the mask feathering strength. The absolute world position refers to the absolute world position of the virtual model to be processed, the world position of the mask refers to the position of the mask center in the world coordinate system, the mask volume refers to the size of the rectangular mask, and the mask feathering strength refers to the smoothness of the mask's edges.

[0083] Typically, the mask's world position in the mask parameters controls its position in the world coordinate system, the mask's volume controls its size, and the mask's feathering strength controls the smoothness of its edges. After obtaining the mask parameters, a rectangular mask can be generated using the Boxmask-3D function. Then, by applying the material to the virtual model being processed, a virtual mask can be generated on the model.

[0084] According to the generated virtual mask, a target rendering area can be determined on the virtual model to be processed, and only the virtual model to be processed within the target rendering area is rendered.

[0085] It is understood that after the virtual mask and the virtual model to be processed overlap, overlapping areas and non-overlapping areas may appear. Therefore, the overlapping area or the non-overlapping area can be determined as the target rendering area. Then, in some embodiments, the target rendering area can be determined on the virtual model to be processed based on the virtual mask. If the virtual mask is not inverted, the area on the virtual model to be processed that does not overlap with the virtual mask is determined as the target rendering area; if the virtual mask is inverted, the area on the virtual model to be processed that overlaps with the virtual mask is determined as the target rendering area.

[0086] If the virtual mask is not inverted, it means that the virtual mask can block the corresponding area of ​​the virtual model to be processed. That is, the overlapping area of ​​the virtual mask and the virtual model to be processed can display the virtual mask but not the virtual model to be processed. For example, see Figure 4 , shows a schematic diagram of the overlap of the virtual mask and the virtual model to be processed, wherein the virtual model to be processed 101 is gray and the virtual mask 102 is white. Since the overlapping area of ​​the virtual model to be processed 101 and the virtual mask 102 can block the virtual model to be processed, the color of the virtual mask 102 can be displayed in the overlapping area, that is, Figure 4 The white area in the dotted box is the overlapping area, and the gray area is the non-overlapping area, which shows the color of the virtual model to be processed 101. Figure 4 The gray area in the image is determined as the target rendering area.

[0087] If the virtual mask is inverted, that is, the output of the Boxmask-3D function is inverted to 0 and 1, then the virtual model to be processed can be displayed in the overlapping area of ​​the virtual mask and the virtual model to be processed, and the virtual mask can be displayed in the non-overlapping area of ​​the virtual mask and the virtual model to be processed. Figure 5 , shows another schematic diagram of the overlap of the virtual mask and the virtual model to be processed. Here, the virtual model to be processed 101 is gray, and the virtual mask 102 is white. Since the virtual mask is inverted, the overlapping area of ​​the virtual model to be processed 101 and the virtual mask 102 cannot block the virtual model to be processed. Therefore, the overlapping area of ​​the virtual model to be processed 101 and the virtual mask 102 can display the color of the virtual model to be processed 101, i.e. Figure 5 The gray area in the figure, the non-overlapping area can display the color of the virtual mask 102, that is, the white area in the figure. Therefore, the overlapping area of ​​the virtual model to be processed and the virtual mask can be directly determined as the target rendering area.

[0088] After determining the target rendering area, the target color parameters are used to render the virtual model to be processed in the target rendering area, so as to enable a color gradient effect for the virtual model to be processed in the specific area.

[0089] The activation of virtual mask can be determined by the input of the developer. For a detailed description of the effect of activating virtual mask, please refer to Figure 6 , shows a schematic diagram of the color gradient effect when the virtual mask is not enabled. Figure 6 The two rectangular models shown in FIG are both virtual models 101 to be processed. The color of the virtual model 101 to be processed is gray by default, and the gradient effect is a gradient effect from gray to white. Figure 6 It can be seen that when the virtual mask is not enabled, the virtual model 101 to be processed presents a gradient effect from gray to white.

[0090] Please continue reading Figure 7 , shows a schematic diagram of the color gradient effect when the virtual mask is enabled. The color of the virtual model 101 to be processed is gray by default. The dotted rectangle is the virtual mask 102. The virtual model 101 to be processed on the left is within the virtual mask 102. Therefore, the gradient effect can be enabled only for the virtual model 101 to be processed on the left. The virtual model 101 to be processed on the right is not within the virtual mask 102 and remains gray.

[0091] To facilitate developers in achieving gradient effects at any position, this method can be integrated into a gradient tool that provides the following parameters for developers to adjust. For example, a sequencer can be provided within which developers can choose whether to enable a virtual mask and, if so, customize its position, size, and feathering strength. The position and angle of the gradient effect can also be provided. This position parameter can be used to adjust the aforementioned OB vector to adjust the position of the color gradient.

[0092] The model rendering solution provided by the embodiments of the present application can be applied to various model rendering scenarios. For example, in cartoon-style rendering, a color gradient effect can be achieved at any position of the virtual model to be processed based on the input position parameters. The color gradient effect can be used to simulate the effect of the virtual model being illuminated by a light source, so that the image obtained by opening the style rendering can have a lighting effect, and the lighting effect is different from the lighting effect in the real environment, thereby enhancing the expressiveness of the image obtained by cartoon-style rendering.

[0093] The method provided by the embodiment of the present application can calculate the target parameters of each pixel on the virtual model to be processed based on the input position parameters and the absolute world position of the virtual model to be processed, and divide the virtual model to be processed into a first area and a second area based on the target parameters. Then, the color of the boundary area between the first area and the second area is smoothly transitioned to obtain the target color parameters. Finally, the virtual model to be processed is rendered based on the target color parameters to obtain a virtual model with a gradient effect. In addition, the input position parameters determine the division between the first area and the second area, that is, the input position parameters can control the position of the color gradient, so that the expressiveness of the picture can be enhanced by color gradient at any position based on the input position parameters.

[0094] The method described in the above embodiment will be further described below.

[0095] In this embodiment, the method of the embodiment of the present application will be described in detail by taking enabling the gradient effect on the virtual model in the specified area as an example.

[0096] like Figure 8 As shown, the specific process of a model rendering method is as follows:

[0097] S210, obtaining the absolute world position of the model to be processed, and establishing a first vector corresponding to each pixel point on the model to be processed based on the absolute world position;

[0098] S220 : Determine a second vector in response to the input position parameter.

[0099] S230: Calculate the dot product corresponding to each pixel point based on the first vector and the second vector.

[0100] S240: Divide the virtual model to be processed into a first area and a second area based on the dot product of each pixel.

[0101] S250 : Based on a first color parameter corresponding to the first area and a second color parameter corresponding to the second area, perform a smooth transition process on a boundary area between the first area and the second area to obtain a target color parameter.

[0102] S260, creating a virtual mask in response to the virtual mask opening operation and the input mask parameters;

[0103] S270: Render the virtual model to be processed within the virtual mask using the target color parameters.

[0104] The contents of S210 to S270 mentioned above can refer to the corresponding parts of the above embodiments, which will not be repeated here. The following will illustrate the solution of the embodiment of the present application with a specific example.

[0105] First, developers can use a sequencer to control the gradient effect, and the rendering method mentioned above can be integrated into a material function. For example, see Figure 9 , which shows a schematic diagram of the sequencer. The BP Active Box is a virtual mask, containing data related to the mask's position, size, and feathering. The BP Directional Gradient New is a gradient effect, containing data such as the gradient's position and effect.

[0106] The gradient effect can be bound to the virtual mask to obtain relevant data of the virtual mask.

[0107] Active controls whether the virtual mask is enabled. 1 means it is enabled, and 0 means it is disabled. The position of the virtual mask can be adjusted using Transform under the BP Active Box. Spanwned under the BP Active Box creates a virtual mask.

[0108] The Transform in BP Directional Gradient New adjusts the position of the second vector, creating a color gradient effect in any direction. In practice, if you need to enable a virtual mask, you can first adjust the virtual mask's position, size, feathering strength, and other settings, and then adjust the gradient effect of the virtual model to be processed within the virtual mask.

[0109] Specifically, in response to the data input by Transform in BP Directional Gradient New, that is, the input position parameter, an arrow component can be added at the position parameter, and then the GetForwardVector node can be used to process the arrow component to obtain the second vector, and the second vector can be passed to the material function through the material interface Set Custom Light VectorParameter.

[0110] In the material function, the absolute world position of the virtual model to be processed can be obtained, and the absolute world position is subtracted from the world position of the preset point to obtain the first vector corresponding to each pixel point.

[0111] The dot product of the first and second vectors is then calculated using the dot node to identify the first and second regions on the virtual model. The result of the dot node is then fed into the smoothstep node to achieve a smooth transition between the first and second regions. The first and second color parameters are then written into the gradient template to obtain the target color parameters. This target color parameter is then used to render the virtual model, achieving a smooth transition between the first and second color parameters.

[0112] When a virtual mask is needed, a Boxmask-3D node is used to create a virtual mask based on the input mask parameters, including the position, volume, and feathering strength of the virtual mask. The result of the Boxmask-3D node is then inverted using the "1-x" node to achieve a color gradient effect on the virtual model being processed within the virtual mask. In actual use, the mask parameters can be adjusted first, followed by the color gradient parameters, so that the color gradient effect is only enabled for the virtual model being processed within the virtual mask.

[0113] As can be seen from the above, the model rendering method provided by the embodiment of the present application can set the relevant parameters for controlling the gradient in the sequencer, so that the developer can perform gradient control according to actual needs. The input position parameters can be obtained through the sequencer, and then the target parameters corresponding to each pixel point are calculated in combination with the world position of each pixel point on the virtual model to be processed, and then the first area and the second area are divided on the virtual model to be processed based on the target parameters; then, based on the first color parameter corresponding to the first area and the second color parameter corresponding to the second area, the boundary area between the first area and the second area is smoothly transitioned to obtain the target color parameters, and the target color parameters are used to render the virtual model to be processed, so as to achieve the color gradient effect at any position on the virtual model to be processed, thereby improving the expressiveness of the picture. The sequencer can provide developers with space for parameter adjustment and free operation, which can not only achieve a picture effect similar to light illumination more flexibly and conveniently, but also improve the development efficiency of the game.

[0114] To better implement the above method, the present application also provides a model rendering device. The model rendering device can be integrated into an electronic device, such as a terminal or a server. The terminal can be a mobile phone, tablet computer, smart Bluetooth device, laptop computer, personal computer, etc. The server can be a single server or a server cluster consisting of multiple servers.

[0115] For example, in this embodiment, the method of the embodiment of the present application will be described in detail by taking the specific integration of the model rendering device in the terminal as an example.

[0116] For example, Figure 10 As shown, the model rendering device 300 may include an acquisition module 310 , a calculation module 320 , a division module 330 , a smoothing module 340 and a rendering module 350 .

[0117] An acquisition module 310 is configured to acquire an absolute world position of the virtual model to be processed, wherein the absolute world position includes the world position of each pixel point on the virtual model to be processed;

[0118] A calculation module 320 is configured to calculate a target parameter corresponding to each pixel point based on the input position parameter and the absolute world position, wherein the target parameter indicates a relative position of the pixel point to the position parameter;

[0119] A division module 330 is configured to divide the virtual model to be processed into a first area and a second area based on the target parameter corresponding to each pixel point;

[0120] a smoothing module 340 configured to perform a smooth transition process on a boundary area between the first area and the second area based on a first color parameter corresponding to the first area and a second color parameter corresponding to the second area, to obtain a target color parameter;

[0121] The rendering module 350 is configured to render the virtual model to be processed using the target color parameters.

[0122] In some embodiments, the calculation module 320 further includes:

[0123] A first determining unit is configured to calculate a first vector corresponding to each pixel point based on a world position of a preset point and a world position of each pixel point on the virtual model to be processed;

[0124] a second determining unit, configured to determine a second vector according to an input position parameter;

[0125] The target parameter calculation unit is used to calculate the dot product of the first vector corresponding to each pixel point and the second vector to obtain the target parameter corresponding to each pixel point.

[0126] In some embodiments, the second determining unit is further configured to:

[0127] Place an arrow component at the input position parameter;

[0128] A second vector is determined according to the direction indicated by the arrow component.

[0129] In some embodiments, the partitioning module 330 further includes:

[0130] A first dividing unit is configured to determine, in the virtual model to be processed, an area where all pixels having target parameters greater than a preset parameter are located as the first area;

[0131] The second dividing unit is configured to determine, in the virtual model to be processed, an area where all pixels having the target parameter smaller than the preset parameter are located as the second area.

[0132] In some embodiments, the smoothing module 340 further includes:

[0133] A parameter acquisition unit, used to obtain a maximum value parameter and a minimum value parameter;

[0134] an interpolation unit, configured to perform interpolation processing on the color parameters of the boundary area between the first area and the second area according to the maximum parameter and the minimum parameter to obtain interpolated color parameters;

[0135] An updating unit is configured to update the interpolated color parameter according to a first color parameter corresponding to the first area and a second color parameter corresponding to the second area to obtain the target color parameter.

[0136] In some embodiments, the rendering module 350 further includes:

[0137] a mask generating unit, configured to generate a virtual mask on the virtual model to be processed according to the absolute world position and the input mask parameters;

[0138] a target determining unit, configured to determine a target rendering area on the virtual model to be processed according to the virtual mask;

[0139] A rendering unit is configured to render the virtual model to be processed within the target rendering area using the target color parameters.

[0140] In some embodiments, the rendering unit is further configured to:

[0141] If the virtual mask has not been inverted, determining an area on the virtual model to be processed that does not overlap with the virtual mask as the target rendering area;

[0142] If the virtual mask is inverted, the area where the virtual model to be processed overlaps with the virtual mask is determined as the target rendering area.

[0143] In specific implementation, the above modules or units can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same or several entities. The specific implementation of the above modules or units can be referred to the previous method embodiments and will not be repeated here.

[0144] As can be seen from the above, the model rendering device of this embodiment can obtain the world position of each pixel on the virtual model to be processed, and calculate the target parameter corresponding to each pixel in combination with the input position parameter, and then divide the virtual model to be processed into a first area and a second area based on the target parameter; then, based on the first color parameter corresponding to the first area and the second color parameter corresponding to the second area, the boundary area between the first area and the second area is smoothly transitioned to obtain the target color parameter, and the target color parameter is used to render the virtual model to be processed so as to achieve a color gradient effect on the virtual model to be processed. Among them, the input position parameter can determine the division of the first area and the second area, that is, the position of the color gradient effect is different when the input position parameter is different, so that the expressiveness of the picture can be enhanced by color gradient at any position.

[0145] Accordingly, an embodiment of the present application also provides an electronic device, which may be a terminal or a server, and the terminal may be a smart phone, tablet computer, laptop computer, touch screen, game console, personal computer, personal digital assistant (PDA) and other terminal devices.

[0146] like Figure 11 As shown, Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device 400 includes a processor 401 having one or more processing cores, a memory 402 having one or more computer-readable storage media, and a computer program stored in the memory 402 and executable on the processor. The processor 401 is electrically connected to the memory 402. Those skilled in the art will understand that the electronic device structure shown in the figure does not constitute a limitation of the electronic device, and may include more or fewer components than shown, or combine certain components, or arrange the components differently.

[0147] The processor 401 is the control center of the electronic device 400. It uses various interfaces and lines to connect various parts of the entire electronic device 400. By running or loading software programs and / or modules stored in the memory 402 and calling data stored in the memory 402, it executes various functions of the electronic device 400 and processes data, thereby monitoring the electronic device 400 as a whole.

[0148] In the embodiment of the present application, the processor 401 in the electronic device 400 loads instructions corresponding to one or more application processes into the memory 402 according to the following steps, and the processor 401 runs the application stored in the memory 402 to implement various functions:

[0149] Obtain the absolute world position of the virtual model to be processed, wherein the absolute world position includes the world position of each pixel point on the virtual model to be processed; calculate the target parameter corresponding to each pixel point according to the input position parameter and the absolute world position, wherein the target parameter indicates the relative position of the pixel point and the position parameter; divide the virtual model to be processed into a first area and a second area based on the target parameter corresponding to each pixel point; perform smooth transition processing on the boundary area between the first area and the second area based on the first color parameter corresponding to the first area and the second color parameter corresponding to the second area to obtain the target color parameter; and render the virtual model to be processed using the target color parameter.

[0150] According to the input position parameters and the absolute world position of the virtual model to be processed, the target parameters of each pixel on the virtual model to be processed are calculated, and the virtual model to be processed is divided into a first area and a second area based on the target parameters. Then, the color of the boundary area between the first area and the second area is smoothly transitioned to obtain the target color parameters. Finally, the virtual model to be processed is rendered based on the target color parameters to obtain a virtual model with a gradient effect.

[0151] According to the world position of the preset point and the world position of each pixel point on the virtual model to be processed, the first vector corresponding to each pixel point is calculated; according to the input position parameter, the second vector is determined; the dot product of the first vector corresponding to each pixel point and the second vector is calculated to obtain the target parameter corresponding to each pixel point.

[0152] An arrow component is placed at the input position parameter; and a second vector is determined according to the direction indicated by the arrow component.

[0153] In the virtual model to be processed, the area where all the pixel points whose target parameters are greater than the preset parameters are located is determined as the first area; in the virtual model to be processed, the area where all the pixel points whose target parameters are less than the preset parameters are located is determined as the second area.

[0154] By constructing a first vector and a second vector, calculating the dot product of the first vector and the second vector, and then dividing the first region into the second region based on the dot product, it is possible to ensure that the region division is related to the input position parameters, thereby achieving color gradient at any position based on different input position parameters.

[0155] Obtain a maximum parameter and a minimum parameter; interpolate the color parameters of the boundary area between the first area and the second area based on the maximum parameter and the minimum parameter to obtain interpolated color parameters; and update the interpolated color parameters based on the first color parameter corresponding to the first area and the second color parameter corresponding to the second area to obtain the target color parameters.

[0156] The color gradient effect is achieved by interpolating the color parameters.

[0157] A virtual mask is generated on the virtual model to be processed according to the absolute world position and the input mask parameters; a target rendering area is determined on the virtual model to be processed according to the virtual mask; and the virtual model to be processed within the target rendering area is rendered using the target color parameters.

[0158] If the virtual mask is not inverted, the area on the virtual model to be processed that does not overlap with the virtual mask is determined as the target rendering area; if the virtual mask is inverted, the area on the virtual model to be processed that overlaps with the virtual mask is determined as the target rendering area.

[0159] Since the material-based color gradient effect is effective for all virtual models that use the material, based on the virtual mask, the color gradient effect can be enabled for some models, which can improve the expressiveness of the picture and make it more flexible and convenient to use.

[0160] The specific implementation of the above operations can be found in the previous embodiments and will not be repeated here.

[0161] Optional, such as Figure 11 As shown, the electronic device 400 further includes: a touch screen 403, a radio frequency circuit 404, an audio circuit 405, an input unit 406, and a power supply 407. Among them, the processor 401 is electrically connected to the touch screen 403, the radio frequency circuit 404, the audio circuit 405, the input unit 406, and the power supply 407 respectively. It can be understood by those skilled in the art that Figure 11 The electronic device structure shown in the figure does not constitute a limitation to the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0162] The touch display screen 403 can be used for displaying a graphical user interface and receiving an operation instruction generated by the user acting on the graphical user interface. The touch display screen 403 can include a display panel and a touch panel. Among them, the display panel can be used for displaying information input by the user or information provided to the user and various graphical user interfaces of the electronic device, and these graphical user interfaces can be composed of graphics, text, icons, videos and any combination thereof. Optionally, a liquid crystal display (LCD), an organic light emitting diode (OLED, Organic Light-Emitting Diode) and the like can be used to configure the display panel. The touch panel can be used for collecting the user's touch operation on or near it (such as the user uses any suitable object or accessory such as a finger, a stylus on the touch panel or near the touch panel) and generates corresponding operation instructions, and the operation instructions execute corresponding programs. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch direction, 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 the touch point coordinates, and then sends it to the processor 401, and can receive the command sent by the processor 401 and execute it. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it is transmitted to the processor 401 to determine the type of touch event, and then the processor 401 provides a corresponding visual output on the display panel according to the type of touch event. In an embodiment of the present application, the touch panel and the display panel can be integrated into the touch display screen 403 to realize the input and output functions. However, in some embodiments, the touch panel and the touch panel can be used as two independent components to realize the input and output functions. That is, the touch display screen 403 can also be used as part of the input unit 406 to realize the input function.

[0163] The radio frequency circuit 404 may be used to transmit and receive radio frequency signals, so as to establish wireless communication with a network device or other electronic devices through wireless communication, and to transmit and receive signals with the network device or other electronic devices.

[0164] Audio circuit 405 can be used to provide an audio interface between the user and the electronic device through a speaker and microphone. Audio circuit 405 can convert received audio data into electrical signals and transmit them to the speaker, which then converts them into sound signals for output. On the other hand, the microphone converts the collected sound signals into electrical signals, which are then received by audio circuit 405 and converted into audio data. The audio data is then output to processor 401 for processing, and then sent to, for example, another electronic device via RF circuit 404. Alternatively, the audio data is output to memory 402 for further processing. Audio circuit 405 may also include an earphone jack to provide communication between external headphones and the electronic device.

[0165] The input unit 406 may be configured to receive input digital, character information, or user feature information (such as fingerprint, iris, or facial information), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.

[0166] Power supply 407 is used to supply power to various components of electronic device 400. Optionally, power supply 407 can be logically connected to processor 401 via a power management system, thereby enabling the power management system to manage charging, discharging, and power consumption. Power supply 407 can also include one or more DC or AC power supplies, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and other arbitrary components.

[0167] although Figure 11 Not shown in the figure, the electronic device 400 may further include a camera, a sensor, a wireless fidelity module, a Bluetooth module, etc., which will not be described in detail here.

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

[0169] As can be seen from the above, the electronic device provided in this embodiment can obtain the world position of each pixel on the virtual model to be processed, and calculate the target parameters corresponding to each pixel in combination with the input position parameters, and then divide the virtual model to be processed into a first area and a second area based on the target parameters; then, based on the first color parameter corresponding to the first area and the second color parameter corresponding to the second area, the boundary area between the first area and the second area is smoothly transitioned to obtain the target color parameters, and the target color parameters are used to render the virtual model to be processed so as to achieve a color gradient effect on the virtual model to be processed. Among them, the input position parameters can determine the division of the first area and the second area, that is, the position of the color gradient effect is different when the input position parameters are different, so that the expressiveness of the picture can be enhanced by color gradient at any position.

[0170] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be accomplished by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0171] To this end, an embodiment of the present application provides a computer-readable storage medium storing a plurality of computer programs, which can be loaded by a processor to execute the steps of any of the model rendering methods provided in the embodiments of the present application. For example, the computer program can execute the following steps:

[0172] Obtain the absolute world position of the virtual model to be processed, wherein the absolute world position includes the world position of each pixel point on the virtual model to be processed; calculate the target parameter corresponding to each pixel point according to the input position parameter and the absolute world position, wherein the target parameter indicates the relative position of the pixel point and the position parameter; divide the virtual model to be processed into a first area and a second area based on the target parameter corresponding to each pixel point; perform smooth transition processing on the boundary area between the first area and the second area based on the first color parameter corresponding to the first area and the second color parameter corresponding to the second area to obtain the target color parameter; and render the virtual model to be processed using the target color parameter.

[0173] According to the input position parameters and the absolute world position of the virtual model to be processed, the target parameters of each pixel on the virtual model to be processed are calculated, and the virtual model to be processed is divided into a first area and a second area based on the target parameters. Then, the color of the boundary area between the first area and the second area is smoothly transitioned to obtain the target color parameters. Finally, the virtual model to be processed is rendered based on the target color parameters to obtain a virtual model with a gradient effect.

[0174] According to the world position of the preset point and the world position of each pixel point on the virtual model to be processed, the first vector corresponding to each pixel point is calculated; according to the input position parameter, the second vector is determined; the dot product of the first vector corresponding to each pixel point and the second vector is calculated to obtain the target parameter corresponding to each pixel point.

[0175] An arrow component is placed at the input position parameter; and a second vector is determined according to the direction indicated by the arrow component.

[0176] In the virtual model to be processed, the area where all the pixel points whose target parameters are greater than the preset parameters are located is determined as the first area; in the virtual model to be processed, the area where all the pixel points whose target parameters are less than the preset parameters are located is determined as the second area.

[0177] By constructing a first vector and a second vector, calculating the dot product of the first vector and the second vector, and then dividing the first region into the second region based on the dot product, it is possible to ensure that the region division is related to the input position parameters, thereby achieving color gradient at any position based on different input position parameters.

[0178] Obtain a maximum parameter and a minimum parameter; interpolate the color parameters of the boundary area between the first area and the second area based on the maximum parameter and the minimum parameter to obtain interpolated color parameters; and update the interpolated color parameters based on the first color parameter corresponding to the first area and the second color parameter corresponding to the second area to obtain the target color parameters.

[0179] The color gradient effect is achieved by interpolating the color parameters.

[0180] A virtual mask is generated on the virtual model to be processed according to the absolute world position and the input mask parameters; a target rendering area is determined on the virtual model to be processed according to the virtual mask; and the virtual model to be processed within the target rendering area is rendered using the target color parameters.

[0181] If the virtual mask is not inverted, the area on the virtual model to be processed that does not overlap with the virtual mask is determined as the target rendering area; if the virtual mask is inverted, the area on the virtual model to be processed that overlaps with the virtual mask is determined as the target rendering area.

[0182] Since the material-based color gradient effect is effective for all virtual models that use the material, based on the virtual mask, the color gradient effect can be enabled for some models, which can improve the expressiveness of the picture and make it more flexible and convenient to use.

[0183] The specific implementation of the above operations can be found in the previous embodiments and will not be repeated here.

[0184] The storage medium may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0185] Since the computer program stored in the storage medium can execute the steps in 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 achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0186] The above is a detailed introduction to a model rendering method, device, storage medium and electronic device provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, based on the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A model rendering method, characterized in that: The method comprises: Acquire the absolute world position of the virtual model to be processed, where the absolute world position includes the world position of each pixel point on the virtual model to be processed; Calculate a first vector corresponding to each pixel point according to the world position of the preset point and the world position of each pixel point on the virtual model to be processed; Input position parameters, which are used to indicate a certain position point in the world coordinate system; placing an arrow component at the input position parameter, wherein the position parameter is used to control the position of the simulated light effect on the virtual model to be processed, and the position parameter includes a translation parameter, a rotation parameter, and a scaling parameter, wherein the translation parameter is used to control the translation of the position of the gradient effect corresponding to the simulated light effect, the rotation parameter is used to control the angle of the gradient effect, and the scaling parameter is used to control the size of the gradient effect; Determine a second vector according to the direction indicated by the arrow component; Calculating a dot product between the first vector and the second vector corresponding to each pixel point to obtain a target parameter corresponding to each pixel point, where the target parameter indicates a relative position of the pixel point and the position parameter; Dividing the virtual model to be processed into a first area and a second area based on the target parameter corresponding to each pixel point; Based on a first color parameter corresponding to the first area and a second color parameter corresponding to the second area, performing a smooth transition process on a boundary area between the first area and the second area to obtain a target color parameter; The target color parameters are used to render the virtual model to be processed in a non-realistic rendering mode.

2. The method according to claim 1, characterized in that Dividing the virtual model to be processed into a first area and a second area based on the target parameter corresponding to each pixel point includes: In the virtual model to be processed, an area where all pixels having target parameters greater than a preset parameter are located is determined as the first area; In the virtual model to be processed, an area where all pixels whose target parameters are smaller than the preset parameters are located is determined as the second area.

3. The method according to claim 1, characterized in that The step of performing a smooth transition process on a boundary area between the first area and the second area based on a first color parameter corresponding to the first area and a second color parameter corresponding to the second area to obtain a target color parameter includes: Get the maximum and minimum parameters; performing interpolation processing on the color parameters of the boundary area between the first area and the second area according to the maximum parameter and the minimum parameter to obtain interpolated color parameters; The interpolated color parameters are updated according to the first color parameters corresponding to the first area and the second color parameters corresponding to the second area to obtain the target color parameters.

4. The method according to any one of claims 1 to 3, characterized in that The step of rendering the virtual model to be processed using the target color parameter includes: generating a virtual mask on the virtual model to be processed according to the absolute world position and the input mask parameters; determining a target rendering area on the virtual model to be processed according to the virtual mask; The target color parameter is used to render the virtual model to be processed within the target rendering area.

5. The method according to claim 4, characterized in that Determining a target rendering area on the virtual model to be processed according to the virtual mask includes: If the virtual mask has not been inverted, determining an area on the virtual model to be processed that does not overlap with the virtual mask as the target rendering area; If the virtual mask is inverted, the area where the virtual model to be processed overlaps with the virtual mask is determined as the target rendering area.

6. A model rendering device, characterized in that: The device comprises: An acquisition module, configured to acquire an absolute world position of the virtual model to be processed, wherein the absolute world position includes a world position of each pixel point on the virtual model to be processed; a calculation module, configured to calculate, based on the world position of a preset point and the world position of each pixel point on the virtual model to be processed, a first vector corresponding to each pixel point, input a position parameter, the input position parameter being used to indicate a position point in the world coordinate system, place an arrow component at the input position parameter, determine a second vector according to the direction indicated by the arrow component, calculate a dot product between the first vector corresponding to each pixel point and the second vector, and obtain a target parameter corresponding to each pixel point, the target parameter indicating the relative position of the pixel point and the position parameter, the position parameter being used to control the position of the simulated light effect on the virtual model to be processed, the position parameter including a translation parameter, a rotation parameter, and a scaling parameter, wherein the translation parameter is used to control the translation of the position of the gradient effect corresponding to the simulated light effect, the rotation parameter is used to control the angle of the gradient effect, and the scaling parameter is used to control the size of the gradient effect; a dividing module, configured to divide the virtual model to be processed into a first area and a second area based on a target parameter corresponding to each pixel point; a smoothing module, configured to perform a smooth transition process on a boundary area between the first area and the second area based on a first color parameter corresponding to the first area and a second color parameter corresponding to the second area, to obtain a target color parameter; A rendering module is used to render the virtual model to be processed in a non-realistic rendering mode using the target color parameters.

7. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a plurality of instructions; the processor loads instructions from the memory to execute the steps in the model rendering method according to any one of claims 1 to 5.

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

Citation Information

Patent Citations

  • Method and device for rendering virtual object in virtual environment, equipment and medium

    CN112884873A

  • Data processing method and device, electronic equipment and readable medium

    CN114494666A