CN112669425A - Hair rendering method, hair rendering device, electronic equipment and readable storage medium - Google Patents

Hair rendering method, hair rendering device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN112669425A
CN112669425A CN202011550632.7A CN202011550632A CN112669425A CN 112669425 A CN112669425 A CN 112669425A CN 202011550632 A CN202011550632 A CN 202011550632A CN 112669425 A CN112669425 A CN 112669425A
Authority
CN
China
Prior art keywords
vertex
rendered
data
model
bounding box
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011550632.7A
Other languages
Chinese (zh)
Inventor
熊波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Pixel Software Technology Co Ltd
Original Assignee
Beijing Pixel Software Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Pixel Software Technology Co Ltd filed Critical Beijing Pixel Software Technology Co Ltd
Priority to CN202011550632.7A priority Critical patent/CN112669425A/en
Publication of CN112669425A publication Critical patent/CN112669425A/en
Pending legal-status Critical Current

Links

Images

Abstract

The embodiment of the application provides a hair rendering method and device, electronic equipment and a readable storage medium, and relates to the technical field of computer graphic processing. The method comprises the steps of obtaining model data to be rendered of a model to be rendered, wherein the model data to be rendered comprises a plurality of groups of vertex index values, and each group of vertex index values comprises a plurality of vertex data. And then, according to the plurality of vertex data, calculating to obtain the central point of the bounding box of the model to be rendered, and calculating the distance value between each vertex data and the central point. Then, the sum of the distance values between all vertex data and the central point included in each group of vertex index values is calculated. All vertex index values are then sorted according to the size of all sums. And finally, performing hair rendering on the model to be rendered according to the sequence of all the vertex index values to obtain the rendered model after hair rendering, so that the problem of poor rendering effect caused by error in rendering sequence is solved.

Description

