CN108932745A - image drawing method, device, terminal device and computer readable storage medium - Google Patents

image drawing method, device, terminal device and computer readable storage medium Download PDF

Info

Publication number
CN108932745A
CN108932745A CN201710369091.XA CN201710369091A CN108932745A CN 108932745 A CN108932745 A CN 108932745A CN 201710369091 A CN201710369091 A CN 201710369091A CN 108932745 A CN108932745 A CN 108932745A
Authority
CN
China
Prior art keywords
hair
pixel
color parameter
parameter
color
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.)
Granted
Application number
CN201710369091.XA
Other languages
Chinese (zh)
Other versions
CN108932745B (en
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201710369091.XA priority Critical patent/CN108932745B/en
Publication of CN108932745A publication Critical patent/CN108932745A/en
Application granted granted Critical
Publication of CN108932745B publication Critical patent/CN108932745B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/04Texture mapping

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Graphics (AREA)
  • Image Generation (AREA)

Abstract

A kind of image drawing method is related to technical field of image processing, including:Tinter for drawing hair is set in Unity, and tinter is integrated with mixed mode and fine pattern;Pass through tinter, it is utilized respectively mixed mode, obtain in the texture mapping of hair to be drawn the position of each pixel and color parameter in hair surface and the boxed area at the back side, using fine pattern, the position of each pixel and color parameter in the filamentary regions at hair surface and the back side are obtained in texture mapping;Hair is drawn according to the position of each pixel and color parameter in the position and color parameter and filamentary regions of pixel each in boxed area by graphic package interface.In addition, the present invention also provides a kind of image plotting device, terminal device and computer readable storage mediums.The fineness that hair is drawn using Unity can be improved in the present invention, so that the hair drawn out is more careful, more has a sense of hierarchy, and will not bring too big burden to the consumption of hardware performance.

Description

Image drawing method, device, terminal device and computer readable storage medium
Technical field
The present invention relates to technical field of image processing more particularly to a kind of image drawing method, device, terminal device and meters Calculation machine readable storage medium storing program for executing.
Background technique
With the development of image processing techniques, 3D drawing technique is more and more applied in computer graphics. Unity3D is current popular a 3D mapping software, is developed, can be created all by Unity Technologie company Such as 3 D video game, the interaction content for building visualization, realtime three dimensional animation type.It is transparent that support is prefixed in Unity The tinter (Shader) of rendering, but the preset Shader only supports the drafting of basic single layer hair transparent channel, and It can not show the details of hair, draw effect as shown in Figure 1, coarse and there is no stereovision.But if using other way into The drafting of wardrobe hair, such as other hair system of certain movie-levels, although the details of hair can be shown, due to the hair system It is to generate each independent hair with the hair system of profession, is combined into hair style, therefore very huge to the performance consumption of hardware Greatly.
Summary of the invention
In view of this, the present invention provides a kind of image drawing method, device, terminal device and computer-readable storage medium The fineness that hair is drawn using Unity can be improved, so that the hair drawn out is more careful, more has a sense of hierarchy, and will not in matter Too big burden is brought to the consumption of hardware performance.
The image drawing method that first aspect of the embodiment of the present invention provides, including:It is arranged in Unity for drawing hair Tinter, the tinter is integrated with mixed mode and fine pattern;By the tinter, it is utilized respectively the hybrid guided mode Formula obtains in the texture mapping of hair to be drawn the position of each pixel and color ginseng in hair surface and the boxed area at the back side Number, using the fine pattern, obtains the position of each pixel in the filamentary regions at hair surface and the back side in the texture mapping It sets and color parameter;By preset graphic package interface, joined according to the position of pixel each in the boxed area and color The position of each pixel and color parameter, draw hair in the several and described filamentary regions.
The image plotting device that second aspect of the embodiment of the present invention provides, including:Integration module, for being set in Unity The tinter for drawing hair is set, the tinter is integrated with mixed mode and fine pattern;Parameter acquisition module, for leading to The tinter is crossed, the mixed mode is utilized respectively, obtains hair surface and the back side in the texture mapping of hair to be drawn The position of each pixel and color parameter in boxed area obtain hair table in the texture mapping using the fine pattern The position of each pixel and color parameter in the filamentary regions at face and the back side;Drafting module, for passing through preset graphic package Interface, according to the position of each pixel in the position of pixel each in the boxed area and color parameter and the filamentary regions It sets and color parameter, hair is drawn.
The terminal device that the third aspect of the embodiment of the present invention provides, including memory, processor and storage are on a memory And the computer program that can be run on a processor, which is characterized in that when the processor executes the computer program, realize The each step in image drawing method provided such as embodiments of the present invention first aspect.
The computer readable storage medium that fourth aspect of the embodiment of the present invention provides, is stored thereon with computer program, It is characterized in that, when the computer program is executed by processor, realizes the figure provided such as embodiments of the present invention first aspect As each step in method for drafting.
Image drawing method, device, terminal device and computer readable storage medium provided in an embodiment of the present invention, pass through It is integrated with two different tupes in the Shader of Unity, is being respectively used to obtain in UV textures hair to be drawn just The position of the area image with different characteristic attribute in face and the back side and color parameter, then according to each area image of acquisition Position and color parameter the boxed area of hair and filamentary regions are drawn and are superimposed respectively so that the hair drawn out It is more careful, more have a sense of hierarchy, to improve the fineness for drawing hair using Unity, and due to not needing using independent Hair drawing system hair is individually drawn, therefore too big burden will not be brought to the consumption of hardware performance.
For above and other objects, features and advantages of the invention can be clearer and more comprehensible, preferred embodiment is cited below particularly, And cooperate institute's drawing figures, it is described in detail below.
Detailed description of the invention
Fig. 1 is the effect diagram for the hair drawn out using existing Unity drawing practice;
Fig. 2 shows a kind of structural schematic diagrams of terminal device;
Fig. 3 is the flow diagram for the image drawing method that one embodiment of the invention provides;
Fig. 4 is the effect diagram that the hair that image drawing method provided in an embodiment of the present invention is drawn out is not used;
Fig. 5 is the effect for the hair drawn out after being repaired using image drawing method provided in an embodiment of the present invention Fruit schematic diagram;
Fig. 6 be another embodiment of the present invention provides image drawing method flow diagram;
Fig. 7 is the effect diagram that hair is drawn in image drawing method provided in an embodiment of the present invention;
Fig. 8 is another effect diagram that hair is drawn in image drawing method provided in an embodiment of the present invention;
Fig. 9 is the structural schematic diagram for the image plotting device that one embodiment of the invention provides;
Figure 10 be another embodiment of the present invention provides image plotting device structural schematic diagram.
Specific embodiment
Further to illustrate that the present invention is the technical means and efficacy realizing predetermined goal of the invention and being taken, below in conjunction with Attached drawing figure and preferred embodiment, to specific embodiment, structure, feature and its effect according to the present invention, detailed description is as follows.
Referring to Fig. 2, showing a kind of structural schematic diagram of terminal device 100.As shown in Fig. 2, terminal device 100 includes Memory 102, storage control 104, one or more (one is only shown in figure) processors 106, Peripheral Interface 108, radio frequency Unit 110, push-button unit 112, audio unit 114 and display unit 116.These components are total by one or more communication Line/signal wire 122 mutually communicates.
It is appreciated that structure shown in Fig. 2 is only to illustrate, the structure of terminal device 100 is not caused to limit.Example Such as, terminal device 100 may also include the more perhaps less component than shown in Fig. 2 or match with different from shown in Fig. 2 It sets.Each component shown in Fig. 2 can be realized using hardware, software, or its combination.
Memory 102 can be used for storing computer program, such as the image drawing method and device pair in the embodiment of the present invention Program instruction/the module answered, processor 106 realize following Fig. 3 when execution stores the computer program in memory 102 To each step in image drawing method shown in Fig. 8.
Memory 102, i.e. computer readable storage medium, it may include high speed random access memory may also include non-volatile Memory, such as one or more magnetic storage device, flash memory or other non-volatile solid state memories.In some examples In, memory 102 can further comprise the memory remotely located relative to processor 106, these remote memories can lead to Network connection is crossed to terminal device 100.The example of above-mentioned network includes but is not limited to internet, intranet, local area network, shifting Dynamic communication network and combinations thereof.Processor 106 and other possible components can be in storage controls to the access of memory 102 It is carried out under 104 control.
Various input/output devices are couple processor 106 and memory 102 by Peripheral Interface 108.Processor 106 Various softwares, instruction in run memory 102 are to execute the various functions of terminal device 100 and carry out data processing.
In some instances, Peripheral Interface 108, processor 106 and storage control 104 can be real in one single chip It is existing.In some other example, they can be realized by independent chip respectively.
Radio frequency unit 110 is used to receive and transmit electromagnetic wave, realizes the mutual conversion of electromagnetic wave and electric signal, thus with Communication network or other equipment are communicated.Radio frequency unit 110 may include various existing for executing the electricity of these functions Circuit component, for example, antenna, RF transceiver, digital signal processor, encryption/deciphering chip, subscriber identity module (SIM) card, Memory etc..Radio frequency unit 110 can be with the wireless network progress of various networks such as internet, intranet, preset type Communication is communicated by the wireless network of preset type with other equipment.The wireless network of above-mentioned preset type can wrap Include cellular telephone networks, WLAN or Metropolitan Area Network (MAN).Various communications can be used in the wireless network of above-mentioned preset type Standard, agreement and technology, including but not limited to global system for mobile communications (Global System for Mobile Communication, GSM), enhanced mobile communication technology (Enhanced Data GSM Environment, EDGE) is wide Band Code Division Multiple Access (Wideband Code Division Multiple Access, W-CDMA), Code Division Multiple Access (Code Division Access, CDMA), time division multiple access technology (Time Division Multiple Access, TDMA), Bluetooth, adopting wireless fidelity technology (Wireless-Fidelity, WiFi) (such as American Institute of Electrical and Electronics Engineers's standard IEEE 802.11a, IEEE 802.11b, IEEE802.11g and/or IEEE 802.11n), the networking telephone (Voice over Internet Protocol, VoIP), worldwide interoperability for microwave accesses (Worldwide Interoperability for Microwave Access, Wi-Max), other for mail, instant messaging and short message agreement and any other is suitable Communications protocol, or even may include the agreement that those are not developed currently yet.
Push-button unit 112 provides user's interface inputted to terminal device 100, and user can be different by pressing Key is so that terminal device 100 executes different functions.
Audio unit 114 provides a user audio interface, may include one or more microphones, one or more raises Sound device and voicefrequency circuit.Voicefrequency circuit receives voice data from Peripheral Interface 108, and voice data is converted to power information, Power information is transmitted to loudspeaker.Power information is converted to the sound wave that human ear can be heard by loudspeaker.Voicefrequency circuit is also from microphone Place receive power information, convert electrical signals to voice data, and by data transmission in network telephony into Peripheral Interface 108 to carry out into one The processing of step.Audio data can obtain from memory 102 or through radio frequency unit 110.In addition, audio data can also be with It stores into memory 102 or is sent by radio frequency unit 110.In some instances, audio unit 114 may also include One earphone broadcasts hole, for providing audio interface to earphone or other equipment.
Display unit 116 provides an output interface between terminal device 100 and user.Specifically, display unit 116 Video output is shown to user, and the content of these videos output may include text, figure, video and any combination thereof.It is some defeated Out the result is that corresponding to some user interface objects.Further, an input is provided also between terminal device 100 and user Interface, for receiving the input of user, such as the gesture operations such as click, sliding of user, so that user interface object is to these The input of user responds.The technology of detection user's input can be based on resistance-type, condenser type or any other possibility Touch control detection technology.
Referring to Fig. 3, Fig. 3 is the flow chart for the image drawing method that one embodiment of the invention provides.It can be applied to Fig. 2 institute The terminal device 100 shown, to realize image drawing method.As shown in figure 3, image drawing method provided in this embodiment include with Lower step:
S101, tinter for drawing hair is set in Unity, tinter is integrated with mixed mode and fine mould Formula;
By on a three-dimension curved surface mesh flattening a to plane, the plane of this expansion is exactly texture (UV) textures.UV U is generally referred to, the abbreviation of V Texture Coordinates, the X with spatial model, Y, Z axis is similar, it defines each point on picture The information of position, these points connect each other with 3D model, for determining the position of surface texture mapping, that is, for determining How a texture image to be placed on to three-dimensional model surface.Wherein, horizontal direction is U, and vertical direction is V, passes through two dimension The UV coordinate system of plane can position any one pixel on image.It is contained in the UV textures of the hair to be drawn of carry Hair to be drawn is in the point of two-dimensional surface and the position in face and color parameter information.
Tinter (Shader) for drawing hair is set in Unity, wherein being integrated with mixed mode (Blend SrcAlpha OneMinusSrcAlpha) and fine pattern (Alpha Test).Mixed mode, for obtaining block in UV textures The position in shape region and color parameter simultaneously carry out mixed processing.Wherein boxed area includes:Transparent region is (e.g., between hair Region) and nontransparent boxed area (e.g., root of hair or hair centre position).Fine pattern, it is Filamentous in UV textures for obtaining The position in region (e.g., the details position of hair, the hair tip and hair decorations) and color parameter.
S102, by tinter, be utilized respectively mixed mode, obtain in the texture mapping of hair to be drawn hair surface and The position of each pixel and color parameter in the boxed area at the back side obtain hair surface in texture mapping using fine pattern Position and color parameter with pixel each in the filamentary regions at the back side;
The position of each pixel and color parameter include in boxed area:The texture (UV) of each pixel is sat in boxed area It is marked with and color parameter, such as:Color identifier and color value.The position of each pixel and color parameter include in filamentary regions:Silk The UV coordinate and color parameter of each pixel in shape region, such as:Color identifier and color value.Wherein, location parameter determines Which drawn in region, color parameter determines which type of effect each region will be depicted as.
S103, by preset graphic package interface, according to the position of pixel each in boxed area and color parameter with And the position of each pixel and color parameter in filamentary regions, hair is drawn.
Graphic package interface, such as can be OpenGL (Open Graphics Library, open graphic library), it is used for The drafting of two dimension or 3-D image.
In practical applications, Shader program is usually at graphics processor (Graphic Processing Unit, GPU) Upper execution, OpenGL main program execute on central processing unit (Central Processing Unit, CPU), OpenGL master Program starts drawing process to data such as video memory input vertexs, and controls drawing process, is sent according to Shader program Position to pixel each in graphing and color parameter, treat graphing and drawn.It should be understood that this implementation Example in drafting may include:Drafting to graphic element each in picture, or each graphic element and each pictorial element are shown Show the drafting of effect.
The realization principle of the present embodiment is to extract two layers from the UV textures of hair to be drawn and be respectively used to draw hair Different parts parameter information.Specifically, being handled first with mixed mode this this UV textures, wherein transparent Region and block-like nontransparent region are taken out, and preset hybrid algorithm is utilized after taking out, to the transparent region of taking-up and The color value of each point or each position in block-like nontransparent region does mixed processing, obtains transparent region and block-like non- The color value of each range point in area pellucida domain.Secondly, extracting position and the color parameter of hair part using fine pattern.Finally, OpenGL interface is called according to above-mentioned parameter value is obtained, to draw out the different zones of hair respectively and be superimposed, to obtain Obtain the final effect of entire hair.Fig. 4 and Fig. 5 is to be repaired using image drawing method provided in an embodiment of the present invention to hair Multiple front and back, the effect diagram of hair.As shown in figure 4, not passing through image drawing method reparation provided in an embodiment of the present invention Hair, the front of only one layer and only hair, the back side of hair is there is no being drawn to come out, and the hair drawn out is whole Body is more coarse, and the details of hair is not embodied.And as shown in figure 5, by Image Rendering provided in an embodiment of the present invention Hair after method reparation, then have stronger stereovision, and the front or the back side of either hair, details all obtain It embodies well.
Image drawing method provided in an embodiment of the present invention, it is two different by being integrated in the Shader of Unity Tupe is respectively used to obtain the administrative division map with different characteristic attribute of the front and back of hair to be drawn in UV textures The position of picture and color parameter, then according to the position of each area image of acquisition and color parameter to the boxed area of hair and Filamentary regions are drawn and are superimposed respectively, so that the hair drawn out is more careful, more has a sense of hierarchy, to improve utilization Unity draws the fineness of hair, and due to not needing individually to draw hair using independent hair drawing system, Therefore too big burden will not be brought to the consumption of hardware performance.
Referring to Fig. 6, Fig. 6 be another embodiment of the present invention provides image drawing method flow chart.It can be applied to Fig. 2 Shown in terminal device 100, to realize image drawing method.As shown in fig. 6, image drawing method provided in this embodiment includes Following steps:
S201, tinter for drawing hair is set in Unity, tinter is integrated with mixed mode and fine mould Formula;
Tinter (Shader) for drawing hair is set in Unity, wherein being integrated with mixed mode (Blend SrcAlpha OneMinusSrcAlpha) and fine pattern (Alpha Test).Mixed mode, for obtaining block in UV textures The position in shape region and color parameter simultaneously carry out mixed processing.Wherein boxed area includes:Transparent region is (e.g., between hair Region) and nontransparent boxed area (e.g., root of hair or hair centre position).Fine pattern, it is Filamentous in UV textures for obtaining The position in region (e.g., the details position of hair, the hair tip and hair decorations) and color parameter.
S202, by the UV textures of tinter carry hair to be drawn, by the UV textures of hair to be drawn by without transparent The picture in channel is converted to the picture of the preset format with alpha channel, and improves the contrast of alpha channel;
By on a three-dimension curved surface mesh flattening a to plane, the plane of this expansion is exactly texture (UV) textures.UV U is generally referred to, the abbreviation of V Texture Coordinates, the X with spatial model, Y, Z axis is similar, it defines each point on picture The information of position, these points connect each other with 3D model, for determining the position of surface texture mapping, that is, for determining How a texture image to be placed on to three-dimensional model surface.Wherein, horizontal direction is U, and vertical direction is V, passes through two dimension The UV coordinate system of plane can position any one pixel on image.It is contained in the UV textures of the hair to be drawn of carry Hair to be drawn is in the point of two-dimensional surface and the information in face.
The UV textures of carry hair to be drawn, by the UV textures of hair to be drawn by the PNG format without transparent channel Picture is converted to the picture of the preset format with the channel Alpha (alpha), and improves the contrast in the channel alpha.Wherein, in advance If format is preferably TGA (Tagged Graphics) format.
The channel alpha is one 8 gray channels, which records the letter of the transparency in image with 256 grades of gray scales Breath defines transparent, opaque and translucent area, wherein white indicate opaque, black to indicate transparent, ash indicates translucent.It is preferred that The contrast in the channel alpha is increased to maximum by ground.
On the one hand, since TGA can store the data information in all channels, by by the head to be drawn of PNG format The UV textures of hair are revised as the picture of the TGA format with the channel Alpha (alpha), can draw and operate in the hair in later period In, facilitate Shader preferably to obtain the data in each channel, to be more convenient for the number between transparent channel and nontransparent channel According to being screened.On the other hand, by improving the contrast in the channel alpha, increase the difference between different colours, can reduce The deviation that different zones data are extracted.
S203, using the corresponding color of any one gray value between 0~255, the transparent region of UV textures is filled out It fills, and Fuzzy Processing is carried out to the hair in UV textures;
Preferably, the transparent region of UV textures is filled using pure white.
Fuzzy Processing is carried out to the hair in UV textures specifically to divide the material part edge of hair in UV textures The Fuzzy Processing of layer.Wherein, material is primarily used to performance hair to interaction (reflection, refraction etc.) property of light.
It should be understood that each image has one or more Color Channels, the Color Channel number defaulted in image depends on In its color mode, i.e., the color mode of one image will determine the quantity of its Color Channel.For example, by default, position Only one channel of chart-pattern, gray scale, duotone and indexed-color image.RGB (red, green, blue) image has 3 channels.Each Color Channel all stores the information of color elements in image.Color addition mixing in all colours channel generates picture in image The color of element.Therefore, by the way that the transparent region of UV textures is carried out pure color filling, hair can carried out using shader Before drafting, by the data of the corresponding Color Channel in all parts of hair being stripped out as far as possible, so that Color Channel Between data level become apparent from.And Fuzzy Processing is carried out to hair, the hair of hair marginal position drawn out can be made Transition it is more natural.
S204 is utilized respectively mixed mode by tinter and obtains hair surface and the back side in the UV textures of hair to be drawn Boxed area in each pixel position and color parameter, obtain hair in the UV textures of hair to be drawn using fine pattern The position of each pixel and color parameter in the filamentary regions at surface and the back side;
The position of each pixel and color parameter include in boxed area:The texture (UV) of each pixel is sat in boxed area It is marked with and color parameter, such as:Color identifier and color value.The position of each pixel and color parameter include in filamentary regions:Silk The UV coordinate and color parameter of each pixel in shape region, such as:Color identifier and color value.Wherein, location parameter determines Which drawn in region, color parameter determines which type of effect each region will be depicted as.
Blend SrcAlpha OneMinusSrcAlpha mode is being utilized by tinter, is obtaining hair to be drawn The position of each pixel and when color parameter in hair surface and the boxed area at the back side, closes semitransparent object in UV textures ZWrit, such as:OFF is set by the value of the ZWrit of the semitransparent object, then obtains each pixel in the boxed area again Position and color parameter original parameter value, and will acquire original parameter value (including:Coordinate value, color identifier and color value) it writes Enter caching, then reuses preset hybrid cytokine, such as:It is right using the alpha of current fragment (fragment) as hybrid cytokine The color value being written in caching before is mixed, and the target of each pixel in the boxed area drawn for hair is obtained Then original position parameter value, color identifier and target color values in caching are sent to preset graphic package and connect by color value Mouthful, such as:OpenGL (Open Graphics Library, open graphic library).
By the mixed processing of above-mentioned mixed mode, one is done between the transparent region of hair and the nontransparent region of bulk A transition, to merge the nontransparent region of original transparent region and bulk, to can guarantee that large stretch of transparent region can be by It is normal to draw.
Alpha Test mode is being utilized by Shader, is obtaining hair surface and the back side in the UV textures of hair to be drawn Filamentary regions in each pixel position and when color parameter, establish the value interval (or filtering section) of an alpha, Between 0~100,0~100 determines that the position details of transparent region, when value is 99%, are anticipated from more to few transition Taste only taken the hair part of very details.In practical applications, it can use alpha cutoff parameter to click through pixel Row filtering.If it should be understood that the alpha of a pixel is unsatisfactory for the condition of alpha cutoff parameter definition, then It just can be filtered.Specifically, the ZWrit of semitransparent object is opened, such as:The value of the ZWrit of the semitransparent object is set It is set to ON, then using Alpha Test mode according to preset filtration parameter, obtains most edge transparent place in UV textures The position of the corresponding pixel of hair and color parameter.
S205, by preset graphic package interface, according to the position of pixel each in boxed area and color parameter with And the position of each pixel and color parameter in filamentary regions, hair is drawn.
Specifically, by OpenGL respectively according to the position of pixel each in boxed area and color parameter in bottom enemy Transparent region and blocky nontransparent region in hair are drawn, and are joined according to the position of pixel each in filamentary regions and color Number draws the hair in hair with the hair tip, then the hair drawn out and the hair tip is superimposed upon in the hair drawn out Transparent region and blocky nontransparent region on.Wherein, the drafting in the present embodiment may include:It treats and draws in hair respectively The drafting of the graphic element at a position, or the drafting of the display effect to each graphic element and each pictorial element.
It should be understood that in drawing process, when the position of pixel each in boxed area and color parameter and filamentary region When the position of each pixel and color parameter clash in domain, drawn according to the position and color parameter of filamentary regions.
As shown in Figure 7 and Figure 8, first pass through both of which in above-mentioned steps to the boxed area of hair and filamentary regions into Then each tomographic image drawn out is fused together by row stratification drawing.The hair image finally merged both supports hair The details of hair and the hair tip is shown, can also support the display at the hair back side.
Image drawing method provided in an embodiment of the present invention, it is two different by being integrated in the Shader of Unity Tupe is respectively used to obtain the administrative division map with different characteristic attribute of the front and back of hair to be drawn in UV textures The position of picture and color parameter, then according to the position of each area image of acquisition and color parameter to the boxed area of hair and Filamentary regions are drawn and are superimposed respectively, so that the hair drawn out is more careful, more has a sense of hierarchy, to improve utilization Unity draws the fineness of hair, and due to not needing individually to draw hair using independent hair drawing system, Therefore too big burden will not be brought to the consumption of hardware performance.
Fig. 9 is the structural schematic diagram for the image plotting device that one embodiment of the invention provides.Image provided in this embodiment Drawing apparatus can be applied in terminal device 100 shown in Fig. 2, for realizing the image drawing method in above-described embodiment.Such as Shown in Fig. 9, image plotting device 30 includes:
Integration module 301, for the tinter for drawing hair to be arranged in Unity, which is integrated with mixing Mode and fine pattern;
Parameter acquisition module 302, for being utilized respectively the mixed mode, obtaining hair to be drawn by the tinter The position of each pixel and color parameter in hair surface and the boxed area at the back side in texture mapping, using the fine pattern, Obtain in the texture mapping position of each pixel and color parameter in the filamentary regions at hair surface and the back side;
Drafting module 303, for passing through preset graphic package interface, according to the position of pixel each in the boxed area With the position of each pixel and color parameter in color parameter and the filamentary regions, hair is drawn.
The detailed process of the respective function of each Implement of Function Module, refers in image plotting device 30 provided in this embodiment Particular content described in above-mentioned Fig. 3 to embodiment illustrated in fig. 5, details are not described herein again.
In the embodiment of the present invention, by being integrated with two different tupes in the Shader of Unity, it is respectively used to The position of the area image with different characteristic attribute of the front and back of hair to be drawn and color in UV textures is obtained to join Number, then carries out the boxed area of hair and filamentary regions according to the position of each area image of acquisition and color parameter respectively It draws and is superimposed, so that the hair drawn out is more careful, more has a sense of hierarchy, to improve the essence for drawing hair using Unity Fineness, and due to not needing individually to draw hair using independent hair drawing system, hardware will not be given The consumption of performance brings too big burden.
Figure 10 be another embodiment of the present invention provides image plotting device structural schematic diagram.Figure provided in this embodiment As drawing apparatus can be applied in terminal device 100 shown in Fig. 2, for realizing the image drawing method in above-described embodiment. Unlike image plotting device 30 shown in Fig. 9, in image plotting device 40 provided by the embodiment:
Further, parameter acquisition module 302 includes:
First acquisition module 3021 utilizes the mixing for the value of the ZWrit parameter of semitransparent object to be set off Mode, obtains the original parameter value of the position of each pixel and color parameter in the boxed area, and the original parameter value that will acquire is write Enter caching, and use preset hybrid cytokine, the color value in the original parameter value being written in the caching is mixed, The target color values of each pixel in the boxed area drawn for hair are obtained, so that the graphic package interface, according to The target color values execute each in the position and color parameter and the filamentary regions according to pixel each in the boxed area The position of pixel and color parameter, the step of drafting to hair;
Second obtains module 3022, for the value of the ZWrit parameter of the semitransparent object to be set on, and according to Preset filtration parameter obtains position and the color ginseng of the corresponding pixel of hair of most edge transparent place in the texture mapping Number.
Further, drafting module 303, including:
Stratification drawing module 3031, for passing through the graphic package interface, respectively according to pixel each in the boxed area Position and color parameter in the hair transparent region and blocky nontransparent region draw, according in the filamentary regions The position of each pixel and color parameter draw the hair in the hair with the hair tip;
Laminating module 3032, for by the graphic package interface, the hair drawn out and the hair tip being superimposed upon and being drawn out The transparent region and blocky nontransparent region on;
Wherein, in drawing process, when the position of pixel each in the boxed area and color parameter and the filamentary regions In each pixel position and color parameter when clashing, drawn according to the position and color parameter of the filamentary regions.
Further, which further includes:
Carry module 401, for being somebody's turn to do the texture mapping of hair to be drawn by the tinter carry;
CHANNEL OPTIMIZATION module 402, for the texture mapping of hair to be drawn will to be somebody's turn to do, by the picture conversion without transparent channel For the picture of the preset format with alpha channel, and improve the contrast of the alpha channel;
Module 403 is filled, for using the corresponding color of any one gray value between 0~255, to the texture mapping Transparent region is filled;
Fuzzy Processing module 404, for carrying out Fuzzy Processing to the hair in the texture mapping.
The detailed process of the respective function of each Implement of Function Module, refers in image plotting device 40 provided in this embodiment Particular content described in above-mentioned Fig. 3 to embodiment illustrated in fig. 8, details are not described herein again.
In the embodiment of the present invention, by being integrated with two different tupes in the Shader of Unity, it is respectively used to The position of the area image with different characteristic attribute of the front and back of hair to be drawn and color in UV textures is obtained to join Number, then carries out the boxed area of hair and filamentary regions according to the position of each area image of acquisition and color parameter respectively It draws and is superimposed, so that the hair drawn out is more careful, more has a sense of hierarchy, to improve the essence for drawing hair using Unity Fineness, and due to not needing individually to draw hair using independent hair drawing system, hardware will not be given The consumption of performance brings too big burden.
It should be noted that, in this document, relational terms such as first and second and the like are used merely to a reality Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to Non-exclusive inclusion, so that process, method, article or device including a series of elements are not only wanted including those Element, but also including other elements that are not explicitly listed, or further include for this process, method, article or device Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that There is also other identical elements in process, method, article or device including the element.
It will be appreciated by those skilled in the art that realizing that all or part of the steps of above-described embodiment can be by hardware come complete At relevant hardware can also being instructed to complete by program, the program can store in a kind of computer-readable storage In medium, storage medium mentioned above can be read-only memory, disk or CD etc..
The above described is only a preferred embodiment of the present invention, be not intended to limit the present invention in any form, though So the present invention has been disclosed as a preferred embodiment, and however, it is not intended to limit the invention, any technology people for being familiar with this profession Member, without departing from the scope of the present invention, when the technology contents using the disclosure above are modified or are modified It is right according to the technical essence of the invention for the equivalent embodiment of equivalent variations, but without departing from the technical solutions of the present invention Any simple modification, equivalent change and modification made by above embodiments, all of which are still within the scope of the technical scheme of the invention.

Claims (12)

1. a kind of image drawing method, which is characterized in that the method includes:
Tinter for drawing hair is set in Unity, and the tinter is integrated with mixed mode and fine pattern;
By the tinter, be utilized respectively the mixed mode, obtain in the texture mapping of hair to be drawn hair surface and The position of each pixel and color parameter in the boxed area at the back side are obtained in the texture mapping using the fine pattern The position of each pixel and color parameter in the filamentary regions at hair surface and the back side;
By preset graphic package interface, according to the position of pixel each in the boxed area and color parameter and described The position of each pixel and color parameter, draw hair in filamentary regions.
2. image drawing method as described in claim 1, which is characterized in that it is described to utilize the mixed mode, it obtains wait draw The position of each pixel and color parameter in hair surface and the boxed area at the back side in the texture mapping of hair processed, including:
The value of the ZWrit parameter of semitransparent object is set off;
Using the mixed mode, the original parameter value of the position of each pixel and color parameter in the boxed area is obtained, and The original parameter value write-in caching that will acquire;
Using preset hybrid cytokine, the color value in the original parameter value being written in caching is mixed, is obtained for head The target color values of each pixel in the boxed area drawn are sent out, so that the graphic package interface, according to the mesh Color value is marked, is executed described according in the position of pixel each in the boxed area and color parameter and the filamentary regions The position of each pixel and color parameter, the step of drafting to hair.
3. image drawing method as described in claim 1, which is characterized in that it is described to utilize the fine pattern, described in acquisition The position of each pixel and color parameter in the filamentary regions at hair surface and the back side in texture mapping, including:
The value of the ZWrit parameter of semitransparent object is set on;
According to preset filtration parameter, the position of the corresponding pixel of hair of most edge transparent place in the texture mapping is obtained It sets and color parameter.
4. image drawing method according to any one of claims 1 to 3, which is characterized in that described to pass through preset figure Shape routine interface, according to each pixel in the position of pixel each in the boxed area and color parameter and the filamentary regions The position of point and color parameter, draw hair, including:
By the graphic package interface, respectively according to the position of pixel each in the boxed area and color parameter, to institute State transparent region in hair and blocky nontransparent region drawn, according to the position of pixel each in the filamentary regions and Color parameter draws the hair in the hair with the hair tip;
The hair drawn out and the hair tip are superimposed upon on the transparent region drawn out and blocky nontransparent region;
Wherein, in drawing process, when the position of pixel each in the boxed area and color parameter and the filamentary regions In each pixel position and color parameter when clashing, drawn according to the position and color parameter of the filamentary regions System.
5. image drawing method as described in claim 1, which is characterized in that it is described by the tinter, it is utilized respectively institute Mixed mode is stated, the position of each pixel in hair surface and the boxed area at the back side in the texture mapping of hair to be drawn is obtained And color parameter obtains in the texture mapping each picture in the filamentary regions at hair surface and the back side using the fine pattern Before the position of vegetarian refreshments and color parameter, including:
Pass through texture mapping described in the tinter carry;
By the texture mapping, the picture of the preset format with alpha channel is converted to by the picture without transparent channel;
Improve the contrast of the alpha channel.
6. image drawing method as described in claim 1, which is characterized in that it is described by the tinter, it is utilized respectively institute Mixed mode is stated, the position of each pixel in hair surface and the boxed area at the back side in the texture mapping of hair to be drawn is obtained And color parameter obtains in the texture mapping each picture in the filamentary regions at hair surface and the back side using the fine pattern Before the position of vegetarian refreshments and color parameter, including:
Using the corresponding color of any one gray value between 0~255, the transparent region of the texture mapping is filled;
Fuzzy Processing is carried out to the hair in the texture mapping.
7. a kind of image plotting device, which is characterized in that described device includes:
Integration module, for being arranged the tinter for drawing hair in Unity, the tinter be integrated with mixed mode and Fine pattern;
Parameter acquisition module, for being utilized respectively the mixed mode, obtaining the texture of hair to be drawn by the tinter The position of each pixel and color parameter are obtained using the fine pattern in hair surface and the boxed area at the back side in textures Take in the texture mapping position of each pixel and color parameter in the filamentary regions at hair surface and the back side;
Drafting module, for passing through preset graphic package interface, according to the position of pixel each in the boxed area and face The position of each pixel and color parameter, draw hair in color parameter and the filamentary regions.
8. image plotting device as claimed in claim 7, which is characterized in that the parameter acquisition module includes:
First obtains module, for the value of the ZWrit parameter of semitransparent object to be set off, using the mixed mode, The original parameter value of the position of each pixel and color parameter in the boxed area is obtained, and the original parameter value write-in that will acquire is slow It deposits, and uses preset hybrid cytokine, the color value in the original parameter value being written in caching is mixed, is used for The target color values of each pixel in the boxed area that hair is drawn, so that the graphic package interface, according to described Target color values execute described according to the position of pixel each in the boxed area and color parameter and the filamentary regions In each pixel position and color parameter, the step of drafting to hair;
Second obtains module, for the value of the ZWrit parameter of the semitransparent object to be set on, and according to preset Filtration parameter obtains position and the color parameter of the corresponding pixel of hair of most edge transparent place in the texture mapping.
9. image plotting device as claimed in claim 7 or 8, which is characterized in that the drafting module, including:
Stratification drawing module, for passing through the graphic package interface, respectively according to the position of pixel each in the boxed area Set and color parameter, in the hair transparent region and blocky nontransparent region draw, according to the filamentary regions In each pixel position and color parameter, in the hair hair and hair the tip draw;
Laminating module, for by the graphic package interface, the hair drawn out and the hair tip are superimposed upon draw out it is transparent On region and blocky nontransparent region;
Wherein, in drawing process, when the position of pixel each in the boxed area and color parameter and the filamentary regions In each pixel position and color parameter when clashing, drawn according to the position and color parameter of the filamentary regions System.
10. image plotting device as claimed in claim 7, which is characterized in that described device further includes:
Carry module, for passing through texture mapping described in the tinter carry;
CHANNEL OPTIMIZATION module, for being converted to alpha channel by the picture without transparent channel by the texture mapping The picture of preset format, and improve the contrast of the alpha channel;
Module is filled, for using the corresponding color of any one gray value between 0~255, to the transparent of the texture mapping Region is filled;
Fuzzy Processing module, for carrying out Fuzzy Processing to the hair in the texture mapping.
11. a kind of terminal device including memory, processor and stores the calculating that can be run on a memory and on a processor Machine program, which is characterized in that when the processor executes the computer program, realize such as any one of claim 1 to 6 Each step in the image drawing method.
12. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the computer program When being executed by processor, each step in image drawing method according to any one of claims 1 to 6 is realized.
CN201710369091.XA 2017-05-23 2017-05-23 Image drawing method and device, terminal equipment and computer readable storage medium Active CN108932745B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710369091.XA CN108932745B (en) 2017-05-23 2017-05-23 Image drawing method and device, terminal equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710369091.XA CN108932745B (en) 2017-05-23 2017-05-23 Image drawing method and device, terminal equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN108932745A true CN108932745A (en) 2018-12-04
CN108932745B CN108932745B (en) 2020-11-17

Family

ID=64449717

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710369091.XA Active CN108932745B (en) 2017-05-23 2017-05-23 Image drawing method and device, terminal equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN108932745B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110619777A (en) * 2019-09-26 2019-12-27 重庆三原色数码科技有限公司 Criminal investigation and experiment intelligent training and assessment system based on VR technology and creation method
CN111028338A (en) * 2019-12-06 2020-04-17 珠海金山网络游戏科技有限公司 Unity 3D-based image drawing method and device
CN111292392A (en) * 2020-01-17 2020-06-16 上海米哈游天命科技有限公司 Unity-based image display method, apparatus, device and medium
CN111402384A (en) * 2020-03-25 2020-07-10 北京字节跳动网络技术有限公司 Image generation method and device, electronic equipment and computer readable storage medium
CN111508053A (en) * 2020-04-26 2020-08-07 网易(杭州)网络有限公司 Model rendering method and device, electronic equipment and computer readable medium
CN111784807A (en) * 2020-07-03 2020-10-16 珠海金山网络游戏科技有限公司 Virtual character drawing method and device
CN114419193A (en) * 2022-01-24 2022-04-29 北京思明启创科技有限公司 Image drawing method, image drawing device, electronic equipment and computer-readable storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1829559A1 (en) * 2006-03-01 2007-09-05 Johnson & Johnson Consumer Companies, Inc. Method for improving sleep behaviors
EP1986158A2 (en) * 2007-04-27 2008-10-29 DreamWorks Animation LLC Decorating computer generated character with surface attached features
EP2443167A1 (en) * 2009-06-15 2012-04-25 Basf Se Process for preparing regioregular poly-(3-substituted) thiophenes, selenophenes, thia- zoles and selenazoles
CN104574480A (en) * 2015-01-16 2015-04-29 北京科艺有容科技有限责任公司 Rapid generation method of role hair style in three-dimensional animation

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1829559A1 (en) * 2006-03-01 2007-09-05 Johnson & Johnson Consumer Companies, Inc. Method for improving sleep behaviors
EP1986158A2 (en) * 2007-04-27 2008-10-29 DreamWorks Animation LLC Decorating computer generated character with surface attached features
EP2443167A1 (en) * 2009-06-15 2012-04-25 Basf Se Process for preparing regioregular poly-(3-substituted) thiophenes, selenophenes, thia- zoles and selenazoles
CN104574480A (en) * 2015-01-16 2015-04-29 北京科艺有容科技有限责任公司 Rapid generation method of role hair style in three-dimensional animation

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
THORSTEN SCHEUERMANN: "Practical Real-Time Hair Rendering and Shading", 《SIGGRAPH"04:ACM SIGGRAPH 2004 SKETCHES》 *

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110619777A (en) * 2019-09-26 2019-12-27 重庆三原色数码科技有限公司 Criminal investigation and experiment intelligent training and assessment system based on VR technology and creation method
CN110619777B (en) * 2019-09-26 2021-08-27 重庆三原色数码科技有限公司 Criminal investigation and experiment intelligent training and assessment system creation method based on VR technology
CN111028338A (en) * 2019-12-06 2020-04-17 珠海金山网络游戏科技有限公司 Unity 3D-based image drawing method and device
CN111028338B (en) * 2019-12-06 2023-08-08 珠海金山数字网络科技有限公司 Image drawing method and device based on Unity3D
CN111292392A (en) * 2020-01-17 2020-06-16 上海米哈游天命科技有限公司 Unity-based image display method, apparatus, device and medium
CN111402384A (en) * 2020-03-25 2020-07-10 北京字节跳动网络技术有限公司 Image generation method and device, electronic equipment and computer readable storage medium
CN111508053A (en) * 2020-04-26 2020-08-07 网易(杭州)网络有限公司 Model rendering method and device, electronic equipment and computer readable medium
CN111508053B (en) * 2020-04-26 2023-11-28 网易(杭州)网络有限公司 Rendering method and device of model, electronic equipment and computer readable medium
CN111784807A (en) * 2020-07-03 2020-10-16 珠海金山网络游戏科技有限公司 Virtual character drawing method and device
CN114419193A (en) * 2022-01-24 2022-04-29 北京思明启创科技有限公司 Image drawing method, image drawing device, electronic equipment and computer-readable storage medium

Also Published As

Publication number Publication date
CN108932745B (en) 2020-11-17

Similar Documents

Publication Publication Date Title
CN108932745A (en) image drawing method, device, terminal device and computer readable storage medium
CN109961498B (en) Image rendering method, device, terminal and storage medium
CN102834849B (en) Carry out the image displaying device of the description of three-dimensional view picture, image drawing method, image depiction program
US9760968B2 (en) Reduction of graphical processing through coverage testing
CN108876931A (en) Three-dimension object color adjustment method, device, computer equipment and computer readable storage medium
CN109389664B (en) Model map rendering method and device and terminal
CN103946895B (en) The method for embedding in presentation and equipment based on tiling block
CN104012097B (en) Method and apparatus for compression and decompression data
CN106126229B (en) Special efficacy generation method and device
CN111508053B (en) Rendering method and device of model, electronic equipment and computer readable medium
CN106886353B (en) Display processing method and device of user interface
CN103503032A (en) Texturing in graphics hardware
CN107770618A (en) A kind of image processing method, device and storage medium
CN112884874B (en) Method, device, equipment and medium for applying applique on virtual model
US9830740B2 (en) Graphic processing unit, system and anti-aliasing method to perform rendering based on image information
TWI502546B (en) System, method, and computer program product for extruding a model through a two-dimensional scene
CN110443877A (en) Method, apparatus, terminal device and the storage medium of model rendering
CN108961382A (en) A kind of image rendering method, device and storage medium
CN111445563B (en) Image generation method and related device
CN110120053A (en) Face's dressing processing method, device and equipment
CN109064535A (en) A kind of hardware-accelerated implementation method of texture mapping in GPU
CN110070515A (en) Image composition method, device and computer readable storage medium
CN112419511A (en) Three-dimensional model file processing method and device, storage medium and server
CN107230249A (en) Shading Rendering method and apparatus
CN109448077A (en) A kind of method, apparatus, equipment and storage medium that multi-layer image merges

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
GR01 Patent grant
GR01 Patent grant