CN115375814A - Method and device for rendering hair of game role, electronic equipment and storage medium - Google Patents

Method and device for rendering hair of game role, electronic equipment and storage medium Download PDF

Info

Publication number
CN115375814A
CN115375814A CN202210993293.2A CN202210993293A CN115375814A CN 115375814 A CN115375814 A CN 115375814A CN 202210993293 A CN202210993293 A CN 202210993293A CN 115375814 A CN115375814 A CN 115375814A
Authority
CN
China
Prior art keywords
hair
rendering
group
pieces
distance
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
CN202210993293.2A
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.)
Perfect World Chongqing Interactive Technology Co ltd
Original Assignee
Perfect World Chongqing Interactive 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 Perfect World Chongqing Interactive Technology Co ltd filed Critical Perfect World Chongqing Interactive Technology Co ltd
Priority to CN202210993293.2A priority Critical patent/CN115375814A/en
Publication of CN115375814A publication Critical patent/CN115375814A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/60Generating or modifying game content before or while executing the game program, e.g. authoring tools specially adapted for game development or game-integrated level editor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T13/00Animation
    • G06T13/203D [Three Dimensional] animation
    • G06T13/403D [Three Dimensional] animation of characters, e.g. humans, animals or virtual beings

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Graphics (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The application relates to a method, a device, an electronic device and a storage medium for rendering hair of a game role, wherein the method comprises the following steps: obtaining hair pieces obtained by splitting a hair model and a hair group consisting of the hair pieces; for each hair group, determining a first rendering order of each hair piece according to a first distance between each hair piece in the hair group and the center point of the hair group and the order of the first distance from near to far; for each hair group, determining a second rendering order of each hair group from back to front based on the front of the game role; and rendering the hair model according to the first rendering sequence and the second rendering sequence to obtain a rendered hair model. According to the technical scheme, the hair rendering effect is vivid and lively, time and labor are avoided being wasted in manual sequencing, and the processing efficiency and accuracy of the hair of the game role are improved.

Description

Method and device for rendering hair of game role, electronic equipment and storage medium
Technical Field
The present application relates to the field of computers, and in particular, to a method and an apparatus for rendering hair of a game character, an electronic device, and a storage medium.
Background
Along with the promotion of game effect quality, the lifelike effect of rendering of game personage hair can highlight the true hair effect of personage more, makes the personage render more lifelike, more lifelike lively.
Because the hair is made of semitransparent, complex and multilayer materials, the hair can be vividly rendered only by rendering according to a certain rendering sequence. At present, in order to achieve realistic hair rendering, designers are generally required to manually sort the hair pieces, and the hair rendering is completed according to manual sorting. Thus, the treatment of the hair of the game character is time-consuming and labor-consuming, and the efficiency is low.
Disclosure of Invention
In order to solve the technical problem of low game character hair processing efficiency, embodiments of the present application provide a method and an apparatus for rendering hair of a game character, an electronic device, and a storage medium.
According to an aspect of an embodiment of the present application, there is provided a method for rendering hair of a game character, including:
obtaining hair pieces obtained by splitting a hair model and a hair group consisting of the hair pieces;
for each hair group, determining a first rendering order of each hair piece according to a first distance between each hair piece in the hair group and a center point of the hair group and an order of the first distance from near to far;
for each hair group, determining a second rendering order of each hair group from back to front based on the front of the game role;
and rendering the hair model according to the first rendering sequence and the second rendering sequence to obtain a rendered hair model.
Optionally, the obtaining of the group of hairs consisting of the hair pieces comprises:
and grouping the hair pieces according to the hair piece types corresponding to the hair pieces to obtain the hair group.
Optionally, the grouping the hair pieces according to the hair piece types corresponding to the hair pieces to obtain the hair group includes:
acquiring the position relation between each hairpin and the head of the game role, wherein the position relation at least comprises the distance between each hairpin and the head of the game role;
classifying the hair pieces according to the position relation to obtain the hair piece types;
and grouping the hair pieces according to the hair piece types to obtain the hair group.
Optionally, the grouping the hair pieces according to the hair piece types corresponding to the hair pieces to obtain the hair group includes:
acquiring the hairstyle type of the game role;
determining the hair style corresponding to each hair piece according to the hair style type;
and grouping the hair pieces according to the hair piece types to obtain the hair group.
Optionally, when the hair style is horse tail, the hair piece style includes: scalp hair and horsetail hair; the grouping the hair pieces according to the hair piece types to obtain the hair group comprises the following steps: and according to the hair piece types, dividing the hair pieces into groups to obtain a scalp hair group and a horse tail hair group.
Optionally, when the hair style is a bun, the hair style includes: scalp hair and bun hair; the grouping the hair pieces according to the hair piece types to obtain the hair group comprises the following steps: and according to the hair piece types, dividing the hair pieces into groups to obtain a scalp hair group and a chignon hair group.
Optionally, for each hair group, determining a first rendering order of each hair piece according to a first distance between each hair piece in the hair group and a center point of the hair group and an order of the first distances from near to far, including:
acquiring a first distance between each hair piece in the hair group and the center point of the hair group;
sequencing the hair pieces according to the sequence of the first distance from near to far to obtain a first sequencing result; or adding a first identifier for each hair piece according to the first distance, wherein the first identifier is used for embodying the sequence of the first distance from near to far;
determining the first rendering order according to the first ordering result or the first identifier.
Optionally, for each hair group, determining a second rendering order of each hair group from back to front with the front of the game character as a reference; the method comprises the following steps:
acquiring a second distance between the center point of the hair group and the camera when the game character faces the camera;
sorting the hair groups according to the sequence of the second distance from far to near to obtain a second sorting result; or adding a second identifier for each hair group according to the second distance, wherein the second identifier is used for embodying the sequence of the second distance from far to near;
and determining the second rendering sequence according to a second sequencing result or the second identifier.
Optionally, the rendering the hair model according to the first rendering order and the second rendering order to obtain a rendered hair model includes:
rendering the hair pieces according to the first rendering sequence to obtain a rendered hair group;
rendering the rendered hair group according to the second rendering sequence to obtain the rendered hair model;
or the like, or, alternatively,
rendering the hair model according to the first rendering order and the second rendering order, and obtaining a rendered hair model comprises:
and rendering the hair pieces in the hair group according to the first rendering sequence in sequence according to the second rendering sequence to obtain a rendered hair model.
According to another aspect of an embodiment of the present application, there is provided a hair rendering apparatus for a game character, including:
the acquisition module is used for acquiring hair pieces obtained by splitting the hair model and a hair group consisting of the hair pieces;
the first sequencing module is used for determining a first rendering sequence of the hair pieces according to a first distance between the hair pieces in the hair group and the center point of the hair group and a sequence of the first distance from near to far for each hair group;
the second sequencing module is used for determining a second rendering sequence of each hair group from back to front by taking the front of the game role as a reference for each hair group;
and the rendering module is used for rendering the hair model according to the first rendering sequence and the second rendering sequence to obtain a rendered hair model.
According to another aspect of the embodiments of the present application, there is also provided a storage medium including a stored program that executes the above steps when the program is executed.
According to another aspect of an embodiment of the present application, there is provided an electronic device including: the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;
the memory is used for storing a computer program;
the processor is configured to implement the above method steps when executing the computer program.
According to another aspect of embodiments of the present application, there is provided a computer-readable storage medium, on which a computer program is stored, which computer program, when being executed by a processor, carries out the above-mentioned method steps.
Compared with the prior art, the technical scheme provided by the embodiment of the application has the following advantages:
this application embodiment, after the hair model split is the hair piece automatically, divide into groups and play up according to the order from inside to outside, the hair group after will playing up merges according to the order from back to front that uses the game role openly as the benchmark, like this, the hair that lies in the hair inboard or rear side from the vision is played up earlier, and is played up after the hair that lies in the hair outside or front side, when guaranteeing that the hair is played up vividly lively, realize automatically according to accurate order play up the hair model, avoid manual sequencing to waste time and energy, the treatment effeciency and the degree of accuracy of game role hair are improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments or technical solutions in the prior art of the present invention, the drawings used in the description of the embodiments or prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained based on these drawings without creative efforts.
Fig. 1 is a flowchart of a method for rendering hair of a game character according to an embodiment of the present disclosure;
FIG. 2 is a flow chart of a method for rendering hair of a game character according to another embodiment of the present application;
FIG. 3 is a flow chart of a method for rendering hair of a game character according to another embodiment of the present application;
FIG. 4 is a block diagram of a hair rendering device for a game character according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure;
FIG. 6 is a schematic diagram of a hair piece included in the hair of a game character according to an embodiment of the present application;
FIG. 7 is a schematic diagram of a grouping of game character hairs according to an embodiment of the present application;
FIG. 8 is a schematic view of a long hair set of a game character in accordance with an embodiment of the present application;
FIG. 9 is a schematic view of the hair of a game character according to another embodiment of the present application;
fig. 10 is a schematic diagram of grouping hairs of a game character according to another 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. 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.
In the related technology, designers manually compare the front-back relation of each hair piece and manually sort and combine the models, so that time and labor are wasted, the efficiency is low, and the accuracy of manual combination is poor only by observing the hair pieces by human eyes. The embodiment of the application breaks up and divides into groups the hair model, organizes the distance of sending out piece and central point according to every hair and sorts the piece of sending out, and the precedence order that sees according to the hair group openly merges for automatic completion sends out piece, the order of hair group is played up, when guaranteeing that the hair is played up the lifelike lively, improves the treatment effeciency and the degree of accuracy of game role hair.
In the embodiments of the application, the front direction of the game role is taken as the front, and the back direction is taken as the back; the hair of the game role is inner near the scalp and outer far from the scalp.
First, a method for rendering hair of a game character according to an embodiment of the present invention will be described.
Fig. 1 is a flowchart of a method for rendering hair of a game character according to an embodiment of the present disclosure. As shown in fig. 1, the method comprises the following steps S11-S14.
S11, obtaining hair pieces obtained by splitting a hair model and a hair group consisting of the hair pieces;
step S12, for each hair group, determining a first rendering sequence of each hair piece according to a first distance between each hair piece in the hair group and the center point of the hair group and a sequence of the first distances from near to far;
step S13, for each hair group, determining a second rendering sequence of each hair group from back to front by taking the front of the game role as a reference;
and S14, rendering the hair model according to the first rendering sequence and the second rendering sequence to obtain the rendered hair model.
The respective steps in the above-described embodiment method are explained in detail below.
(1) With respect to step S11
Because the number of hairs is large, the types and styles of the hairs are various, the colors are different, and complicated hair rendering may occupy a large amount of rendering resources, the hair model of the game role is generally manufactured based on a patch, that is, the whole hair model is composed of a plurality of hair patches (hereinafter referred to as "hair patches"). And 3dsMax, MAYA and other software are used for placing the hair pieces according to the hair growth rule, carrying out UVW expansion on the hair pieces, and placing the hair paste picture on the corresponding UV position, thereby simulating the real hair effect.
As shown in FIG. 6, the hair of the game character is composed of a plurality of hair pieces, and each hair piece 61 can be edited and adjusted independently.
For a patch-based hair model, the hair model may be split using a splitting (DETACH) element, for example, using a command poly op.
In this step, a hair group consisting of the hair pieces is also obtained, that is, the hair pieces obtained after the hair model is split are grouped. Obtaining a set of hair comprised of said pieces of hair comprises: and grouping the hair pieces according to the hair piece types corresponding to the hair pieces to obtain the hair group.
The hair piece type can be determined in various ways, for example, the hair piece type can be determined by the position relation of the hair piece and the head, or the hair piece type can be determined based on the hair style of the game character.
(2) With respect to step S12
For each hair group, the location of its center point is determined. The central point of the hair set may be the central point of the hair set in the world coordinate system, or the central point of the hair set in the camera coordinate system, or the like. The whole hair model and the central point are positioned in the same coordinate system, so that the distance between the hair piece and the central point can be accurately calculated in the following process.
The position of the center point of the hair group can be calculated based on the position of the center point of each hair piece in the hair group, and can also be specified according to the position of the hair group. For example, if the hair group is a hair portion wrapped around the scalp, the center point of the hair group may be set as the center of the game character's head; if the hair group is a chignon part located on the top, on the side of the head or behind the brain, the center point of the hair group can be set as the center position of the chignon; if the hair group is a horse tail, the center point of the hair group is positioned in front of the middle part of the horse tail.
For each hair piece in the group, its distance from the center point of the group is calculated, close, i.e. the first rendering inside the group, and far, i.e. the last rendering outside the group.
(3) With respect to step S13
Since each hair group is also in front-back order visually, the rendering order of each hair group needs to be determined before rendering. And rendering from back to front according to the front-back sequence viewed from the front of the game character, namely the hair group which is actually in front is also in front visually, so that the combined hair model visually conforms to the natural law.
(4) With respect to step S14
After the rendering order of the hair pieces and the rendering order of the hair groups are obtained, the hair pieces and the hair groups can be rendered in sequence.
This application embodiment, after the hair model split is the hair piece automatically, divide into groups according to the order of from inside to outside and render, the hair group after will rendering combines according to the order of seeing from the game role openly from the back to the front, like this, the hair that lies in the hair inboard or rear side is rendered earlier from the vision, and is rendered after the hair that lies in the hair outside or front side, when guaranteeing that the hair renders lifelike lively the effect, realize that the hair model is rendered according to accurate order automatically, avoid manual sequencing to waste time and energy, the treatment effeciency and the degree of accuracy of game role hair are improved.
In alternative embodiments, grouping the hair pieces based on their types may be in any of the following ways.
In a first mode
And grouping the hair pieces according to the hair piece types corresponding to the hair pieces to obtain the hair group, wherein the steps A1-A3 are included.
A1, acquiring the position relation between each hairpin and the head of the game character, wherein the position relation at least comprises the distance between each hairpin and the head of the game character;
step A2, classifying the hair pieces according to the position relation to obtain the hair piece types;
and A3, grouping the hair pieces according to the hair piece types to obtain the hair group.
In this aspect, a plurality of distance threshold ranges may be set, and the hair pieces located within a certain threshold range from the head of the game character may be classified into the same type and the same group. Therefore, the obtained multiple hair groups are divided according to the distance between the multiple hair groups and the head of the game role, each hair group is rendered from inside to outside according to the distance between the hair piece and the central point, the hairs with different distances from the head of the game role are rendered according to the correct sequence, the rendered hair groups are combined from back to front, and each hair group is also combined from far to near from the scalp actually, so that the rendered hair visual effect is more consistent with the natural law, and the whole hair rendering effect is more vivid.
Mode two
Grouping the hair pieces according to the hair piece types corresponding to the hair pieces to obtain the hair group, wherein the hair group comprises:
step B1, acquiring the hairstyle type of the game role;
b2, determining the hair style corresponding to each hair piece according to the hair style type;
and step B3, grouping the hair pieces according to the hair piece types to obtain the hair group.
Optionally, when the hair style is horse tail, the hair piece types include: scalp hair and horsetail hair; the step B3 includes: and according to the hair piece types, dividing the hair pieces into groups to obtain a scalp hair group and a horse tail hair group. If the hairstyle is horsetail, the hair wrapped on the scalp can be divided into one group, and the horsetail part can be divided into another group.
Optionally, when the hair style type is a bun, the hair style type includes: scalp hair and bun hair; the step B3 includes: and according to the hair piece types, dividing the hair pieces into groups to obtain a scalp hair group and a chignon hair group. If the hair style is a hair bun, the hair wrapped around the scalp can be divided into one group, and the hair bun parts can be divided into another group.
In this manner, if the hairstyle is short, all of the pieces of hair can be grouped together; if the hairstyle is a shawl hair, the hair wrapped around the scalp can be divided into one group, and the hair on the shawl part can be divided into one group. There are various types of hair styles, which are not described in detail herein.
As shown in FIG. 7, the hairs of the game character are divided into two groups, a scalp hair group 71 is a part close to the scalp, and a long hair group 72 is a shawl hair part far from the scalp, as shown in FIG. 8.
As shown in fig. 9 and 10, the game characters are divided into two groups, a scalp hair group 81 at a portion close to the scalp, and a horse tail hair group 82 at a portion far from the scalp.
Therefore, the hair pieces are grouped through the hairstyle, the hair can be divided into relatively independent parts, each group of hair is rendered according to the sequence from inside to outside, the visual effect rendered by each part of the hair is in accordance with the natural law, and then all groups of hair are combined according to the sequence from back to front, so that the rendering effect of the whole hair is more vivid.
The hair pieces are grouped, and the two modes can be combined, namely the grouping of the hair pieces is determined by combining the positions of the hair pieces and the types of the hairstyles, so that for complex hairstyles, the hair pieces can be grouped, sequenced and rendered more accurately and effectively, and the visual effect of the finally combined hairstyle is more vivid.
In an alternative embodiment, fig. 2 is a flowchart of a method for rendering hair of a game character according to another embodiment of the present application. As shown in fig. 2, in the step S12, the process of determining the hair piece rendering process in each group specifically includes:
step S21, acquiring a first distance between each hair piece in the hair group and the center point of the hair group;
s22, sequencing the hairpieces according to the sequence of the first distance from near to far to obtain a first sequencing result; or, adding a first identifier for each hair piece according to the first distance, wherein the first identifier is used for embodying the sequence of the first distance from near to far;
and S23, determining the first rendering sequence according to the first sequencing result or the first identifier.
Optionally, in step S21, the distance between the hair piece and the center point of the hair set may be calculated as a distance between the center point of the hair piece and the center point of the hair set, or an average distance between each point on the hair piece and the center point, or a shortest distance or a longest distance between the hair piece and the center point is selected as a distance between the hair piece and the center point of the hair set, or a distance between the plane where the hair piece is located and the center point of the hair set is calculated, or a distance between the tangent line of the hair piece and the center point of the hair set is calculated, and so on. The designer can select any mode to calculate the distance between the hair piece and the center point of the hair group according to needs, and the specific calculation method is not described herein again.
Optionally, in step S22, for each hair group, a rendering order of each hair piece may be determined according to a distance between the hair piece and a center point of the hair group, in order to implement sequential rendering of the hair pieces, each hair piece may be directly and automatically sorted according to the distance, and sequentially rendered according to the order, or an identifier for identifying the rendering order may be added to each hair piece, and sequentially rendered according to the identifier during rendering. For example, a hair set contains 5 hair pieces: hair piece A, hair piece B, hair piece C, hair piece D and hair piece E. The distance between each hair piece and the center point of the hair group is respectively as follows:
hair piece A,6.89cm;
hair piece B,6.77cm;
hair piece C,5.98cm;
hair piece D,8.16cm;
hair piece E,7.32cm.
According to the distance from each hair piece to the center point of the hair group, the hair pieces can be sorted as follows: hair piece C-hair piece B-hair piece A-hair piece E-hair piece D, and rendering is carried out according to the sequence. Alternatively, the identification may be added to the hair piece according to the distance, such as, hair piece a: s3, hair piece B: s2, hair piece C: s1, hair piece D: s5, hair piece E: and s4. And during subsequent rendering, rendering is carried out according to the sequence of the identifiers s1-s 5.
In the embodiment, the sequencing of the hair pieces in the hair group is automatically completed by a tool, the manual sequencing of designers is not needed, the processing efficiency and the accuracy of the hair of the game role are improved, and the hair pieces are sequentially rendered from inside to outside, so that the visual effect of the rendered hair group is vivid and lively.
In an alternative embodiment, fig. 3 is a flowchart of a method for rendering hair of a game character according to another embodiment of the present application. As shown in fig. 3, in step S13, the process of determining the hair group rendering order specifically includes:
step S31, acquiring a second distance between the center point of the hair group and the camera when the front of the game role faces the camera;
s32, sorting the hair groups according to the sequence of the second distance from far to near to obtain a second sorting result; or adding a second identifier to each hair group according to the second distance, wherein the second identifiers are used for embodying the sequence of the second distance from far to near;
and step S33, determining the second rendering sequence according to a second sequencing result or the second identifier.
Optionally, in step 31, the distance between the hair group and the camera may be calculated by calculating the distance between the center point of the hair group and the camera, or the average distance between each point of the hair group and the camera, or selecting the shortest distance or the longest distance between the hair group and the camera, and so on. The designer can select any mode to calculate the distance between the hair group and the camera according to needs, and the specific calculation method is not described herein.
Optionally, in step S32, the merging order of the hair groups may be determined according to the distances between the hair groups and the camera, and in order to implement sequential merging of the hair groups, the hair groups may be directly and automatically sorted according to the distances, and sequentially merged according to the order, or an identifier for identifying the merging order may be added to each hair group, and sequentially merged according to the identifier.
For example, a hair model contains 3 hair groups: hair group G1, hair group G2, hair group G3. The distance between each hair group and the camera is respectively as follows:
hair group G1, 17.14;
hair group G2, 16.57;
hair group G3, 17.36.
The distance between each hair group and the camera may be sorted by: hair group G3-hair group G1-hair group G2, combined in this order. Alternatively, the patches may be marked by distance from far to near, e.g., hair group G1: n2, hair group G2: n3, hair group G3: n1. And merging according to the sequence of the identifiers n1-n 3.
In the embodiment, the sequential combination of the hair groups can be automatically completed by a tool without manual sequencing and combination of designers, so that the processing efficiency and accuracy of the hair of the game role are improved, and the hair groups are combined according to the sequence from far to near from the camera, so that the whole hair after final combination visually conforms to the natural law, and the effect is vivid.
In alternative embodiments of the present application, the step S14 may render the hair in two ways.
In a first mode
Rendering the hair pieces according to the first rendering sequence to obtain a rendered hair group; and rendering the rendered hair group according to the second rendering sequence to obtain the rendered hair model.
Namely, the hair pieces in each hair group are rendered in sequence at the same time, and the rendered hair groups are rendered in sequence.
For example, hair group G1, includes hair pieces A1-E1, and hair group G2 includes hair pieces A2-E2. Firstly, rendering the hair pieces A1-E1 in sequence to obtain a rendered hair group G1', and rendering the hair pieces A2-E2 in sequence to obtain a rendered hair group G2'. And then combining the hair groups G1 'and G2' according to the sequence to obtain the rendered hair model.
Mode two
And rendering the hair pieces in the hair group according to the first rendering sequence in sequence to obtain a rendered hair model.
For example, hair group G1, includes hair pieces A1-E1, and hair group G2 includes hair pieces A2-E2.
The rendering sequence of the hair groups is G2-G1, therefore, the hair pieces A2-E2 are rendered in sequence to obtain the rendered hair group G2', then the hair pieces A1-E1 are rendered in sequence to obtain the rendered hair group G1', and then the rendered hair model can be directly obtained.
In an alternative embodiment, after the hair pieces and the hair groups are sorted, a hair model in which the hair pieces and the hair groups are sorted can be generated instead of rendering the hair. The method further comprises the following steps: combining the hair pieces according to a first rendering sequence to obtain a target hair group; and combining the target hair according to the second rendering sequence to obtain the target hair model. In this embodiment, the target hair model includes target hair groups and a merging order of the target hair groups, and each target hair group includes a hair piece and a rendering order of the hair pieces. And during rendering, the finally output target hair model can sequentially render the hair pieces in each target hair group according to the combination sequence of the target hair groups, and finally obtain the rendered target hair model. The target hair model can be output and applied to different game roles so as to realize the makeup/decoration change of the game roles.
The following are embodiments of the apparatus of the present application that may be used to perform embodiments of the method of the present application.
Fig. 4 is a block diagram of a hair rendering apparatus for a game character according to an embodiment of the present disclosure, which may be implemented as part of or all of an electronic device through software, hardware, or a combination of the software and the hardware. As shown in fig. 4, the apparatus includes:
an obtaining module 41, configured to obtain a hair piece obtained by splitting a hair model, and a hair group composed of the hair pieces;
a first ordering module 42, configured to, for each hair group, determine a first rendering order of each hair piece according to a first distance between each hair piece in the hair group and a center point of the hair group and an order from near to far of the first distance;
a second sorting module 43, configured to, for each hair group, determine a second rendering order of each hair group from back to front with the front of the game character as a reference;
and the rendering module 44 is configured to render the hair piece according to the first rendering order, and render the hair group according to the second rendering order, so as to obtain a rendered hair model.
Optionally, the obtaining module 41 is configured to group the hair pieces according to the hair piece types corresponding to the hair pieces to obtain the hair group.
Optionally, the obtaining module 41 is configured to obtain a position relationship between each issue piece and the head of the game character, where the position relationship at least includes a distance between the issue piece and the head of the game character; classifying the hair pieces according to the position relation to obtain the hair piece types; and grouping the hair pieces according to the hair piece types to obtain the hair group.
Optionally, the obtaining module 41 is configured to obtain a hair style type of the game role; determining the hair piece type corresponding to each hair piece according to the hair type; and grouping the hair pieces according to the hair piece types to obtain the hair group.
Optionally, the first sequencing module 42 is configured to obtain a first distance between each hair piece in the hair set and a center point of the hair set; sequencing the hair pieces according to the sequence of the first distance from near to far to obtain a first sequencing result; or adding a first identifier for each hair piece according to the first distance, wherein the first identifier is used for embodying the sequence of the first distance from near to far; determining the first rendering order according to the first ordering result or the first identifier.
Optionally, the second sorting module 43 is configured to obtain a second distance between the center point of the hair group and the camera when the game character faces the camera; sorting the hair groups according to the sequence of the second distance from far to near to obtain a second sorting result; or adding a second identifier for each hair group according to the second distance, wherein the second identifier is used for embodying the sequence of the second distance from far to near; and determining the second rendering sequence according to a second sequencing result or the second identifier.
Optionally, the rendering module 44 is configured to render the hair fragments according to the first rendering order, so as to obtain a rendered hair group; and rendering the rendered hair group according to the second rendering sequence to obtain the rendered hair model. Or, the rendering module 44 is configured to sequentially render the hair pieces in the hair group according to the second rendering order and the first rendering order, so as to obtain a rendered hair model.
An embodiment of the present application further provides an electronic device, as shown in fig. 5, the electronic device may include: the system comprises a processor 1501, a communication interface 1502, a memory 1503 and a communication bus 1504, wherein the processor 1501, the communication interface 1502 and the memory 1503 complete communication with each other through the communication bus 1504.
A memory 1503 for storing a computer program;
the processor 1501, when executing the computer program stored in the memory 1503, implements the steps of the method embodiments described below.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Alternatively, the memory may be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; 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, discrete hardware components.
The present application also provides a computer-readable storage medium having stored thereon a computer program which, when being executed by a processor, carries out the steps of the above-mentioned method embodiments.
It should be noted that, for the above-mentioned apparatus, electronic device and computer-readable storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiments.
It is further noted that, herein, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or apparatus that comprises the element.
The above description is merely illustrative of particular embodiments of the invention that enable those skilled in the art to understand or practice the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A method for hair rendering of a game character, comprising:
obtaining hair pieces obtained by splitting a hair model and a hair group consisting of the hair pieces;
for each hair group, determining a first rendering order of each hair piece according to a first distance between each hair piece in the hair group and the center point of the hair group and the order of the first distance from near to far;
for each hair group, determining a second rendering order of each hair group from back to front by taking the front of the game character as a reference;
and rendering the hair model according to the first rendering sequence and the second rendering sequence to obtain a rendered hair model.
2. The method of claim 1, wherein said obtaining a set of hair consisting of said pieces of hair comprises:
and grouping the hair pieces according to the hair piece types corresponding to the hair pieces to obtain the hair group.
3. The method of claim 2, wherein said grouping said hair pieces according to their corresponding hair piece types to obtain said hair set comprises:
acquiring the position relation between each hairpin and the head of the game role, wherein the position relation at least comprises the distance between each hairpin and the head of the game role;
classifying the hair pieces according to the position relation to obtain the hair piece types;
and grouping the hair pieces according to the hair piece types to obtain the hair group.
4. The method of claim 2, wherein said grouping said hair pieces according to their corresponding hair piece types to obtain said hair set comprises:
acquiring the hairstyle type of the game role;
determining the hair style corresponding to each hair piece according to the hair style type;
and grouping the hair pieces according to the hair piece types to obtain the hair group.
5. The method according to claim 4, wherein when the hairstyle type is horse tail, the hairpiece type comprises: scalp hair and horsetail hair;
the grouping the hair pieces according to the hair piece types to obtain the hair group comprises the following steps:
and according to the hair piece types, dividing the hair pieces into groups to obtain a scalp hair group and a horse tail hair group.
6. The method of claim 4, wherein when the hair style type is a bun, the bun type comprises: scalp hair and hair bun hair;
the grouping the hair pieces according to the hair piece types to obtain the hair group comprises the following steps:
and according to the hair piece types, dividing the hair pieces into groups to obtain a scalp hair group and a chignon hair group.
7. The method of claim 1, wherein for each of the hair groups, determining a first rendering order of the hair pieces according to a first distance between the hair pieces in the hair group and a center point of the hair group and an order from near to far of the first distance comprises:
acquiring a first distance between each hair piece in the hair group and the center point of the hair group;
sequencing the hair pieces according to the sequence of the first distance from near to far to obtain a first sequencing result; or adding a first identifier for each hair piece according to the first distance, wherein the first identifier is used for embodying the sequence of the first distance from near to far;
determining the first rendering order according to a first ordering result or the first identification.
8. The method of claim 1, wherein for each of the hair groups, a second rendering order for each of the hair groups is determined in a back-to-front order with respect to a front face of the game character; the method comprises the following steps:
acquiring a second distance between the center point of the hair group and the camera when the game character faces the camera;
sorting the hair groups according to the sequence of the second distance from far to near to obtain a second sorting result; or adding a second identifier for each hair group according to the second distance, wherein the second identifier is used for embodying the sequence of the second distance from far to near;
and determining the second rendering sequence according to a second sequencing result or the second identifier.
9. The method of claim 1, wherein the rendering the hair model according to the first rendering order and the second rendering order, and wherein obtaining a rendered hair model comprises:
rendering the hair pieces according to the first rendering sequence to obtain a rendered hair group;
rendering the rendered hair group according to the second rendering sequence to obtain the rendered hair model;
or the like, or, alternatively,
rendering the hair model according to the first rendering order and the second rendering order, and obtaining a rendered hair model comprises:
and rendering the hair pieces in the hair group according to the first rendering sequence in sequence according to the second rendering sequence to obtain a rendered hair model.
10. An apparatus for hair rendering of a game character, comprising:
the acquisition module is used for acquiring hair pieces obtained by splitting the hair model and a hair group consisting of the hair pieces;
the first sequencing module is used for determining a first rendering sequence of the hair pieces according to a first distance between the hair pieces in the hair group and the center point of the hair group and a sequence of the first distance from near to far for each hair group;
the second sequencing module is used for determining a second rendering sequence of each hair group from back to front by taking the front of the game role as a reference for each hair group;
and the rendering module is used for rendering the hair model according to the first rendering sequence and the second rendering sequence to obtain a rendered hair model.
CN202210993293.2A 2022-08-18 2022-08-18 Method and device for rendering hair of game role, electronic equipment and storage medium Pending CN115375814A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210993293.2A CN115375814A (en) 2022-08-18 2022-08-18 Method and device for rendering hair of game role, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210993293.2A CN115375814A (en) 2022-08-18 2022-08-18 Method and device for rendering hair of game role, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115375814A true CN115375814A (en) 2022-11-22

Family

ID=84065966

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210993293.2A Pending CN115375814A (en) 2022-08-18 2022-08-18 Method and device for rendering hair of game role, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115375814A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116570920A (en) * 2023-07-12 2023-08-11 腾讯科技(深圳)有限公司 Data management method, device, computer and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116570920A (en) * 2023-07-12 2023-08-11 腾讯科技(深圳)有限公司 Data management method, device, computer and storage medium

Similar Documents

Publication Publication Date Title
CN106570822B (en) Face mapping method and device
CN109671016B (en) face model generation method and device, storage medium and terminal
CN108629339A (en) Image processing method and related product
CN113987344B (en) Intelligent 3D garment style simulation method based on layout library and cost estimation method thereof
CN105117445A (en) Automatic hairstyle matching method, device and system
CN115375814A (en) Method and device for rendering hair of game role, electronic equipment and storage medium
KR101488491B1 (en) Method for providing virtual hairstyle and apparatus using the same
CN112200896B (en) Virtual object wind animation rendering method and device, storage medium and electronic device
CN107437272A (en) Interaction entertainment method, apparatus and terminal device based on augmented reality
CN111612891A (en) Model generation method, point cloud data processing device, point cloud data processing equipment and medium
CN114119906A (en) Self-adaptive driving method and device for clothing model and storage medium
CN112221145A (en) Game face model generation method and device, storage medium and electronic equipment
CN108229536A (en) Optimization method, device and the terminal device of classification prediction model
CN109492540B (en) Face exchange method and device in image and electronic equipment
CN110287343A (en) Picture Generation Method and device
CN110288690A (en) The generation method of massif and device, storage medium, processor in sand table map
CN114358252A (en) Operation execution method and device in target neural network model and storage medium
CN112767038B (en) Poster CTR prediction method and device based on aesthetic characteristics
CN112102441A (en) Color card manufacturing method and device, electronic equipment and storage medium
CN115690281B (en) Role expression driving method and device, storage medium and electronic device
CN107679766A (en) A kind of gunz task dynamic redundancy dispatching method and device
CN116188720A (en) Digital person generation method, device, electronic equipment and storage medium
CN109871632A (en) A kind of method, apparatus that tread pattern pitch automatically generates, system and equipment
CN115600857A (en) Intelligent manufacturing method and system for digital product, computer and storage medium
CN109173259A (en) Audio optimization method, device and equipment in a kind of game

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