Hair rendering method, hair rendering device, electronic equipment and readable storage medium
Technical Field
The present application relates to the field of computer graphics processing technologies, and in particular, to a hair rendering method, apparatus, electronic device, and readable storage medium.
Background
Simulation of some characters and animal characters often occurs in games. In this simulation, a hair simulation inevitably occurs. The hair simulation is different from other part simulations, because the hair is generally rendered according to a transparent object in the three-dimensional rendering, and other parts (such as arms, heads and the like) are physically rendered. The transparent object rendering may involve rendering order of a model mesh bin. If the rendering sequence is wrong, the final rendering result is deviated.
How to improve the problem that the rendering effect of a simulation model is deviated due to the error of the rendering sequence when the hair is rendered is a problem which needs to be solved at present.
Disclosure of Invention
In view of the above, the present application provides a hair rendering method, apparatus, electronic device and readable storage medium to solve the above technical problems.
The embodiment of the application can be realized as follows:
in a first aspect, the present application provides a method of hair rendering, the method comprising:
obtaining model data to be rendered of a model to be rendered, wherein the model data to be rendered comprises a plurality of groups of vertex index values, and each group of vertex index values comprises a plurality of vertex data;
calculating to obtain a central point of a bounding box of the model to be rendered according to the plurality of vertex data, and calculating a distance value between each vertex data and the central point;
calculating the sum of all vertex data included in each group of vertex index values and the distance value of the central point;
sorting all the vertex index values according to the size of all the sums;
and performing hair rendering on the model to be rendered according to the sequence of all the vertex index values to obtain a rendered model after hair rendering.
In an optional embodiment, the step of calculating a central point of a bounding box of the model to be rendered according to the plurality of vertex data includes:
based on a bounding box algorithm, generating a bounding box of the model to be rendered according to the plurality of vertex data;
and acquiring coordinate data of the bounding box, and calculating to obtain the central point of the bounding box according to the coordinate data.
In an alternative embodiment, the bounding box includes a plurality of vertices, the step of obtaining coordinate data of the bounding box and calculating a center point of the bounding box according to the coordinate data includes:
acquiring coordinate data of a plurality of vertexes included in the bounding box;
searching a point with the minimum sum of distance values from the coordinate data of each vertex, wherein the point is positioned in the bounding box;
and obtaining the coordinate value of the point, and taking the coordinate value as the central point of the bounding box.
In alternative embodiments, the bounding box algorithm comprises one or more of an AABB bounding box algorithm, a bounding sphere algorithm, a directional bounding box OBB algorithm, and a fixed directional convex hull FDH algorithm.
In an alternative embodiment, the step of calculating the distance value between each vertex data and the central point comprises:
calculating a distance value of each of the vertex data from the center point according to the following formula:
Figure BDA0002855871520000031
wherein D isi(x) is the distance value between the ith vertex data and the central point1,y1,z1) Is a coordinate value of the center point, (x)i2,yi2,zi2) The coordinate value of the ith vertex data.
In an alternative embodiment, the sum of all vertex data included in each set of vertex index values and the distance value of the center point is calculated by the following formula:
Figure BDA0002855871520000032
wherein Z isjDistance values of all vertex data included in the jth set of vertex index values from the center point, DjiAnd the distance value between the ith vertex data and the central point included in the jth group is obtained.
In a second aspect, the present application provides a hair rendering apparatus, the apparatus comprising:
the system comprises an acquisition module, a rendering module and a rendering module, wherein the acquisition module is used for acquiring model data to be rendered of a model to be rendered, the model data to be rendered comprises a plurality of groups of vertex index values, and each group of vertex index values comprises a plurality of vertex data;
the calculation module is used for calculating the central point of the bounding box of the model to be rendered according to the plurality of vertex data and calculating the distance value between each vertex data and the central point;
the calculation module is further configured to calculate a sum of all vertex data included in each group of the vertex index values and the distance value of the center point;
a sorting module for sorting all the vertex index values according to the size of all the sums;
and the rendering module is used for performing hair rendering on the model to be rendered according to the sequence of all the vertex index values to obtain a rendered model after the hair rendering.
In an alternative embodiment, the calculation module is configured to:
based on a bounding box algorithm, generating a bounding box of the model to be rendered according to the plurality of vertex data, acquiring coordinate data of the bounding box, and calculating to obtain a central point of the bounding box according to the coordinate data.
In a third aspect, the present application provides an electronic device, which includes a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, when the electronic device is running, the processor and the memory communicate with each other via the bus, and the processor executes the machine-readable instructions to perform the steps of the hair rendering method according to any one of the foregoing embodiments.
In a fourth aspect, the present application provides a readable storage medium storing a computer program which, when executed, implements the steps of the hair rendering method of any of the preceding embodiments.
The embodiment of the application provides a hair rendering method, a hair rendering device, electronic equipment and a readable storage medium.
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, several embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained from the drawings without inventive effort.
Fig. 1 is a block diagram of an electronic device according to an embodiment of the present disclosure.
Fig. 2 is a flowchart of a hair rendering method according to an embodiment of the present application.
Fig. 3 is a schematic diagram of a model to be rendered and a bounding box of the model to be rendered according to an embodiment of the present disclosure.
Fig. 4 is a flow chart illustrating sub-steps of a hair rendering method according to an embodiment of the present disclosure.
Fig. 5 is a functional block diagram of a hair rendering apparatus according to an embodiment of the present application.
Icon: 100-an electronic device; 110-a memory; 120-a processor; 130-a hair rendering device; 131-an acquisition module; 132-a calculation module; 133-a sorting module; 134-a rendering module; 140-a communication unit.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
In the description of the present application, it should be noted that if the terms "upper", "lower", "inside", "outside", etc. are used for indicating the orientation or positional relationship based on the orientation or positional relationship shown in the drawings or the orientation or positional relationship which the present invention product is usually put into use, it is only for convenience of describing the present application and simplifying the description, but it is not intended to indicate or imply that the referred device or element must have a specific orientation, be constructed in a specific orientation and be operated, and thus, should not be construed as limiting the present application.
Furthermore, the appearances of the terms "first," "second," and the like, if any, are used solely to distinguish one from another and are not to be construed as indicating or implying relative importance.
It should be noted that the features of the embodiments of the present application may be combined with each other without conflict.
As described in the background, some simulation of characters and animal characters often occurs in games. In this simulation, a hair simulation inevitably occurs. The hair simulation is different from other part simulations, because the hair is generally rendered according to a transparent object in the three-dimensional rendering, and other parts (such as arms, heads and the like) are physically rendered. The transparent object rendering may involve rendering order of a model mesh bin. If the rendering sequence is wrong, the final rendering result is deviated.
At present, art workers make hairs according to the sequence from inside to outside, so that the hairs are rendered according to the sequence from inside to outside during rendering, and the problems are solved. However, the hair model is often impossible to be formed at one time, and some adjustments are often made in later period and manufacturing, so that the original sequence is broken, and several places with wrong rendering sequence appear suddenly in the final rendering, thereby causing bad rendering effect. In order to solve the problem, some procedures are added at a later stage to improve the problems, such as increasing rendering batches and the like, so that extra rendering consumption is required, and the consumption can reduce the game frame rate and cause poor game experience.
How to improve the problem that the rendering effect of a simulation model is deviated due to the error of the rendering sequence when the hair is rendered is a problem which needs to be solved at present.
In view of this, embodiments of the present application provide a hair rendering method, apparatus, electronic device, and readable storage medium, by sorting a sequence of vertex index values including a plurality of vertex data based on a distance between the vertex data included in a model to be rendered and a center point of a bounding box of the model to be rendered, and rendering hairs of the model to be rendered from inside to outside according to the sorting, a problem of rendering sequence errors is improved, an additional rendering batch does not need to be increased, a memory required for rendering is reduced, and a game frame rate is improved. The above scheme is explained in detail below.
Referring to fig. 1, fig. 1 is a block diagram of an electronic device 100 according to an embodiment of the present disclosure. The device may comprise a processor 120, a memory 110, a hair rendering apparatus 130 and a communication unit 140, the memory 110 storing machine readable instructions executable by the processor 120, the processor 120 and the memory 110 communicating via a bus when the electronic device 100 is running, the processor 120 executing the machine readable instructions and performing the steps of the hair rendering method.
The elements of the memory 110, the processor 120 and the communication unit 140 are electrically connected to each other directly or indirectly to realize the transmission or interaction of signals.
For example, the components may be electrically connected to each other via one or more communication buses or signal lines. The hair rendering device 130 includes at least one software functional module that may be stored in the memory 110 in the form of software or firmware (firmware). The processor 120 is adapted to execute executable modules stored in the memory 110, such as software functional modules or computer programs comprised by the hair rendering device 130.
The Memory 110 may be, but is not limited to, a Random ACCess Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like.
The processor 120 may be an integrated circuit chip having signal processing capabilities. The Processor 120 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and so on.
But may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
In the embodiment of the present application, the memory 110 is used for storing a program, and the processor 120 is used for executing the program after receiving the execution instruction. The method defined by the process disclosed in any of the embodiments of the present application can be applied to the processor 120, or implemented by the processor 120.
The communication unit 140 is used to establish a communication connection between the electronic apparatus 100 and another electronic apparatus via a network, and to transmit and receive data via the network.
In some embodiments, the network may be any type of wired or wireless network, or combination thereof. Merely by way of example, the Network may include a wired Network, a Wireless Network, a fiber optic Network, a telecommunications Network, an intranet, the internet, a Local Area Network (LAN), a Wide Area Network (WAN), a Wireless Local Area Network (WLAN), a Metropolitan Area Network (MAN), a Wide Area Network (WAN), a Public Switched Telephone Network (PSTN), a bluetooth Network, a ZigBee Network, a Near Field Communication (NFC) Network, or the like, or any combination thereof.
In the embodiment of the present application, the specific type of the electronic device 100 is not limited, and for example, the electronic device may be, but is not limited to, a smart phone, a Personal Computer (PC), a tablet PC, a Personal Digital Assistant (PDA), a Mobile Internet Device (MID), a web server, a data server, a gateway device, and other devices having a processing function.
It will be appreciated that the configuration shown in figure 1 is merely illustrative. Electronic device 100 may also have more or fewer components than shown in FIG. 1, or a different configuration than shown in FIG. 1. The components shown in fig. 1 may be implemented in hardware, software, or a combination thereof.
Based on the implementation architecture of the electronic device 100, an embodiment of the present application provides a hair rendering method, please refer to fig. 2, where fig. 2 is one of flowcharts of the hair rendering method provided in the embodiment of the present application. The following is described in detail with reference to the specific flow shown in fig. 2.
Referring to fig. 2, an embodiment of the present application provides a hair rendering method, including:
step S1, obtaining model data to be rendered of the model to be rendered.
The model data to be rendered comprises a plurality of groups of vertex index values, and each group of vertex index values comprises a plurality of vertex data. The vertex data included in each set of vertex index values may form a bin, which is the bin data.
And step S2, according to the plurality of vertex data, calculating to obtain the central point of the bounding box of the model to be rendered, and calculating the distance value between each vertex data and the central point.
The vertex data may include data information such as a three-dimensional position, texture data, and a normal of the vertex.
In step S3, the sum of the distance values between all vertex data and the center point included in each set of vertex index values is calculated.
In step S4, all vertex index values are sorted according to the size of all sums.
And step S5, performing hair rendering on the model to be rendered according to the sequence of all the vertex index values to obtain a rendered model after hair rendering.
As an example, the model to be rendered may be a virtual object, for example, a game character in a network game, and the hair may be a hair of the game character, such as an animal hair. The hair can be hair-like objects of the virtual object, such as grass in a lawn, fur in clothes and the like.
Meanwhile, please refer to fig. 3, in which fig. 3 is a schematic diagram of a model to be rendered and a bounding box of the model to be rendered according to an embodiment of the present disclosure.
As shown in fig. 3, the model to be rendered may be a three-dimensional model, such as a rabbit shown in fig. 3, the three-dimensional model may be composed of a plurality of meshes, and after the model to be rendered is acquired, a hair region in the model to be rendered may be detected, and hair rendering is performed on the hair region.
Because the model to be rendered is composed of a plurality of grid surface elements, the vertexes of the model to be rendered, including the grid surface elements, can be known, and each vertex has a three-dimensional coordinate of the vertex, namely the vertex data. When the mesh bin is a triangle, the model to be rendered is composed of a plurality of triangle planes, the index value of each triangle plane is the vertex index value, and each group of vertex index values comprises three vertex data.
Furthermore, the bounding box of the model to be rendered is a closed space which completely contains the object combination. Complex objects are packaged in a simple bounding box that approximates the shape of the complex geometry, such as a sphere around the rabbit or a cube surrounding the rabbit as shown in fig. 3.
As an alternative embodiment, the process of sorting all vertex index values according to the size of all summations may be sorting from small to large, and it is understood that the smaller the summations of all vertex data and the distance value of the central point included in the vertex index values are, the more the mesh bin represented by the vertex index value is in the inner layer of the model to be rendered (like the inner layer of an onion). The larger the sum of the distance values of all vertex data and the central point included in the vertex index value, the more the mesh bin represented by the vertex index value is at the outer layer of the model to be rendered (like the outer layer of an onion).
That is, when the vertex index values are arranged in the order from small to large and the rendering sequence is rendered according to the vertex index value ordering manner, the whole rendering process is performed from the inside to the outside of the model to be rendered. In this manner, the model data may be stored again after the vertex index values are reordered. And rendering the hairs of the model according to the sequencing mode of the vertex index values until the game is online.
According to the hair rendering method provided by the embodiment of the application, the hair is rendered from inside to outside according to the top index values in the sequence by sequencing the top index values again, so that the problem of error in the rendering sequence is solved, the additional increase of rendering batches is not needed, the memory required by rendering is reduced, and the game frame rate is improved.
As an alternative implementation, please refer to fig. 4 in combination, and fig. 4 is a flowchart illustrating sub-steps of a hair rendering method according to an embodiment of the present application. Step S2 can be implemented by the following method, and the center point of the bounding box of the model to be rendered is obtained:
and step S21, generating a bounding box of the model to be rendered according to the plurality of vertex data based on a bounding box algorithm.
And step S22, acquiring coordinate data of the bounding box, and calculating to obtain the center point of the bounding box according to the coordinate data.
Wherein the bounding box algorithm comprises one or more of an AABB (Axis-aligned bounding box) algorithm, a Sphere of bounding (Sphere) algorithm, an oriented bounding box OBB (oriented bounding box) algorithm, and a Fixed orientation convex hull FDH (Fixed orientations circles or k-DOP) algorithm.
The bounding box includes a plurality of vertices, and the step S22 may calculate the center point of the bounding box by:
coordinate data of a plurality of vertices included in the bounding box is acquired. And searching a point with the minimum sum of the distance values of the coordinate data from each vertex, wherein the point is positioned in the bounding box. And obtaining the coordinate value of the point, and taking the coordinate value as the central point of the bounding box.
It can be understood that if the bounding box of the model to be rendered is a sphere, the center point of the bounding box is located at the center of the sphere, and if the bounding box of the model to be rendered is a cube, the center point of the bounding box is the centroid or the center of gravity of the cube.
Therefore, the bounding box of the model to be rendered can be calculated through different bounding box algorithms, the central point of the bounding box is obtained through calculation according to the coordinate data of the bounding box, the sequencing basis of the vertex index value is conveniently determined according to the distance values between different vertex data and the central point of the bounding box, and the vertex index value is sequenced according to the sequencing basis.
As an alternative embodiment, step S2 may also obtain the distance value of each vertex data from the center point by:
calculating the distance value of each vertex data from the center point according to the following formula:
Figure BDA0002855871520000141
wherein D isi(x) is the distance value between the ith vertex data and the center point1,y1,z1) Is a coordinate value of the center point, (x)i2,yi2,zi2) The coordinate value of the ith vertex data.
For example, if the model to be rendered includes 6 vertex data, the vertex data is vertex data 1, vertex data 2, vertex data 3, vertex data 4, vertex data 5, and vertex data 6.
If the coordinate value of the vertex data 1 is (c)12,y12,z12) The coordinate value of the vertex data 2 is (x)22,y22,z22) The distance value D between the vertex data 1 and the center point1Comprises the following steps:
Figure BDA0002855871520000142
the distance value D between the vertex data 2 and the center point2Comprises the following steps:
Figure BDA0002855871520000143
the calculation principle of the distance value between the other vertex data and the center point is the same as the above example, which is not an example.
Therefore, in the embodiment of the application, the distance value between each vertex data and the central point can be calculated through the formula, so that the sequencing basis of the vertex index values can be determined through the distance values subsequently, the vertex index values are sequenced according to the sequencing basis, and hairs are rendered according to the sequencing order of the vertex index values during rendering, without additionally increasing rendering batches, the memory required by rendering is reduced, and the game frame rate is improved.
As an alternative implementation, the sum of the distance values between all vertex data included in each group of vertex index values and the central point is calculated by the following formula:
Figure BDA0002855871520000151
wherein Z isjDistance values of all vertex data and center points included in the jth set of vertex index values, DjiThe distance value between the ith vertex data and the central point included in the jth group.
For example, if the model to be rendered includes 6 vertex data, the vertex data is vertex data 1, vertex data 2, vertex data 3, vertex data 4, vertex data 5, and vertex data 6. And vertex data 1, vertex data 2, and vertex data 3 are included in a set of vertex index values A1, and vertex 4, vertex data 5, and vertex data 6 are included in a set of vertex index values A2.
Assuming that the distance value of each vertex data from the central point is respectively: the distance value of the vertex data 1 from the central point is 4, the distance value of the vertex data 2 from the central point is 5, and the distance value of the vertex data 3 from the central point is 5. The distance value of the vertex data 4 from the central point is 7, the distance value of the vertex data 5 from the central point is 8, and the distance value of the vertex data 6 from the central point is 9.
The vertex index value a1 includes the sum of the distance values of all vertex data from the center point as: 4+5+5 ═ 14. The vertex index value a2 includes the sum of the distance values of all vertex data from the center point as: 7+8+ 9-24.
Since the sum corresponding to the vertex index value a2 is greater than the sum corresponding to the vertex index value a1, it can be known that the mesh bin formed by the vertex data 1, the vertex data 2, and the vertex data 3 included in the vertex index value a1 is closer to the center point of the bounding box of the model to be rendered.
Therefore, the vertex index value a1 and the vertex index value a2 can be sorted in descending order, and the sorting results of a1 and a2 are obtained. In the subsequent rendering process, the hair rendering is carried out on the model to be rendered according to the sequencing sequence, so that the rendering result is ensured to be correct, the additional increase of rendering batches is not needed, the memory required by rendering is reduced, and the game frame rate is improved.
Based on the same inventive concept, please refer to fig. 5 in combination, and fig. 5 is a block diagram of functional blocks of a hair rendering apparatus according to an embodiment of the present application. The embodiment of the application also provides a hair rendering device corresponding to the hair rendering method, and the device comprises:
the obtaining module 131 is configured to obtain model data to be rendered of a model to be rendered, where the model data to be rendered includes multiple sets of vertex index values, and each set of vertex index value includes multiple vertex data.
The calculating module 132 is configured to calculate a central point of the bounding box of the model to be rendered according to the plurality of vertex data, and calculate a distance value between each vertex data and the central point.
The calculating module 132 is further configured to calculate a sum of distance values between all vertex data and the center point included in each group of vertex index values.
And a sorting module 133, configured to sort all vertex index values according to the size of all sums.
And the rendering module 134 is configured to perform hair rendering on the model to be rendered according to the sequence of all the vertex index values, so as to obtain a rendering model after hair rendering.
In an alternative embodiment, the calculation module 132 is configured to:
based on a bounding box algorithm, generating a bounding box of the model to be rendered according to the plurality of vertex data, acquiring coordinate data of the bounding box, and calculating according to the coordinate data to obtain a central point of the bounding box.
Because the principle of the device in the embodiment of the present application for solving the problem is similar to the method for rendering the hair, the implementation principle of the device can be referred to the implementation principle of the method, and repeated details are not repeated.
The embodiment of the application also provides a readable storage medium, wherein a computer program is stored in the readable storage medium, and the computer program is used for realizing the hair rendering method when being executed.
To sum up, the embodiment of the present application provides a hair rendering method, a hair rendering device, an electronic device 100, and a readable storage medium, where model data to be rendered of a model to be rendered is obtained, where the model data to be rendered includes multiple sets of vertex index values, and each set of vertex index values includes multiple vertex data. And then, according to the plurality of vertex data, calculating to obtain the central point of the bounding box of the model to be rendered, and calculating the distance value between each vertex data and the central point. Then, the sum of the distance values between all vertex data and the central point included in each group of vertex index values is calculated. All vertex index values are then sorted according to the size of all sums. And finally, performing hair rendering on the model to be rendered according to the sequence of all the vertex index values to obtain the rendered model after the hair rendering, so that the problem of poor rendering effect due to error in rendering sequence is solved, and meanwhile, no extra rendering batch is needed, the memory required by rendering is reduced, and the game frame rate is improved.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present application should be covered within the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A method of hair rendering, the method comprising:
obtaining model data to be rendered of a model to be rendered, wherein the model data to be rendered comprises a plurality of groups of vertex index values, and each group of vertex index values comprises a plurality of vertex data;
calculating to obtain a central point of a bounding box of the model to be rendered according to the plurality of vertex data, and calculating a distance value between each vertex data and the central point;
calculating the sum of all vertex data included in each group of vertex index values and the distance value of the central point;
sorting all the vertex index values according to the size of all the sums;
and performing hair rendering on the model to be rendered according to the sequence of all the vertex index values to obtain a rendered model after hair rendering.
2. A hair rendering method according to claim 1, wherein the step of calculating a center point of a bounding box of the model to be rendered according to a plurality of the vertex data comprises:
based on a bounding box algorithm, generating a bounding box of the model to be rendered according to the plurality of vertex data;
and acquiring coordinate data of the bounding box, and calculating to obtain the central point of the bounding box according to the coordinate data.
3. A hair rendering method according to claim 2, wherein the bounding box comprises a plurality of vertices, the step of obtaining coordinate data of the bounding box, and the step of calculating a center point of the bounding box from the coordinate data comprises:
acquiring coordinate data of a plurality of vertexes included in the bounding box;
searching a point with the minimum sum of distance values from the coordinate data of each vertex, wherein the point is positioned in the bounding box;
and obtaining the coordinate value of the point, and taking the coordinate value as the central point of the bounding box.
4. A hair rendering method according to claim 2, characterized in that the bounding box algorithm comprises one or more of an AABB bounding box algorithm, a bounding sphere algorithm, a directional bounding box OBB algorithm and a fixed directional convex hull FDH algorithm.
5. A hair rendering method according to claim 1, wherein the step of calculating a distance value of each of the vertex data from the center point comprises:
calculating a distance value of each of the vertex data from the center point according to the following formula:
Figure FDA0002855871510000021
wherein D isi(x) is the distance value between the ith vertex data and the central point1,y1,z1) Is a coordinate value of the center point, (x)i2,yi2,zi2) The coordinate value of the ith vertex data.
6. A hair rendering method according to claim 1, characterized in that: the sum of all vertex data included in each group of vertex index values and the distance value of the central point is calculated by the following formula:
Figure FDA0002855871510000022
wherein Z isjDistance values of all vertex data included in the jth set of vertex index values from the center point, DjiAnd the distance value between the ith vertex data and the central point included in the jth group is obtained.
7. A hair rendering apparatus, characterized in that the apparatus comprises:
the system comprises an acquisition module, a rendering module and a rendering module, wherein the acquisition module is used for acquiring model data to be rendered of a model to be rendered, the model data to be rendered comprises a plurality of groups of vertex index values, and each group of vertex index values comprises a plurality of vertex data;
the calculation module is used for calculating the central point of the bounding box of the model to be rendered according to the plurality of vertex data and calculating the distance value between each vertex data and the central point;
the calculation module is further configured to calculate a sum of all vertex data included in each group of the vertex index values and the distance value of the center point;
a sorting module for sorting all the vertex index values according to the size of all the sums;
and the rendering module is used for performing hair rendering on the model to be rendered according to the sequence of all the vertex index values to obtain a rendered model after the hair rendering.
8. A hair rendering method as recited in claim 7, wherein the computing module is configured to:
based on a bounding box algorithm, generating a bounding box of the model to be rendered according to the plurality of vertex data, acquiring coordinate data of the bounding box, and calculating to obtain a central point of the bounding box according to the coordinate data.
9. An electronic device, comprising a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is operated, the processor and the memory communicate via the bus, and the processor executes the machine-readable instructions to perform the steps of the hair rendering method according to any one of claims 1-6.
10. A readable storage medium, characterized in that the readable storage medium stores a computer program which, when executed, implements the steps of the hair rendering method of any of claims 1-6.
CN202011550632.7A 2020-12-23 2020-12-23 Hair rendering method, hair rendering device, electronic equipment and readable storage medium Pending CN112669425A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011550632.7A CN112669425A (en) 2020-12-23 2020-12-23 Hair rendering method, hair rendering device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011550632.7A CN112669425A (en) 2020-12-23 2020-12-23 Hair rendering method, hair rendering device, electronic equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN112669425A true CN112669425A (en) 2021-04-16

