Virtual curling model rendering method, device, equipment and storage medium

文档序号:1896913 发布日期:2021-11-30 浏览:15次 中文

阅读说明:本技术 虚拟卷发模型渲染方法、装置、设备及存储介质 (Virtual curling model rendering method, device, equipment and storage medium ) 是由 陶晗 朱君君 郑启强 詹定根 于 2021-08-27 设计创作,主要内容包括:本申请提供一种虚拟卷发模型渲染方法、装置、设备及存储介质,涉及模型渲染领域。该方法包括:根据输入的卷发配置参数,对预设头发模型中目标发片的二维纹理坐标进行调整;根据调整后的所述目标发片的二维纹理坐标、预设的发片贴图,和预设的发片定位图,对所述目标发片对应的卷发模型进行调整,得到所述预设头发模型对应的虚拟卷发模型;其中,所述发片定位图包括:所述目标发片的头发定位信息。相对于现有技术,避免了玩家无法自定义定制发型的问题。(The application provides a virtual curly hair model rendering method, device, equipment and storage medium, and relates to the field of model rendering. The method comprises the following steps: adjusting two-dimensional texture coordinates of a target hair piece in a preset hair model according to the input hair curling configuration parameters; adjusting a hair curling model corresponding to the target hair piece according to the adjusted two-dimensional texture coordinates of the target hair piece, a preset hair piece mapping and a preset hair piece positioning map to obtain a virtual hair curling model corresponding to the preset hair model; wherein, the hair piece location picture includes: hair positioning information of the target hair piece. Compared with the prior art, the problem that the player cannot customize the hairstyle is avoided.)

1. A method of virtual curl model rendering, the method comprising:

adjusting two-dimensional texture coordinates of a target hair piece in a preset hair model according to the input hair curling configuration parameters;

adjusting a hair curling model corresponding to the target hair piece according to the adjusted two-dimensional texture coordinates of the target hair piece, a preset hair piece mapping and a preset hair piece positioning map to obtain a virtual hair curling model corresponding to the preset hair model; wherein, the hair piece location picture includes: hair positioning information of the target hair piece.

2. The method according to claim 1, wherein the adjusting the hair curling model corresponding to the target hair piece according to the adjusted two-dimensional texture coordinates of the target hair piece, the preset hair piece mapping and the preset hair piece positioning map to obtain the virtual hair curling model corresponding to the preset hair model comprises:

determining the position of each pixel point on the target hair piece by adopting a pixel shader according to the adjusted two-dimensional texture coordinate of the target hair piece, the hair piece mapping and the hair piece positioning diagram;

calculating the offset of the texture coordinate axis of the target film sending according to the position of each pixel point on the target film sending;

and adjusting the texture coordinate axis of the curling model corresponding to the target hairpiece according to the texture coordinate axis offset to obtain the virtual curling model.

3. The method of claim 2, wherein determining the position of each pixel point on the target hair piece using a pixel shader according to the adjusted two-dimensional texture coordinates of the target hair piece, the hair piece map, and the hair piece positioning map comprises:

and determining the position of each pixel point on each texture coordinate axis on the target hair piece by adopting the pixel shader according to the adjusted two-dimensional texture coordinate of the target hair piece, the hair piece mapping and the hair piece positioning diagram.

4. The method of claim 3, wherein said calculating a texture coordinate axis offset for the target hair piece based on the location of each pixel point on the target hair piece comprises:

calculating the offset of the target hairpin on another texture coordinate axis according to the position of each pixel point on one texture coordinate axis of the target hairpin; the texture coordinate axis offset includes: the texture coordinate system comprises a first texture coordinate axis and a second texture coordinate axis, wherein the first texture coordinate axis and the second texture coordinate axis are respectively two coordinate axes which are perpendicular to each other on the texture coordinate system.

5. The method of claim 4, wherein said calculating an offset of said target hair piece in one texture coordinate axis based on a position of said each pixel point in said target hair piece in another texture coordinate axis comprises:

and calculating the offset of the target hair piece on the other texture coordinate axis according to the position of each pixel point on the texture coordinate axis on the target hair piece and the preset curling degree.

6. The method of claim 1, wherein if the hair curl configuration parameter comprises: and (3) adjusting the two-dimensional texture coordinates of the target hair piece in the preset hair model according to the input curly hair configuration parameters by using a curved-straight transition parameter, wherein the curved-straight transition parameter comprises the following steps:

according to the curve-straight transition parameters, the position of the target hair piece on a first texture coordinate axis is adjusted, wherein the first texture coordinate axis is as follows: a texture coordinate axis along the length of the hair piece.

7. The method of claim 1, wherein the hair curl configuration parameters further comprise: hair piece width parameter, and hair root direction parameter;

the adjusting the two-dimensional texture coordinates of the target hairpiece in the preset hair model according to the input curly hair configuration parameters comprises the following steps:

calculating the latest position of the target hair piece on a second texture coordinate axis according to the hair piece width parameter, the hair root direction parameter, the position of the target hair piece on the first texture coordinate axis and the historical position of the target hair piece on the second texture coordinate axis; wherein the first texture coordinate axis is: along the texture coordinate axis of the hair piece length direction, the second texture coordinate axis is: texture coordinate axes in the width direction of the hair piece;

and adjusting the position of the target hair patch on the second texture coordinate axis to be the latest position.

