CN112734888B - Rendering method, system, device and medium for two-dimensional animation character - Google Patents
Rendering method, system, device and medium for two-dimensional animation character Download PDFInfo
- Publication number
- CN112734888B CN112734888B CN202110029398.1A CN202110029398A CN112734888B CN 112734888 B CN112734888 B CN 112734888B CN 202110029398 A CN202110029398 A CN 202110029398A CN 112734888 B CN112734888 B CN 112734888B
- Authority
- CN
- China
- Prior art keywords
- picture
- channel data
- sequence frame
- pictures
- simplified
- 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.)
- Active
Links
- 238000009877 rendering Methods 0.000 title claims abstract description 53
- 238000000034 method Methods 0.000 title claims abstract description 38
- 230000000717 retained effect Effects 0.000 claims description 8
- 238000004590 computer program Methods 0.000 claims description 5
- 239000003550 marker Substances 0.000 claims description 3
- 239000003086 colorant Substances 0.000 claims description 2
- 101100065699 Arabidopsis thaliana ETC1 gene Proteins 0.000 description 11
- 238000010586 diagram Methods 0.000 description 10
- 230000005540 biological transmission Effects 0.000 description 3
- 238000004891 communication Methods 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 230000033001 locomotion Effects 0.000 description 3
- 230000006835 compression Effects 0.000 description 2
- 238000007906 compression Methods 0.000 description 2
- 239000007787 solid Substances 0.000 description 2
- 230000007547 defect Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T13/00—Animation
- G06T13/80—2D [Two Dimensional] animation, e.g. using sprites
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T9/00—Image coding
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Multimedia (AREA)
- Processing Or Creating Images (AREA)
Abstract
More particularly, the present invention relates to a method, system, device and medium for rendering a two-dimensional animated character. Simplifying the sequence frame pictures of the two-dimensional animation role; merging and recombining the simplified sequence frame pictures to generate a first picture and a second picture in a preset format; and decoding the first picture and the second picture in the preset format, and rendering the two-dimensional animation role. The invention solves the problems of large number of pictures, large memory occupation and poor expandability while basically ensuring the image quality.
Description
Technical Field
More particularly, the present invention relates to a method, system, device and medium for rendering a two-dimensional animated character.
Background
Typically, an artist manually draws or creates sequential frame pictures of a two-dimensional animated character via a 3D model. The sequence frame pictures have a fixed file naming format, and the application program sequentially reads and replaces the sequence frame pictures according to the sequence through the file naming format to realize the image expression and animation of the two-dimensional animation role. This implementation has the following three major drawbacks.
The first defect is that the number of pictures is large, and reading pictures in sequence causes no small pressure on IO of a storage disk. Assuming that the image expression and animation direction number of a certain two-dimensional animation role is m, the role action number is n, and the action average sequence frame picture number is k, the role has m × n × k sequence frame pictures in total. For example, if the character representation and animation are divided into 12 directions, each direction has 10 movements, each movement has 8 pictures in sequence on average, and the character has 960 (12 × 10 × 8) pictures in sequence. After using the symmetric mirror technique, 480 sequential frame pictures are still required.
The second drawback is that the memory footprint is large. With the loading of a large number of sequence frame pictures, the memory usage will also increase significantly. For the above example, assuming that each sequence frame picture is a 32-bit bitmap of 256 × 256 pixels, 480 sequence frame pictures would occupy about 120M of memory space without compression.
The third drawback is poor scalability. In the practical application process of the game, more changes need to be made to the expression of the two-dimensional animated character, for example, the two-dimensional animated characters of different countries need to display different colors at corresponding positions. To achieve this function, an additional picture (referred to herein as a "marked picture") is required to mark out the color-changing portion, resulting in a further increase in memory usage.
Disclosure of Invention
The invention aims to provide a rendering method, a rendering system, rendering equipment and a rendering medium for a two-dimensional animation role, which can solve the problems of large number of pictures, large memory occupation and poor expandability while basically ensuring the image quality.
The invention discloses a rendering method of a two-dimensional animation role, which comprises the following steps:
simplifying the sequence frame pictures of the two-dimensional animation role;
merging and recombining the simplified sequence frame pictures to generate a first picture and a second picture in a preset format;
and decoding the first picture and the second picture in a preset format, and rendering the two-dimensional animation character.
Optionally, the simplifying the sequence frame pictures of the two-dimensional animated character includes:
comparing all pixels of one of the sequence frame pictures with corresponding pixels of each of the remaining sequence frame pictures, wherein if a difference between two compared pixels is less than a first threshold, the two pixels are the same;
calculating the number and/or percentage of non-identical pixels between the one sequence frame picture and each sequence frame picture, wherein if the number and/or percentage of non-identical pixels between the one sequence frame picture and one or more sequence frame pictures in the rest sequence frame pictures is less than a second threshold value, the one sequence frame picture is identical to the one or more sequence frame pictures;
for the same sequence frame picture, only one sequence frame picture is retained.
Optionally, simplifying the sequence frame pictures of the two-dimensional animated character further includes offsetting one or more of the two compared sequence frame pictures.
Optionally, merging and recombining the simplified sequence frame pictures to generate a first picture and a second picture in a predetermined format includes:
arranging and merging the simplified sequence frame pictures into a third picture;
decoding the third picture to generate RGBA channel data of the third picture;
recombining one or more channel data in RGBA channel data of the third picture, and converting the recombined channel data into the first picture and the second picture in a predetermined format, wherein the first picture in the predetermined format comprises R channel data, G channel data and B channel data of the third picture, and the second picture in the predetermined format comprises A channel data of the third picture.
Optionally, after the simplified sequence frame pictures are arranged and merged into a third picture, the position information and the size information of each of the simplified sequence frame pictures in the third picture are recorded as sequence frame metadata.
Optionally, decoding the first picture and the second picture in a predetermined format, rendering the two-dimensional animated character includes:
decoding the first picture and the second picture in a preset format to generate R channel data, G channel data, B channel data and A channel data of the third picture;
restoring the sequence frame picture based on the R channel data, the G channel data, the B channel data and the A channel data of the third picture and the sequence frame metadata;
and rendering the two-dimensional animation role based on the restored sequence frame pictures.
Optionally, after simplifying the sequence frame pictures of the two-dimensional animated character, simplifying the mark pictures corresponding to the sequence frame pictures, wherein the simplified sequence frame pictures are merged and recombined to generate the first picture in the predetermined format, and the simplified mark pictures are merged and recombined to generate the second picture in the predetermined format.
Optionally, merging and recombining the simplified marked pictures to generate the second picture in the predetermined format includes:
arranging and merging the simplified marked pictures into a fourth picture;
decoding the fourth picture to generate RGBA channel data of the fourth picture;
recombining one or more channel data in the RGBA channel data of the third picture and the fourth picture, and converting the channel data into the second picture in a predetermined format, wherein the second picture in the predetermined format comprises the A channel data of the third picture and the R channel data of the fourth picture.
Optionally, decoding the first picture and the second picture in a predetermined format, rendering the two-dimensional animated character includes:
decoding the first picture and the second picture in a predetermined format, generating R-channel data, G-channel data, B-channel data, and A-channel data of the third picture, and generating R-channel data of the fourth picture;
restoring the sequence frame picture based on the R channel data, the G channel data, the B channel data and the A channel data of the third picture and the sequence frame metadata;
restoring the marked picture based on the R channel data of the fourth picture and the sequence frame metadata;
rendering the two-dimensional animation role based on the restored sequence frame picture and the marked picture.
The invention discloses a rendering system of a two-dimensional animation role, which comprises:
the simplifying unit is used for simplifying the sequence frame pictures of the two-dimensional animation roles;
the merging and recombining unit is used for merging and recombining the simplified sequence frame pictures to generate a first picture and a second picture in a preset format;
and the rendering unit is used for decoding the first picture and the second picture in a preset format and rendering the two-dimensional animation role.
Optionally, after simplifying the sequence frame pictures of the two-dimensional animation character, the simplifying unit simplifies the tag pictures corresponding to the sequence frame pictures, wherein the merging and recombining unit merges and recombines the simplified sequence frame pictures to generate the first picture in the predetermined format, and merges and recombines the simplified tag pictures to generate the second picture in the predetermined format.
An apparatus for rendering a two-dimensional animated character includes a memory having stored thereon computer-executable instructions and a processor configured to execute the instructions to implement a method for rendering a two-dimensional animated character.
A computer storage medium encoded with a computer program comprising instructions that are executed by one or more computers to implement a method of rendering a two-dimensional animated character is disclosed.
Compared with the prior art, the implementation mode of the invention has the main differences and the effects that:
the invention can reduce the number of the sequence frame pictures by simplifying the sequence frame pictures of the two-dimensional animation roles. The simplified sequence frame pictures are merged and recombined to generate the first picture and the second picture in the preset format, so that the occupied space of a memory can be reduced. The second picture with the preset format in the invention reserves a channel for storing other information, thereby improving the expandability.
Drawings
FIG. 1 is a block diagram of a hardware configuration of a computer terminal of a rendering method of a two-dimensional animated character according to the present invention;
FIG. 2 is a block diagram of a rendering system for a two-dimensional animated character according to the present invention;
FIG. 3 is a flow chart of a method of rendering a two-dimensional animated character according to the present invention;
FIG. 4 is a simplified schematic diagram of sequential frame pictures according to the present invention;
FIGS. 5 (a) and 5 (b) are schematic diagrams of pixel comparisons according to the present invention;
fig. 6 (a) to 6 (d) are schematic diagrams of sequence frame picture offsets according to the present invention;
FIG. 7 is another flowchart of a method of rendering a two-dimensional animated character according to the present invention.
Detailed Description
In order to make the purpose and technical solution of the embodiments of the present invention clearer, the technical solution of the embodiments of the present invention will be clearly and completely described below with reference to the drawings of the embodiments of the present invention. It should be apparent that the described embodiments are only some of the embodiments of the present invention, and not all of them. All other embodiments, which can be derived by a person skilled in the art from the described embodiments of the invention without inventive step, are within the scope of protection of the invention.
In accordance with an embodiment of the present invention, there is provided an embodiment of a method for rendering a two-dimensional animated character, it being noted that the steps illustrated in the flowchart of the drawings may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be performed in an order different than that presented herein.
The method provided by the application mode can be executed in a mobile terminal, a computer terminal or a server. Taking the example of running on a computer terminal, fig. 1 is a hardware structure block diagram of the computer terminal of the rendering method of a two-dimensional animated character according to the present invention. As shown in fig. 1, the computer terminal 100 may include one or more processors 101 (only one is shown in the figure) (the processor 101 may include but is not limited to a processing device such as a central processing unit CPU, an image processor GPU, a digital signal processor DSP, a microprocessor MCU, or a programmable logic device FPGA), an input-output interface 102 for interacting with a user, a memory 103 for storing data, and a transmission device 104 for communication function, and the processor 101, the input-output interface 102, the memory 103, and the transmission device 104 are connected to each other via a bus 105. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration and is not intended to limit the structure of the electronic device. For example, computer terminal 100 may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
The memory 103 may be configured to store a database, a queue, and software programs and modules of application software, such as program instructions/modules corresponding to the rendering method of the two-dimensional animated character according to the present invention, and the processor 101 executes various functional applications and data processing by running the software programs and modules stored in the memory 103, so as to implement the above-mentioned rendering method of the two-dimensional animated character. The memory 103 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 103 may further include memory located remotely from the processor 101, which may be connected to the computer terminal 100 over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 104 is used to receive or transmit data via a network, which may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others. A concrete example of the network described above may include the internet provided by a communication provider of the computer terminal 100.
FIG. 2 is a block diagram of a rendering system for a two-dimensional animated character according to the present invention; FIG. 3 is a flow chart of a method of rendering a two-dimensional animated character according to the present invention; FIG. 4 is a simplified schematic diagram of sequential frame pictures according to the present invention; FIGS. 5 (a) and 5 (b) are schematic diagrams of pixel comparisons according to the present invention; fig. 6 (a) to 6 (d) are schematic diagrams of sequence frame picture offsets according to the present invention. The following is a detailed description with reference to fig. 2 to 6 (d).
In step S301, the simplifying unit 201 simplifies the sequence frame picture of the two-dimensional animated character;
in step S302, the merging and recombining unit 202 merges and recombines the simplified sequence frame pictures to generate a first picture and a second picture in a predetermined format;
in step S303, the rendering unit 203 decodes the first picture and the second picture in the predetermined format, and renders a two-dimensional animated character.
As shown in fig. 4, each two-dimensional animated character may individually use a picture library in which all sequence frame pictures of the character are stored, each sequence frame picture having a corresponding name, e.g., name a referring to picture a and name B referring to picture B. After simplifying the sequence frame pictures of the two-dimensional animated character, the reference relationship of the picture names may change, for example, since picture a and picture B are the same, only picture a may be retained and picture B may be deleted, so that name B is modified to refer to picture a. The invention can reduce the number of the sequence frame pictures, such as hundreds of pictures to limited pictures, by simplifying the sequence frame pictures of the two-dimensional animation role.
The sequential frame picture may be in an RGBA8888 format, and the first picture and the second picture in the predetermined format may be in an ETC1 format. The ETC1 format is a compression format, and 1 piece of 32-bit map with the 1024x1024 RGBA8888 format occupies 4M memory, while 1 piece of the 1024x1024 ETC1 format map occupies 512K memory. The simplified sequence frame pictures are merged and recombined to generate the first picture and the second picture in the preset format, so that the occupied space of a memory can be reduced, for example, the occupied space is reduced to 1/4 or 1/8 of that of the traditional scheme.
Optionally, simplifying the sequence frame pictures of the two-dimensional animated character includes:
comparing all pixels of one of the sequence frame pictures with corresponding pixels of each of the other sequence frame pictures, wherein if a difference between the two compared pixels is less than a first threshold, the two pixels are the same;
calculating the number and/or percentage of non-identical pixels between one sequence frame picture and each sequence frame picture, wherein if the number and/or percentage of non-identical pixels between one sequence frame picture and one or more sequence frame pictures in the rest sequence frame pictures is less than a second threshold value, the one sequence frame picture is identical to the one or more sequence frame pictures;
for the same sequence frame picture, only one sequence frame picture is retained.
As shown in fig. 5 (a), the sequence frame picture data in the RGBA8888 format is arranged in the memory, wherein each group of 4 data (each data has a value ranging from 0 to 255) of RGBA constitutes data of one pixel. n is the total number of pixels of the picture, i.e. the product of the length and the width of the picture.
As shown in fig. 5 (b), T1 and T2 are two sequential frame pictures to be compared, and the data pointed by the arrow is the data to be compared in turn. If the difference between the two values of T1[ R1] and T2[ R1] is smaller than the set threshold value (the value range is 1-255), then T1[ R1] and T2[ R1] are the same. If the four pairs of data T1[ R1] and T2[ R1], T1[ G1] and T2[ G1], T1[ B1] and T2[ B1], and T1[ A1] and T2[ A1] are all the same, then the pixel at position 1 of T1 and T2 is the same. T1 and T2 are the same if the number and/or percentage of non-identical pixels between T1 and T2 is less than another threshold that is set. For the same T1 and T2, only one sequence frame picture is retained, e.g., only T1 is retained and T2 is deleted. By performing the comparison step on each sequence frame picture in the picture library of each two-dimensional animation character and the rest sequence frame pictures in the picture library, the sequence frame pictures with small pixel difference can be found out and excluded, and the number of the sequence frame pictures can be reduced.
Optionally, simplifying the sequence frame pictures of the two-dimensional animated character further comprises offsetting one or more of the two compared sequence frame pictures.
As shown in fig. 6 (a), there may be two sequential frame pictures with a small difference, but there is a certain offset due to the relationship of character motion when, for example, an artist derives a character picture. The peripheral portion in the figure is a transparent pixel, the small circle portion is a difference portion between two sequential frame pictures, and the large circle portion is the same portion between the two sequential frame pictures. It can be seen that although the large circular portions of the two sequence frame pictures are the same, there is a difference in image position. As shown in fig. 6 (b), in the comparison process, the transparent pixels may be removed first, and then the comparison may be performed. However, as shown in fig. 6 (c), after cutting the transparent pixels, if two sequence frame pictures are directly compared, a large number of pixels that are not identical may occur, thereby drawing an erroneous conclusion that the two sequence frame pictures are not identical. Therefore, as shown in fig. 6 (d), shifting one or more of the two compared sequence frame pictures can result in a slight difference of only a small circle portion between the two sequence frame pictures, so that the two sequence frame pictures are identical.
Optionally, merging and recombining the simplified sequence frame pictures to generate the first picture and the second picture in the predetermined format includes:
arranging and merging the simplified sequence frame pictures into a third picture;
decoding the third picture to generate RGBA channel data of the third picture;
and recombining one or more channel data in the RGBA channel data of the third picture, and converting the RGBA channel data into a first picture and a second picture in a predetermined format, wherein the first picture in the predetermined format comprises R channel data, G channel data and B channel data of the third picture, and the second picture in the predetermined format comprises A channel data of the third picture.
The third picture can be recorded as color texture, limited in size to 2048x2048 (a common rule for most cell phone games), in the format RGBA8888 bits. The simplified sequence frame pictures are arranged and combined into a large picture, so that the number of the pictures can be reduced, and meanwhile, most of blanks in the pictures are removed by utilizing a third-party combining tool and an algorithm, so that the memory space can be saved.
The Color texture is decoded to generate RGBA channel data of the Color texture, which may be recorded as Color _ r, color _ g, color _ b, and Color _ a, respectively.
The color texture is converted into a first picture in ETC1 format using a third party tool, and the first picture in ETC1 format may be recorded as rgb texture. The rgb texture includes R channel data Color _ R, G channel data Color _ G, and B channel data Color _ B of Color texture, and A channel data Color _ a of Color texture is discarded.
Pure white channel data having the same size as the Color texture is created in the memory, and the three a channel data Color _ a of the Color texture and the pure white channel data are merged and saved as a temporary picture, which may be recorded as temp. The temp. png is converted into a second picture in ETC1 format using a third party tool, and the second picture in ETC1 format may be recorded as maa texture. The maa texture includes three A channel data Color _ a of Color texture, and pure white channel data is discarded.
In the invention, one or more channel data in the RGBA channel data of the third picture are recombined and converted into the first picture and the second picture in the preset format, the memory occupation is reduced to 1/4 of that of the traditional scheme, and the second picture in the preset format comprises a plurality of A channel data of the third picture, but only one A channel data of the third picture is actually needed, so that the channel is reserved to store other information for use, and the expandability can be improved.
Optionally, after the simplified sequence frame pictures are arranged and merged into a third picture, the position information and the size information of each of the simplified sequence frame pictures in the third picture are recorded as sequence frame metadata.
The sequence frame metadata may be recorded as a frame meta indicating position information and size information of each of the simplified sequence frame pictures in the color texture.
Optionally, decoding the first picture and the second picture in a predetermined format, and rendering the two-dimensional animated character includes:
decoding a first picture and a second picture in a preset format to generate R channel data, G channel data, B channel data and A channel data of a third picture;
restoring a sequence frame picture based on R channel data, G channel data, B channel data, A channel data and sequence frame metadata of the third picture;
rendering a two-dimensional animation role based on the restored sequence frame pictures.
The rgb texture holds R channel data Color _ R, G channel data Color _ G, and B channel data Color _ B of Color texture, and the maa texture holds A channel data Color _ a of Color texture. The above four channel data Color _ r, color _ g, color _ b, and Color _ a based on Color texture, and based on frame meta indicating position information and size information of each sequence frame picture in Color texture, the sequence frame pictures are restored. And rendering an accurate two-dimensional animation role based on the restored sequence frame picture.
Fig. 7 is another flowchart of a rendering method of a two-dimensional animated character according to the present invention. This is explained in detail below with reference to fig. 2 and 7.
In step S701, the simplifying unit 201 simplifies the sequence frame picture of the two-dimensional animated character;
in step S702, the simplification unit 201 simplifies the flag picture corresponding to the sequence frame picture;
in step S703, the merging and recombining unit 202 merges and recombines the simplified sequence frame pictures to generate a first picture in a predetermined format;
in step S704, the merging and recombining unit 202 merges and recombines the simplified tagged pictures to generate a second picture with a predetermined format;
in step S705, the rendering unit 203 decodes the first picture and the second picture in the predetermined format, and renders the two-dimensional animated character.
It is understood that step S702 and step S701 may also be performed simultaneously, and step S704 and step S703 may also be performed simultaneously.
The marker picture corresponds to the sequence frame picture and indicates whether the original pixel of the corresponding sequence frame picture needs to be discolored. Since the flag picture corresponds to the sequence frame picture, the flag picture can be simplified based on the simplification result of the sequence frame picture, and for example, if only the sequence frame picture T1 is retained and the sequence frame picture T2 is deleted, only the flag picture T1 'corresponding to the sequence frame picture T1 may be retained and the flag picture T2' corresponding to the sequence frame picture T2 may be deleted. The content related to simplifying the sequence frame picture of the two-dimensional animation character has been described in detail in the above description, and therefore is not described herein again.
Due to the existence of the mark pictures, the simplified sequence frame pictures can be merged and recombined to generate a first picture in a preset format, and the simplified mark pictures can be merged and recombined to generate a second picture in the preset format.
Optionally, merging and recombining the simplified sequence frame pictures to generate the first picture in the predetermined format includes:
arranging and merging the simplified sequence frame pictures into a third picture;
decoding the third picture to generate RGBA channel data of the third picture;
and recombining one or more channel data in the RGBA channel data of the third picture, and converting the channel data into a first picture in a preset format, wherein the first picture in the preset format comprises R channel data, G channel data and B channel data of the third picture.
The third picture can be recorded as color texture, limited in size to 2048x2048 (a common rule for most cell phone games), in the format RGBA8888 bits. The simplified sequence frame pictures are arranged and combined into a large picture, so that the number of the pictures can be reduced, and meanwhile, most of blanks in the pictures are removed by utilizing a third-party combining tool and an algorithm, so that the memory space can be saved.
The Color texture is decoded to generate RGBA channel data of the Color texture, which may be recorded as Color _ r, color _ g, color _ b, and Color _ a, respectively.
The color texture is converted into a first picture in ETC1 format using a third party tool, and the first picture in ETC1 format may be recorded as rgb texture. The rgb texture includes R channel data Color _ R, G channel data Color _ G, and B channel data Color _ B of Color texture, and A channel data Color _ a of Color texture is discarded.
Optionally, merging and recombining the simplified marked pictures to generate a second picture in a predetermined format includes:
arranging the simplified marked pictures and merging the marked pictures into a fourth picture;
decoding the fourth picture to generate RGBA channel data of the fourth picture;
and recombining one or more channel data in the RGBA channel data of the third picture and the fourth picture, and converting the RGBA channel data into a second picture with a predetermined format, wherein the second picture with the predetermined format comprises the A channel data of the third picture and the R channel data of the fourth picture.
The fourth picture may be recorded as mask texture. The simplified marked pictures are arranged and combined into a large picture, so that the number of the pictures can be reduced, and meanwhile, most of blanks in the pictures are removed by utilizing a third-party combining tool and an algorithm, so that the memory space can be saved.
And decoding the Mask texture to generate RGBA channel data of the Mask texture, and taking only R channel data therein, wherein the RGBA channel data can be recorded as Mask _ R which indicates whether the original pixels of the corresponding sequence frame pictures need to be discolored or not.
Pure white channel data with the same size as the Color texture is created in the memory, and the R channel data Mask _ R of the Mask texture, the two A channel data Color _ a of the Color texture and the pure white channel data are merged and saved as a temporary picture, which can be recorded as temp. The temp. png is converted into a second picture in ETC1 format using a third party tool, and the second picture in ETC1 format may be recorded as maa texture. The maa texture includes R channel data Mask _ R of Mask texture and two A channel data Color _ a of Color texture, and pure white channel data is discarded.
In the invention, one or more channel data in the RGBA channel data of the third picture are recombined and converted into the first picture with the preset format, and one or more channel data in the RGBA channel data of the third picture and the RGBA channel data of the fourth picture are recombined and converted into the second picture with the preset format, so that the memory occupation is reduced to 1/8 of that of the traditional scheme, and the second picture with the preset format comprises a plurality of A channel data of the third picture, but only one A channel data of the third picture is actually required, thereby reserving a channel for storing other information and improving the expandability.
Optionally, after the simplified sequence frame pictures are arranged and merged into a third picture, the position information and the size information of each of the simplified sequence frame pictures in the third picture are recorded as sequence frame metadata.
The sequence frame metadata may be recorded as a frame meta indicating position information and size information of each of the simplified sequence frame pictures in the color texture.
Optionally, decoding the first picture and the second picture in the predetermined format, and rendering the two-dimensional animated character includes:
decoding a first picture and a second picture in a preset format to generate R channel data, G channel data, B channel data and A channel data of a third picture and R channel data of a fourth picture;
restoring a sequence frame picture based on R channel data, G channel data, B channel data, A channel data and sequence frame metadata of the third picture;
restoring a marked picture based on R channel data and sequence frame metadata of the fourth picture;
and rendering the two-dimensional animation role based on the restored sequence frame picture and the marked picture.
The rgb texture holds R channel data Color _ R, G channel data Color _ G, and B channel data Color _ B of Color texture, and the maa texture holds A channel data Color _ a of Color texture. The above four channel data Color _ r, color _ g, color _ b, and Color _ a based on Color texture, and based on frame meta indicating position information and size information of each sequence frame picture in Color texture, the sequence frame pictures are restored. The markup picture is restored based on the R channel data Mask _ R of the Mask texture and based on the frame meta indicating the position information and the size information of each sequence frame picture in the color texture. And rendering an accurate two-dimensional animation role based on the restored sequence frame picture and the marked picture.
The invention also provides a rendering device for a two-dimensional animated character, the device comprising a memory storing computer executable instructions and a processor configured to execute the instructions to implement a rendering method for a two-dimensional animated character.
The present invention also provides a computer storage medium encoded with a computer program, the computer program comprising instructions executable by one or more computers to perform a method of rendering a two-dimensional animated character.
Each method embodiment of the present invention can be implemented by software, hardware, firmware, or the like. Whether the present invention is implemented as software, hardware, or firmware, the instruction code may be stored in any type of computer-accessible memory (e.g., permanent or modifiable, volatile or non-volatile, solid or non-solid, fixed or removable media, etc.). Also, the Memory may be, for example, programmable Array Logic (PAL), random Access Memory (RAM), programmable Read Only Memory (PROM), read-Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), a magnetic disk, an optical disk, a Digital Versatile Disk (DVD), and so on.
It should be noted that, each unit/module mentioned in each device embodiment of the present invention is a logical unit/module, and physically, one logical unit may be one physical unit, or may be a part of one physical unit, or may be implemented by a combination of multiple physical units, and the physical implementation manner of these logical units itself is not the most important, and the combination of the functions implemented by these logical units is the key to solve the technical problem provided by the present invention. Furthermore, the above-mentioned embodiments of the apparatus of the present invention do not introduce elements that are less relevant for solving the technical problems of the present invention in order to highlight the innovative part of the present invention, which does not indicate that there are no other elements in the above-mentioned embodiments of the apparatus.
It is to be noted that in the claims and the description of the present patent, relational terms such as first and second, and the like are 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, the use of the verb "comprise a" to define an element does not exclude the presence of another, same element in a process, method, article, or apparatus that comprises the element.
While the invention has been shown and described with reference to certain preferred embodiments thereof, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention.
Claims (8)
1. A method of rendering a two-dimensional animated character, the method comprising:
simplifying the sequence frame pictures of the two-dimensional animation role;
simplifying a marker picture corresponding to the sequence frame picture, wherein the marker picture indicates whether the original pixel of the corresponding sequence frame picture needs to be discolored;
merging the simplified sequence frame pictures to obtain a third picture, and recombining the third picture to generate a first picture in a preset format;
merging the simplified marked pictures to obtain a fourth picture, and recombining the third picture and the fourth picture to generate a second picture with a preset format;
decoding the first picture and the second picture in a preset format, and rendering the two-dimensional animation role;
merging the simplified sequence frame pictures to obtain a third picture, and recombining the third picture to generate the first picture with the predetermined format includes:
arranging and merging the simplified sequence frame pictures into the third picture;
decoding the third picture to generate RGBA channel data of the third picture;
recombining one or more channel data in RGBA channel data of the third picture, and converting the RGBA channel data into the first picture in a preset format, wherein the first picture in the preset format comprises R channel data, G channel data and B channel data of the third picture;
merging the simplified marked pictures to obtain a fourth picture, recombining the third picture and the fourth picture, and generating a second picture with a predetermined format comprises:
arranging and merging the simplified marked pictures into the fourth picture;
decoding the fourth picture to generate RGBA channel data of the fourth picture;
recombining one or more channel data of RGBA channel data of the third picture and the fourth picture, and converting the recombined channel data into the second picture in a predetermined format, wherein the second picture in the predetermined format comprises A channel data of the third picture and R channel data of the fourth picture, and the R channel data of the fourth picture indicates whether an original pixel of the corresponding sequence frame picture needs to be discolored.
2. The method of claim 1, wherein simplifying the sequential frame pictures of the two-dimensional animated character comprises:
comparing all pixels of one of the sequence frame pictures with corresponding pixels of each of the remaining sequence frame pictures, wherein if a difference between two compared pixels is less than a first threshold, the two pixels are the same;
calculating the number and/or percentage of non-identical pixels between the one sequence frame picture and each sequence frame picture, wherein if the number and/or percentage of non-identical pixels between the one sequence frame picture and one or more sequence frame pictures in the rest sequence frame pictures is less than a second threshold value, the one sequence frame picture is identical to the one or more sequence frame pictures;
for the same sequence frame picture, only one sequence frame picture is retained.
3. The method of claim 2, wherein simplifying the sequence frame pictures of the two-dimensional animated character further comprises offsetting one or more of the two compared sequence frame pictures.
4. The method according to claim 1, wherein after the simplified sequence frame pictures are arranged and merged into the third picture, position information and size information of each of the simplified sequence frame pictures in the third picture are recorded as sequence frame metadata.
5. The method of claim 1, wherein decoding the first picture and the second picture in a predetermined format, rendering the two-dimensional animated character comprises:
decoding the first picture and the second picture in a predetermined format, generating R-channel data, G-channel data, B-channel data, and A-channel data of the third picture, and generating R-channel data of the fourth picture;
restoring the sequence frame picture based on the R channel data, the G channel data, the B channel data, the A channel data and the sequence frame metadata of the third picture;
restoring the marked picture based on the R channel data of the fourth picture and the sequence frame metadata;
rendering the two-dimensional animation role based on the restored sequence frame picture and the marked picture.
6. A system for rendering a two-dimensional animated character, the system comprising:
the simplifying unit is used for simplifying the sequence frame pictures of the two-dimensional animation roles and simplifying the mark pictures corresponding to the sequence frame pictures, wherein the mark pictures indicate whether the original pixels of the corresponding sequence frame pictures need to change colors or not;
the merging and recombining unit is used for merging the simplified sequence frame pictures to obtain a third picture, recombining the third picture to generate a first picture in a preset format, merging the simplified mark pictures to obtain a fourth picture, and recombining the third picture and the fourth picture to generate a second picture in the preset format;
the rendering unit is used for decoding the first picture and the second picture in a preset format and rendering the two-dimensional animation role;
merging the simplified sequence frame pictures to obtain a third picture, and recombining the third picture to generate a first picture with a predetermined format includes:
arranging and merging the simplified sequence frame pictures into the third picture;
decoding the third picture to generate RGBA channel data of the third picture;
recombining one or more channel data in RGBA channel data of the third picture, and converting the RGBA channel data into the first picture in a preset format, wherein the first picture in the preset format comprises R channel data, G channel data and B channel data of the third picture;
merging the simplified marked pictures to obtain a fourth picture, recombining the third picture and the fourth picture, and generating a second picture with a predetermined format comprises:
arranging and merging the simplified marked pictures into the fourth picture;
decoding the fourth picture to generate RGBA channel data of the fourth picture;
recombining one or more channel data of RGBA channel data of the third picture and the fourth picture, and converting the recombined channel data into the second picture in a predetermined format, wherein the second picture in the predetermined format comprises A channel data of the third picture and R channel data of the fourth picture, and the R channel data of the fourth picture indicates whether an original pixel of the corresponding sequence frame picture needs to be discolored.
7. A two-dimensional animated character rendering apparatus comprising a memory having computer-executable instructions stored thereon and a processor configured to execute the instructions to implement the method of rendering a two-dimensional animated character according to any of claims 1-5.
8. A computer storage medium encoded with a computer program, the computer program comprising instructions that are executed by one or more computers to implement the method of rendering a two-dimensional animated character of any one of claims 1-5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110029398.1A CN112734888B (en) | 2021-01-11 | 2021-01-11 | Rendering method, system, device and medium for two-dimensional animation character |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110029398.1A CN112734888B (en) | 2021-01-11 | 2021-01-11 | Rendering method, system, device and medium for two-dimensional animation character |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112734888A CN112734888A (en) | 2021-04-30 |
CN112734888B true CN112734888B (en) | 2022-10-04 |
Family
ID=75590125
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110029398.1A Active CN112734888B (en) | 2021-01-11 | 2021-01-11 | Rendering method, system, device and medium for two-dimensional animation character |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112734888B (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104933747A (en) * | 2015-06-10 | 2015-09-23 | 北京奇虎科技有限公司 | Method and device for converting vector animation into bitmap animation |
CN107204024A (en) * | 2016-03-16 | 2017-09-26 | 腾讯科技(深圳)有限公司 | Handle the method and device of sequence of pictures frame |
CN109816757A (en) * | 2018-12-14 | 2019-05-28 | 深圳壹账通智能科技有限公司 | Play method and device, computer equipment, the computer storage medium of frame animation |
CN109993817A (en) * | 2017-12-28 | 2019-07-09 | 腾讯科技(深圳)有限公司 | A kind of implementation method and terminal of animation |
CN112070863A (en) * | 2019-06-11 | 2020-12-11 | 腾讯科技(深圳)有限公司 | Animation file processing method and device, computer readable storage medium and computer equipment |
CN112070867A (en) * | 2019-06-11 | 2020-12-11 | 腾讯科技(深圳)有限公司 | Animation file processing method and device, computer readable storage medium and computer equipment |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2003299022A (en) * | 2002-04-03 | 2003-10-17 | Toshiba Corp | Image data storing and reproducing system and method for storing and reproducing image data |
WO2016205265A1 (en) * | 2015-06-19 | 2016-12-22 | Schlumberger Technology Corporation | Efficient algorithms for volume visualization on irregular grids |
CN106502836B (en) * | 2016-11-02 | 2019-04-19 | 四川秘无痕信息安全技术有限责任公司 | A kind of monitor video data reconstruction method based on WB_DC file system |
-
2021
- 2021-01-11 CN CN202110029398.1A patent/CN112734888B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104933747A (en) * | 2015-06-10 | 2015-09-23 | 北京奇虎科技有限公司 | Method and device for converting vector animation into bitmap animation |
CN107204024A (en) * | 2016-03-16 | 2017-09-26 | 腾讯科技(深圳)有限公司 | Handle the method and device of sequence of pictures frame |
CN109993817A (en) * | 2017-12-28 | 2019-07-09 | 腾讯科技(深圳)有限公司 | A kind of implementation method and terminal of animation |
CN109816757A (en) * | 2018-12-14 | 2019-05-28 | 深圳壹账通智能科技有限公司 | Play method and device, computer equipment, the computer storage medium of frame animation |
CN112070863A (en) * | 2019-06-11 | 2020-12-11 | 腾讯科技(深圳)有限公司 | Animation file processing method and device, computer readable storage medium and computer equipment |
CN112070867A (en) * | 2019-06-11 | 2020-12-11 | 腾讯科技(深圳)有限公司 | Animation file processing method and device, computer readable storage medium and computer equipment |
Also Published As
Publication number | Publication date |
---|---|
CN112734888A (en) | 2021-04-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20160321529A1 (en) | Producing, capturing and using visual identification tags for moving objects | |
CN109754046B (en) | Two-dimensional code, encoding method, decoding method, device and equipment of two-dimensional code | |
WO2020248879A1 (en) | Animation data encoding and decoding methods and apparatuses, storage medium, and computer device | |
CN109934764A (en) | Processing method, device, terminal, server and the storage medium of panoramic video file | |
CN108734756B (en) | Animation production method and device, storage medium and electronic device | |
CN116977531A (en) | Three-dimensional texture image generation method, three-dimensional texture image generation device, computer equipment and storage medium | |
CN112734888B (en) | Rendering method, system, device and medium for two-dimensional animation character | |
CN112070866B (en) | Animation data encoding and decoding method and device, storage medium and computer equipment | |
CN112714338A (en) | Video transmission method, video playing method, video transmission device, video playing device, computer equipment and storage medium | |
CN115473895B (en) | Method and device for dividing digital object warehouse node consensus groups under ubiquitous environment | |
CN110969042B (en) | Two-dimensional code identification method and device and hardware device | |
CN110111380A (en) | 3D rendering transmission and method for reconstructing based on depth camera | |
CN111541901B (en) | Picture decoding method and device | |
CN112070850B (en) | Animation data encoding and decoding method and device, storage medium and computer equipment | |
CN112150585B (en) | Animation data encoding and decoding method and device, storage medium and computer equipment | |
CN106604033B (en) | Image coding and logical calculation method and device | |
CN113778905B (en) | UI design acceptance method, device, equipment and storage medium | |
CN117953175B (en) | Method, system, equipment and medium for constructing virtual world data model | |
CN108280502A (en) | A kind of QR codes capacity boost method and terminal | |
US20240244248A1 (en) | Encoding and decoding methods, encoder, decoder and storage medium | |
CN112150589B (en) | Animation data encoding and decoding method and device, storage medium and computer equipment | |
CN112802134B (en) | Coding method, device and terminal of three-dimensional model | |
CN117218269A (en) | Video processing method, device, equipment and storage medium | |
KR100558346B1 (en) | Moving picture coding method for multimedia service on wire/wireless communication | |
CN113535172A (en) | Information searching method, device, equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
EE01 | Entry into force of recordation of patent licensing contract |
Application publication date: 20210430 Assignee: Shanghai Xiding Network Technology Co.,Ltd. Assignor: SHANGHAI LILITH TECHNOLOGY Corp. Contract record no.: X2024980005853 Denomination of invention: The rendering methods, systems, devices, and media for two-dimensional animated characters Granted publication date: 20221004 License type: Common License Record date: 20240516 |
|
EE01 | Entry into force of recordation of patent licensing contract |