Rendering method and device and electronic equipment
Reducing the number of vertices by generating mesh models and extrusion operations, the problem of low hair rendering efficiency is solved, and faster loading time and higher rendering efficiency is achieved.
Patent Information
- Application Number
- CN202311110535.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-30
- Publication Date
- 2025-02-28
AI Technical Summary
When rendering hair, due to the excessive amount of hair rendered, the hair loading time is too long, which reduces the rendering efficiency.
By obtaining the rendering area of the object to be rendered, particles and their parameter information are generated, grid models are generated based on this information, and patches are generated through extrusion operations, and finally rendering based on patches is performed to reduce the number of vertices that need to be retained and improve loading speed.
By reducing the number of vertices, the loading time of particles is shortened, the rendering efficiency of the rendering area is improved, and the user experience is improved.
Smart Images

Figure CN119540418A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular to a rendering method, device and electronic device. Background Art
[0002] With the rapid development of computer graphics technology, virtual objects are increasingly being used in the production of movies, games and animations. In order to achieve the realism of virtual objects, some key technologies are needed, such as skeletal animation, facial expressions and hair simulation, and hair simulation has always been a very challenging and important issue in the field of graphics. Hair rendering refers to drawing hair for virtual objects and achieving hair simulation, which plays an important role in improving the realism of virtual objects.
[0003] However, when performing hair rendering, it often happens that the hair loading time is too long due to the excessive amount of hair to be rendered, resulting in low rendering efficiency of the hair rendering. Summary of the invention
[0004] In order to solve the above technical problems, the present disclosure provides a rendering method, device and electronic device for solving the problem that when performing hair rendering, the hair loading time is too long due to the excessive number of rendered hairs, resulting in low rendering efficiency of hair rendering.
[0005] In order to achieve the above objectives, the present disclosure provides the following technical solutions:
[0006] In a first aspect, the present disclosure provides a rendering method, comprising: obtaining a rendering area of an object to be rendered; wherein the rendering area includes a target number of points to be rendered, and each point to be rendered corresponds to a strip-shaped object; taking the point to be rendered as a starting point, generating at least one particle and parameter information corresponding to each particle; generating a mesh model based on the parameter information; wherein the mesh model includes at least two vertices, and configuration parameters corresponding to each vertex, the configuration parameters including a topological relationship, one particle corresponds to at least two vertices, and different particles have different corresponding vertices; based on the at least two vertices corresponding to the particle and the topological relationship corresponding to the vertices, determining at least one broken line segment corresponding to the particle; performing an extrusion operation on the broken line segment to generate a facet corresponding to the broken line segment; wherein the sum of the number of vertices corresponding to the facet is less than a preset threshold; based on the facet, rendering the rendering area to obtain a rendering result of the object to be rendered.
[0007] As an optional implementation of the present disclosure, generating at least one particle with the point to be rendered as the starting point includes: using a particle system in the rendering area to generate at least one particle with the point to be rendered as the starting point.
[0008] As an optional implementation of the present disclosure, an extrusion operation is performed on a broken line segment to generate a face patch corresponding to the broken line segment, including: randomly selecting a preset number of broken line segments from the broken line segment as first target segments, and using the broken line segments other than the first target segments from the broken line segment as second target segments; for the first target segment, an extrusion operation is performed along a first direction to obtain a first actual face patch corresponding to the first target segment; for the second target segment, an extrusion operation is performed along a second direction to obtain a second actual face patch corresponding to the second target segment; wherein the first direction is perpendicular to the second direction; based on the first actual face patch and the second actual face patch, a face patch corresponding to the broken line segment is generated.
[0009] As an optional implementation of the present disclosure, the first direction is the x-axis direction in the grid model, and the second direction is the y-axis direction in the grid model.
[0010] As an optional implementation of the present disclosure, before generating a mesh model based on parameter information, the rendering method provided by the present disclosure also includes: performing a target operation on particles to obtain modified particles; wherein the target operation includes one or more of distribution, randomization and modeling; generating a mesh model based on the parameter information, including: generating a mesh model based on the parameter information of the modified particles.
[0011] As an optional implementation of the present disclosure, the parameter information at least includes position information of the starting point of the particle in the rendering area, position information of the ending point, position information of each bending point, and the deflection direction of the particle. Taking the point to be rendered as the starting point, generating at least one particle and parameter information corresponding to each particle, including: taking the point to be rendered as the starting point, generating at least one particle; measuring the particle to obtain position information of the starting point of the particle in the rendering area, position information of the ending point, position information of each bending point, and the deflection direction of the particle; generating a mesh model based on the parameter information, including: determining at least one vertex and configuration parameters corresponding to each vertex based on the position information of the starting point of the particle in the rendering area, position information of the ending point, position information of each bending point, and the deflection direction of the particle; generating a mesh model according to the vertex and the configuration parameters corresponding to the vertex.
[0012] As an optional implementation of the present disclosure, when the object to be rendered is an animal's body, the parameter information further includes a first parameter for representing the color of the strip-shaped object at the cortical connection, and the configuration parameters further include the first parameter.
[0013] As an optional implementation of the present disclosure, when the rendering result includes a rendering area with brightness greater than a first threshold, and the rendering result includes a rendering area with brightness less than a second threshold, the parameter information also includes a second parameter for representing the height of the strip-shaped object, and the configuration parameters also include the second parameter.
[0014] In a second aspect, the present disclosure provides a rendering device, comprising: an acquisition unit, used to acquire a rendering area of an object to be rendered; wherein the rendering area includes a target number of points to be rendered, and each point to be rendered corresponds to a strip-shaped object; a processing unit, used to generate at least one particle and parameter information corresponding to each particle, taking the points to be rendered acquired by the acquisition unit as a starting point; the processing unit is also used to generate a mesh model based on the parameter information; wherein the mesh model includes at least two vertices and configuration parameters corresponding to each vertex, the configuration parameters include a topological relationship, one particle corresponds to at least two vertices, and different particles have different corresponding vertices; the processing unit is also used to determine at least one broken line segment corresponding to the particle based on the at least two vertices corresponding to the particle and the topological relationship corresponding to the vertices; the processing unit is also used to perform an extrusion operation on the broken line segment to generate a facet corresponding to the broken line segment; wherein the sum of the number of vertices corresponding to the facet is less than a preset threshold; the processing unit is also used to render the rendering area based on the facet to obtain a rendering result of the object to be rendered.
[0015] As an optional implementation of the present disclosure, the processing unit is specifically configured to use a particle system within the rendering area acquired by the acquisition unit to generate at least one particle with the point to be rendered as a starting point.
[0016] As an optional implementation of the present disclosure, a processing unit is specifically used to randomly select a preset number of broken line segments from the broken line segments as first target line segments, and use the broken line segments other than the first target line segments from the broken line segments as second target line segments; the processing unit is specifically used to perform an extrusion operation along a first direction on the first target line segment to obtain a first actual face patch corresponding to the first target line segment; the processing unit is specifically used to perform an extrusion operation along a second direction on the second target line segment to obtain a second actual face patch corresponding to the second target line segment; wherein the first direction is perpendicular to the second direction; the processing unit is specifically used to generate a face patch corresponding to the broken line segment based on the first actual face patch and the second actual face patch.
[0017] As an optional implementation of the present disclosure, the first direction is the x-axis direction in the grid model, and the second direction is the y-axis direction in the grid model.
[0018] As an optional implementation of the present disclosure, the processing unit is also used to perform target operations on particles to obtain modified particles; wherein the target operations include one or more of distribution, randomization and modeling; the processing unit is specifically used to generate a mesh model based on parameter information of the modified particles.
[0019] As an optional implementation of the present disclosure, the parameter information at least includes position information of the starting point of the particle in the rendering area, position information of the ending point, position information of each bending point, and the deflection direction of the particle; the processing unit is specifically used to generate at least one particle with the point to be rendered acquired by the acquisition unit as the starting point; the processing unit is specifically used to measure the particle to obtain the position information of the starting point of the particle in the rendering area, the position information of the ending point, position information of each bending point, and the deflection direction of the particle; the processing unit is specifically used to determine at least one vertex and the configuration parameters corresponding to each vertex based on the position information of the starting point of the particle in the rendering area, the position information of the ending point, the position information of each bending point, and the deflection direction of the particle; the processing unit is specifically used to generate a mesh model according to the vertices and the configuration parameters corresponding to the vertices.
[0020] As an optional implementation of the present disclosure, when the object to be rendered is an animal's body, the parameter information further includes a first parameter for representing the color of the strip-shaped object at the cortical connection, and the configuration parameters further include the first parameter.
[0021] As an optional implementation of the present disclosure, when the rendering result includes a rendering area with brightness greater than a first threshold, and the rendering result includes a rendering area with brightness less than a second threshold, the parameter information also includes a second parameter for representing the height of the strip-shaped object, and the configuration parameters also include the second parameter.
[0022] In a third aspect, the present disclosure provides an electronic device, comprising: a memory and a processor, the memory being used to store a computer program; the processor being used to enable the electronic device to implement any one of the rendering methods provided in the first aspect when executing the computer program.
[0023] In a fourth aspect, the present invention discloses a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a computing device, the computing device implements any one of the rendering methods provided in the first aspect.
[0024] In a fifth aspect, the present invention discloses a computer program product. When the computer program product is executed on a computer, the computer implements any rendering method provided in the first aspect.
[0025] The description of the second, third, fourth and fifth aspects in the present disclosure can refer to the detailed description of the first aspect; and the beneficial effects of the description of the second, third, fourth and fifth aspects can refer to the beneficial effect analysis of the first aspect, which will not be repeated here.
[0026] It should be noted that the above computer instructions may be stored in whole or in part on a first computer-readable storage medium, wherein the first computer-readable storage medium may be packaged together with the processor of the rendering device, or may be packaged separately from the processor of the rendering device, which is not limited in the present disclosure.
[0027] In the present disclosure, the name of the rendering device does not limit the device or functional module itself. In actual implementation, these devices or functional modules may appear with other names. As long as the functions of each device or functional module are similar to those of the present disclosure, they fall within the scope of the claims of the present disclosure and their equivalent technologies.
[0028] These and other aspects of the present disclosure will become more apparent from the following description.
[0029] Compared with the prior art, the technical solution provided by the present invention has the following advantages:
[0030] As can be seen from the above, the rendering method provided by the present disclosure, after obtaining the rendering area of the object to be rendered, takes the point to be rendered in the rendering area as the starting point, and generates at least one particle. Then, based on the parameter information, a mesh model is generated; then, based on at least two vertices corresponding to the particle and the topological relationship corresponding to the vertex, at least one polyline segment corresponding to the particle is determined. Then, an extrusion operation is performed on the polyline segment to generate a facet corresponding to the polyline segment. Finally, based on the facet, the rendering area is rendered to obtain the rendering result of the object to be rendered. It can be seen that the rendering method provided by the present disclosure, when the strip-shaped object is hair, by limiting the sum of the number of vertices corresponding to the facet, such as the sum of the number of vertices is less than a preset threshold, the number of vertices to be retained can be reduced. Since the number of vertices to be loaded is reduced, the loading time of the particles can be accelerated. Since the loading time is shortened, the rendering efficiency of the rendering area can be improved to ensure the user experience. The problem that when rendering hair, the hair loading time is too long due to the excessive number of rendered hairs, resulting in low rendering efficiency of hair rendering is solved. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0032] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0033] Figure 1One of the flowcharts of the rendering method provided in the embodiment of the present disclosure;
[0034] Figure 2 A second flowchart of the rendering method provided in the embodiment of the present disclosure;
[0035] Figure 3 A third flowchart of the rendering method provided in the embodiment of the present disclosure;
[0036] Figure 4 A fourth flowchart of the rendering method provided in an embodiment of the present disclosure;
[0037] Figure 5 A fifth flowchart of the rendering method provided in the embodiment of the present disclosure;
[0038] Figure 6 A schematic diagram of the structure of a rendering device provided in an embodiment of the present disclosure;
[0039] Figure 7 A schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure;
[0040] Figure 8 A schematic diagram of the structure of a computer program product of a rendering method provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0041] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0042] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0043] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0044] The particle system in the embodiment of the present disclosure is one of the most mature theories in computer graphics for describing irregular objects to date, and is also one of the methods with the best visual effects in the field of visual simulation for simulating natural phenomena and special effects.
[0045] The patch in the embodiment of the present disclosure is a new type of geometric primitive. In the subdivision stage, the patch must first be specified, that is, an ordered list of vertices.
[0046] H5 in the embodiments of the present disclosure refers to HTML5 (HyperText Markup Language 5), which is a language description method for constructing Web content.
[0047] Blender in the disclosed embodiment is a free open source 3D graphics software that provides a series of animation short film production solutions from modeling, animation, materials, rendering, to audio processing, video editing, etc.
[0048] The Mesh in the disclosed embodiment is a mesh of a model, where points form lines, lines form triangles, and triangles form faces. The mesh surface is then expressed through materials, such as shadows, maps, etc.
[0049] Figure 1 is a flowchart of a rendering method according to an exemplary embodiment. Figure 1 As shown, the method includes the following S11-S16.
[0050] S11, obtaining a rendering area of the object to be rendered, wherein the rendering area includes a target number of points to be rendered, and each point to be rendered corresponds to a strip-shaped object.
[0051] In some examples, the rendering area may be a closed curved surface or a closed plane, which is not limited here.
[0052] In some examples, the strip-shaped object may be hair, brush bristles, animal hair, etc.
[0053] In some examples, in order to ensure the rendering effect, a target number of points to be rendered may be evenly set in the rendering area. Alternatively, a target number of points to be rendered may be randomly selected in the rendering area. Alternatively, according to the proportion of strip-shaped objects in different areas of the rendering area, a preset number of points to be rendered (equal to the product of the proportion of strip-shaped objects in the area and the target number) may be set for different areas.
[0054] In some examples, the object to be rendered may be a snow boot, or a person's hair, an animal's body, and the like.
[0055] S12, taking the point to be rendered as a starting point, generating at least one particle and parameter information corresponding to each particle.
[0056] In some examples, one particle corresponds to one strip-shaped object. One particle corresponds to one parameter information, and the parameter information at least includes the position information of the starting point of the particle in the rendering area, the position information of the ending point, the position information of each bending point, and the deflection direction of the particle.
[0057] In some examples, in order to better describe the position of the particle in the rendering area, the rendering method provided by the embodiments of the present disclosure establishes a rectangular coordinate system in the rendering area, such as taking any vertex in the rendering area as the origin, taking the plane where the rendering area is located as the xy plane, and establishing the z axis perpendicular to the xy plane, thereby completing the establishment of the rectangular coordinate system. Afterwards, the particle's parameter information is obtained by measuring the position information (coordinate point) of the starting point of the particle in the rectangular coordinate system, the position information of the end point, the position information of each bending point, and the deflection direction of the particle.
[0058] In some examples, at least one particle may be generated at each point to be rendered in the rendering area using a particle system, so that the number of strip-shaped objects in the rendering area may be controlled by controlling the number of particles corresponding to each point to be rendered.
[0059] In some examples, the preset end point area may be determined based on the height of a strip-shaped object that needs to be rendered in the rendering area.
[0060] In some examples, the end point of the particle may be a point randomly selected within a preset end point region.
[0061] In some examples, when generating at least one particle at a point to be rendered, it is first necessary to determine the number of particles to be ejected at the point to be rendered, and then select at least one control point area on both sides of the line connecting the starting point of the particle and the preset end point area. Then, randomly select a point with a certain number of particles in the preset end point area as the end point of the particle. The control point area is used to change the movement direction of the particle.
[0062] For each particle, after determining the starting point and end point of the particle, at least one control point is randomly selected in each control point area, and a motion trajectory is drawn by inputting the starting point and end point of the particle and at least one control point into the target curve drawing function (such as the drawing function of the Bezier curve). Afterwards, the motion trajectory is used as a strip-shaped object, so that the strip-shaped object existing in the rendering area can be simulated.
[0063] In some examples, the particle system may be provided in Digital Content Creator (DCC), or provided by Blender.
[0064] S13, generating a mesh model based on the parameter information, wherein the mesh model includes at least two vertices and configuration parameters corresponding to each vertex, the configuration parameters include a topological relationship, one particle corresponds to at least two vertices, and different particles correspond to different vertices.
[0065] In some examples, the parameter information includes the position information of the starting point of the particle in the rendering area, the position information of the ending point, the position information of each bending point, and the deflection direction of the particle; in this case, at least one vertex and the configuration parameter corresponding to each vertex can be determined based on the position information of the starting point of the particle in the rendering area, the position information of the ending point, the position information of each bending point, and the deflection direction of the particle. The mesh model is generated according to the vertex and the configuration parameter corresponding to the vertex.
[0066] In some examples, since the parameter information of particles in the rectangular coordinate system is not a universal description method, such as: particle 1 is a line segment with a length of 1 extending from (0, 0, 0) to the top, the particle needs to be converted into a mesh model, such as generating a mesh model based on the parameter information. At this time, the parameter information of particle 1 is converted into mesh = line: (0, 0, 0) -> (0, 0, 1), so that the particle can be converted into a universal description.
[0067] S14. Determine at least one broken line segment corresponding to the particle based on at least two vertices corresponding to the particle and the topological relationship corresponding to the vertices.
[0068] In some examples, the connection relationship between vertices can be determined based on the topological relationship. Then, at least one broken line segment is generated through the connection relationship between the vertices contained in the particle (two vertices are connected, corresponding to one broken line segment).
[0069] S15, performing an extrusion operation on the polyline segment to generate a face patch corresponding to the polyline segment, wherein the sum of the number of vertices corresponding to the face patch is less than a preset threshold.
[0070] In some examples, since the generated particle is a line, in order to meet the rendering effect requirements on the mobile terminal H5, the rendering method provided by the present disclosure generates a Mesh grid by converting the parameter information of the particle after obtaining the particle. At this time, after converting the particle into a Mesh grid, at least one polyline segment corresponding to the particle can be determined based on at least two vertices corresponding to the particle and the topological relationship corresponding to the vertex. In order to make the particle more three-dimensional, the rendering method provided by the embodiment of the present disclosure generates a facet corresponding to the polyline segment by performing an extrusion operation on the polyline segment, such as: performing an extrusion operation on the polyline segment in the first direction and the second direction respectively, and generating a facet corresponding to the polyline segment. Compared with the prior art in which particles are extruded in various directions (such as: various faces of a bottomless tetrahedron), the rendering method provided by the embodiment of the present disclosure only performs an extrusion operation in the first direction and the second direction respectively, and generates a facet in the first direction and a facet in the second direction. Since the number of facets is less, the number of vertices that need to be retained is less, so that the number of vertices can be simplified. Since the number of vertices of the particle is greatly reduced, the loading time of the particle can be accelerated. Since the loading time is shortened, the rendering efficiency of the rendering area can be improved to ensure the user experience.
[0071] In some examples, the first direction is perpendicular to the second direction. In this way, all the patches can be divided into two groups and made perpendicular to each other, ensuring that at least half of the strip-shaped objects are visible, avoiding the strip-shaped objects being too sparse at a specific angle. At the same time, through the light and dark changes of the patches, the effect of partial lighting is poorly simulated, at least a change is produced.
[0072] In some examples, the first direction is the x-axis direction in the grid model, and the second direction is the y-axis direction in the grid model.
[0073] In some examples, when the object to be rendered is the body of an animal, the parameter information also includes a first parameter (such as UV) for representing the color of the strip-shaped object at the cortical connection. For example, when the object to be rendered is the body of a small animal and the strip-shaped object is the animal's hair, since it is necessary to ensure that the color of the hair is consistent with the color of the epidermis, the color of the hair can be controlled by the first parameter to ensure the rendering effect. For example, the rendering area is set with multiple colors, and different colors correspond to different points to be rendered. Therefore, the area can be divided based on the points to be rendered corresponding to the color, and the same first parameter can be configured for the particles in the same area, so that the color of the hair can be controlled.
[0074] In some examples, when the rendering result includes a rendering area with a brightness greater than a first threshold, and the rendering result includes a rendering area with a brightness less than a second threshold, the parameter information also includes a second parameter (such as called intercept) for representing the height of the strip-shaped object. For example, when rendering the rendering area, the strip-shaped object with a lower position (such as the second parameter is less than or equal to the height threshold) can be ambient light masked, thereby producing a natural light and dark level and ensuring the rendering effect.
[0075] In some examples, the height of the strip-shaped object is equal to the sum of the heights of the broken line segments included in the particles corresponding to the strip-shaped object.
[0076] In some examples, after obtaining particles, target operations can be performed on the particles to obtain modified particles. The target operations include one or more of distribution, randomization, and modeling. This can simulate the actual distribution of strip-shaped objects, making the rendering effect more consistent with the real scene. At the same time, a mesh model is generated based on the parameter information of the modified particles.
[0077] In some examples, a preset number (such as 50% of the total number of broken line segments) of broken line segments can be randomly selected from the broken line segments as the first target line segments, and the broken line segments other than the first target line segments can be used as the second target line segments. Afterwards, for the first target line segment, an extrusion operation is performed along a first direction (such as the x-axis direction) to obtain a first actual facet corresponding to the first target line segment. For the second target line segment, an extrusion operation is performed along a second direction (such as the y-axis direction) to obtain a second actual facet corresponding to the second target line segment. The first direction and the second direction are perpendicular. Based on the first actual facet and the second actual facet, a facet corresponding to the broken line segment is generated. In this way, the light and dark levels can be simulated by controlling the orientation of the facets to avoid the situation where the distribution of strip-shaped objects cannot be clearly seen at certain angles, thereby ensuring the rendering effect.
[0078] S16. Rendering the rendering area based on the face patch to obtain a rendering result of the object to be rendered.
[0079] As can be seen from the above, the rendering method provided by the embodiment of the present disclosure generates a mesh model through the parameter information of the particles after obtaining the particles. Afterwards, extrusion operations are performed in the first direction and the second direction of the broken line segment respectively to generate facets corresponding to the broken line segment. Compared with the prior art in which particles are extruded in various directions (such as the various faces of a bottomless tetrahedron), the rendering method provided by the embodiment of the present disclosure only performs extrusion operations in the first direction and the second direction respectively to generate facets in the first direction and the second direction. Since the number of facets is smaller, the number of vertices that need to be retained is smaller, thereby streamlining the number of vertices. Since the number of vertices of the particles is greatly reduced, the loading time of the particles can be accelerated. Since the loading time is shortened, the rendering efficiency of the rendering area can be improved to ensure the user experience.
[0080] As an optional implementation of the present disclosure, Figure 1 ,like Figure 2 As shown, the above S12 can be specifically implemented through the following S120.
[0081] S120: Using a particle system in the rendering area, generating at least one particle with the point to be rendered as a starting point.
[0082] As an optional implementation of the present disclosure, Figure 1 ,like Figure 3 As shown, the above S15 can be specifically implemented through the following S150-S153.
[0083] S150. Randomly select a preset number of broken line segments from the broken line segments as first target line segments, and select the broken line segments other than the first target line segments from the broken line segments as second target line segments.
[0084] S151 . For a first target line segment, perform an extrusion operation along a first direction to obtain a first actual facet corresponding to the first target line segment.
[0085] S152: For the second target line segment, perform an extrusion operation along a second direction to obtain a second actual facet corresponding to the second target line segment, wherein the first direction is perpendicular to the second direction.
[0086] S153: Generate a patch corresponding to the polyline segment based on the first actual patch and the second actual patch.
[0087] As an optional implementation of the present disclosure, the first direction is the x-axis direction in the grid model, and the second direction is the y-axis direction in the grid model.
[0088] As an optional implementation of the present disclosure, Figure 1 ,like Figure 4As shown, the rendering method provided by the embodiment of the present disclosure further includes S17, and the above S13 can be specifically implemented by the following S131.
[0089] S17, performing a target operation on the particles to obtain modified particles, wherein the target operation includes one or more of distribution, randomization and modeling.
[0090] S131. Generate a mesh model based on the parameter information of the modified particles.
[0091] As an optional implementation of the present disclosure, the parameter information at least includes the position information of the starting point of the particle in the rendering area, the position information of the ending point, the position information of each bending point, and the deflection direction of the particle; Figure 1 ,like Figure 5 As shown, the above S12 can be specifically implemented through the following S120 and S121, and the above S13 can be specifically implemented through the following S132 and S133.
[0092] S120 , generating at least one particle with the point to be rendered as a starting point.
[0093] S121, measuring the particle to obtain the position information of the starting point of the particle in the rendering area, the position information of the ending point, the position information of each bending point, and the deflection direction of the particle.
[0094] S132. Determine at least one vertex and configuration parameters corresponding to each vertex based on the position information of the starting point, the position information of the ending point, the position information of each bending point, and the deflection direction of the particle in the rendering area.
[0095] S133. Generate a mesh model according to the vertices and configuration parameters corresponding to the vertices.
[0096] As an optional implementation of the present disclosure, when the object to be rendered is an animal's body, the parameter information further includes a first parameter for representing the color of the strip-shaped object at the cortical connection, and the configuration parameters further include the first parameter.
[0097] As an optional implementation of the present disclosure, when the rendering result includes a rendering area with brightness greater than a first threshold, and the rendering result includes a rendering area with brightness less than a second threshold, the parameter information also includes a second parameter for representing the height of the strip-shaped object, and the configuration parameters also include the second parameter.
[0098] The above mainly introduces the solution provided by the embodiment of the present invention from the perspective of the method. In order to achieve the above functions, it includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present invention can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0099] The embodiment of the present invention can divide the functional modules of the rendering device according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present invention is schematic and is only a logical functional division. There may be other division methods in actual implementation.
[0100] like Figure 6 As shown, an embodiment of the present invention provides a schematic diagram of the structure of a rendering device 10. The rendering device 10 includes an acquisition unit 101 and a processing unit 102.
[0101] The acquisition unit 101 is used to acquire a rendering area of an object to be rendered; wherein the rendering area includes a target number of points to be rendered, and each point to be rendered corresponds to a strip-shaped object; the processing unit 102 is used to generate at least one particle and parameter information corresponding to each particle, taking the points to be rendered acquired by the acquisition unit 101 as a starting point; the processing unit 102 is also used to generate a mesh model based on the parameter information; wherein the mesh model includes at least two vertices and configuration parameters corresponding to each vertex, the configuration parameters include a topological relationship, one particle corresponds to at least two vertices, and different particles have different corresponding vertices; the processing unit 102 is also used to determine at least one broken line segment corresponding to the particle based on the at least two vertices corresponding to the particle and the topological relationship corresponding to the vertices; the processing unit 102 is also used to perform an extrusion operation on the broken line segment to generate a facet corresponding to the broken line segment; wherein the sum of the number of vertices corresponding to the facet is less than a preset threshold; the processing unit 102 is also used to render the rendering area based on the facet to obtain a rendering result of the object to be rendered.
[0102] As an optional implementation of the present disclosure, the processing unit 102 is specifically configured to use a particle system in the rendering area acquired by the acquisition unit 101 to generate at least one particle with the point to be rendered as a starting point.
[0103] As an optional implementation of the present disclosure, the processing unit 102 is specifically used to randomly select a preset number of broken line segments from the broken line segments as first target line segments, and use the broken line segments other than the first target line segments from the broken line segments as second target line segments; the processing unit 102 is specifically used to perform an extrusion operation along a first direction on the first target line segment to obtain a first actual face patch corresponding to the first target line segment; the processing unit 102 is specifically used to perform an extrusion operation along a second direction on the second target line segment to obtain a second actual face patch corresponding to the second target line segment; wherein the first direction is perpendicular to the second direction; the processing unit 102 is specifically used to generate a face patch corresponding to the broken line segment based on the first actual face patch and the second actual face patch.
[0104] As an optional implementation of the present disclosure, the first direction is the x-axis direction in the grid model, and the second direction is the y-axis direction in the grid model.
[0105] As an optional implementation of the present disclosure, the processing unit 102 is also used to perform target operations on particles to obtain modified particles; wherein the target operations include one or more of distribution, randomization and modeling; the processing unit 102 is specifically used to generate a mesh model based on parameter information of the modified particles.
[0106] As an optional implementation of the present disclosure, the parameter information at least includes position information of the starting point of the particle in the rendering area, position information of the ending point, position information of each bending point, and the deflection direction of the particle; the processing unit 102 is specifically used to generate at least one particle with the point to be rendered obtained by the acquisition unit 101 as the starting point; the processing unit 102 is specifically used to measure the particle to obtain the position information of the starting point of the particle in the rendering area, the position information of the ending point, the position information of each bending point, and the deflection direction of the particle; the processing unit 102 is specifically used to determine at least one vertex and the configuration parameters corresponding to each vertex based on the position information of the starting point of the particle in the rendering area, the position information of the ending point, the position information of each bending point, and the deflection direction of the particle; the processing unit 102 is specifically used to generate a mesh model according to the vertices and the configuration parameters corresponding to the vertices.
[0107] As an optional implementation of the present disclosure, when the object to be rendered is an animal's body, the parameter information further includes a first parameter for representing the color of the strip-shaped object at the cortical connection, and the configuration parameters further include the first parameter.
[0108] As an optional implementation of the present disclosure, when the rendering result includes a rendering area with brightness greater than a first threshold, and the rendering result includes a rendering area with brightness less than a second threshold, the parameter information also includes a second parameter for representing the height of the strip-shaped object, and the configuration parameters also include the second parameter.
[0109] Among them, all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module, and its role will not be repeated here.
[0110] Of course, the rendering device 10 provided in the embodiment of the present invention includes but is not limited to the above modules, for example, the rendering device 10 may further include a storage unit 103. The storage unit 103 may be used to store the program code of the rendering device 10, and may also be used to store data generated by the rendering device 10 during operation, such as data in a write request.
[0111] Figure 7 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention is shown in FIG. Figure 7 As shown, the electronic device may include: at least one processor 51 , a memory 52 , a communication interface 53 and a communication bus 54 .
[0112] Combine the following Figure 7 A detailed introduction to the various components of electronic equipment:
[0113] The processor 51 is the control center of the electronic device, and may be a processor or a general term for multiple processing elements. For example, the processor 51 is a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention, such as one or more DSPs, or one or more field programmable gate arrays (FPGAs).
[0114] In a specific implementation, as an embodiment, the processor 51 may include one or more CPUs, such as Figure 7 Also, as an embodiment, the electronic device 10 may include multiple processors, such as Figure 7 51 and 55 are shown in FIG. Each of these processors may be a single-core processor (Single-CPU) or a multi-core processor (Multi-CPU). The processor here may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0115] The memory 52 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 52 may exist independently and be connected to the processor 51 via a communication bus 54. The memory 52 may also be integrated with the processor 51.
[0116] In a specific implementation, the memory 52 is used to store the data of the present invention and execute the software program of the present invention. The processor 51 can execute various functions of the air conditioner by running or executing the software program stored in the memory 52 and calling the data stored in the memory 52.
[0117] The communication interface 53 uses any transceiver-like device to communicate with other devices or communication networks, such as Radio Access Network (RAN), Wireless Local Area Networks (WLAN), terminals, the cloud, etc. The communication interface 53 may include an acquisition unit 101 to implement an acquisition function.
[0118] The communication bus 54 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0119] As an example, combining Figure 6The function implemented by the acquisition unit 101 in the rendering device 10 is the same as Figure 7 The function of the communication interface 53 in the rendering device 10 is the same as that of the processing unit 102 in the rendering device 10. Figure 7 The function of the processor 51 in the rendering device 10 is the same as that of the storage unit 103 in the rendering device 10. Figure 7 The function of the memory 52 in is the same.
[0120] Another embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a computing device, the computing device implements the method shown in the above method embodiment.
[0121] In some embodiments, the disclosed methods may be implemented as computer program instructions encoded in a machine-readable format on a computer-readable storage medium or on other non-transitory media or articles of manufacture.
[0122] Figure 8 The diagram schematically shows a conceptual partial view of a computer program product provided by an embodiment of the present invention, where the computer program product includes a computer program for executing a computer process on a computing device.
[0123] In one embodiment, the computer program product is provided using a signal bearing medium 410. The signal bearing medium 410 may include one or more program instructions that, when executed by one or more processors, may provide the above-described Figure 1 Thus, for example, reference to Figure 1 In the embodiment shown in , one or more features of S11-S15 can be undertaken by one or more instructions associated with the signal bearing medium 410. In addition, Figure 8 The program instructions in also describe example instructions.
[0124] In some examples, signal bearing medium 410 may include computer readable medium 411, such as, but not limited to, a hard drive, a compact disk (CD), a digital video disk (DVD), a digital tape, a memory, a read-only memory (ROM), or a random access memory (RAM), and the like.
[0125] In some implementations, signal bearing medium 410 may include computer recordable medium 412 such as, but not limited to, memory, read / write (R / W) CD, R / W DVD, and the like.
[0126] In some implementations, signal bearing medium 410 may include communication medium 413 such as, but not limited to, digital and / or analog communication media (eg, fiber optic cables, waveguides, wired communication links, wireless communication links, etc.).
[0127] The signal bearing medium 410 may be communicated by a wireless form of communication medium 413 (eg, a wireless communication medium conforming to the IEEE 802.41 standard or other transmission protocol). The one or more program instructions may be, for example, computer executable instructions or logic implemented instructions.
[0128] In some examples, such as for Figure 6 The depicted rendering device may be configured to provide various operations, functions, or actions in response to one or more program instructions via computer-readable medium 411 , computer-recordable medium 412 , and / or communication medium 413 .
[0129] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0130] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0131] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0132] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0133] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks or optical disks.
[0134] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A rendering method, characterized in that: include: Acquire a rendering area of the object to be rendered; wherein the rendering area includes a target number of points to be rendered, and each of the points to be rendered corresponds to a strip-shaped object; Taking the point to be rendered as a starting point, generating at least one particle and parameter information corresponding to each particle; Generate a mesh model based on the parameter information; wherein the mesh model includes at least two vertices and configuration parameters corresponding to each vertex, the configuration parameters include a topological relationship, one particle corresponds to at least two vertices, and different particles correspond to different vertices; Determine at least one polyline segment corresponding to the particle based on at least two vertices corresponding to the particle and a topological relationship corresponding to the vertices; Performing an extrusion operation on the polyline segment to generate a face patch corresponding to the polyline segment; wherein the sum of the number of vertices corresponding to the face patch is less than a preset threshold; Based on the facet, the rendering area is rendered to obtain a rendering result of the object to be rendered.
2. The rendering method according to claim 1, characterized in that: The step of generating at least one particle with the point to be rendered as a starting point includes: A particle system is used in the rendering area to generate at least one particle with the point to be rendered as a starting point.
3. The rendering method according to claim 1, characterized in that: The step of performing an extrusion operation on the polyline segment to generate a facet corresponding to the polyline segment includes: randomly selecting a preset number of broken line segments from the broken line segments as first target line segments, and selecting broken line segments from the broken line segments other than the first target line segments as second target line segments; For the first target line segment, perform an extrusion operation along a first direction to obtain a first actual facet corresponding to the first target line segment; For the second target line segment, perform an extrusion operation along a second direction to obtain a second actual facet corresponding to the second target line segment; wherein the first direction is perpendicular to the second direction; A patch corresponding to the polyline segment is generated based on the first actual patch and the second actual patch.
4. The rendering method according to claim 3, characterized in that: The first direction is the x-axis direction in the grid model, and the second direction is the y-axis direction in the grid model.
5. The rendering method according to claim 1, characterized in that: Before generating the grid model based on the parameter information, the method further includes: Performing a target operation on the particles to obtain modified particles; wherein the target operation includes one or more of distribution, randomization and shaping; The step of generating a grid model based on the parameter information includes: A mesh model is generated based on the parameter information of the modified particles.
6. The rendering method according to claim 1, characterized in that: The parameter information at least includes position information of a starting point of the particle in the rendering area, position information of an ending point, position information of each bending point, and a deflection direction of the particle; The step of taking the point to be rendered as a starting point and generating at least one particle and parameter information corresponding to each particle includes: Taking the point to be rendered as a starting point, generating at least one particle; Measuring the particle to obtain position information of a starting point, position information of an end point, position information of each bending point, and a deflection direction of the particle in the rendering area; The step of generating a grid model based on the parameter information includes: Determine at least one vertex and configuration parameters corresponding to each vertex based on the position information of the starting point, the position information of the ending point, the position information of each bending point, and the deflection direction of the particle in the rendering area; A mesh model is generated according to the vertices and configuration parameters corresponding to the vertices.
7. The rendering method according to any one of claims 1 to 6, characterized in that: In the case where the object to be rendered is an animal's body, the parameter information further includes a first parameter for indicating the color of the strip-shaped object at a cortical connection, and the configuration parameters further include the first parameter.
8. The rendering method according to any one of claims 1 to 6, characterized in that: When the rendering result includes a rendering area with brightness greater than a first threshold, and the rendering result includes a rendering area with brightness less than a second threshold, the parameter information also includes a second parameter for representing the height of the strip-shaped object, and the configuration parameters also include the second parameter.
9. A rendering device, characterized in that: include: An acquisition unit, used for acquiring a rendering area of an object to be rendered; wherein the rendering area includes a target number of points to be rendered, and each of the points to be rendered corresponds to a strip-shaped object; A processing unit, used to generate at least one particle and parameter information corresponding to each particle based on the point to be rendered obtained by the obtaining unit as a starting point; the processing unit is further used to generate a mesh model based on the parameter information; wherein the mesh model includes at least two vertices and configuration parameters corresponding to each vertex, the configuration parameters include a topological relationship, one particle corresponds to at least two vertices, and different particles correspond to different vertices; The processing unit is further used to determine at least one broken line segment corresponding to the particle based on at least two vertices corresponding to the particle and a topological relationship corresponding to the vertices; The processing unit is further configured to perform an extrusion operation on the polyline segment to generate a face patch corresponding to the polyline segment; wherein the sum of the number of vertices corresponding to the face patch is less than a preset threshold; The processing unit is further used to render the rendering area based on the face patch to obtain a rendering result of the object to be rendered.
10. An electronic device, characterized in that: include: A memory and a processor, wherein the memory is used to store a computer program; and the processor is used to enable the electronic device to implement the rendering method according to any one of claims 1 to 8 when executing the computer program.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a computing device, the computing device implements the rendering method according to any one of claims 1 to 8.