8. The method of claim 1, wherein the hair curl configuration parameters further comprise: a curl interpolation parameter;

the adjusting the two-dimensional texture coordinates of the target hairpiece in the preset hair model according to the input curly hair configuration parameters comprises the following steps:

according to the curl interpolation parameter, adjusting the position of the target hair piece on a first texture coordinate axis, wherein the first texture coordinate axis is as follows: a texture coordinate axis along the length of the hair piece.

9. The method of claim 1, wherein the hair curl configuration parameters further comprise: a normal adjustment parameter;

the adjusting the two-dimensional texture coordinates of the target hairpiece in the preset hair model according to the input curly hair configuration parameters comprises the following steps:

generating a normal rotation matrix of the target hair piece according to the normal adjustment parameter, wherein the normal rotation matrix of the target hair piece comprises: adjusting parameters of normals of all pixel points in the target film sending;

and adjusting the normal of each pixel point in the target film sending according to the normal adjustment parameter of each pixel point.

10. The method according to any one of claims 1 to 9, wherein before adjusting the two-dimensional texture coordinates of the target hair piece in the pre-set hair model according to the input hair curling configuration parameters, the method further comprises;

rolling the target hair piece into a cylinder shape to obtain a hair curling model corresponding to the target hair piece;

binding a hair curling model corresponding to the target hair piece with the two-dimensional texture coordinates of the target hair piece;

and binding the two-dimensional texture coordinates of the target hair piece with the hair piece positioning diagram.

11. An apparatus for rendering a virtual curl model, the apparatus comprising: an adjustment module and a generation module, wherein:

the adjusting module is used for adjusting the two-dimensional texture coordinates of the target hair piece in the preset hair model according to the input hair curling configuration parameters;

the generation module is used for adjusting a hair curling model corresponding to the target hair piece according to the adjusted two-dimensional texture coordinates of the target hair piece, a preset hair piece mapping and a preset hair piece positioning map to obtain a virtual hair curling model corresponding to the preset hair model; wherein, the hair piece location picture includes: hair positioning information of the target hair piece.

12. A virtual curl model rendering apparatus, the apparatus comprising: a processor, a storage medium and a bus, the storage medium storing machine-readable instructions executable by the processor, the processor and the storage medium communicating via the bus when the virtual curly hair model rendering device is operating, the processor executing the machine-readable instructions to perform the method of any of the preceding claims 1-10.

13. A storage medium, characterized in that the storage medium has stored thereon a computer program which, when being executed by a processor, performs the method of any of the preceding claims 1-10.

Technical Field

The application relates to the technical field of model rendering, in particular to a virtual curly model rendering method, device, equipment and storage medium.

Background

The leading role in the game is the player's avatar, and the player always wants to make his own character personate. The self-defined appearance not only meets the aesthetic feeling of the player, but also strengthens the emotional relation between the player and the role, is beneficial to improving the immersion feeling, and finally effectively improves the game experience.

The prior art hair style customization mostly provides several preset schemes from which the player can select different models. These preset hairstyles do not support modification, and provide good hairstyle representation with the combination of carved models and fine art resources, and various curls are not lost.

However, the preset hair style customization mode does not support the form customization, is not personalized enough, and a player can only select the preset hair style, so that the player is limited to a certain extent, and the player cannot customize the hair style.

Disclosure of Invention

An object of the present application is to provide a method, an apparatus, a device, and a storage medium for rendering a virtual curly hair model, so as to solve the problem that a player cannot customize a hairstyle in the prior art.

In order to achieve the above purpose, the technical solutions adopted in the embodiments of the present application are as follows:

in a first aspect, an embodiment of the present application provides a virtual curly model rendering method, where the method includes:

adjusting two-dimensional texture coordinates of a target hair piece in a preset hair model according to the input hair curling configuration parameters;

adjusting a hair curling model corresponding to the target hair piece according to the adjusted two-dimensional texture coordinates of the target hair piece, a preset hair piece mapping and a preset hair piece positioning map to obtain a virtual hair curling model corresponding to the preset hair model; wherein, the hair piece location picture includes: hair positioning information of the target hair piece.

Optionally, the adjusting, according to the adjusted two-dimensional texture coordinate of the target hair piece, a preset hair piece mapping map, and a preset hair piece positioning map, a hair curling model corresponding to the target hair piece to obtain a virtual hair curling model corresponding to the preset hair model includes:

determining the position of each pixel point on the target hair piece by adopting a pixel shader according to the adjusted two-dimensional texture coordinate of the target hair piece, the hair piece mapping and the hair piece positioning diagram;

calculating the offset of the texture coordinate axis of the target film sending according to the position of each pixel point on the target film sending;

and adjusting the texture coordinate axis of the curling model corresponding to the target hairpiece according to the texture coordinate axis offset to obtain the virtual curling model.

Optionally, the determining, by using a pixel shader, a position of each pixel point on the target hair piece according to the adjusted two-dimensional texture coordinate of the target hair piece, the hair piece mapping, and the hair piece positioning map includes:

and determining the position of each pixel point on each texture coordinate axis on the target hair piece by adopting the pixel shader according to the adjusted two-dimensional texture coordinate of the target hair piece, the hair piece mapping and the hair piece positioning diagram.