Family

ID=75409945

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011550632.7A Pending CN112669425A (en) 2020-12-23 2020-12-23 Hair rendering method, hair rendering device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN112669425A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113313802A (en) * 2021-05-25 2021-08-27 完美世界(北京)软件科技发展有限公司 Image rendering method, device and equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113313802A (en) * 2021-05-25 2021-08-27 完美世界(北京)软件科技发展有限公司 Image rendering method, device and equipment and storage medium
CN113313802B (en) * 2021-05-25 2022-03-11 完美世界(北京)软件科技发展有限公司 Image rendering method, device and equipment and storage medium

Similar Documents

Publication Publication Date Title
US10062197B2 (en) Animating a virtual object in a virtual world
CN111260764A (en) Method, device and storage medium for making animation
US9984488B2 (en) Animating a virtual object in a virtual world
CN112288665A (en) Image fusion method and device, storage medium and electronic equipment
CN108837510A (en) Methods of exhibiting and device, storage medium, the electronic device of information
CN111583398B (en) Image display method, device, electronic equipment and computer readable storage medium
CN112102480A (en) Image data processing method, apparatus, device and medium
CN112669425A (en) Hair rendering method, hair rendering device, electronic equipment and readable storage medium
CN110647859B (en) Face image decomposition method and device, electronic equipment and storage medium
US10410393B2 (en) Animating a virtual object in a virtual world
CN114677572A (en) Object description parameter generation method and deep learning model training method
CN107789832A (en) Form method, apparatus, terminal device and the storage medium of complicated impinger
US20230342942A1 (en) Image data processing method, method and apparatus for constructing digital virtual human, device, storage medium, and computer program product
CN109697748A (en) Model compression processing method, model pinup picture processing method device, storage medium
CN110310357B (en) Model interleaving processing method and device, computing equipment and storage medium
CN112381929A (en) Three-dimensional power equipment model modeling method
CN112734900A (en) Baking method, baking device, baking equipment and computer-readable storage medium of shadow map
CN109598672A (en) A kind of map road rendering method and device
CN115099025A (en) Method for calculating fluid flow speed in fluid model, electronic device and storage medium
CN114581586A (en) Method and device for generating model substrate, electronic equipment and storage medium
US10896510B2 (en) Image processing apparatus, image processing method, and program
CN116486108B (en) Image processing method, device, equipment and storage medium
CN116468831B (en) Model processing method, device, equipment and storage medium
CN116402989B (en) Data processing method, device, equipment and medium
CN115049767B (en) Animation editing method and device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination