A virtual model rendering method and apparatus
By selecting target mesh vertices from the mesh vertices of the virtual model and configuring point primitives, and rendering the point primitives according to the background image attribute parameters, a flashing point effect image is generated. This solves the problem of high performance overhead in the full-screen post-processing method and achieves efficient rendering of the flashing point effect.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING ZITIAO NETWORK TECH CO LTD
- Filing Date
- 2021-07-30
- Publication Date
- 2026-07-24
AI Technical Summary
In existing technologies, the performance overhead is relatively large when using full-screen post-processing to achieve the flashing effect of virtual model rendering images.
Select multiple target mesh vertices from the mesh vertices of the target virtual model, configure point primitives, determine the attribute parameters corresponding to each target mesh vertex according to the background image, and render the point primitives on the background image to generate the rendered effect image.
It reduces the performance overhead of rendering flashing effects and allows users to set the number, density, brightness, and size of flashes according to their needs, controlling the flashing effect and achieving flexibility and efficiency in creating flashing effects.
Smart Images

Figure CN115700773B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of image rendering technology, and in particular to a rendering method and apparatus for a virtual model. Background Technology
[0002] In game development and special effects production, to enhance the rendering effect of virtual models, it is often necessary to add glitter (Kira) to the rendered image of the virtual model, thus giving the rendered image a glitter effect. For example, when rendering a diamond model, adding glitter to the rendered image can give the diamond model a glitter effect, thereby increasing the aesthetics and realism of the rendered image.
[0003] Current technologies commonly achieve the flashing effect in rendered images through full-screen post-processing. Specifically, a rendered image containing a virtual model but without the flashing effect is first generated. When outputting the rendered image, a flashing image is overlaid on top of it, resulting in a rendered image with the flashing effect. Because achieving the flashing effect through full-screen post-processing requires overlaying the flashing image on top of the rendered image simultaneously, this method incurs significant performance overhead. Summary of the Invention
[0004] In view of this, the present disclosure provides a rendering method and apparatus for a virtual model to solve the problem of high performance overhead in achieving the flashing effect of the rendered image through full-screen post-processing.
[0005] To achieve the above objectives, the present disclosure provides the following technical solutions:
[0006] In a first aspect, embodiments of this disclosure provide a virtual model rendering method, comprising:
[0007] Multiple target mesh vertices are selected from the mesh vertices of the target virtual model based on a preset method;
[0008] Configure the point primitives corresponding to each target mesh vertex;
[0009] Render the target virtual model to obtain a background image;
[0010] The attribute parameters of the point primitives corresponding to each target mesh vertex are determined based on the background image;
[0011] Based on the attribute parameters of the point primitives corresponding to each target mesh vertex, the point primitives corresponding to each target mesh vertex are rendered on the background image to generate the rendering effect image of the target virtual model.
[0012] As an optional implementation of this disclosure, the step of selecting multiple target mesh vertices from the mesh vertices of the target virtual model based on a preset method includes:
[0013] Based on a preset number of point primitives, the same number of target mesh vertices are randomly selected from the mesh vertices of the target virtual model.
[0014] As an optional implementation of this disclosure, the step of selecting multiple target mesh vertices from the mesh vertices of the target virtual model based on a preset method includes:
[0015] The target virtual model's grid vertices are divided into multiple grid vertex sets based on the pre-defined sparsity of the point primitives;
[0016] One target grid vertex is randomly selected from each of the multiple grid vertex sets.
[0017] As an optional implementation of this disclosure, the step of determining the attribute parameters of the point primitives corresponding to each target mesh vertex based on the background image includes at least one of the following:
[0018] The visibility parameters of the point primitives corresponding to each target mesh vertex are determined based on the background image. The visibility parameters include a first parameter for characterizing the visibility of the corresponding point primitive or a second parameter for characterizing the invisibility of the corresponding point primitive.
[0019] The rendering position of the point primitives corresponding to each target mesh vertex is determined based on the background image;
[0020] The brightness of the point primitives corresponding to each target grid vertex is determined based on the background image;
[0021] The size of the point primitives corresponding to each target mesh vertex is determined based on the background image.
[0022] As an optional implementation of this disclosure, determining the visibility parameters of point primitives corresponding to each target mesh vertex based on the background image includes:
[0023] Obtain the brightness of the pixel corresponding to each target grid vertex in the background image;
[0024] Determine whether the brightness of the pixel corresponding to each target grid vertex is greater than or equal to the threshold brightness;
[0025] Based on the judgment result, the visibility parameters of the point primitives corresponding to the target mesh vertex are determined.
[0026] As an optional implementation of this disclosure, determining the visibility parameters of the point primitives corresponding to the target mesh vertex based on the judgment result includes:
[0027] If the brightness of the pixel corresponding to the target grid vertex is greater than or equal to the threshold brightness, then the visibility parameter of the point primitive corresponding to the target grid vertex is determined to be the first parameter;
[0028] If the brightness of the pixel corresponding to the target mesh vertex is less than the threshold brightness, then the visibility parameter of the point primitive corresponding to the target mesh vertex is determined to be the second parameter.
[0029] As an optional implementation of this disclosure, determining the rendering position of the point primitives corresponding to each target mesh vertex based on the background image includes:
[0030] Obtain the position coordinates of each target mesh vertex in the background image;
[0031] The position coordinates of each target mesh vertex are determined as the rendering position of the point primitive corresponding to each target mesh vertex.
[0032] As an optional implementation of this disclosure, determining the brightness of the point primitives corresponding to each target mesh vertex based on the background image includes:
[0033] Obtain the brightness of the pixel corresponding to each target grid vertex in the background image;
[0034] The brightness of the point primitives corresponding to each target grid vertex is determined based on the brightness of the pixels corresponding to each target grid vertex.
[0035] The brightness of the point primitive corresponding to the target mesh vertex is positively correlated with the brightness of the pixel corresponding to the target mesh vertex.
[0036] As an optional implementation of this disclosure, determining the size of the point primitives corresponding to each target mesh vertex based on the background image includes:
[0037] Obtain the depth of the pixel corresponding to each target mesh vertex in the background image;
[0038] The size of the point primitive corresponding to each target mesh vertex is determined based on the depth of the pixel point corresponding to each target mesh vertex.
[0039] The size of the point primitive corresponding to the target mesh vertex is negatively correlated with the depth of the pixel corresponding to the target mesh vertex.
[0040] As an optional implementation of this disclosure, the method further includes:
[0041] Obtain the time corresponding to the rendered image;
[0042] The brightness and / or size of the point primitives corresponding to each target mesh vertex are adjusted according to the time specified.
[0043] Secondly, embodiments of this disclosure provide a virtual model rendering apparatus, comprising:
[0044] The selection unit is used to select multiple target mesh vertices from the mesh vertices of the target virtual model based on a preset method;
[0045] Configuration unit, used to set point primitives on each target mesh vertex respectively;
[0046] A rendering unit is used to render the target virtual model to obtain a background image;
[0047] The determining unit is used to determine the attribute parameters of the point primitives corresponding to each target mesh vertex based on the background image;
[0048] The rendering unit is further configured to render the point primitives corresponding to each target mesh vertex on the background image according to the attribute parameters of the point primitives corresponding to each target mesh vertex, thereby generating the rendering effect image of the target virtual model.
[0049] As an optional implementation of this disclosure, the selection unit is specifically used to randomly select the same number of target mesh vertices from the mesh vertices of the target virtual model according to a preset number of point primitives.
[0050] As an optional implementation of this disclosure, the selection unit is specifically used to divide the grid vertices of the target virtual model into multiple grid vertex sets according to a preset sparsity of point primitives; and to randomly select one target grid vertex from each of the multiple grid vertex sets.
[0051] As an optional implementation of this disclosure, the determining unit is specifically used for at least one of the following:
[0052] The visibility parameters of the point primitives corresponding to each target mesh vertex are determined based on the background image. The visibility parameters include a first parameter for characterizing the visibility of the corresponding point primitive or a second parameter for characterizing the invisibility of the corresponding point primitive.
[0053] The rendering position of the point primitives corresponding to each target mesh vertex is determined based on the background image;
[0054] The brightness of the point primitives corresponding to each target grid vertex is determined based on the background image;
[0055] The size of the point primitives corresponding to each target mesh vertex is determined based on the background image.
[0056] As an optional implementation of this disclosure, the determining unit is specifically used to obtain the brightness of the pixels corresponding to each target grid vertex in the background image; determine whether the brightness of the pixels corresponding to each target grid vertex is greater than or equal to a threshold brightness; and determine the visibility parameters of the point primitives corresponding to the target grid vertex based on the determination result.
[0057] As an optional implementation of this disclosure, the determining unit is specifically configured to determine the visibility parameter of the point primitive corresponding to the target mesh vertex as the first parameter if the brightness of the pixel corresponding to the target mesh vertex is greater than or equal to the threshold brightness; and to determine the visibility parameter of the point primitive corresponding to the target mesh vertex as the second parameter if the brightness of the pixel corresponding to the target mesh vertex is less than the threshold brightness.
[0058] As an optional implementation of this disclosure, the determining unit is specifically used to obtain the position coordinates of each target mesh vertex in the background image; and to determine the position coordinates of each target mesh vertex as the rendering position of the point primitive corresponding to each target mesh vertex.
[0059] As an optional implementation of this disclosure, the determining unit is specifically used to obtain the brightness of the pixel corresponding to each target grid vertex in the background image; and to determine the brightness of the point primitive corresponding to each target grid vertex based on the brightness of the pixel corresponding to each target grid vertex.
[0060] The brightness of the point primitive corresponding to the target mesh vertex is positively correlated with the brightness of the pixel corresponding to the target mesh vertex.
[0061] As an optional implementation of this disclosure, the determining unit is specifically used to obtain the depth of the pixel points corresponding to each target grid vertex in the background image; and to determine the size of the point primitives corresponding to each target grid vertex based on the depth of the pixel points corresponding to each target grid vertex.
[0062] The size of the point primitive corresponding to the target mesh vertex is negatively correlated with the depth of the pixel corresponding to the target mesh vertex.
[0063] As an optional implementation of this disclosure, the determining unit is further configured to obtain the time corresponding to the rendered image; and adjust the brightness and / or size of the point primitives corresponding to each target mesh vertex according to the time.
[0064] Thirdly, embodiments of this disclosure provide an electronic device, including: a memory and a processor, wherein the memory is used to store a computer program; and the processor is used to cause the electronic device to implement the virtual model rendering method described in any of the above embodiments when the computer program is invoked.
[0065] Fourthly, embodiments of this disclosure provide a computer-readable storage medium storing a computer program that, when executed by a computing device, causes the computing device to implement the virtual model rendering method described in any of the above embodiments.
[0066] Fifthly, this disclosure provides a computer program product that, when run on a computer, enables the computer to implement the virtual model rendering method described in any of the above embodiments.
[0067] The virtual model rendering method provided in this embodiment first selects multiple target mesh vertices from the mesh vertices of the target virtual model based on a preset method, and configures the point primitives corresponding to each target mesh vertex. Then, it renders the target virtual model to obtain a background image. Next, it determines the attribute parameters of the point primitives corresponding to each target mesh vertex based on the background image, and renders the point primitives corresponding to each target mesh vertex on the background image based on the attribute parameters of the point primitives corresponding to each target mesh vertex, generating a rendered image of the target virtual model. Since the rendered image of the target virtual model in this embodiment is an image obtained by rendering the point primitives corresponding to each target mesh vertex on the background image obtained by rendering the target virtual model, the generated rendered image in this embodiment has a flashing effect. Compared to achieving a flashing effect in a rendered image through full-screen post-processing, this embodiment does not require overlaying a flashing image on top of the rendered image while displaying the rendered image. Therefore, this embodiment can reduce the performance overhead of achieving a flashing effect in a rendered image, solving the problem of high performance overhead when achieving a flashing effect in a rendered image through full-screen post-processing.
[0068] Furthermore, since the embodiments of this disclosure will select multiple target mesh vertices from the mesh vertices of the target virtual model in a preset manner and configure the point primitives corresponding to each target mesh vertex, the embodiments of this disclosure can select the number and density of target mesh vertices as needed, and thus set the number and density of flash points to arbitrary values.
[0069] Furthermore, since the attribute parameters of the point primitives in this embodiment of the present disclosure may include the brightness and size of the point primitives, the brightness and size of the point primitives can be set to arbitrary values as needed, thereby achieving the effect of flashing points changing with time. Moreover, the scaling degree, brightness change degree, and flashing speed of the point primitives during the flashing process can be further controlled by the maximum and minimum values of the brightness and size of the point primitives, as well as the rate of change between the maximum and minimum values.
[0070] Furthermore, by compiling the virtual model rendering method provided in this embodiment into a script, any virtual model can achieve the flashing effect after adding the script obtained by compiling the virtual model rendering method provided in this embodiment. The flashing effect is convenient, quick to implement, and has very low performance overhead. Attached Figure Description
[0071] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0072] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0073] Figure 1 A flowchart illustrating the steps of the virtual model rendering method provided in this embodiment of the disclosure;
[0074] Figure 2 This is a schematic diagram of the structure of the virtual model rendering apparatus provided in the embodiments of this disclosure;
[0075] Figure 3 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0076] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.
[0077] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.
[0078] In this disclosure, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" or "for example" in this disclosure should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner. Furthermore, in the description of the embodiments in this disclosure, unless otherwise stated, "a plurality of" means two or more.
[0079] Based on the above, this disclosure provides a virtual model rendering method, referring to... Figure 1 As shown, the virtual model rendering method includes the following steps:
[0080] S11. Select multiple target mesh vertices from the mesh vertices of the target virtual model based on a preset method.
[0081] Specifically, in this embodiment of the disclosure, the target virtual model is a mesh model that represents objects in the real world or virtual world using multiple interconnected polygons (mesh). The vertices of the target virtual model's mesh refer to the vertices of each polygon in the mesh model. The objects represented by the target virtual model may include diamonds, virtual clothing, ice blocks, glass, etc., and the polygons may include triangles, parallelograms, rectangles, etc. This embodiment of the disclosure does not limit the objects represented by the virtual model or the shape of the mesh of the target virtual model.
[0082] Furthermore, the implementation of step S11 (selecting multiple target mesh vertices from the mesh vertices of the target virtual model based on a preset method) can include at least the following two methods:
[0083] Implementation Method 1
[0084] Based on a preset number of point primitives, the same number of target mesh vertices are randomly selected from the mesh vertices of the target virtual model.
[0085] That is, target mesh vertices are randomly selected from the mesh vertices of the target virtual model according to the preset number of point primitives.
[0086] For example, if the preset number of point primitives is 100 and the number of grid vertices of the target virtual model is 10,000, then the implementation method of randomly selecting the same number of target grid vertices from the grid vertices of the target virtual model according to the preset number of point primitives can be: randomly selecting 100 grid vertices from the 10,000 grid vertices of the target virtual model as target grid vertices.
[0087] Implementation Method Two
[0088] The target virtual model's mesh vertices are divided into multiple mesh vertex sets according to a preset sparse degree; and a target mesh vertex is randomly selected from each of the multiple mesh vertex sets.
[0089] That is, target mesh vertices are randomly selected from the mesh vertices of the target virtual model according to a preset sparsity.
[0090] For example, if the preset sparsity is one target grid vertex selected from every 100 grid vertices, and the total number of grid vertices in the target virtual model is 15,000, then the implementation method of randomly selecting the same number of target grid vertices from the grid vertices of the target virtual model according to the preset number of point primitives can be as follows: First, the 15,000 grid vertices of the target virtual model are divided into 150 grid vertex sets on an equal basis, and then one grid vertex is randomly selected from each grid vertex set as the target grid vertex, for a total of 150 target grid vertices.
[0091] S12. Configure the point primitives corresponding to each target mesh vertex.
[0092] Optionally, in this embodiment of the disclosure, there is a one-to-one correspondence between target mesh vertices and point primitives. That is, each target mesh vertex is configured with a unique corresponding point primitive.
[0093] For example, the point primitives corresponding to each target mesh vertex can be set on each target mesh vertex to implement the configuration of the point primitives corresponding to each target mesh vertex.
[0094] S13. Render the target virtual model to obtain a background image.
[0095] Since the background image is an image obtained by rendering the target virtual model, it includes the object represented by the target virtual model. This embodiment does not limit the rendering method used when rendering the target virtual model; any rendering method can be used to render the target virtual model, as long as a background image including the object represented by the target virtual model can be obtained.
[0096] S14. Determine the attribute parameters of the point primitives corresponding to each target mesh vertex based on the background image.
[0097] As an optional implementation of this disclosure, step S14 (determining the attribute parameters of the point primitives corresponding to each target mesh vertex based on the background image) may include at least one of the following four:
[0098] 1. Determine the visibility parameters of the point primitives corresponding to each target mesh vertex based on the background image.
[0099] The visibility parameters include a first parameter for characterizing the visibility of the corresponding point primitive or a second parameter for characterizing the invisibility of the corresponding point primitive.
[0100] 2. Determine the rendering position of the point primitives corresponding to each target mesh vertex based on the background image.
[0101] 3. Determine the brightness of the point primitives corresponding to each target grid vertex based on the background image.
[0102] 4. Determine the size of the point primitives corresponding to each target mesh vertex based on the background image.
[0103] That is, the attribute parameters of a point primitive include at least one of the following: visibility parameter, rendering position, brightness, and size.
[0104] It should be noted that, in addition to visibility parameters, rendering position, brightness, and size, the attribute parameters of point primitives in this embodiment may also include at least one of the following: rendering texture, brightness change rate during flickering, brightness change range during flickering, size change rate during flickering, and size change range during flickering. The rendering texture, brightness change rate during flickering, brightness change range during flickering, size change rate during flickering, and size change range during flickering can be set to arbitrary values by the user according to their needs, thereby enabling more diverse rendering image effects obtained by the virtual model rendering method according to this embodiment and improving the user experience.
[0105] S15. Render the point primitives corresponding to each target mesh vertex on the background image according to the attribute parameters of the point primitives corresponding to each target mesh vertex, and generate the rendering effect image of the target virtual model.
[0106] Specifically, when the attribute parameters of the point primitives can include visibility parameters, rendering position, brightness, and size, the implementation of step S15 (rendering the point primitives corresponding to each target mesh vertex on the background image according to the attribute parameters of the point primitives corresponding to each target mesh vertex, generating the rendering effect image of the target virtual model) can include the following steps a and b:
[0107] Step a: Obtain the set of point primitives to be rendered based on the visibility parameters of the point primitives corresponding to each target mesh vertex.
[0108] The set of point primitives to be rendered is a set of point primitives whose visibility parameter is the first parameter among the point primitives corresponding to each target mesh vertex.
[0109] Specifically, since point primitives with a visibility parameter of the second parameter are not visible, there is no need to render these point primitives during the actual rendering process. Therefore, point primitives with a visibility parameter of the second parameter can be removed from the point primitives that need to be rendered, avoiding the need to obtain other parameters of these point primitives based on the background image, thereby reducing the number of point primitives that need to be processed and reducing the amount of data that needs to be processed when rendering the target virtual model.
[0110] Step b: Based on the brightness and size of each point primitive in the set of point primitives to be rendered, render each point primitive in the set of point primitives to be rendered at its respective rendering position to generate the rendering effect image of the target virtual model.
[0111] The virtual model rendering method provided in this embodiment first selects multiple target mesh vertices from the mesh vertices of the target virtual model based on a preset method, and configures the point primitives corresponding to each target mesh vertex. Then, it renders the target virtual model to obtain a background image. Next, it determines the attribute parameters of the point primitives corresponding to each target mesh vertex based on the background image, and renders the point primitives corresponding to each target mesh vertex on the background image based on the attribute parameters of the point primitives corresponding to each target mesh vertex, generating a rendered image of the target virtual model. Since the rendered image of the target virtual model in this embodiment is an image obtained by rendering the point primitives corresponding to each target mesh vertex on the background image obtained by rendering the target virtual model, the generated rendered image in this embodiment has a flashing effect. Compared to achieving a flashing effect in a rendered image through full-screen post-processing, this embodiment does not require overlaying a flashing image on top of the rendered image while displaying the rendered image. Therefore, this embodiment can reduce the performance overhead of achieving a flashing effect in a rendered image, solving the problem of high performance overhead when achieving a flashing effect in a rendered image through full-screen post-processing.
[0112] It should also be noted that when implementing the flashing effect in the rendered image using full-screen post-processing, it is easy to encounter the problem that the flashing points do not appear on the object corresponding to the virtual model, but rather in areas other than the object corresponding to the virtual model. In the above embodiment, the point primitives correspond to the mesh vertices of the point primitives, thus ensuring that the point primitives are rendered on the object corresponding to the target virtual model, avoiding rendering the point primitives in areas other than the object corresponding to the target virtual model.
[0113] As an optional implementation of this disclosure, the step of determining the visibility parameters of the point primitives corresponding to each target mesh vertex based on the background image includes the following steps 1 to 3:
[0114] Step 1: Obtain the brightness of the pixel corresponding to each target grid vertex in the background image.
[0115] Step 2: Determine whether the brightness of the pixel corresponding to each target grid vertex is greater than or equal to the threshold brightness.
[0116] Step 3: Determine the visibility parameters of the point primitives corresponding to the target mesh vertex based on the judgment result.
[0117] Optionally, step 3 above (determining the visibility parameters of the point primitives corresponding to the target mesh vertex based on the judgment result) includes:
[0118] If the brightness of the pixel corresponding to the target grid vertex is greater than or equal to the threshold brightness, then the visibility parameter of the point primitive corresponding to the target grid vertex is determined to be the first parameter;
[0119] If the brightness of the pixel corresponding to the target grid vertex is less than the threshold brightness, then the visibility parameter of the point primitive corresponding to the target grid vertex is determined to be the second parameter.
[0120] That is, in step 2 above, if the brightness of the pixel corresponding to any target mesh vertex is greater than or equal to the threshold brightness, the visibility parameter of the point primitive corresponding to the target mesh vertex is determined as the first parameter; if the brightness of the pixel corresponding to any target mesh vertex is less than the threshold brightness, the visibility parameter of the point primitive corresponding to the target mesh vertex is determined as the second parameter. This is to realize the determination of the visibility parameter of the point primitive corresponding to the target mesh vertex based on the brightness of the pixel corresponding to the target mesh vertex, and to determine whether to render the point primitive based on the visibility parameter of the point primitive when rendering the point primitive.
[0121] In practice, the areas with lower brightness represented by the network model are generally backlit surfaces and do not contain reflective points. Rendering point primitives in these low-brightness areas would result in a less realistic rendering image. In the above embodiment, the brightness of the pixels corresponding to the target mesh vertices is first obtained, and then the decision on whether to render the point primitives corresponding to the target mesh vertices is made based on their brightness. Therefore, this embodiment avoids rendering point primitives in low-brightness areas, thereby improving the realism of the rendered image.
[0122] As an optional implementation of this disclosure, the step of determining the rendering position of the point primitives corresponding to each target mesh vertex based on the background image includes the following steps I and II:
[0123] Step 1: Obtain the position coordinates of each target grid vertex in the background image.
[0124] Specifically, the position coordinates of the target mesh vertex in the background image can be the pixel coordinates of the corresponding pixel of the target mesh vertex.
[0125] For example, if the pixel corresponding to a certain target grid vertex is the pixel in the 102nd row and 451st column of the background image, then the position coordinates of the target grid vertex can be represented as (102, 451).
[0126] Step II: Determine the position coordinates of each target mesh vertex as the rendering position of the corresponding point primitive.
[0127] It should be noted that during actual rendering, the rendering area of a point primitive may include multiple pixels, depending on the size of the point primitive. When the rendering area of a point primitive includes multiple pixels, the rendering position of the point primitive can be the geometric center of the rendering area.
[0128] As an optional implementation of this disclosure, the step of determining the brightness of the point primitives corresponding to each target mesh vertex based on the background image includes the following steps (1) and (2):
[0129] Step (1): Obtain the brightness of the pixel corresponding to each target grid vertex in the background image.
[0130] Step (2): Determine the brightness of the point primitives corresponding to each target grid vertex based on the brightness of the pixel points corresponding to each target grid vertex.
[0131] The brightness of the point primitive corresponding to any target grid vertex is positively correlated with the brightness of the pixel corresponding to that target grid vertex.
[0132] That is, the greater the brightness of the pixel corresponding to the target mesh vertex, the greater the brightness of the point primitive corresponding to the target mesh vertex; conversely, the smaller the brightness of the pixel corresponding to the target mesh vertex, the smaller the brightness of the point primitive corresponding to the target mesh vertex.
[0133] The above embodiments determine the brightness of the point primitives corresponding to each target grid vertex based on the brightness of the pixel corresponding to each target grid vertex, and the brightness of the point primitives corresponding to the target grid vertex is positively correlated with the brightness of the pixel corresponding to the target grid vertex. Therefore, the above embodiments can make the brightness of the point primitives match the brightness of the object represented by the target network model.
[0134] As an optional implementation of this disclosure, the step of determining the size of the point primitives corresponding to each target mesh vertex based on the background image includes the following steps ① and ②:
[0135] Step 1: Obtain the depth of the pixel points corresponding to each target mesh vertex in the background image.
[0136] Specifically, in this embodiment of the present disclosure, the depth of the pixel corresponding to the target mesh vertex can be a value used to characterize the distance from the target mesh vertex to the virtual camera.
[0137] Step 2: Determine the size of the point primitive corresponding to each target mesh vertex based on the depth of the pixel corresponding to each target mesh vertex.
[0138] The size of the point primitive corresponding to the target mesh vertex is negatively correlated with the depth of the pixel corresponding to the target mesh vertex.
[0139] That is, the greater the depth of the pixel corresponding to the target mesh vertex, the smaller the size of the point primitive corresponding to the target mesh vertex; conversely, the smaller the depth of the pixel corresponding to the target mesh vertex, the greater the brightness of the point primitive corresponding to the target mesh vertex.
[0140] The above embodiments determine the size of the point primitives corresponding to each target mesh vertex based on the depth of the pixel corresponding to each target mesh vertex, and the depth of the point primitives corresponding to the target mesh vertex is negatively correlated with the size of the pixel corresponding to the target mesh vertex. Therefore, the above embodiments can make the point primitives appear smaller when farther away and larger when closer, thereby making the final generated rendering effect image more realistic.
[0141] Furthermore, based on the above embodiments, the virtual model rendering method provided in this disclosure also includes:
[0142] Obtain the time corresponding to the rendered image, and adjust the brightness and / or size of the point primitives corresponding to each target mesh vertex according to the time.
[0143] In this embodiment of the disclosure, the time corresponding to the rendered image can include a time in any time reference frame. For example, the system time of the rendering system, the time of the timing system, the relative time of the rendered image with other rendered images, etc. Furthermore, the time corresponding to the rendered image can specifically be the time when rendering of the rendered image begins, the time when the rendered image is output, etc.
[0144] Since the above embodiments obtain the time corresponding to the rendering effect image and adjust the brightness and / or size of the point primitives corresponding to each target mesh vertex according to the time, the above embodiments can make the point primitives in the multi-frame continuous rendering effect image of the target network model exhibit the effect of brightness and / or size change over time, thereby making the rendering effect image exhibit a flickering effect.
[0145] Based on the same inventive concept, as an implementation of the above method, this disclosure also provides a virtual model rendering device. This device embodiment corresponds to the aforementioned method embodiment. For ease of reading, this device embodiment will not repeat the details of the aforementioned method embodiment one by one, but it should be clear that the virtual model rendering device in this embodiment can correspondingly implement all the contents of the aforementioned method embodiment.
[0146] This disclosure provides a virtual model rendering apparatus. Figure 2 This is a schematic diagram of the structure of the virtual model rendering device, as shown below. Figure 2 As shown, the virtual model rendering device 200 includes:
[0147] Selection unit 21 is used to select multiple target mesh vertices from the mesh vertices of the target virtual model based on a preset method;
[0148] Configuration unit 22 is used to set point primitives on each target mesh vertex respectively;
[0149] Rendering unit 23 is used to render the target virtual model to obtain a background image;
[0150] The determining unit 24 is used to determine the attribute parameters of the point primitives corresponding to each target mesh vertex based on the background image;
[0151] The rendering unit 23 is further configured to render the point primitives corresponding to each target mesh vertex on the background image according to the attribute parameters of the point primitives corresponding to each target mesh vertex, thereby generating the rendering effect image of the target virtual model.
[0152] It should be noted that the above embodiment uses the same functional unit as an example to illustrate the function unit for rendering the target virtual model to obtain the background image and the function unit for rendering the point primitives corresponding to each target mesh vertex on the background image according to the attribute parameters of the point primitives corresponding to each target mesh vertex. However, in practice, these two functional units can also be different functional units.
[0153] As an optional implementation of this disclosure, the selection unit 21 is specifically used to randomly select the same number of target mesh vertices from the mesh vertices of the target virtual model according to a preset number of point primitives.
[0154] As an optional implementation of this disclosure, the selection unit 21 is specifically used to divide the grid vertices of the target virtual model into multiple grid vertex sets according to a preset sparsity of point primitives; and randomly select one target grid vertex from each of the multiple grid vertex sets.
[0155] As an optional implementation of this disclosure, the determining unit 24 is specifically used for at least one of the following:
[0156] The visibility parameters of the point primitives corresponding to each target mesh vertex are determined based on the background image. The visibility parameters include a first parameter for characterizing the visibility of the corresponding point primitive or a second parameter for characterizing the invisibility of the corresponding point primitive.
[0157] The rendering position of the point primitives corresponding to each target mesh vertex is determined based on the background image;
[0158] The brightness of the point primitives corresponding to each target grid vertex is determined based on the background image;
[0159] The size of the point primitives corresponding to each target mesh vertex is determined based on the background image.
[0160] As an optional implementation of this disclosure, the determining unit 24 is specifically used to obtain the brightness of the pixel corresponding to each target grid vertex in the background image; determine whether the brightness of the pixel corresponding to each target grid vertex is greater than or equal to a threshold brightness; and determine the visibility parameter of the point primitive corresponding to the target grid vertex based on the determination result.
[0161] As an optional implementation of this disclosure, the determining unit 24 is specifically configured to determine the visibility parameter of the point primitive corresponding to the target mesh vertex as the first parameter if the brightness of the pixel corresponding to the target mesh vertex is greater than or equal to the threshold brightness; and to determine the visibility parameter of the point primitive corresponding to the target mesh vertex as the second parameter if the brightness of the pixel corresponding to the target mesh vertex is less than the threshold brightness.
[0162] As an optional implementation of this disclosure, the determining unit 24 is specifically used to obtain the position coordinates of each target mesh vertex in the background image; and to determine the position coordinates of each target mesh vertex as the rendering position of the point primitive corresponding to each target mesh vertex.
[0163] As an optional implementation of this disclosure, the determining unit 24 is specifically used to obtain the brightness of the pixel corresponding to each target grid vertex in the background image; and determine the brightness of the point primitive corresponding to each target grid vertex based on the brightness of the pixel corresponding to each target grid vertex; wherein the brightness of the point primitive corresponding to the target grid vertex is positively correlated with the brightness of the pixel corresponding to the target grid vertex.
[0164] As an optional implementation of this disclosure, the determining unit 24 is specifically used to obtain the depth of the pixel corresponding to each target grid vertex in the background image; and to determine the size of the point primitive corresponding to each target grid vertex based on the depth of the pixel corresponding to each target grid vertex; wherein the size of the point primitive corresponding to the target grid vertex is negatively correlated with the depth of the pixel corresponding to the target grid vertex.
[0165] As an optional implementation of this disclosure, the determining unit 24 is further configured to obtain the time corresponding to the rendered image; and adjust the brightness and / or size of the point primitives corresponding to each target mesh vertex according to the time.
[0166] Based on the same inventive concept, this disclosure also provides an electronic device. Figure 3 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this disclosure, such as... Figure 3 As shown, the electronic device provided in this embodiment includes a memory 31 and a processor 32. The memory 31 is used to store computer programs; the processor 32 is used to enable the electronic device to implement the virtual model rendering method provided in the above embodiment when the computer program is invoked and executed.
[0167] This disclosure also provides a computer-readable storage medium storing a computer program that, when executed by a computing device, causes the computing device to implement the virtual model rendering method provided in the above embodiments.
[0168] This disclosure also provides a computer program product that, when run on a computer, enables the computer to implement the virtual model rendering method provided in the above embodiments.
[0169] Those skilled in the art will understand that embodiments of this disclosure can be provided as methods, systems, or computer program products. Therefore, this disclosure can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this disclosure can take the form of a computer program product embodied on one or more computer-usable storage media containing computer-usable program code.
[0170] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0171] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, like read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0172] Computer-readable media include both permanent and non-permanent, removable and non-removable storage media. Storage media can store information using any method or technology; the information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0173] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this disclosure, and are not intended to limit them. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this disclosure.
Claims
1. A virtual model rendering method, characterized in that, include: Multiple target mesh vertices are selected from the mesh vertices of the target virtual model based on a preset method. The target virtual model is a mesh model of an object represented by multiple interconnected polygons, and the mesh vertices of the target virtual model are the vertices of each polygon in the mesh model. Configure the point primitives corresponding to each target mesh vertex, with a one-to-one correspondence between target mesh vertices and point primitives; Render the target virtual model to obtain a background image; The attribute parameters of the point primitives corresponding to each target mesh vertex are determined based on the background image; Based on the attribute parameters of the point primitives corresponding to each target mesh vertex, the point primitives corresponding to each target mesh vertex are rendered on the background image to generate the rendering effect image of the target virtual model; The attribute parameters include visibility parameters, which include a first parameter indicating that the corresponding point primitive is visible or a second parameter indicating that the corresponding point primitive is not visible. The visibility parameters of the point primitives corresponding to each target mesh vertex are determined based on the background image, including: Obtain the brightness of the pixel corresponding to each target grid vertex in the background image; Determine whether the brightness of the pixel corresponding to each target grid vertex is greater than or equal to the threshold brightness; Based on the judgment result, the visibility parameters of the point primitives corresponding to the target mesh vertex are determined.
2. The method according to claim 1, characterized in that, The step of selecting multiple target mesh vertices from the mesh vertices of the target virtual model based on a preset method includes: Based on a preset number of point primitives, the same number of target mesh vertices are randomly selected from the mesh vertices of the target virtual model.
3. The method according to claim 1, characterized in that, The step of selecting multiple target mesh vertices from the mesh vertices of the target virtual model based on a preset method includes: The target virtual model's grid vertices are divided into multiple grid vertex sets based on the pre-defined sparsity of the point primitives; One target grid vertex is randomly selected from each of the multiple grid vertex sets.
4. The method according to claim 1, characterized in that, The step of determining the attribute parameters of the point primitives corresponding to each target mesh vertex based on the background image includes at least one of the following: The rendering position of the point primitives corresponding to each target mesh vertex is determined based on the background image; The brightness of the point primitives corresponding to each target grid vertex is determined based on the background image; The size of the point primitives corresponding to each target mesh vertex is determined based on the background image.
5. The method according to claim 4, characterized in that, The step of determining the visibility parameters of the point primitives corresponding to the target mesh vertex based on the judgment result includes: If the brightness of the pixel corresponding to the target grid vertex is greater than or equal to the threshold brightness, then the visibility parameter of the point primitive corresponding to the target grid vertex is determined to be the first parameter; If the brightness of the pixel corresponding to the target grid vertex is less than the threshold brightness, then the visibility parameter of the point primitive corresponding to the target grid vertex is determined to be the second parameter.
6. The method according to claim 4, characterized in that, The step of determining the rendering position of the point primitives corresponding to each target mesh vertex based on the background image includes: Obtain the position coordinates of each target mesh vertex in the background image; The position coordinates of each target mesh vertex are determined as the rendering position of the point primitive corresponding to each target mesh vertex.
7. The method according to claim 4, characterized in that, The step of determining the brightness of the point primitives corresponding to each target grid vertex based on the background image includes: Obtain the brightness of the pixel corresponding to each target grid vertex in the background image; The brightness of the point primitives corresponding to each target grid vertex is determined based on the brightness of the pixels corresponding to each target grid vertex. The brightness of the point primitive corresponding to the target mesh vertex is positively correlated with the brightness of the pixel corresponding to the target mesh vertex.
8. The method according to claim 4, characterized in that, Determining the size of the point primitives corresponding to each target mesh vertex based on the background image includes: Obtain the depth of the pixel corresponding to each target mesh vertex in the background image; The size of the point primitive corresponding to each target mesh vertex is determined based on the depth of the pixel point corresponding to each target mesh vertex. The size of the point primitive corresponding to the target mesh vertex is negatively correlated with the depth of the pixel corresponding to the target mesh vertex.
9. The method according to any one of claims 4-8, characterized in that, The method further includes: Obtain the time corresponding to the rendered image; The brightness and / or size of the point primitives corresponding to each target mesh vertex are adjusted according to the time specified.
10. A virtual model rendering device, characterized in that, include: The selection unit is used to select multiple target mesh vertices from the mesh vertices of the target virtual model based on a preset method. The target virtual model is a mesh model of an object represented by multiple interconnected polygons, and the mesh vertices of the target virtual model are the vertices of each polygon in the mesh model. The configuration unit is used to set point primitives on each target mesh vertex, with a one-to-one correspondence between the target mesh vertex and the point primitive; A rendering unit is used to render the target virtual model to obtain a background image; The determining unit is used to determine the attribute parameters of the point primitives corresponding to each target mesh vertex based on the background image; The rendering unit is further configured to render the point primitives corresponding to each target mesh vertex on the background image according to the attribute parameters of the point primitives corresponding to each target mesh vertex, thereby generating a rendering effect image of the target virtual model. The attribute parameters include visibility parameters, which include a first parameter indicating that the corresponding point primitive is visible or a second parameter indicating that the corresponding point primitive is not visible. The determining unit is specifically used to determine the visibility parameters of the point primitives corresponding to each target grid vertex based on the background image, including: obtaining the brightness of the pixels corresponding to each target grid vertex in the background image; determining whether the brightness of the pixels corresponding to each target grid vertex is greater than or equal to a threshold brightness; and determining the visibility parameters of the point primitives corresponding to the target grid vertex based on the determination result.
11. An electronic device, characterized in that, include: A memory and a processor, the memory being used to store a computer program; the processor being used to cause the electronic device to implement the virtual model rendering method according to any one of claims 1-9 when executing the computer program.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a computing device, causes the computing device to implement the virtual model rendering method according to any one of claims 1-9.
13. A computer program product, characterized in that, When the computer program product is run on a computer, the computer implements the virtual model rendering method according to any one of claims 1-9.