Optionally, the calculating, according to the position of each pixel point on the target hair piece, a texture coordinate axis offset of the target hair piece includes:

calculating the offset of the target hairpin on another texture coordinate axis according to the position of each pixel point on one texture coordinate axis of the target hairpin; the texture coordinate axis offset includes: the texture coordinate system comprises a first texture coordinate axis and a second texture coordinate axis, wherein the first texture coordinate axis and the second texture coordinate axis are respectively two coordinate axes which are perpendicular to each other on the texture coordinate system.

Optionally, the calculating, according to the position of each pixel point on one texture coordinate axis of the target hairpiece, an offset of the target hairpiece on another texture coordinate axis includes:

and calculating the offset of the target hair piece on the other texture coordinate axis according to the position of each pixel point on the texture coordinate axis on the target hair piece and the preset curling degree.

Optionally, if the hair curling configuration parameters include: and (3) adjusting the two-dimensional texture coordinates of the target hair piece in the preset hair model according to the input curly hair configuration parameters by using a curved-straight transition parameter, wherein the curved-straight transition parameter comprises the following steps:

according to the curve-straight transition parameters, the position of the target hair piece on a first texture coordinate axis is adjusted, wherein the first texture coordinate axis is as follows: a texture coordinate axis along the length of the hair piece.

Optionally, the hair curling configuration parameters further include: hair piece width parameter, and hair root direction parameter;

the adjusting the two-dimensional texture coordinates of the target hairpiece in the preset hair model according to the input curly hair configuration parameters comprises the following steps:

calculating the latest position of the target hair piece on a second texture coordinate axis according to the hair piece width parameter, the hair root direction parameter, the position of the target hair piece on the first texture coordinate axis and the historical position of the target hair piece on the second texture coordinate axis; wherein the first texture coordinate axis is: along the texture coordinate axis of the hair piece length direction, the second texture coordinate axis is: texture coordinate axes in the width direction of the hair piece;

and adjusting the position of the target hair patch on the second texture coordinate axis to be the latest position.

Optionally, the hair curling configuration parameters further include: a curl interpolation parameter;

the adjusting the two-dimensional texture coordinates of the target hairpiece in the preset hair model according to the input curly hair configuration parameters comprises the following steps:

according to the curl interpolation parameter, adjusting the position of the target hair piece on a first texture coordinate axis, wherein the first texture coordinate axis is as follows: a texture coordinate axis along the length of the hair piece.

Optionally, the hair curling configuration parameters further include: a normal adjustment parameter;

the adjusting the two-dimensional texture coordinates of the target hairpiece in the preset hair model according to the input curly hair configuration parameters comprises the following steps:

generating a normal rotation matrix of the target hair piece according to the normal adjustment parameter, wherein the normal rotation matrix of the target hair piece comprises: adjusting parameters of normals of all pixel points in the target film sending;

and adjusting the normal of each pixel point in the target film sending according to the normal adjustment parameter of each pixel point.

Optionally, before adjusting the two-dimensional texture coordinates of the target hair piece in the preset hair model according to the input hair curling configuration parameters, the method further includes;

rolling the target hair piece into a cylinder shape to obtain a hair curling model corresponding to the target hair piece;

binding a hair curling model corresponding to the target hair piece with the two-dimensional texture coordinates of the target hair piece;

and binding the two-dimensional texture coordinates of the target hair piece with the hair piece positioning diagram.

In a second aspect, another embodiment of the present application provides a virtual curly hair model rendering apparatus, including: an adjustment module and a generation module, wherein:

the adjusting module is used for adjusting the two-dimensional texture coordinates of the target hair piece in the preset hair model according to the input hair curling configuration parameters;

the generation module is used for adjusting a hair curling model corresponding to the target hair piece according to the adjusted two-dimensional texture coordinates of the target hair piece, a preset hair piece mapping and a preset hair piece positioning map to obtain a virtual hair curling model corresponding to the preset hair model; wherein, the hair piece location picture includes: hair positioning information of the target hair piece.

Optionally, the apparatus further comprises: a determination module and a calculation module, wherein:

the determining module is used for determining the position of each pixel point on the target hair piece by adopting a pixel shader according to the adjusted two-dimensional texture coordinate of the target hair piece, the hair piece mapping chart and the hair piece positioning chart;

the calculation module is specifically configured to calculate a texture coordinate axis offset of the target film sending according to the position of each pixel point on the target film sending;

the adjusting module is specifically configured to adjust the texture coordinate axis of the hair curling model corresponding to the target hair piece according to the offset of the texture coordinate axis, so as to obtain the virtual hair curling model.

Optionally, the determining module is specifically configured to determine, by using the pixel shader, a position of each pixel point on each texture coordinate axis on the target hair piece according to the adjusted two-dimensional texture coordinate of the target hair piece, the hair piece mapping, and the hair piece positioning map.

Optionally, the calculating module is specifically configured to calculate, according to the position of each pixel point on one texture coordinate axis of the target hairpiece, an offset of the target hairpiece on another texture coordinate axis; the texture coordinate axis offset includes: the texture coordinate system comprises a first texture coordinate axis and a second texture coordinate axis, wherein the first texture coordinate axis and the second texture coordinate axis are respectively two coordinate axes which are perpendicular to each other on the texture coordinate system.

Optionally, the calculating module is specifically configured to calculate an offset of the target hair piece on another texture coordinate axis according to the position of each pixel point on the one texture coordinate axis on the target hair piece and a preset curling degree.

Optionally, the adjusting module is specifically configured to adjust the position of the target hair piece on a first texture coordinate axis according to the curved-straight transition parameter, where the first texture coordinate axis is: a texture coordinate axis along the length of the hair piece.

Optionally, the hair curling configuration parameters further include: hair piece width parameter, and hair root direction parameter;

the calculating module is specifically configured to calculate a latest position of the target hairpiece on a second texture coordinate axis according to the hairpiece width parameter, the hair root direction parameter, the position of the target hairpiece on the first texture coordinate axis, and a historical position of the target hairpiece on the second texture coordinate axis; wherein the first texture coordinate axis is: along the texture coordinate axis of the hair piece length direction, the second texture coordinate axis is: texture coordinate axes in the width direction of the hair piece;

the adjusting module is specifically configured to adjust the position of the target hair piece on the second texture coordinate axis to the latest position.

Optionally, the hair curling configuration parameters further include: a curl interpolation parameter;

the adjusting module is specifically configured to adjust a position of the target hair piece on a first texture coordinate axis according to the curl interpolation parameter, where the first texture coordinate axis is: a texture coordinate axis along the length of the hair piece.

Optionally, the hair curling configuration parameters further include: a normal adjustment parameter;

the generating module is specifically configured to generate a normal rotation matrix of the target hair piece according to the normal adjustment parameter, where the normal rotation matrix of the target hair piece includes: adjusting parameters of normals of all pixel points in the target film sending;

and the adjusting module is specifically used for adjusting the normal of each pixel point in the target film sending according to the normal adjusting parameter of each pixel point.

Optionally, the apparatus further comprises: a binding module, wherein:

the generating module is specifically configured to roll the target hair piece into a cylindrical shape to obtain a hair curling model corresponding to the target hair piece;

the binding module is specifically configured to bind a hair curling model corresponding to the target hair piece with the two-dimensional texture coordinates of the target hair piece; and binding the two-dimensional texture coordinates of the target hair piece with the hair piece positioning diagram.

In a third aspect, another embodiment of the present application provides a virtual curly model rendering device, including: a processor, a storage medium and a bus, the storage medium storing machine-readable instructions executable by the processor, the processor and the storage medium communicating via the bus when the virtual curly hair model rendering device is operated, the processor executing the machine-readable instructions to perform the steps of the method according to any one of the first aspect.

In a fourth aspect, another embodiment of the present application provides a storage medium having a computer program stored thereon, where the computer program is executed by a processor to perform the steps of the method according to any one of the above first aspects.

The beneficial effect of this application is: by adopting the virtual curly hair model rendering method provided by the application, the two-dimensional texture coordinates of the target hair piece in the preset hair model can be adjusted according to the input curly hair configuration parameters, then the curly hair model corresponding to the target hair piece is adjusted according to the two-dimensional texture coordinates of the adjusted target hair piece, the preset hair piece mapping and the preset hair piece positioning diagram, and the adjusted virtual curly hair model is obtained.

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 schematic flowchart of a virtual volume model rendering method according to an embodiment of the present application;

fig. 2 is a schematic flowchart of a virtual curl model rendering method according to another embodiment of the present application;

FIG. 3 is a schematic diagram of a virtual curl model provided in accordance with an embodiment of the present application;

FIG. 4 is a schematic diagram of a virtual curl model provided in accordance with another embodiment of the present application;

FIG. 5 is a schematic diagram of a virtual curl model provided in accordance with another embodiment of the present application;

FIG. 6 is a schematic diagram of a virtual curl model provided in accordance with another embodiment of the present application;

FIG. 7 is a schematic diagram of a virtual curl model provided in accordance with another embodiment of the present application;

fig. 8 is a schematic flowchart of a virtual curl model rendering method according to another embodiment of the present application;

fig. 9 is a schematic structural diagram of a virtual volume model rendering apparatus according to an embodiment of the present application;

fig. 10 is a schematic structural diagram of a virtual curling model rendering apparatus according to another embodiment of the present application;

fig. 11 is a schematic structural diagram of a virtual curl model rendering device according to an embodiment of the present application.

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 of the present application without making any creative effort, shall fall within the protection scope of the present application.

Additionally, the flowcharts used in this application illustrate operations implemented according to some embodiments of the present application. It should be understood that the operations of the flow diagrams may be performed out of order, and steps without logical context may be performed in reverse order or simultaneously. One skilled in the art, under the guidance of this application, may add one or more other operations to, or remove one or more operations from, the flowchart.

For the purpose of facilitating an understanding of the embodiments of the present application, the following partial terms related to the present application are explained:

rolling Rome: a common style of tubular vertical coil is a spring-like hanging hair coil.

Hair piece: a face insert in a hair model is adopted to simulate modeling of hair bundles and is a mainstream scheme for modeling hair in current games.

And (3) rolling degree: the curl level of hair can be described by 1-4 for the density of the coil turns and A-C for the stiffness of the coil, where: a is softest and is elongated most under gravity; c is the hardest and can maintain the basic form under gravity. 1A is straight hair, 4C turns like the screw thread.

Two-dimensional texture coordinates UV: vertex component information with a polygon and tessellated mesh for mapping the two-dimensional map onto the mesh of the three-dimensional model.

UV texture space: a two-dimensional texture coordinate system for defining UV, the UV texture space using letters U and V to indicate axes in the two-dimensional space.

Shader (Shader): a computer program for shading a three-dimensional scene.

Pixel Shader (Pixel Shader): and a shader for processing the pixels.

The virtual volume model rendering method provided by the embodiment of the present application is explained below with reference to a plurality of specific application examples. Fig. 1 is a schematic flowchart of a virtual volume model rendering method according to an embodiment of the present application, and as shown in fig. 1, the method includes:

s101: and adjusting the two-dimensional texture coordinates of the target hair piece in the preset hair model according to the input hair curling configuration parameters.

In the following embodiments, the preset hair model is described as an example, and is only applied to the three-dimensional curly hair of the cylindrical vertical scroll, for example, a roman scroll.

In the embodiment of the present application, the input of the configuration parameter may be determined, for example, in response to a parameter input operation of a player on a configuration interface, where the player may open the configuration interface by clicking a configuration control in the game interface during a game, or invoke the presentation of the configuration interface by using a preset shortcut key or a preset shortcut gesture, and then set or adjust a curling configuration parameter in a parameter to be adjusted in the configuration interface, it should be understood that the foregoing embodiment is merely an exemplary illustration, and a manner of specifically acquiring the curling configuration parameter and an operation of invoking the configuration interface may be flexibly adjusted according to a user's requirement, and are not limited to what is provided in the foregoing embodiment.

S102: and adjusting the hair curling model corresponding to the target hair piece according to the adjusted two-dimensional texture coordinates of the target hair piece, the preset hair piece mapping and the preset hair piece positioning diagram to obtain a virtual hair curling model corresponding to the preset hair model.

Wherein, the hair piece mapping is used for rendering the hair piece color of each target hair piece, and the hair piece positioning diagram comprises: the hair positioning information of the target hair piece is used for mapping the position of each pixel point on the hair piece model on the target hair piece; in the embodiment of the application, a first preset channel is arranged in the hair piece positioning diagram and used for storing the length information of the hair, and when the hair piece mapping comprises a plurality of hair pieces, a second preset channel is also arranged in the hair piece positioning diagram and used for storing the transverse positioning information of the hair pieces.

The hair curling form of the hair curling model can be adjusted according to the input hair curling configuration parameters by adjusting the hair curling model of the target hair piece.

By adopting the virtual curly hair model rendering method provided by the application, the two-dimensional texture coordinates of the target hair piece in the preset hair model can be adjusted according to the input curly hair configuration parameters, then the curly hair model corresponding to the target hair piece is adjusted according to the two-dimensional texture coordinates of the adjusted target hair piece, the preset hair piece mapping and the preset hair piece positioning diagram, and the adjusted virtual curly hair model is obtained.

Optionally, on the basis of the foregoing embodiment, an embodiment of the present application may further provide a virtual curling model rendering method, and an implementation process of obtaining a virtual curling model corresponding to a preset hair model in the foregoing method is described as follows with reference to the accompanying drawings. Fig. 2 is a flowchart illustrating a virtual curl model rendering method according to another embodiment of the present application, and as shown in fig. 2, S102 may include:

s103: and determining the position of each pixel point on the target hair piece by adopting a pixel shader according to the adjusted two-dimensional texture coordinate, the hair piece mapping and the hair piece positioning picture of the target hair piece.

In some possible embodiments, for example, a pixel shader may be used to determine the position of each pixel point on each texture coordinate axis on the target hair piece according to the adjusted two-dimensional texture coordinates, hair piece maps, and hair piece positioning maps of the target hair piece, and the position of each pixel point on the hair piece may be queried during rendering.

S104: and calculating the offset of the texture coordinate axis of the target film sending according to the position of each pixel point on the target film sending.

For example, in an embodiment of the present application, the offset may be calculated, for example, by calculating an offset of the target hair piece in another texture coordinate axis according to a position of each pixel point in the target hair piece in one texture coordinate axis; the texture coordinate axis offset includes: the offset of the first texture coordinate axis, and/or the offset of the second texture coordinate axis, the first texture coordinate axis and the second texture coordinate axis are two coordinate axes which are perpendicular to each other on the texture coordinate system.

For example, in the embodiment of the application, the left side of the two-dimensional texture of the target hair piece is adjusted, for example, a horizontal axis offset and a vertical axis offset of a two-dimensional texture coordinate may be determined through a hair curling configuration parameter, and then the two-dimensional texture coordinate of the target hair piece in the hair model is adjusted according to the horizontal axis offset and the vertical axis offset to obtain the two-dimensional texture coordinate of the adjusted target hair piece, where the two-dimensional texture coordinates of different target hair pieces may represent spiral effects of different hair pieces, so that the adjustment of the spiral effect of the hair piece is realized through the adjustment of the hair curling configuration parameter.

In some possible embodiments, when the horizontal axis offset and the vertical axis offset are calculated, the calculation manner may be, for example, to determine, for a target hair piece, the position of the vertical axis of the hair piece after adjustment according to the vertical axis offset (the vertical axis of the hair piece in this application is defined as U in UV) pixel by pixel, and then calculate the offset of the horizontal axis of the hair piece (the horizontal axis of the hair piece in this application is defined as V in UV) according to the position of the vertical axis of the hair piece, and the determination formula of the horizontal axis offset may be, for example, O ═ R × Lv(ii) a Wherein O is the lateral axis offset of the hair piece, R is the overall curl, LvThe method comprises the steps of determining the position of a current pixel point on a hair piece for the percentage of the current pixel point on a current hair piece longitudinal axis, calculating the lateral axis offset of the hair piece according to the hair piece longitudinal axis position, and adjusting the lateral axis position of the hair piece according to the lateral axis offset of the hair piece to obtain the two-dimensional texture coordinate of the adjusted target hair piece.

The offset of the target hair piece on the other texture coordinate axis may be calculated, for example, according to the position of each pixel point on one texture coordinate axis on the target hair piece and a preset curling degree, and the offset of the target hair piece on the other texture coordinate axis is calculated.

S105: and adjusting the texture coordinate axis of the curling model corresponding to the target hairpiece according to the offset of the texture coordinate axis to obtain the virtual curling model.

The hair curling form of the target hair piece in the hair curling model can be adjusted by adjusting the texture coordinate axis of the hair curling model corresponding to the target hair piece, so that the virtual hair curling model with the changed form is obtained, and the effect of adjusting the hair curling form of the virtual hair curling model is realized by a player.

For example, in one embodiment of the present application, if the curling configuration parameters include: the curved-straight transition parameter may be, for example, a manner of adjusting the two-dimensional texture coordinates of the target hair piece: according to the curve-straight transition parameters, the position of the target hair piece on a first texture coordinate axis is adjusted, wherein the first texture coordinate axis is as follows: a texture coordinate axis along the length of the hair piece.

In the embodiment of the present application, the predetermined curved-straight transition parameter may be determined according to the formula Where T is the straight-curved transition coefficient input by the user, in the embodiment of the present application, T may be a range value of 0-1, LvIs the percentage of the current pixel point on the current sending piece vertical axis, namely the percentage of the pixel point before adjustment on the current sending piece vertical axis, L'vFor example, for a virtual hair curling model with a length of 1m, the curve transition parameter is 0 (hair root position) -0.5m for straight hair, and 0.5-1.0m (hair tail position) for 20 circles/m for curled hair. If there is no transition between curls and curls, starting at 0.5m, it appears that a length of curls is spliced directly under the straight hair, resulting in a very stiff and unnatural overall effect of the virtual curl model; the transition is that the middle joint part of the two sections of the straight hair and the curly hair is gradually curled, so that the transition effect exists between the curly hair and the straight hair, and the whole effect of the virtual curly hair model is more natural.

In another embodiment of the present application, the hair curling configuration parameters further include: hair piece width parameter, and hair root direction parameter; in this case, the two-dimensional texture coordinates of the target hair piece may be adjusted by: calculating the latest position of the target hair piece on a second texture coordinate axis according to the hair piece width parameter, the hair root direction parameter, the position of the target hair piece on the first texture coordinate axis and the historical position of the target hair piece on the second texture coordinate axis; wherein the first texture coordinate axis is: along the texture coordinate axis of the hair piece length direction, the second texture coordinate axis is: texture coordinate axes in the width direction of the hair piece; and adjusting the position of the target hair piece on the second texture coordinate axis to be the latest position.

In the embodiment of the present application, the preset hair piece width and hair root direction adjustment formula may be, for example:

Br=Bl+D

wherein, W in the above formula is the width parameter of the hair piece input by the user, and D is the root direction parameter input by the user. O is the lateral axis offset of the hair piece, R is the overall curl, LvThe percentage width () is the interpolation adjustment function of the width, and the clamp () is the threshold clipping function, for the percentage of the current pixel on the vertical axis of the current hairpiece. L ishPositioning Cross Axis percentage, L 'for pre-conditioned Hair piece'hPositioning the cross-axis percentage for the adjusted hair piece, Bl,BrThe middle values in the above formula mean the left and right boundaries of the hair piece texture determined after considering W and D, respectively.

In another embodiment of the present application, the hair curling configuration parameters further include: a curl interpolation parameter; in this case, the two-dimensional texture coordinates of the target hair piece may be adjusted by: according to the curl interpolation parameter, the position of the target hair piece on a first texture coordinate axis is adjusted, wherein the first texture coordinate axis is as follows: a texture coordinate axis along the length of the hair piece.

In an embodiment of the present application, the curl difference adjustment formula may be, for example:

wherein, gnPositioning the longitudinal axis position, m, in the hair piece for curl interpolationnA volume interpolation parameter input for a user; gn,mn∈[0,1]N is equal to 0, …, k, and g0=0,gk=1,gn<gn+1。i∈[0,1]The value along the hair length coordinate axis in the hair piece positioning information of the current pixel, gradientCurl () is an interpolation function of curl, LvIs the percentage of the pixel before adjustment on the current tile longitudinal axis, L'vThe percentage of the adjusted pixel points on the longitudinal axis of the adjusted hair piece is shown.

In another embodiment of the present application, the hair curling configuration parameters further include: a normal adjustment parameter; in this case, the two-dimensional texture coordinates of the target hair piece may be adjusted by: generating a normal rotation matrix of the target hair piece according to the normal adjustment parameter, wherein the normal rotation matrix of the target hair piece comprises: adjusting parameters of normals of all pixel points in the target film sending; and adjusting the normal of each pixel point in the target film sending according to the normal adjustment parameter of each pixel point.

In an embodiment of the present application, the formula for the hair curl normal adjustment may be, for example:

where M is the normal rotation matrix and f () is a function that generates the rotation matrix with the rotation axis and angle.The unit vectors of the current pixel tangent line and the current pixel normal line, P is a normal line adjustment coefficient input by a user, P can be a range value of 0-1, for example, and the adjustment of the hair curl normal line can visually change the hair curl direction of the target hair piece so as to ensure that the hair curl of the target hair piece isAppearing flatter or fuller.

Fig. 3 is a schematic diagram of a virtual curl model provided in an embodiment of the present application, fig. 4 is a schematic diagram of a virtual curl model provided in another embodiment of the present application, fig. 5 is a schematic diagram of a virtual curl model provided in another embodiment of the present application, fig. 6 is a schematic diagram of a virtual curl model provided in another embodiment of the present application, fig. 7 is a schematic diagram of a virtual curl model provided in another embodiment of the present application, as shown in fig. 3-7, for example, fig. 3 is an initial virtual curl model with parameters not adjusted, fig. 4 is a virtual curl model with a curve straight transition parameter adjusted, fig. 5 is a virtual curl model with a hair piece width parameter and a hair root direction parameter adjusted, fig. 6 is a virtual curl model with a curl interpolation parameter adjusted, fig. 7 is a virtual curl model with a normal adjustment parameter adjusted, see the method provided in the present application, the virtual curly hair model of different forms can be obtained by adjusting different parameters, so that the player can adjust each parameter according to own requirements, and a user-defined virtual curly hair model which meets own requirements is obtained.

Optionally, on the basis of the foregoing embodiments, an embodiment of the present application may further provide a virtual volume model rendering method, and an implementation process of the foregoing method is described as follows with reference to the accompanying drawings. Fig. 3 is a schematic flowchart of a virtual curl model rendering method according to another embodiment of the present application, as shown in fig. 8, before S101, the method may further include:

s106: and rolling the target hair piece into a cylinder shape to obtain a hair curling model corresponding to the target hair piece.

In the embodiment of the present application, for example, the portions of the target hair piece that need to be made into roman rolls may be respectively connected left and right to be rolled into a cylindrical shape, so as to obtain a hair curling model corresponding to the target hair piece; that is, in the embodiment of the present application, for the same target piece of hair, there may be a part of the piece of hair being straight hair, and a part of the piece of hair being a roman coil, for example, there may be a straight hair from the root to the middle of the target piece of hair, and a roman coil from the middle to the tail of the target piece of hair; the root part to the tail part of the target hair piece can be a roman coil, and the setting mode and the setting position of the roman coil in the specific target hair piece can be flexibly adjusted according to the needs of the user, which is not limited to the embodiments.

S107: and binding the hair curling model corresponding to the target hair piece with the two-dimensional texture coordinates of the target hair piece.

The hair curling model is a model in which hair pieces needing to be made into Roman curls in target hair pieces are respectively connected left and right to be rolled into a cylinder shape, after the hair curling model is bound with two-dimensional texture coordinates, a hair piece positioning diagram can be generated according to the two-dimensional texture coordinates and the hair piece mapping diagram and is used for inquiring the positioning of each pixel point on the hair pieces in rendering, the bound virtual hair curling model stores initial information of some parameters, and the representation effect of the modified virtual hair curling model can be determined through modifying the initial parameter information and parameters input by a user on the basis of the initial virtual hair curling model, so that the representation effect of the virtual hair curling model can be adjusted through modifying the parameters.

S108: and binding the two-dimensional texture coordinates of the target hair piece with the hair piece positioning diagram.

By adopting the virtual curling model rendering method provided by the application, the two-dimensional texture coordinates of the target hair piece in the preset hair model can be adjusted according to the input curling configuration parameters, the hair piece positioning diagram is regenerated according to the adjusted two-dimensional texture coordinates, and the curling model corresponding to the target hair piece is adjusted according to the two-dimensional texture coordinates and the regenerated large hair piece positioning diagram, so that the adjusted virtual curling model is obtained, the curling configuration parameters in the application comprise multiple types, the width and the curl of the hair piece can be adjusted according to the needs of a user, so that the virtual curling model can be customized, the operability and the expression form of a player on the virtual curling model are improved, and the game experience of the player is improved.

The virtual curling model rendering device provided by the present application is explained below with reference to the accompanying drawings, and the virtual curling model rendering device may execute any one of the virtual curling model rendering methods shown in fig. 1 to 8, and specific implementation and beneficial effects thereof are referred to above and will not be described again below.

Fig. 9 is a schematic structural diagram of a virtual curl model rendering apparatus according to an embodiment of the present application, and as shown in fig. 9, the apparatus includes: an adjustment module 201 and a generation module 202, wherein:

the adjusting module 201 is configured to adjust two-dimensional texture coordinates of a target hair piece in a preset hair model according to an input hair curling configuration parameter;

a generating module 202, configured to adjust a hair curling model corresponding to the target hair piece according to the adjusted two-dimensional texture coordinate of the target hair piece, a preset hair piece mapping and a preset hair piece positioning diagram, to obtain a virtual hair curling model corresponding to the preset hair model, where the hair piece positioning diagram includes: hair position information of the target hair piece.

Optionally, on the basis of the foregoing embodiments, embodiments of the present application may further provide a virtual volume model rendering apparatus, and an implementation process of the apparatus shown in fig. 9 is described below with reference to the accompanying drawings. Fig. 10 is a schematic structural diagram of a virtual curl model rendering apparatus according to another embodiment of the present application, and as shown in fig. 10, the apparatus further includes: a determination module 203 and a calculation module 204, wherein:

a determining module 203, configured to determine, according to the adjusted two-dimensional texture coordinates of the target hair piece, the hair piece mapping map, and the hair piece positioning map, a position of each pixel point on the target hair piece by using a pixel shader;

the calculating module 204 is specifically configured to calculate a texture coordinate axis offset of the target film sending according to a position of each pixel point on the target film sending;

the adjusting module 201 is specifically configured to adjust a texture coordinate axis of the hair curling model corresponding to the target hair piece according to the offset of the texture coordinate axis, so as to obtain a virtual hair curling model.

Optionally, the determining module 203 is specifically configured to determine, by using a pixel shader, a position of each pixel point on each texture coordinate axis on the target hair piece according to the adjusted two-dimensional texture coordinate of the target hair piece, the hair piece patch, and the hair piece positioning map.

Optionally, the calculating module 204 is specifically configured to calculate, according to a position of each pixel point on one texture coordinate axis of the target hairpin, an offset of the target hairpin on another texture coordinate axis; the texture coordinate axis offset includes: the offset of the first texture coordinate axis, and/or the offset of the second texture coordinate axis, the first texture coordinate axis and the second texture coordinate axis are two coordinate axes which are perpendicular to each other on the texture coordinate system.

Optionally, the calculating module 204 is specifically configured to calculate an offset of the target hair piece on another texture coordinate axis according to a position of each pixel point on one texture coordinate axis of the target hair piece and a preset curling degree.

Optionally, the adjusting module 201 is specifically configured to adjust a position of the target hair piece on a first texture coordinate axis according to the curved-straight transition parameter, where the first texture coordinate axis is: a texture coordinate axis along the length of the hair piece.

Optionally, the hair curling configuration parameters further comprise: hair piece width parameter, and hair root direction parameter;

the calculating module 204 is specifically configured to calculate the latest position of the target hair piece in the second texture coordinate axis according to the hair piece width parameter, the hair root direction parameter, the position of the target hair piece in the first texture coordinate axis, and the historical position of the target hair piece in the second texture coordinate axis; wherein the first texture coordinate axis is: along the texture coordinate axis of the hair piece length direction, the second texture coordinate axis is: texture coordinate axes in the width direction of the hair piece;

the adjusting module 201 is specifically configured to adjust the position of the target hair patch in the second texture coordinate axis to the latest position.

Optionally, the hair curling configuration parameters further comprise: a curl interpolation parameter;

the adjusting module 201 is specifically configured to adjust the position of the target hair patch in a first texture coordinate axis according to the curl interpolation parameter, where the first texture coordinate axis is: a texture coordinate axis along the length of the hair piece.

Optionally, the hair curling configuration parameters further comprise: a normal adjustment parameter;

the generating module 202 is specifically configured to generate a normal rotation matrix of the target hair piece according to the normal adjustment parameter, where the normal rotation matrix of the target hair piece includes: adjusting parameters of normals of all pixel points in the target film sending;

the adjusting module 201 is specifically configured to adjust the normal of each pixel point in the target film according to the normal adjustment parameter of each pixel point.

As shown in fig. 10, the apparatus further includes: a binding module 205, wherein:

the generating module 202 is specifically configured to roll the target hair piece into a cylindrical shape to obtain a hair curling model corresponding to the target hair piece;

a binding module 205, configured to specifically bind a hair curling model corresponding to the target hair piece with the two-dimensional texture coordinates of the target hair piece; and binding the two-dimensional texture coordinates of the target hair piece with the hair piece positioning diagram.

The above-mentioned apparatus is used for executing the method provided by the foregoing embodiment, and the implementation principle and technical effect are similar, which are not described herein again.

These above modules may be one or more integrated circuits configured to implement the above methods, such as: one or more Application Specific Integrated Circuits (ASICs), or one or more microprocessors, or one or more Field Programmable Gate Arrays (FPGAs), etc. For another example, when one of the above modules is implemented in the form of a Processing element scheduler code, the Processing element may be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

Fig. 11 is a schematic structural diagram of a virtual volume model rendering device according to an embodiment of the present application, where the virtual volume model rendering device may be integrated in a terminal device or a chip of the terminal device.

As shown in fig. 11, the virtual curl model rendering apparatus includes: a processor 501, a storage medium 502, and a bus 503.

The processor 501 is used for storing a program, and the processor 501 calls the program stored in the storage medium 502 to execute the method embodiment corresponding to fig. 1-8. The specific implementation and technical effects are similar, and are not described herein again.

Optionally, the present application also provides a program product, such as a storage medium, on which a computer program is stored, including a program, which, when executed by a processor, performs embodiments corresponding to the above-described method.

In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.

Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.

In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.

The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to perform some steps of the methods according to the embodiments of the present application. And the aforementioned storage medium includes: a U disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.

19页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种游戏数据处理方法、装置、设备及存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类