CN115861454A - Method and device for storing patch position information, electronic equipment and storage medium - Google Patents

Method and device for storing patch position information, electronic equipment and storage medium Download PDF

Info

Publication number
CN115861454A
CN115861454A CN202211461018.2A CN202211461018A CN115861454A CN 115861454 A CN115861454 A CN 115861454A CN 202211461018 A CN202211461018 A CN 202211461018A CN 115861454 A CN115861454 A CN 115861454A
Authority
CN
China
Prior art keywords
value
patch
order
actual
index
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211461018.2A
Other languages
Chinese (zh)
Inventor
张天晨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network 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 Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202211461018.2A priority Critical patent/CN115861454A/en
Publication of CN115861454A publication Critical patent/CN115861454A/en
Pending legal-status Critical Current

Links

Images

Abstract

The embodiment of the application discloses a method and a device for storing position information of a patch, electronic equipment and a computer-readable storage medium; the method and the device can acquire the actual position value and the actual index value of the surface patch to be stored; based on the first preset compression value, carrying out compression coding on the actual position value to obtain a position storage value of the actual position value, wherein the position storage value comprises a high position value and a low position value; performing compression coding on the actual index value based on a second preset compression value to obtain an index storage value of the actual index value; and generating an information storage map of the patch to be stored according to the high-order position value, the low-order position value and the index storage value, wherein a first pixel point in the information storage map is used for storing the high-order position value and the index storage value, and a second pixel point in the information storage map is used for storing the low-order position value and the index storage value. According to the embodiment of the application, the storage precision of the position information when the frame animation special effect is recorded by adopting low-precision maps such as TGA (thermal transfer gate analysis) maps can be improved.

Description

Method and device for storing patch position information, electronic equipment and storage medium
Technical Field
The present application relates to the field of graphics processing technologies, and in particular, to a method and an apparatus for storing patch position information, an electronic device, and a computer-readable storage medium.
Background
High precision maps, such as EXR maps, are capable of storing higher dynamic range and color precision than conventional 8-bit and 10-bit image formats, support pixel color values of 16-bit floating point numbers, 32-bit floating point numbers and 32-bit integers, and can store values in excess of 1.
However, the inventor of the present application found in the actual development process that: the high-precision map such as the EXR map cannot be sampled on the low-end device (such as a low-configuration mobile phone), but only the low-precision map such as the TGA map can be sampled, so that the low-precision map such as the TGA map can only be used for recording the special effect of the frame animation on the low-end device, which will cause the frame animation to have an excessively jumping effect, and thus the picture effect is poor.
Disclosure of Invention
The embodiment of the application provides a method and a device for storing position information of a patch, electronic equipment and a computer-readable storage medium, which can improve the storage precision of position information when a frame animation special effect is recorded by using low-precision maps such as TGA (thermal transfer elevation) maps.
In a first aspect, an embodiment of the present application provides a method for storing patch position information, including:
acquiring an actual position value and an actual index value of a surface patch to be stored;
based on a first preset compression value, carrying out compression coding on the actual position value to obtain a position storage value of the actual position value, wherein the position storage value comprises a high position value and a low position value;
based on a second preset compression value, carrying out compression coding on the actual index value to obtain an index storage value of the actual index value;
and generating an information storage map of the to-be-stored patch according to the high-order position value, the low-order position value and the index storage value, wherein a first pixel point in the information storage map is used for storing the high-order position value and the index storage value, and a second pixel point in the information storage map is used for storing the low-order position value and the index storage value.
In a second aspect, an embodiment of the present application further provides a patch position information storage apparatus, including:
the device comprises an acquisition unit, a storage unit and a processing unit, wherein the acquisition unit is used for acquiring an actual position value and an actual index value of a surface patch to be stored;
the first compression unit is used for carrying out compression coding on the actual position value based on a first preset compression value to obtain a position storage value of the actual position value, wherein the position storage value comprises a high position value and a low position value;
the second compression unit is used for carrying out compression coding on the actual index value based on a second preset compression value to obtain an index storage value of the actual index value;
and the storage unit is used for generating an information storage map of the to-be-stored patch according to the high-order position value, the low-order position value and the index storage value, wherein a first pixel point in the information storage map is used for storing the high-order position value and the index storage value, and a second pixel point in the information storage map is used for storing the low-order position value and the index storage value.
In a third aspect, an embodiment of the present application further provides an electronic device, including a memory storing a plurality of instructions; the processor loads instructions from the memory to execute any one of the patch position information storage methods provided by the embodiments of the present application.
In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, where a plurality of instructions are stored, and the instructions are adapted to be loaded by a processor to perform any one of the patch location information storage methods provided in the embodiment of the present application.
In the embodiment of the application, the actual position value of the surface patch to be stored is compressed and encoded into a high position value and a low position value, and the high position value and the low position value are respectively stored by adopting 2 different pixel points (a first pixel point and a second pixel point) in an information storage map; on the first hand, compared with 1 pixel, 2 pixels are adopted for storing an actual position value, and the data storage precision can be improved on the basis of improving the range of the stored value range; in a second aspect, after the actual position value is compressed and encoded by adopting the first preset compression, the numerical value after the decimal point can be accurately stored, so that the data storage precision of low-precision maps such as the TGA maps is improved, the position value of a surface patch sampled by the low-precision maps such as the TGA maps is more accurate, the problem of large storage error of the position value of the surface patch caused by low data storage precision of the low-precision maps such as the TGA maps is avoided, and the situation of jumping of the frame animation is avoided; thereby improving the picture effect of the frame animation displayed on the low-end device.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic diagram of a scenario of a patch position information storage system provided in an embodiment of the present application;
fig. 2 is a schematic flowchart of an embodiment of a method for storing location information of a patch provided in an embodiment of the present application;
fig. 3 is a schematic view of a scene of a preset patch set provided in the present embodiment;
FIG. 4 is a schematic diagram of a storage structure of an information storage map provided in an embodiment of the present application;
FIG. 5 is a schematic view of a scene of an information storage map provided in an embodiment of the present application;
FIG. 6 is a schematic diagram of an interface of a data storage facility provided in an embodiment of the present application;
FIG. 7 is a diagram of a scenario in which the second set of UV positions of all selected patches are combined as provided in the example of the present application
Fig. 8 is a schematic structural diagram of a patch position information storage apparatus provided in an embodiment of the present application;
fig. 9 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only some embodiments of the present application, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application. Meanwhile, in the description of the embodiments of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance. Thus, features defined as "first", "second", may explicitly or implicitly include one or more of the described features. In the description of the embodiments of the present application, "a plurality" means two or more unless specifically defined otherwise.
The embodiment of the application provides a method and a device for storing patch position information, electronic equipment and a computer-readable storage medium.
Specifically, this embodiment will be described from the perspective of a patch position information storage device, which may be specifically integrated in an electronic device, that is, the patch position information storage method according to this embodiment may be executed by an electronic device, which may be a terminal, a server, or the like. The terminal can be a mobile phone, a tablet Computer, an intelligent bluetooth device, a notebook Computer, a touch screen, a game machine, or a Personal Computer (PC), and the like; the server may be a single server or a server cluster composed of a plurality of servers.
In some embodiments, the patch location information storage apparatus may also be integrated in a plurality of electronic devices, for example, the patch location information storage apparatus may be integrated in a plurality of servers, and the patch location information storage method of the present application is implemented by the plurality of servers. For another example, the patch position information storage apparatus may be integrated in a plurality of terminals, and the patch position information storage method of the present application is implemented by the plurality of terminals.
In some embodiments, the patch location information storage may also be integrated in the terminal and server clusters.
In some embodiments, the server may also be implemented in the form of a terminal, for example, a personal computer may be configured as the server to integrate the patch position information storage device, and the server configured by the personal computer is configured to implement the patch position information storage method of the present application.
For example, the method for storing location information of a patch according to the embodiment of the present application may be applied to a system for storing location information of a patch as shown in fig. 1. The patch position information storage system includes a terminal 101 and a server 102, and the terminal 101 may be a device including both receiving and transmitting hardware, that is, a device having receiving and transmitting hardware capable of performing bidirectional communication on a bidirectional communication link. The terminal 101 may specifically be a terminal device for running a game application, for example, the terminal 101 is specifically one of a mobile phone, a tablet computer, a notebook computer, and the like. The terminal 101 and the server 102 can perform bidirectional communication through a network, the server 102 can be used for storing information such as an actual position value and an actual index value of a patch to be stored, the terminal 101 acquires the actual position value and the actual index value of the patch to be stored from the server through the network, and the storage of the patch position information into an information storage map and the sampling of the information storage map for picture rendering are realized through a processor (such as a CPU (central processing unit), a GPU (graphics processing unit) or the like) of the terminal 101; the server 102 may be an independent server, or may be a server network or a server cluster composed of servers, which includes but is not limited to a computer, a network host, a single network server, multiple network server sets, or a cloud server composed of multiple servers. Among them, the Cloud server is constituted by a large number of computers or web servers based on Cloud Computing (Cloud Computing). For example, the terminal device 10 may obtain an actual position value and an actual index value of a patch to be stored; based on a first preset compression value, carrying out compression coding on the actual position value to obtain a position storage value of the actual position value, wherein the position storage value comprises a high position value and a low position value; based on a second preset compression value, carrying out compression coding on the actual index value to obtain an index storage value of the actual index value; and generating an information storage map of the to-be-stored patch according to the high-order position value, the low-order position value and the index storage value, wherein a first pixel point in the information storage map is used for storing the high-order position value and the index storage value, and a second pixel point in the information storage map is used for storing the low-order position value and the index storage value.
The following detailed description is made with reference to the accompanying drawings, respectively. It should be noted that the following description of the embodiments is not intended to limit the preferred order of the embodiments. Although a logical order is shown in the flow diagrams, in some cases, the steps shown or described may be performed in an order different than shown in the figures.
As shown in fig. 2, a specific flow of the method for storing patch position information may include steps 201 to 204, where:
201. and acquiring the actual position value and the actual index value of the surface patch to be stored.
The to-be-stored patch refers to a patch for which storage of a position value and an index value is required.
The actual position value refers to a position value to be recorded of a surface patch to be stored before uncompressed coding. The actual position value may specifically include a first coordinate value (e.g., coordinate value X1 on the X axis) of the patch to be stored on the first coordinate axis, a second coordinate value (e.g., coordinate value Y1 on the Y axis) on the second coordinate axis, and a third coordinate value (e.g., coordinate value Z1 on the Z axis) on the third coordinate axis, for example, the actual position value is (X1, Y1, Z1). For convenience of description, the first coordinate value, the second coordinate value, and the third coordinate value are X-axis coordinate value, Y-axis coordinate value, and Z-axis coordinate value, respectively, for example.
The actual index value refers to an index value to be recorded of a to-be-stored patch before uncompressed coding.
In order to clearly understand how the patch position storage method of this embodiment can store the position information of the frame animation special effect when a low-precision map such as a TGA map is used to record the frame animation special effect, the example that the map is an 8-bit map is taken as an example to explain in this method embodiment.
In step 201, there are various ways to obtain the actual position value and the actual index value, which exemplarily include:
1) The position value and the index value of each patch are stored in the preset database, and in step 201, the actual position value and the actual index value of the patch to be stored are directly read from the preset database.
2) And acquiring an actual position value and an actual index value in real time in the process of creating the to-be-stored surface patch. For convenience of understanding, taking as an example that the to-be-stored patch is one patch in the target patch set, and the position value and the index value of each patch in the target patch set are stored in the same information storage map, for example, the actual index value acquisition process of the to-be-stored patch may specifically include the following steps (1) to (3):
(1) and creating a patch to be stored, and adding the patch to a preset patch set. For example, a patch may be created in modeling software (e.g., 3ds max), added to a pre-set patch set, and set the coordinate position of the patch in the modeled scene coordinate system.
(2) And determining the selected patch from the preset patch set, and adding the selected patch into the target patch set.
For example, a modeler may select each patch from a preset set of patches, add the selected patch to the target set of patches, and use the selected order of the selected patches as an index value of the selected patch. For example, as shown in fig. 3, for convenience of illustration, each patch in the preset patch set is illustrated in a tiled arrangement in fig. 3 (therefore, the modeling scene coordinate system in fig. 3 only shows X and Y axes), and fig. 3 illustrates that the preset patch set includes 32 patches; assuming that 32 patches are all selected to be added to the target patch set, the selection order of each selected patch will be the index value of each selected patch.
(3) And traversing each patch in the target patch set, and taking the current traversed patch as the patch to be stored. Exemplarily, the coordinate position of the patch to be stored in the modeling scene coordinate system set in the step (1) during modeling may be used as the actual position value of the patch to be stored. And (3) taking the selected sequence of the surface patches to be stored in the step (2) as the actual index value of the surface patches to be stored.
Further, in order to improve the data storage precision of the information storage map, so as to improve the position recording accuracy of the special effect of the frame animation, and further improve the picture effect of the frame animation displayed by the low-end device, when the to-be-stored surface patch is created in the step (1), the coordinate values of the to-be-stored surface patch on the X axis, the Y axis and the Z axis of the modeling scene coordinate system are set in [0,10], so as to set the actual position value to be a value in the value range of [0,10 ].
In the step (2), after the patch is selected, whether the actual position value of the selected patch is within the value range [0,10] of the actual position value is checked; if the actual position value of the selected patch is within the value range [0,10] of the actual position value, adding the selected patch into the target patch set; if the actual position value of the selected patch is out of the value range [0,10] of the actual position value, the selected patch is not added into the target patch set, and a prompt that the position is not satisfactory is output (for example, "the x, y or z axis position value is less than the minimum value", "the x, y or z axis position value is greater than the maximum value", and the like).
For ease of understanding, the basic principle of storing position values into maps is first described below (here, HEX denotes hexadecimal, DEC denotes decimal):
1. range of color values for the map. Expressed in binary [0000, 1111 1111], in decimal [0, 255], in hexadecimal [00, ff ], for a total of 256 color values.
2. The range of the value range of the color values of the map [0,1]. Therefore, the actual storage values of 256 color values of [0, 255] in the 8-bit map are:
the 1 st color value is 0:0/255=0
The 2 nd color value is 1:1/255=0.0039215.
The 3 rd color value is 2:2/255=0.0078431.
...
256 th color value 255:255/255=1
It can be seen that, when 8-bit maps are used for storage, the following 2-aspect precision problems exist: (1) values with an accuracy higher than 1/255=0.0039215. (e.g., 0.001) cannot be stored; (2) the storage error of a more accurate stored value is larger (e.g., 0.1, which would be stored as an indeterminate value of 26/255=0.10196078.. Or 25/255= 0.09803921).
In order to effectively improve the data storage precision of the information storage map in step 204, so as to improve the position recording accuracy of the special effect of the frame animation, and further improve the picture effect of the frame animation displayed by the low-end device, the actual position value is set to be a value within a value range of [0,10] when the to-be-stored patch is created. And the data (such as the actual position value and the actual index value) is stored into the 8-bit map with the value range of [0,1] through a compression and encoding mode. The reason why the actual position value is set to the value within the value range of [0,10] can improve the data storage precision is described in the following (for details, see the section of "how the value range of the actual position value is [0,10] can affect the data storage precision", for example), and details are not described here.
Similarly, further, in order to improve the data storage precision of the information storage map and improve the index value recording accuracy of the frame animation special effect, the value range of the actual index value may also be set according to actual requirements, and if the value range of the actual index value is set to [0,120], at this time, in step (2), after the patch is selected, it is checked whether the number of the selected patches added to the target patch set exceeds a preset limited number (the preset limited number = the maximum value in the value range of the actual index value), that is, whether the index value of the selected patch is within the value range of the actual index value [0,120 ]; if the index value of the selected patch is within the value range [0,120] of the actual index value, adding the selected patch into the target patch set; otherwise, the selected patch is not added into the target patch set, and a prompt indicating that the number of the selected patches does not meet the requirement is output (for example, "the selection number of patches exceeds the maximum limit number 120").
202. And carrying out compression coding on the actual position value based on a first preset compression value to obtain a position storage value of the actual position value.
Wherein the position storage value comprises a high position value and a low position value.
The first preset compression value is a compression value used for compression-coding the actual position value. For example 6550.
The position storage value is a value obtained by compression-encoding an actual position value and stored in the information storage map.
Specifically, in order to ensure that the 3 bits behind the decimal point of the actual position value can be accurately stored, the first preset compression value is set to be greater than or equal to 1000, the actual position value is multiplied by the first preset compression value to perform compression coding, and the 3 bits behind the decimal point of the actual position value can be effectively reserved, so that the data storage precision of the information storage map in the step 204 is effectively improved, the position recording accuracy of the special effect of the frame animation is improved, and the picture effect of the frame animation displayed by the low-end device is further improved.
Illustratively, the step 202 may specifically include the following steps 2021 to 2025:
2021. and multiplying the actual position value by a first preset compression value to obtain a decimal value of the actual position value.
The actual position value is in a decimal format, and the first preset compression value is smaller than a decimal value corresponding to a maximum storage value formed by the first pixel point and the second pixel point. For convenience, the decimal value corresponding to the maximum storage value formed by the first pixel point and the second pixel point is simply referred to as the two-pixel maximum storage value. And the largest storage value formed by the first pixel point and the second pixel point is [ FFFF ].
As described later (see "one, for details, how selecting a value smaller than the maximum stored value of two pixels (e.g., 6550) as the first preset compressed value may affect the data storage accuracy"), the data storage accuracy of the actual position value may be improved by using a value smaller than the maximum stored value of two pixels as the first preset compressed value.
2022. And converting the decimal value of the actual position value to obtain a hexadecimal value of the actual position value.
2023. And splitting the hexadecimal value of the actual position value to obtain a high-order hexadecimal value and a low-order hexadecimal value of the actual position value.
2024. And acquiring the high-order position value based on the high-order hexadecimal value of the actual position value.
2025. And acquiring the lower position value based on the lower hexadecimal value of the actual position value.
The upper position value refers to the first four-digit value of the hexadecimal value of the actual position value.
The lower position value refers to the last four digits of the hexadecimal value of the actual position value.
For example, the X-axis coordinate value =0.123 and the first preset compression value =6550 in the actual position value (X-axis coordinate value, Y-axis coordinate value, Z-axis coordinate value) are taken as examples. Step 2021 to 2025:
first, the X-axis coordinate value is multiplied by a first preset compressed value to obtain a decimal value of the X-axis coordinate value (0.123): 0.123 × 6550=805.65 (DEC) = (reserved integer) 805 (DEC). Where the actual position value (e.g., 0.123) multiplied by 6550 has 2 effects: the method is used for reserving the data of 3 bits behind the decimal point of the actual position value and ensuring that the actual position value in the value range [0,10] can be stored.
Then, the decimal value of the actual position value is converted to obtain the hexadecimal value of the actual position value: 805 (DEC) =0325 (HEX).
Then, the hexadecimal value of the actual position value is split to obtain a high-order hexadecimal value and a low-order hexadecimal value of the actual position value: splitting 0325 into two parts: 03 (HEX) and 25 (HEX) so that data can be stored in both pixels (first and second pixel points).
Finally, acquiring a high-order position value based on the high-order hexadecimal value of the actual position value; the lower position value is obtained based on the lower hexadecimal value of the actual position value. Specifically, the high and low hexadecimal values are subjected to decimal conversion to obtain a high decimal value 03 (HEX) =3 (DEC) and a low decimal value 25 (HEX) =37 (DEC), respectively; then, the values are divided by 255 to obtain the high position value of 3/255 and the low position value of 37/255. Thus, the high position value of 3/255 and the low position value of 37/255 of the X-axis coordinate value (0.123) can be obtained.
Similarly, the high position value and the low position value of the coordinate values of the Y axis and the Z axis can be obtained. The high position values of the coordinate values of the X axis, the Y axis and the Z axis are respectively recorded as: a first high position value, a second high position value, a third high position value; the low position values of the coordinate values of the X axis, the Y axis and the Z axis are respectively recorded as: a first low-order position value, a second low-order position value, and a third low-order position value.
203. And performing compression coding on the actual index value based on a second preset compression value to obtain an index storage value of the actual index value.
The index storage value is a value obtained by compression-encoding an actual index value and stored in the information storage map.
There are various ways to obtain the index stored in step 203, which exemplarily includes:
(1) When the maximum value of the actual index value is less than or equal to 255, that is, when only one pixel point is used to store the actual index value accurately and completely. The maximum value of the actual index value is the second preset compression value, that is, only one pixel point is used to completely store the actual index value, so that the index storage values stored by the first pixel point and the second pixel point can be the same. At this time, the actual index value is multiplied by the second preset compression value by referring to the following step 2031 to obtain a decimal value of the actual index value; then, the decimal value of the actual index value is divided by 255 to obtain the result as the index storage value of the actual index value. For example, assuming that the maximum value of the actual index value is 15 and the second predetermined compressed value is 15, then (the maximum value of the actual index value 15 × the second predetermined compressed value 15) = ≦ 255, only one pixel is used to store the actual index value completely enough; at this time, a decimal value (i.e., 150) of the actual index value may be obtained by multiplying the actual index value (e.g., 10) by the second preset compression value (i.e., 15), and the index storage value =150/255.
(2) When the maximum value of the actual index value is larger than 255, that is, when only one pixel is not enough to completely store the actual index value any more. That is, the index storage value includes a high-order index value and a low-order index value, and the actual index value is compressed in a compression encoding manner similar to the actual position value in steps 2021 to 2025 to form the high-order index value and the low-order index value, which are stored in the first pixel point and the second pixel point, respectively. In this case, step 203 may specifically include the following steps 2031 to 2035:
2031. and multiplying the actual index value by a second preset compression value to obtain a decimal value of the actual index value.
Wherein, the second preset compression value refers to a compression value used for compression encoding the actual index value. Such as 500.
2032. And converting the decimal value of the actual index value to obtain a hexadecimal value of the actual index value.
2033. And splitting the hexadecimal value of the actual index value to obtain a high-order hexadecimal value and a low-order hexadecimal value of the actual index value.
2034. And acquiring the high-order index value based on the high-order hexadecimal value of the actual index value.
2035. And acquiring the lower index value based on the lower hexadecimal value of the actual index value.
The high-order index value refers to the first four-digit value of the hexadecimal value of the actual index value.
The lower position value refers to the last four digits of the hexadecimal value of the actual index value.
For example, the actual index value =120 and the second preset compression value =500 are taken as examples. In steps 2031 to 2035:
first, the actual index value is multiplied by a second preset compression value to obtain a decimal value of the actual index value: 120 × 500=60000 (DEC). Where, similar to the actual position value multiplied by 6550, the actual index value 120 multiplied by 500 acts to: the actual index values that are within the value range [0,120] are guaranteed to be stored. Since the range of values [0000, ffff ] (HEX) = [0,65535] (DEC) that two pixels can store needs to ensure that the product of the second predetermined compressed value and the maximum value in the range of values of the actual index value is < 65535 (i.e., the second predetermined compressed value is 120 < 65535) to ensure that the actual index value in the range of values [0,120] is stored, the second predetermined compressed value needs to be < (65535/120), i.e., the second predetermined compressed value is < 546.125, so the second predetermined compressed value is =500 here. It can be understood that, taking the value range of the actual index value [0,120] as an example, the value of the second preset compression value is described, when the value range of the actual index value changes, the maximum value in the value range of the actual index value changes accordingly, and the second preset compression value also changes accordingly, but in order to improve the storage precision of the actual index value, at least the following requirements are satisfied: the product of the second predetermined compressed value and the maximum value in the range of values of the actual index value is < 65535.
Then, the decimal value of the actual index value is converted to obtain the hexadecimal value of the actual index value: 60000 (DEC) = EA60 (HEX).
Then, splitting the hexadecimal value of the actual index value to obtain a high-order hexadecimal value and a low-order hexadecimal value of the actual index value: EA60 was split into two parts: EA (HEX) and 60 (HEX), which allows data to be stored in two pixels (first and second pixel points).
Finally, acquiring a high-order index value based on the high-order hexadecimal value of the actual index value; based on the lower hexadecimal value of the actual index value, the lower index value is obtained. Specifically, the high and low hexadecimal values are subjected to decimal conversion to obtain a high decimal value EA (HEX) =234 (DEC) and a low decimal value 60 (HEX) =96 (DEC), respectively; then, the high position value is 234/255 and the low position value is 96/255 by dividing 255 respectively.
It can be seen that by multiplying the actual index value by the second preset compression value, the storage error of the actual index value can be compressed, and the storage error decreases as the second preset compression value increases. Therefore, when the actual index value is stored using one pixel, in order to reduce the storage error of the actual index value as much as possible and ensure that the index storage value can be stored completely, the second preset compressed value may be made as large as possible on the premise that (the maximum value of the actual index value × the second preset compressed value) ≦ 255, that is, the second preset compressed value may be made ≦ 255/the maximum value of the actual index value, for example, when the maximum value of the actual index value is 15, the second preset compressed value =255/15=17 may be made. When the actual index value is stored using two pixels, in order to reduce the storage error of the actual index value as much as possible and ensure that the index storage value can be stored completely, the second preset compression value may be made as large as possible on the premise that (the maximum value of the actual index value × the second preset compression value) ≦ 65535, that is, the second preset compression value may be made ≦ 65535/the maximum value of the actual index value, for example, when the maximum value of the actual index value is 131, the second preset compression value =65535/131 ≈ 500 (taking an integer).
204. And generating an information storage map of the to-be-stored patch according to the high-order position value, the low-order position value and the index storage value.
Wherein, the first pixel point in the information storage map is used for storing the high-order position value and the index storage value, and the second pixel point in the information storage map is used for storing the low-order position value and the index storage value.
Referring to fig. 4 and fig. 5, for example, step 204 may specifically include the following steps 2041 to 2043:
2041. and acquiring the storage pixel position of the surface patch to be stored.
Wherein the storage pixel storage location comprises a pixel location of the upper bit position value and a pixel location of the lower bit position value.
Wherein the pixel position of the high-order position value is used to indicate the row coordinate and the column coordinate of the high-order position value in the information storage map.
Wherein the pixel position of the lower position value is used to indicate the row coordinate and the column coordinate of the lower position value in the information storage map.
In step 2041, there are various ways to obtain the position of the storage pixel, which illustratively includes:
(1) In some embodiments, two pixel positions may be randomly selected as the pixel position of the high bit position value and the pixel position of the low bit position value of the patch to be stored.
For example, the pixel position of the high-order position value and the pixel position of the low-order position value of the 1 st patch in the target patch set are respectively the 1 st row and the 1 st column of the 3 rd row of the map; the pixel positions of the high-order position value and the low-order position value of the 2 nd patch are respectively the 2 nd row and the 2 nd column, the 2 nd row and the 1 st column, \8230ofthe map.
(2) In some embodiments, as shown in fig. 4 and fig. 5, the high-order position value of the actual position value of each patch in the target patch set may be recorded on the same row of pixels of the information storage map, and the low-order position value may be recorded on the same row of pixels of the information storage map. That is, for a single patch to be stored, the pixel position of the high-order position value obtained in step 2041 is the same as the mapping column coordinate corresponding to the pixel position of the low-order position value.
The column coordinate and the row coordinate of the map are respectively the column coordinate and the row coordinate of the high-order position value or the low-order position value in the information storage map.
For example, pixel positions of high position values of 1 st, 2 nd, \ 8230, 32 th patches in the target patch set are respectively row 1 st column, row 2 nd column, \ 8230, row 1 st column 32, pixel positions of low position values are respectively row 2 nd column, \ 8230, row 2 nd column 32; it can be seen that the column coordinates of the same patch (i.e., the patch to be stored) are the same (e.g., the column coordinate of the 1 st patch high position value is).
Because one information storage map usually stores the actual position values of a plurality of patches, and the scanning of the map is usually performed according to line-by-line scanning, the high-order position values of the actual position values of all patches in a target patch set are recorded on the same row of pixel points of the information storage map, and the low-order position values are recorded on the same row of pixel points of the information storage map, so that all the high-order position values and the low-order position values in the information storage map can be read only by scanning two rows of pixels in the information storage map during subsequent scanning and reading. Therefore, the speed of reading all the high-order position values and the low-order position values in the information storage map in the subsequent process (such as decoding) can be improved by recording the high-order position values of the actual position values of all the patches in the target patch set on the same row of pixel points of the information storage map and recording the low-order position values on the same row of pixel points of the information storage map.
(3) In some embodiments, the high-order position value of the actual position value of each patch in the target patch set may also be recorded on the same row of pixels in the information storage map, and the low-order position value may also be recorded on the same row of pixels in the information storage map. That is, the pixel position of the high-order position value obtained in step 2041 is the same as the map line coordinate corresponding to the pixel position of the low-order position value.
Similarly, when the mapping is scanned column by column, the high-order position value of the actual position value of each mapping in the target mapping set is recorded on the same column of pixel points of the information storage mapping, and the low-order position value is recorded on the same column of pixel points of the information storage mapping, so that all the high-order position values and the low-order position values in the information storage mapping can be read only by scanning two columns of pixels in the information storage mapping during subsequent scanning and reading; thereby improving the speed of reading all the high-order position values and low-order position values in the information storage map in the subsequent process (such as decoding).
2042. Generating the first pixel point at a pixel position of the high-order position value based on the high-order position value and the index storage value.
In some embodiments, the high position value includes a first coordinate value of the patch to be stored in the first coordinate axis, a second coordinate value of the patch to be stored in the second coordinate axis, and a third coordinate value of the patch to be stored in the third coordinate axis, and the first high position value (i.e., a high position value of the X-axis coordinate value), the second high position value (i.e., a high position value of the Y-axis coordinate value), and the third high position value (i.e., a high position value of the Z-axis coordinate value) are obtained after performing compression coding respectively. Referring to fig. 4, for example, step 2042 may specifically include the following steps A1 to A4:
a1, setting the first high-order position value as an R channel value of the pixel position of the high-order position value to generate a first pixel point of which the R channel stores the first high-order position value.
And A2, setting the second high-order position value as a G channel value of the pixel position of the high-order position value to generate a first pixel point of which the G channel stores the second high-order position value.
And A3, setting the third high-order position value as a B channel value of the pixel position of the high-order position value to generate a first pixel point of which the B channel stores the third high-order position value.
And A4, setting the index storage value as an A-channel value of the pixel position of the high-order position value to generate a first pixel point of which the A-channel stores the index storage value.
For example, as shown in fig. 4, the position values and the index values of 32 patches in the target patch set are all stored in the same information storage map, and the index storage values include the upper index value and the lower index value. Suppose that:
the actual stored value (x 1, y1, z 1) for patch 1 is compressed and encoded as above in step 202 to obtain the high-order position value
Figure BDA0003955390130000141
Low position value->
Figure BDA0003955390130000142
Wherein it is present>
Figure BDA0003955390130000143
Is the high position value of the coordinate values of the X axis, the Y axis and the Z axis of the 1 st patch respectively>
Figure BDA0003955390130000144
The low position values of the coordinate values of the X axis, the Y axis and the Z axis of the 1 st patch are respectively.
The actual stored values (x 2, y2, z 2) for the 2 nd patch are compressed and encoded as in step 202 above to obtain the high-order position values
Figure BDA0003955390130000145
Low position value->
Figure BDA0003955390130000146
The actual stored values (x 32, y32, z 32) for the 32 th patch are compression encoded as in step 202 above to obtain the high-order position values
Figure BDA0003955390130000147
Low position value->
Figure BDA0003955390130000148
After step 2041, pixel positions of high-order position values of 1 st, 2 nd, \ 8230, 32 th patches are determined as follows: line 1, column 1, line 1, column 2, \ 8230, line 1, column 32; pixel positions of high position values of 1 st, 2 nd, \8230, 32 th patches are respectively: line 2, column 1, line 2, column 2, \ 8230, line 2, column 32.
In this case, in steps A1 to A4, the high position value of the X-axis, Y-axis, Z-axis coordinate value of the 1 st patch may be set
Figure BDA0003955390130000151
Respectively setting the channel values of an R channel, a G channel, a B channel and an A channel of the 1 st row and 1 st column pixel points; the high position value of the coordinate values of the X axis, the Y axis and the Z axis of the 2 nd patch is determined>
Figure BDA0003955390130000152
Respectively setting the channel values of an R channel, a G channel, a B channel and an A channel of the 1 st row and 2 nd column pixel points; 8230; the high position value of the X-axis, Y-axis and Z-axis coordinate values of the 32 th patch is determined>
Figure BDA0003955390130000153
And setting the channel values of the R channel, the G channel, the B channel and the A channel of the 1 st row and 32 th column pixel points respectively.
2043. Generating the second pixel point at a pixel location of the low position value based on the low position value and the index storage value.
In some embodiments, the low-order position value includes a first coordinate value of the to-be-stored patch in the first coordinate axis, a second coordinate value in the second coordinate axis, and a third coordinate value in the third coordinate axis, and the first low-order position value (i.e., a low-order position value of the X-axis coordinate value), the second low-order position value (i.e., a low-order position value of the Y-axis coordinate value), and the third low-order position value (i.e., a low-order position value of the Z-axis coordinate value) are obtained after performing compression coding, respectively. Exemplarily, step 2043 may specifically include the following steps B1 to B4:
and B1, setting the first low-order position value as an R channel value of the pixel position of the low-order position value to generate a second pixel point of which the R channel stores the first low-order position value.
And B2, setting the second low-order position value as a G channel value of the pixel position of the low-order position value to generate a second pixel point of which the G channel stores the second low-order position value.
And B3, setting the third low-order position value as a B-channel value of the pixel position of the low-order position value to generate a second pixel point of which the B-channel stores the third low-order position value.
And B4, setting the index storage value as an A-channel value of the pixel position of the low-order position value to generate a second pixel point of which the A-channel stores the index storage value.
For convenience of understanding, the following description is continued with the examples in the above steps A1 to A4, and in the steps B1 to B4, the lower position values of the X-axis, Y-axis and Z-axis coordinate values of the 1 st patch may be set
Figure BDA0003955390130000154
Respectively setting channel values of an R channel, a G channel, a B channel and an A channel of the 2 nd row and 1 st column pixel points; the low position values of the X-axis, Y-axis and Z-axis coordinate values of the 2 nd patch
Figure BDA0003955390130000161
Respectively setting channel values of an R channel, a G channel, a B channel and an A channel of the 2 nd row and 2 nd column pixel points; 8230; the low position value of the X-axis, Y-axis and Z-axis coordinate values of the 32 th patch is determined>
Figure BDA0003955390130000162
And setting the channel values of the R channel, the G channel, the B channel and the A channel of the 2 nd row and 32 nd column pixel points respectively.
Thus, row 1, column 1, row 1, column 2, \ 8230can be generated, and high-order position values can be stored in the row 1, column 32 pixel point positions
Figure BDA0003955390130000163
Figure BDA0003955390130000164
The low-order position values are stored in the pixel point positions of the 1 st row and the 2 nd column of the 2 nd row and the 32 nd column of the 2 nd row respectively
Figure BDA0003955390130000165
The information storage map of (2).
Further, in order to reduce the data processing amount when reading the actual position value and the actual index value of the patch to be stored from the information storage map (for example, when sampling the information storage map for screen rendering), when generating the information storage map in step 204, the number of patches in the target patch set may be used as the number of horizontal pixels of the information storage map to be generated, that is, the number of pixel columns of the generated information storage map = the number of patches of the target patch set. In this case, step 204 may specifically include: acquiring the number of patches of a target patch set; and generating the information storage map according to the number of the patches, the high-order position value, the low-order position value and the index storage value. And the number of pixel columns of the information storage map is the same as the number of the patches. For example, if the number of patches in the target patch set =32, an information storage map with pixel column number =32 may be generated. The pixel column number of the information storage mapping = the number of patches of the target patch set is enough to store all patches in the target patch set, and all pixel points in a row of pixels are used for data storage of the patches at the moment, so that redundant pixel points do not need to be scanned, and the data processing amount when the actual position value and the actual index value of the patch to be stored are read from the information storage mapping can be reduced.
Similarly, the number of pixel lines of the generated information storage map may be set to 2 to reduce the data processing amount when reading the actual position value and the actual index value of the patch to be stored from the information storage map.
Further, when the actual position value and the actual index value of the patch to be stored need to be read from the information storage map, for example, when the information storage map is sampled for picture rendering, the position storage value and the index storage value stored in the information storage map by compression coding need to be decoded and restored, where the decoding process of the position storage value may include the following steps D1 to D3:
and D1, decoding the high-order position value stored by the first pixel point to obtain a high-order decoded value of the high-order position value.
And D2, decoding the low-order position value stored in the second pixel point to obtain a low-order decoded value of the low-order position value.
And D3, splicing the high-order decoded value of the high-order position value and the low-order decoded value of the low-order position value to obtain the decoded position value of the to-be-stored patch.
For convenience of understanding, the following description is continued with the example of steps 2021 to 2025, for example, after performing compression coding on the X-axis coordinate value =0.123, the high-order position value 3/255 and the low-order position value 37/255 are obtained, that is, steps D1 to D3, first, the high-order position value 3/255 stored in the first pixel is decoded: the high position value of 3/255 needs to be multiplied by 255 × 256, i.e., (3/255) × 255 × 256=768 (DEC). Decoding the low-order position value 37/255 stored in the first pixel point: the low order position value needs to be multiplied by 255, i.e. (37/255) × 255=37 (DEC). Then, the upper decoded value 768 (DEC) of the upper position value and the lower decoded value 37 (DEC) of the lower position value are concatenated to obtain a decoded position value of the X-axis coordinate value: decoding position value = (lower decoded value + upper decoded value)/6550 = (37 + 768)/6550 ≈ 0.1229007 ≈ 0.123. Similarly, the decoding position values of the coordinate values of the Y axis and the Z axis can be obtained, so that the decoding position values of the surface patches to be stored can be complete.
Similarly, if the index storage value is stored in two pixels in a split manner, that is, the index storage value includes a higher index value and a lower index value, the decoding process of the index storage value may include the following steps E1 to E3:
e1, decoding the high-order index value stored in the first pixel point to obtain a high-order decoded value of the high-order index value.
And E2, decoding the low-order index value stored in the second pixel point to obtain a low-order decoded value of the low-order index value.
And E3, splicing the high-order decoded value of the high-order index value and the low-order decoded value of the low-order index value to obtain the decoded index value of the to-be-stored patch.
Therefore, when the information storage map is adopted to render the model to be rendered, the position storage value and the index storage value which are stored in the information storage map by the compression coding are decoded and restored to obtain a decoding position value and a decoding index value of the surface patch to be stored; and rendering the patch effect rendered by the patch to be stored into the model to be rendered according to the decoding position value and the decoding index value of the patch to be stored.
Some data bases that the method of the present embodiment can improve the data storage accuracy when 8-bit maps store data (such as actual position values) are given below:
1. what is needed is a first pre-defined compression value that is selected to be less than the maximum stored value of two pixels (e.g., 6550) to affect data storage accuracy.
In order to ensure that the last 3 bits of the decimal point of the actual position value can be accurately stored, it is necessary to multiply the actual position value by a value above 1000 (i.e., the first preset compression value ≧ 1000). And the range of value range that two pixels can store is [0000, ffff ] (HEX) = [0,65535] (DEC), and since the storable range needs to be kept [0,10], 65535/10=6553.5, and 6550 is multiplied instead of 6553.5 because a part can be left, preventing the result after multiplication from exceeding 65535. Taking the actual position value =10 as an example, the compression encoding and decoding process of the actual position value is as follows:
if the result is multiplied by 6550:
(1) when compressing and encoding, the steps 2021 to 2022 are executed: 10 × 6550=65500 (DEC) = FFDC (HEX); of these, 10 times 6550 are used to retain the data of 3 bits after the decimal point.
Then, step 2023 to 2025 are executed: the FFDC is split into two parts: FF (HEX) and DC (HEX), which can store data in two pixels (first and second pixel points), FF (HEX) =255 (DEC) and DC (HEX) =220 (DEC). I.e., 255/255 for the high position value and 220/255 for the low position value.
(2) In decoding, steps D1 to D3 are performed:
the low order position value needs to be multiplied by 255, i.e. (220/255) × 255=220 (DEC).
The high position value needs to be multiplied by 255 × 256, i.e., (255/255) × 255 × 256=65280 (DEC).
The resulting decoded position value = (lower decoded value + upper decoded value)/6550 = (220 + 65280)/6550 =10.
If the result is multiplied by 6553:
compression encoding: 6553 × 10=65530 (DEC) = FFFA (HEX), and is divided into FF (HEX) =255 (DEC) and FA (HEX) =250 (DEC), and the upper position value =255/255 and the lower position value =250/255.
And (3) decoding: the lower position value is (250/255) × 255=250 (DEC), the upper position value is (255/255) × 255 × 256=65280 (DEC), and the finally obtained decoded position value = (lower decoded value + upper decoded value)/6553 = (250 + 65280)/6553 ≈ 10.0610407 ≈ 10.061.
It can be seen that if the first predetermined compression value is greater than 6550, the calculation result will be exceeded, which results in the decoded position value being greater than the actual position value, thereby causing the storage accuracy to be reduced. Therefore, the first preset compression value is set to a value smaller than 6553, and the data storage accuracy can be improved.
2. The data storage precision can be influenced by the value range of the actual position value [0,10 ]. Referring to table 1, the following describes how the data storage accuracy can be improved when 8-bit map storage data (such as actual position values) is stored by setting the actual position values to values within the value range of [0,10], by taking as an example that the value ranges of the actual position values are [0,10], [0,100], [0,1000], respectively, and storing by using 2-bit pixels (that is, 65535 stored values can be stored in total and 6550, 655, 65 compressed values, respectively) as an example.
In view of the above, when storing color values, a pixel may have an error, for example, hexadecimal, such as: f may be recorded as E, 3 may be recorded as 2 or 4.
1. Error of [0,10 ]. Take the actual position value =10 as an example:
and (3) encoding: 10 × 6550=65500 (DEC) = FFDC (HEX) = > high-order FF (HEX), low-order DC (HEX).
There may be an error: FF-1= fe (HEX) =254 (DEC), DC-1= db (HEX) =219 (DEC).
Decoding to obtain: (254 + 256+ 219)/6550 ≈ 9.960763358778626.
The error is: 10-9.960763358778626=0.039236641221374.
2. Error of [0,100 ]. Take the actual position value =100 as an example:
and (3) encoding: 100 × 655=65500 (DEC) = FFDC (HEX) = > high-order FF (HEX), low-order DC (HEX).
There may be an error: FF-1= fe (HEX) =254 (DEC), DC-1= db (HEX) =219 (DEC).
Decoding to obtain: (254 + 256+ 219)/655 ≈ 99.6076.
The error is: 100-99.6076=0.3924.
3. Error of [0,1000 ]. Take the actual position value =1000 as an example:
and (3) encoding: 1000 × 65=65500 (DEC) = FFDC (HEX) = > high-order FF (HEX), low-order DC (HEX).
There may be an error: FF-1= fe (HEX) =254 (DEC), DC-1= db (HEX) =219 (DEC).
Decoding to obtain: (254 x 256+ 219)/65 x 1003.7384.
The error is: 1000-1003.7384= -3.7384.
It can be seen that, also when two pixels are used (range of value range [0000, ffff ]), the larger the range of value of the actual position value, the larger the error.
TABLE 1
Value range [0,10] [0,100] [0,1000]
Error of the measurement 0.039236641221374 0.3924 -3.7384
3. The 2 pixels of the map are selected for storing an actual position value, which may affect the data storage accuracy.
If 3 pixels are used for storage, the error will also exist, and the maximum error value will be changed from 0101 (HEX) to 010101 (HEX), and the error will become larger. Wherein, the stored value corresponding to each pixel has an error of 01, and the error value 0101 (HEX) is composed of an error of 01 of the high position value and an error of 01 of the low position value; 010101 (HEX) is composed of the 01 error of the original high position value, the 01 error of the low position value, and the 01 error of the stored value of the third pixel. To ensure that the error value is still 0.0393, the range of the value range that can be saved is still [0,1], and the range of the value range is not enlarged, but the data processing amount required by adding one pixel is increased, which is meaningless.
If 1 pixel storage is used, the range of storable value ranges is [00,FF ], i.e., [0,256], and if three decimal places are to be reserved, the storage cannot be completed in this pixel. (since it is necessary to multiply 1000 by at least three bits after the decimal point is reserved, 1001 is obtained even if 1000 is multiplied by 1.001, and 1001> -256 is obtained, and therefore, data of three bits after the decimal point cannot be stored).
Therefore, the 2 pixels are used for storing an actual position value, so that the data storage precision can be improved on the basis of improving the range of the stored value range and reducing the processing amount of the stored data.
For better understanding, please refer to fig. 3, fig. 4, and fig. 5, the method for storing patch position information in this embodiment will be described below with reference to the case where a patch is created in an actual service scene, a value range of an actual position value is [0,10], and a value range of an actual index value is [0,120], and how to store the actual position value and the actual index value of the patch; at this time, the storing process includes:
1. creating a patch in 3ds max to obtain a preset patch set containing 32 patches as shown in fig. 3, wherein the coordinate values of the X axis, the Y axis and the Z axis of the created patch are all within [0,10], and the actual position values of the patch are formed according to the coordinate values of the X axis, the Y axis and the Z axis of the patch.
2. And (3) fully selecting the first patch to the last patch of the preset patch set (at this time, the selected sequence is the recorded actual index value), and obtaining the target patch set. As shown in fig. 6, clicking "render patch position and order" in the data storage tool interface shown in fig. 6 may set the actual position value and the actual index value of each patch.
3. As shown in fig. 6, click the "output picture" button in the data storage tool and proceed to step four. In FIG. 6, the "selected UV channel" is set to "UV2", indicating the location where the output is the second set of UV.
4. The data storage tool can automatically calculate and output the information storage map, and the tool algorithm comprises the following steps (1) to (7):
(1) and after clicking the [ output picture ] button, acquiring the selected tiles according to the selected sequence of the tiles and storing the selected tiles in the array object _ array.
(2) And checking the patch. The selected patch is inspected after finishing the storage, including:
1) If the target patch set is less than or equal to 0, the patch is not selected, and the inspection is not passed;
2) If the number of patches in the target patch set is greater than the maximum number of objects defined by the tool (i.e., > the maximum value of the value range of the actual index value), the target patch set will not pass the inspection in order to ensure the accuracy;
3) Checking all the selected patches in the array, and checking whether the actual position values are within a set minimum and maximum range (namely whether the actual position values are within a value range [0,10 ]);
4) If the coordinate value of any axis of the XYZ axes of the selected patch is less than the minimum value (namely 0), the check is failed;
5) If the coordinate value of any of the XYZ axes of the selected patch > the maximum value (i.e., 10), the check is not passed.
(3) If the check is passed, the number of selected patches is recorded, and the number of horizontal pixels of the map (the number of pixel columns = the pixel length = the number of selected patches) is stored as information, as shown in fig. 4.
(4) And selecting and storing the output position of the map, and if the output position is empty, canceling the storage.
Specifically, after clicking the "output picture" button, if the check of the check patch in step (2) passes, a window for selecting a storage location pops up, if clicking the "save" button, the name (including a path) of the file is recorded, and if clicking the "cancel" button, a null value is returned.
(5) If the position for storing the map is not null, traversing all the selected patches in the target patch set, setting and storing data one by one, and executing the following steps 1) to 5 aiming at the traversed current patch:
1) Obtain [ UVW expansion ] modifier for the current patch (english name: unwrap UVW);
2) Setting a uv channel of the current patch as a second set of uv through an Unwrap _ UVW modifier of the current patch;
3) Since all subsequently selected patches need to be merged into one patch, the UV of all selected patches will be merged together. However, UV merging together results in the entire map being sampled for each selected patch, which results in inaccurate sampling of the pixels corresponding to each selected patch index value, and therefore requires shifting and scaling, where:
the first set of UV of the 1 st surface patch can completely sample frame animation chartlet information;
zooming and moving the second set of UV of the 1 st patch to the 1 st position to ensure that the 1 st vertical row of information can be sampled;
zooming and moving the second set of UV of the 2 nd patch to the 2 nd position to ensure that the 2 nd vertical row of information can be sampled;
scaling and moving the second set of UV of the 32 th patch to the 32 nd position to ensure that the 32 nd vertical row of information can be sampled;
combining the second set of UV of 32 patches to obtain the positions of the second set of UV of all selected patches, as shown in FIG. 7, wherein the position of each black dot in FIG. 7 represents the position of the second set of UV of one patch; wherein the position of the second set of UV for each selected patch corresponds to the pixel position stored in the derived information storage map, as shown in fig. 7 (the positions of the second set of UV for 32 patches are shown in fig. 7) and fig. 5 (the situation of storing the actual position values and the actual index values of 32 patches is shown in fig. 5, and each matrix box in fig. 5 represents a pixel).
4) The settings of the Unwrap _ UVW modifier are saved.
5) The data of the current patch is stored. (that is, the actual position value and the actual index value of the current patch are recorded, and the specific storage manner may refer to the description about the storage of the actual position value and the actual index value of the patch to be stored, which is not described herein again)
(6) And after the data storage of the current patch is finished, starting to store the map according to the stored data rendering information.
And (4) storing the rendered information storage map to the output position selected in the step (4), wherein the pixel length of the rendered information storage map = the number of the selected patches = the number of patches in the target patch set.
(7) And after finishing, popping up a prompt box to prompt that rendering is finished, and storing the obtained information map.
From the above, the actual position value of the patch to be stored is compressed and encoded into the high position value and the low position value, and 2 different pixel points (a first pixel point and a second pixel point) in the information storage map are adopted to store the high position value and the low position value respectively; on the first hand, compared with 1 pixel, 2 pixels are adopted for storing an actual position value, and the data storage precision can be improved on the basis of improving the range of the stored value range; in a second aspect, after the actual position value is compressed and encoded by adopting the first preset compression, the numerical value after the decimal point can be accurately stored, so that the data storage precision of low-precision maps such as the TGA maps is improved, the position value of a surface patch sampled by the low-precision maps such as the TGA maps is more accurate, the problem of large storage error of the position value of the surface patch caused by low data storage precision of the low-precision maps such as the TGA maps is avoided, and the situation of jumping of the frame animation is avoided; thereby improving the picture effect of the frame animation displayed on the low-end device.
In order to better implement the above method, the present application further provides a patch location information storage apparatus, which may be specifically integrated in an electronic device, for example, a computer device, where the computer device may be a terminal, a server, or the like. The terminal can be a mobile phone, a tablet computer, an intelligent Bluetooth device, a notebook computer, a personal computer and other devices; the server may be a single server or a server cluster composed of a plurality of servers.
For example, in this embodiment, a method according to the embodiment of the present application will be described in detail by taking an example in which a patch position information storage device is specifically integrated in a smart phone.
For example, as shown in fig. 8, the patch position information storage means may include:
an obtaining unit 801, configured to obtain an actual position value and an actual index value of a patch to be stored;
a first compression unit 802, configured to perform compression coding on the actual position value based on a first preset compression value to obtain a position storage value of the actual position value, where the position storage value includes a higher position value and a lower position value;
a second compression unit 803, configured to perform compression coding on the actual index value based on a second preset compression value, to obtain an index storage value of the actual index value;
a storage unit 804, configured to generate an information storage map of the to-be-stored patch according to the high-order position value, the low-order position value, and the index storage value, where a first pixel point in the information storage map is used to store the high-order position value and the index storage value, and a second pixel point in the information storage map is used to store the low-order position value and the index storage value.
In some embodiments, the storage unit 804 is specifically configured to:
acquiring a storage pixel position of the to-be-stored patch, wherein the storage pixel position comprises a pixel position of the high-order position value and a pixel position of the low-order position value;
generating the first pixel point at a pixel position of the high-order position value based on the high-order position value and the index storage value;
generating the second pixel point at a pixel location of the low position value based on the low position value and the index storage value.
In some embodiments, the actual position value includes a first coordinate value of the to-be-stored patch in a first coordinate axis, a second coordinate value of the to-be-stored patch in a second coordinate axis, and a third coordinate value of the to-be-stored patch in a third coordinate axis, and the high position value includes a first high position value, a second high position value, and a third high position value obtained by respectively performing compression coding on the first coordinate value, the second coordinate value, and the third coordinate value; the storage unit 804 is specifically configured to:
setting the first high-order position value as an R channel value of a pixel position of the high-order position value to generate a first pixel point of which the R channel stores the first high-order position value;
setting the second high-order position value as a G channel value of the pixel position of the high-order position value to generate a first pixel point of which the G channel stores the second high-order position value;
setting the third high-order position value as a B channel value of the pixel position of the high-order position value to generate a first pixel point of which the B channel stores the third high-order position value;
and setting the index storage value as an A-channel value of the pixel position of the high-order position value to generate a first pixel point of which the A-channel stores the index storage value.
In some embodiments, the actual position value includes a first coordinate value of the to-be-stored patch in a first coordinate axis, a second coordinate value of the to-be-stored patch in a second coordinate axis, and a third coordinate value of the to-be-stored patch in a third coordinate axis, and the low position value includes a first low position value, a second low position value, and a third low position value obtained by respectively performing compression coding on the first coordinate value, the second coordinate value, and the third coordinate value; the storage unit 804 is specifically configured to:
setting the first low-order position value as an R channel value of the pixel position of the low-order position value to generate a second pixel point of which the R channel stores the first low-order position value;
setting the second low-order position value as a G channel value of the pixel position of the low-order position value to generate a second pixel point of which the G channel stores the second low-order position value;
setting the third low-order position value as a B channel value of the pixel position of the low-order position value to generate a second pixel point of which the B channel stores the third low-order position value;
and setting the index storage value as an A-channel value of the pixel position of the low-order position value to generate a second pixel point of which the A-channel stores the index storage value.
In some embodiments, the mapping column coordinates corresponding to the pixel position of the high position value are the same as the mapping column coordinates corresponding to the pixel position of the low position value.
In some embodiments, the first compression unit 802 is specifically configured to:
multiplying the actual position value by a first preset compression value to obtain a decimal value of the actual position value, wherein the actual position value is in a decimal format;
converting the decimal value of the actual position value to obtain a hexadecimal value of the actual position value;
splitting the hexadecimal value of the actual position value to obtain a high-order hexadecimal value and a low-order hexadecimal value of the actual position value;
acquiring the high-order position value based on the high-order hexadecimal value of the actual position value;
and acquiring the lower position value based on the lower hexadecimal value of the actual position value.
In some embodiments, the index storage values include a higher index value and a lower index value, and the second compression unit 803 is specifically configured to:
multiplying the actual index value by a second preset compression value to obtain a decimal value of the actual index value;
converting the decimal value of the actual index value to obtain a hexadecimal value of the actual index value;
splitting the hexadecimal value of the actual index value to obtain a high-order hexadecimal value and a low-order hexadecimal value of the actual index value;
acquiring the high-order index value based on the high-order hexadecimal value of the actual index value;
and acquiring the lower index value based on the lower hexadecimal value of the actual index value.
In some embodiments, the patch position information storage apparatus further includes a decoding unit (not shown in the figure), where the decoding unit is specifically configured to:
when the information storage map is adopted to render a model to be rendered, decoding the high-order position value stored by the first pixel point to obtain a high-order decoded value of the high-order position value;
decoding the low-order position value stored in the second pixel point to obtain a low-order decoded value of the low-order position value;
splicing the high-order decoded value and the low-order decoded value to obtain a decoding position value of the to-be-stored patch;
and rendering the patch effect of the patch to be stored to the model to be rendered based on the decoding position value.
In some embodiments, the to-be-stored patches are patches in a target patch set, and the storage unit 804 is specifically configured to:
acquiring the number of patches of the target patch set;
and generating the information storage map according to the number of patches, the high-order position value, the low-order position value and the index storage value, wherein the number of pixel columns of the information storage map is the same as the number of patches.
In some embodiments, the information storage map is an 8-bit map, and the actual position value ranges from 0 to 10.
In some embodiments, the information storage map is used to record a position value and an index value of each patch in a target patch set, and before acquiring an actual position value and an actual index value of a patch to be stored, the acquiring unit 801 is specifically configured to:
determining a selected patch from a preset patch set;
if the position value of the selected surface patch is within the value range of the actual index value and the index value of the selected surface patch is within the value range of the actual index value, adding the selected surface patch into a target surface patch set;
and traversing each patch in the target patch set, and taking the current traversed patch as the patch to be stored.
Therefore, the patch position information storage device provided by the embodiment of the application can bring the following technical effects: compressing and coding the actual position value of the surface patch to be stored into a high position value and a low position value, and respectively storing the high position value and the low position value by adopting 2 different pixel points (a first pixel point and a second pixel point) in an information storage map; on the first hand, compared with 1 pixel, 2 pixels are adopted for storing an actual position value, and the data storage precision can be improved on the basis of improving the range of the stored value range; in a second aspect, after the actual position value is compressed and encoded by adopting the first preset compression, the numerical value after the decimal point can be accurately stored, so that the data storage precision of low-precision maps such as the TGA maps is improved, the position value of a surface patch sampled by the low-precision maps such as the TGA maps is more accurate, the problem of large storage error of the position value of the surface patch caused by low data storage precision of the low-precision maps such as the TGA maps is avoided, and the situation of jumping of the frame animation is avoided; thereby improving the picture effect of the frame animation displayed on the low-end device.
Correspondingly, the embodiment of the present application further provides an electronic device, where the electronic device may be a terminal, and the terminal may be a terminal device such as a smart phone, a tablet Computer, a notebook Computer, a touch screen, a game machine, a Personal Computer (PC), a Personal Digital Assistant (PDA), and the like. As shown in fig. 9, fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present application. The electronic device 900 includes a processor 901 with one or more processing cores, a memory 902 with one or more computer-readable storage media, and a computer program stored on the memory 902 and executable on the processor. The processor 901 is electrically connected to the memory 902. Those skilled in the art will appreciate that the electronic device configurations shown in the figures do not constitute limitations of the electronic device, and may include more or fewer components than shown, or some components in combination, or a different arrangement of components.
The processor 901 is a control center of the electronic device 900, connects various parts of the whole electronic device 900 by using various interfaces and lines, performs various functions of the electronic device 900 and processes data by running or loading software programs and/or modules stored in the memory 902 and calling data stored in the memory 902, thereby performing overall monitoring of the electronic device 900. The Processor 901 may be a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a Network Processor (NP), and the like, and may implement or execute each method, step, and logic block disclosed in the embodiments of the present application.
In this embodiment of the application, the processor 901 in the electronic device 900 loads instructions corresponding to processes of one or more application programs into the memory 902 according to the following steps, and the processor 901 runs the application programs stored in the memory 902, so as to implement various functions, for example:
acquiring an actual position value and an actual index value of a surface patch to be stored;
based on a first preset compression value, carrying out compression coding on the actual position value to obtain a position storage value of the actual position value, wherein the position storage value comprises a high position value and a low position value;
based on a second preset compression value, carrying out compression coding on the actual index value to obtain an index storage value of the actual index value;
and generating an information storage map of the to-be-stored patch according to the high-order position value, the low-order position value and the index storage value, wherein a first pixel point in the information storage map is used for storing the high-order position value and the index storage value, and a second pixel point in the information storage map is used for storing the low-order position value and the index storage value.
In some embodiments, the generating an information storage map of the to-be-stored patch according to the high bit position value, the low bit position value, and the index storage value includes:
acquiring a storage pixel position of the to-be-stored patch, wherein the storage pixel position comprises a pixel position of the high-order position value and a pixel position of the low-order position value;
generating the first pixel point at a pixel position of the high-order position value based on the high-order position value and the index storage value;
generating the second pixel point at a pixel location of the low position value based on the low position value and the index storage value.
In some embodiments, the actual position value includes a first coordinate value of the to-be-stored patch in a first coordinate axis, a second coordinate value of the to-be-stored patch in a second coordinate axis, and a third coordinate value of the to-be-stored patch in a third coordinate axis, and the high position value includes a first high position value, a second high position value, and a third high position value obtained by respectively performing compression coding on the first coordinate value, the second coordinate value, and the third coordinate value;
the generating the first pixel point at the pixel position of the high-order position value based on the high-order position value and the index storage value includes:
setting the first high-order position value as an R channel value of a pixel position of the high-order position value to generate a first pixel point of which the R channel stores the first high-order position value;
setting the second high-order position value as a G channel value of the pixel position of the high-order position value to generate a first pixel point of which the G channel stores the second high-order position value;
setting the third high-order position value as a B-channel value of the pixel position of the high-order position value to generate a first pixel point of which the B-channel stores the third high-order position value;
and setting the index storage value as an A-channel value of the pixel position of the high-order position value to generate a first pixel point of which the A-channel stores the index storage value.
In some embodiments, the actual position value includes a first coordinate value of the to-be-stored patch in a first coordinate axis, a second coordinate value of the to-be-stored patch in a second coordinate axis, and a third coordinate value of the to-be-stored patch in a third coordinate axis, and the low position value includes a first low position value, a second low position value, and a third low position value obtained by respectively performing compression coding on the first coordinate value, the second coordinate value, and the third coordinate value;
the generating the second pixel point at the pixel position of the lower position value based on the lower position value and the index storage value comprises:
setting the first low-order position value as an R channel value of a pixel position of the low-order position value to generate a second pixel point of which the R channel stores the first low-order position value;
setting the second low-order position value as a G channel value of the pixel position of the low-order position value to generate a second pixel point of which the G channel stores the second low-order position value;
setting the third low-order position value as a B channel value of the pixel position of the low-order position value to generate a second pixel point of which the B channel stores the third low-order position value;
and setting the index storage value as an A-channel value of the pixel position of the low-order position value to generate a second pixel point of which the A-channel stores the index storage value.
In some embodiments, the tile column coordinates corresponding to the pixel position of the high position value are the same as the tile column coordinates corresponding to the pixel position of the low position value.
In some embodiments, the compression-encoding the actual position value based on the first preset compression value to obtain a position storage value of the actual position value includes:
multiplying the actual position value by a first preset compression value to obtain a decimal value of the actual position value, wherein the actual position value is in a decimal format;
converting the decimal value of the actual position value to obtain a hexadecimal value of the actual position value;
splitting the hexadecimal value of the actual position value to obtain a high-order hexadecimal value and a low-order hexadecimal value of the actual position value;
acquiring the high-order position value based on the high-order hexadecimal value of the actual position value;
and acquiring the lower position value based on the lower hexadecimal value of the actual position value.
In some embodiments, the index storage values comprise a high index value and a low index value, the high index value being stored at the first pixel point and the low index value being stored at the second pixel point;
the performing compression coding on the actual index value based on a second preset compression value to obtain an index storage value of the actual index value includes:
multiplying the actual index value by a second preset compression value to obtain a decimal value of the actual index value;
converting the decimal value of the actual index value to obtain a hexadecimal value of the actual index value;
splitting the hexadecimal value of the actual index value to obtain a high-order hexadecimal value and a low-order hexadecimal value of the actual index value;
acquiring the high-order index value based on the high-order hexadecimal value of the actual index value;
and acquiring the lower index value based on the lower hexadecimal value of the actual index value.
In some embodiments, the method further comprises:
when the information storage map is adopted to render a model to be rendered, decoding the high-order position value stored by the first pixel point to obtain a high-order decoded value of the high-order position value;
decoding the low-order position value stored in the second pixel point to obtain a low-order decoded value of the low-order position value;
splicing the high-order decoded value and the low-order decoded value to obtain a decoding position value of the to-be-stored patch;
and rendering the patch effect of the patch to be stored to the model to be rendered based on the decoding position value.
In some embodiments, the generating an information storage map of the to-be-stored patch according to the high position value, the low position value, and the index storage value includes:
acquiring the number of patches of the target patch set;
and generating the information storage map according to the number of the patches, the high-order position value, the low-order position value and the index storage value, wherein the number of pixel columns of the information storage map is the same as the number of the patches.
In some embodiments, the information storage map is an 8-bit map, and the actual position value ranges from 0 to 10.
In some embodiments, the information storage map is configured to record a position value and an index value of each patch in a target patch set, and before obtaining an actual position value and an actual index value of a patch to be stored, the method further includes:
determining a selected patch from a preset patch set;
if the position value of the selected surface patch is within the value range of the actual index value and the index value of the selected surface patch is within the value range of the actual index value, adding the selected surface patch into a target surface patch set;
and traversing each patch in the target patch set, and taking the current traversed patch as the patch to be stored.
Therefore, the electronic device 900 provided by the embodiment can bring the following technical effects: compressing and coding the actual position value of the surface patch to be stored into a high position value and a low position value, and respectively storing the high position value and the low position value by adopting 2 different pixel points (a first pixel point and a second pixel point) in an information storage map; on the first hand, compared with 1 pixel, 2 pixels are adopted for storing an actual position value, and the data storage precision can be improved on the basis of improving the range of the stored value range; in a second aspect, after the actual position value is compressed and encoded by adopting the first preset compression, the numerical value after the decimal point can be accurately stored, so that the data storage precision of low-precision maps such as the TGA maps is improved, the position value of a surface patch sampled by the low-precision maps such as the TGA maps is more accurate, the problem of large storage error of the position value of the surface patch caused by low data storage precision of the low-precision maps such as the TGA maps is avoided, and the situation of jumping of the frame animation is avoided; thereby improving the picture effect of the frame animation displayed on the low-end device.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
Optionally, as shown in fig. 9, the electronic device 900 further includes: touch-sensitive display screen 903, radio frequency circuit 904, audio circuit 905, input unit 906 and power 907. The processor 901 is electrically connected to the touch display screen 903, the radio frequency circuit 904, the audio circuit 905, the input unit 906, and the power supply 907. Those skilled in the art will appreciate that the electronic device configuration shown in fig. 9 does not constitute a limitation of the electronic device and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The touch screen 903 may be used for displaying a graphical user interface and receiving operation instructions generated by a user acting on the graphical user interface. The touch display screen 903 may include a display panel and a touch panel. Among other things, the display panel may be used to display information input by or provided to a user as well as various graphical user interfaces of the electronic device, which may be made up of graphics, text, icons, video, and any combination thereof. Alternatively, the Display panel may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. The touch panel may be used to collect touch operations of a user on or near the touch panel (for example, operations of the user on or near the touch panel using any suitable object or accessory such as a finger, a stylus pen, and the like), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Alternatively, the touch panel may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 901, and can receive and execute commands sent by the processor 901. The touch panel may cover the display panel, and when the touch panel detects a touch operation on or near the touch panel, the touch panel is transmitted to the processor 901 to determine the type of the touch event, and then the processor 901 provides a corresponding visual output on the display panel according to the type of the touch event. In the embodiment of the present application, a touch panel and a display panel may be integrated into the touch display screen 903 to realize input and output functions. However, in some embodiments, the touch panel and the touch panel can be implemented as two separate components to perform the input and output functions. That is, the touch display 903 may also be used as a part of the input unit 906 to implement an input function.
The rf circuit 904 may be configured to transmit and receive rf signals to establish wireless communication with a network device or other electronic devices through wireless communication, and transmit and receive signals to and from the network device or other electronic devices.
The audio circuitry 905 may be used to provide an audio interface between a user and an electronic device through a speaker, microphone. The audio circuit 905 can transmit the electrical signal converted from the received audio data to a loudspeaker, and the electrical signal is converted into a sound signal by the loudspeaker and output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 905 and converted into audio data, and the audio data is processed by the audio data output processor 901, and then transmitted to another electronic device through the radio frequency circuit 904, or the audio data is output to the memory 902 for further processing. The audio circuitry 905 may also include an earbud jack to provide communication of peripheral headphones with the electronic device.
The input unit 906 may be used to receive input numbers, character information, or user characteristic information (e.g., fingerprint, iris, facial information, etc.), and generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
Power supply 907 is used to power the various components of electronic device 900. Optionally, the power supply 907 may be logically connected to the processor 901 through a power management system, so as to implement functions of managing charging, discharging, power consumption management, and the like through the power management system. Power supply 907 may also include any component such as one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
Although not shown in fig. 9, the electronic device 900 may further include a camera, a sensor, a wireless fidelity module, a bluetooth module, etc., which are not described in detail herein.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions or by associated hardware controlled by the instructions, which may be stored in a computer readable storage medium and loaded and executed by a processor.
To this end, embodiments of the present application provide a computer-readable storage medium, in which a plurality of computer programs are stored, and the computer programs can be loaded by a processor to execute any of the patch position information storage methods provided by the embodiments of the present application. For example, the computer program may execute the steps of the following patch position information storage method:
acquiring an actual position value and an actual index value of a surface patch to be stored;
based on a first preset compression value, carrying out compression coding on the actual position value to obtain a position storage value of the actual position value, wherein the position storage value comprises a high position value and a low position value;
based on a second preset compression value, carrying out compression coding on the actual index value to obtain an index storage value of the actual index value;
and generating an information storage map of the to-be-stored patch according to the high-order position value, the low-order position value and the index storage value, wherein a first pixel point in the information storage map is used for storing the high-order position value and the index storage value, and a second pixel point in the information storage map is used for storing the low-order position value and the index storage value.
In some embodiments, the generating an information storage map of the to-be-stored patch according to the high bit position value, the low bit position value, and the index storage value includes:
acquiring a storage pixel position of the to-be-stored patch, wherein the storage pixel position comprises a pixel position of the high-order position value and a pixel position of the low-order position value;
generating the first pixel point at a pixel position of the high-order position value based on the high-order position value and the index storage value;
generating the second pixel point at a pixel location of the low position value based on the low position value and the index storage value.
In some embodiments, the actual position value includes a first coordinate value of the to-be-stored patch in a first coordinate axis, a second coordinate value of the to-be-stored patch in a second coordinate axis, and a third coordinate value of the to-be-stored patch in a third coordinate axis, and the high position value includes a first high position value, a second high position value, and a third high position value obtained by respectively performing compression coding on the first coordinate value, the second coordinate value, and the third coordinate value;
the generating the first pixel point at the pixel position of the high-order position value based on the high-order position value and the index storage value includes:
setting the first high-order position value as an R channel value of a pixel position of the high-order position value to generate a first pixel point of which the R channel stores the first high-order position value;
setting the second high-order position value as a G channel value of the pixel position of the high-order position value to generate a first pixel point of which the G channel stores the second high-order position value;
setting the third high-order position value as a B channel value of the pixel position of the high-order position value to generate a first pixel point of which the B channel stores the third high-order position value;
and setting the index storage value as an A channel value of the pixel position of the high-order position value to generate a first pixel point of which the A channel stores the index storage value.
In some embodiments, the actual position value includes a first coordinate value of the to-be-stored patch in a first coordinate axis, a second coordinate value of the to-be-stored patch in a second coordinate axis, and a third coordinate value of the to-be-stored patch in a third coordinate axis, and the low position value includes a first low position value, a second low position value, and a third low position value obtained by respectively performing compression coding on the first coordinate value, the second coordinate value, and the third coordinate value;
the generating the second pixel point at the pixel position of the lower position value based on the lower position value and the index storage value comprises:
setting the first low-order position value as an R channel value of a pixel position of the low-order position value to generate a second pixel point of which the R channel stores the first low-order position value;
setting the second low-order position value as a G channel value of the pixel position of the low-order position value to generate a second pixel point of which the G channel stores the second low-order position value;
setting the third low-order position value as a B-channel value of the pixel position of the low-order position value to generate a second pixel point of which the B-channel stores the third low-order position value;
and setting the index storage value as an A-channel value of the pixel position of the low-order position value to generate a second pixel point of which the A-channel stores the index storage value.
In some embodiments, the tile column coordinates corresponding to the pixel position of the high position value are the same as the tile column coordinates corresponding to the pixel position of the low position value.
In some embodiments, the compression-encoding the actual position value based on the first preset compression value to obtain a position storage value of the actual position value includes:
multiplying the actual position value by a first preset compression value to obtain a decimal value of the actual position value, wherein the actual position value is in a decimal format;
converting the decimal value of the actual position value to obtain a hexadecimal value of the actual position value;
splitting the hexadecimal value of the actual position value to obtain a high-order hexadecimal value and a low-order hexadecimal value of the actual position value;
acquiring the high-order position value based on the high-order hexadecimal value of the actual position value;
and acquiring the lower position value based on the lower hexadecimal value of the actual position value.
In some embodiments, the index storage values include a high index value and a low index value, the high index value being stored at the first pixel point and the low index value being stored at the second pixel point;
the compression encoding of the actual index value based on the second preset compression value to obtain an index storage value of the actual index value includes:
multiplying the actual index value by a second preset compression value to obtain a decimal value of the actual index value;
converting the decimal value of the actual index value to obtain a hexadecimal value of the actual index value;
splitting the hexadecimal value of the actual index value to obtain a high-order hexadecimal value and a low-order hexadecimal value of the actual index value;
acquiring the high-order index value based on the high-order hexadecimal value of the actual index value;
and acquiring the lower index value based on the lower hexadecimal value of the actual index value.
In some embodiments, the method further comprises:
when the information storage map is adopted to render a model to be rendered, decoding the high-order position value stored by the first pixel point to obtain a high-order decoded value of the high-order position value;
decoding the low-order position value stored in the second pixel point to obtain a low-order decoded value of the low-order position value;
splicing the high-order decoded value and the low-order decoded value to obtain a decoding position value of the to-be-stored patch;
and rendering the patch effect of the patch to be stored to the model to be rendered based on the decoding position value.
In some embodiments, the generating an information storage map of the to-be-stored patch according to the high position value, the low position value, and the index storage value includes:
acquiring the number of patches of the target patch set;
and generating the information storage map according to the number of the patches, the high-order position value, the low-order position value and the index storage value, wherein the number of pixel columns of the information storage map is the same as the number of the patches.
In some embodiments, the information storage map is an 8-bit map, and the actual position value ranges from 0 to 10.
In some embodiments, the information storage map is configured to record a position value and an index value of each patch in a target patch set, and before obtaining an actual position value and an actual index value of a patch to be stored, the method further includes:
determining a selected patch from a preset patch set;
if the position value of the selected surface patch is within the value range of the actual index value and the index value of the selected surface patch is within the value range of the actual index value, adding the selected surface patch into a target surface patch set;
and traversing each patch in the target patch set, and taking the current traversed patch as the patch to be stored.
As can be seen, the computer program can be loaded by the processor to execute any one of the patch location information storage methods provided in the embodiments of the present application, so as to achieve the following technical effects: compressing and coding the actual position value of the surface patch to be stored into a high position value and a low position value, and respectively storing the high position value and the low position value by adopting 2 different pixel points (a first pixel point and a second pixel point) in an information storage map; on the first hand, compared with 1 pixel, 2 pixels are adopted for storing an actual position value, and the data storage precision can be improved on the basis of improving the range of the stored value range; in a second aspect, after the actual position value is compressed and encoded by adopting the first preset compression, the numerical value after the decimal point can be accurately stored, so that the data storage precision of low-precision maps such as the TGA maps is improved, the position value of a surface patch sampled by the low-precision maps such as the TGA maps is more accurate, the problem of large storage error of the position value of the surface patch caused by low data storage precision of the low-precision maps such as the TGA maps is avoided, and the situation of jumping of the frame animation is avoided; thereby improving the picture effect of the frame animation displayed on the low-end device.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
Wherein the computer-readable storage medium may include: read Only Memory (ROM), random Access Memory (RAM), magnetic or optical disks, and the like. Since the computer program stored in the computer-readable storage medium can execute any of the patch location information storage methods provided in the embodiments of the present application, beneficial effects that can be achieved by any of the patch location information storage methods provided in the embodiments of the present application can be achieved, which are detailed in the foregoing embodiments and will not be described herein again.
In the above patch position information storage device, the computer-readable storage medium, and the electronic device, the description of each embodiment has a respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments. It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes and the possible advantages of the above-described patch position information storage device, the computer-readable storage medium, the electronic device and the corresponding units thereof may refer to the description of the patch position information storage method in the above embodiments, and are not described herein again in detail.
A patch position information storage method, a patch position information storage device, an electronic device, and a computer-readable storage medium provided in the embodiments of the present application are described in detail above, and a specific example is applied in the description to explain the principles and embodiments of the present application, and the description of the embodiments is only used to help understanding the method and the core idea of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (14)

1. A method for storing position information of a patch, comprising:
acquiring an actual position value and an actual index value of a surface patch to be stored;
based on a first preset compression value, carrying out compression coding on the actual position value to obtain a position storage value of the actual position value, wherein the position storage value comprises a high position value and a low position value;
based on a second preset compression value, carrying out compression coding on the actual index value to obtain an index storage value of the actual index value;
and generating an information storage map of the to-be-stored patch according to the high-order position value, the low-order position value and the index storage value, wherein a first pixel point in the information storage map is used for storing the high-order position value and the index storage value, and a second pixel point in the information storage map is used for storing the low-order position value and the index storage value.
2. The method for storing patch position information according to claim 1, wherein said generating an information storage map of the patch to be stored according to the high position value, the low position value, and the index storage value comprises:
acquiring a storage pixel position of the to-be-stored patch, wherein the storage pixel position comprises a pixel position of the high-order position value and a pixel position of the low-order position value;
generating the first pixel point at a pixel position of the high-order position value based on the high-order position value and the index storage value;
generating the second pixel point at a pixel location of the low position value based on the low position value and the index storage value.
3. The method for storing patch position information according to claim 2, wherein the actual position value includes a first coordinate value of the patch to be stored on a first coordinate axis, a second coordinate value of the patch to be stored on a second coordinate axis, and a third coordinate value of the patch to be stored on a third coordinate axis, and the high position value includes a first high position value, a second high position value, and a third high position value obtained by compression-coding the first coordinate value, the second coordinate value, and the third coordinate value, respectively;
the generating the first pixel point at the pixel position of the high-order position value based on the high-order position value and the index storage value includes:
setting the first high-order position value as an R channel value of a pixel position of the high-order position value to generate a first pixel point of which the R channel stores the first high-order position value;
setting the second high-order position value as a G channel value of the pixel position of the high-order position value to generate a first pixel point of which the G channel stores the second high-order position value;
setting the third high-order position value as a B channel value of the pixel position of the high-order position value to generate a first pixel point of which the B channel stores the third high-order position value;
and setting the index storage value as an A-channel value of the pixel position of the high-order position value to generate a first pixel point of which the A-channel stores the index storage value.
4. The method for storing patch position information according to claim 2, wherein the actual position value includes a first coordinate value of the patch to be stored on a first coordinate axis, a second coordinate value of the patch to be stored on a second coordinate axis, and a third coordinate value of the patch to be stored on a third coordinate axis, and the lower position value includes a first lower position value, a second lower position value, and a third lower position value obtained by compression-coding the first coordinate value, the second coordinate value, and the third coordinate value, respectively;
the generating the second pixel point at the pixel position of the low-order position value based on the low-order position value and the index storage value includes:
setting the first low-order position value as an R channel value of a pixel position of the low-order position value to generate a second pixel point of which the R channel stores the first low-order position value;
setting the second low-order position value as a G channel value of the pixel position of the low-order position value to generate a second pixel point of which the G channel stores the second low-order position value;
setting the third low-order position value as a B-channel value of the pixel position of the low-order position value to generate a second pixel point of which the B-channel stores the third low-order position value;
and setting the index storage value as an A-channel value of the pixel position of the low-order position value to generate a second pixel point of which the A-channel stores the index storage value.
5. The method of storing patch position information according to claim 2, wherein the mapping column coordinates corresponding to the pixel position of the upper position value are the same as the mapping column coordinates corresponding to the pixel position of the lower position value.
6. The method for storing patch position information according to claim 1, wherein said compression-encoding the actual position value based on a first preset compression value to obtain a position storage value of the actual position value comprises:
multiplying the actual position value by a first preset compression value to obtain a decimal value of the actual position value, wherein the actual position value is in a decimal format;
converting the decimal value of the actual position value to obtain a hexadecimal value of the actual position value;
splitting the hexadecimal value of the actual position value to obtain a high-order hexadecimal value and a low-order hexadecimal value of the actual position value;
acquiring the high-order position value based on the high-order hexadecimal value of the actual position value;
and acquiring the lower position value based on the lower hexadecimal value of the actual position value.
7. The method of storing patch position information of claim 1, wherein the index storage value includes a higher index value and a lower index value, the higher index value being stored at the first pixel point and the lower index value being stored at the second pixel point;
the compression encoding of the actual index value based on the second preset compression value to obtain an index storage value of the actual index value includes:
multiplying the actual index value by a second preset compression value to obtain a decimal value of the actual index value;
converting the decimal value of the actual index value to obtain a hexadecimal value of the actual index value;
splitting the hexadecimal value of the actual index value to obtain a high-order hexadecimal value and a low-order hexadecimal value of the actual index value;
acquiring the high-order index value based on the high-order hexadecimal value of the actual index value;
and acquiring the lower index value based on the lower hexadecimal value of the actual index value.
8. The method of storing patch position information as claimed in claim 1, the method further comprising:
when the information storage map is adopted to render a model to be rendered, decoding the high-order position value stored by the first pixel point to obtain a high-order decoded value of the high-order position value;
decoding the low-order position value stored in the second pixel point to obtain a low-order decoded value of the low-order position value;
splicing the high-order decoded value and the low-order decoded value to obtain a decoding position value of the to-be-stored patch;
and rendering the patch effect of the patch to be stored to the model to be rendered based on the decoding position value.
9. The method of claim 1, wherein the to-be-stored patch is a patch in a target patch set, and the generating an information storage map of the to-be-stored patch according to the high position value, the low position value, and the index storage value includes:
acquiring the number of patches of the target patch set;
and generating the information storage map according to the number of patches, the high-order position value, the low-order position value and the index storage value, wherein the number of pixel columns of the information storage map is the same as the number of patches.
10. The method of claim 1, wherein the information storage map is an 8-bit map, and the actual position value ranges from 0 to 10.
11. The method of storing patch position information of claim 10, wherein the information storage map is used to record position values and index values of patches in a target patch set, and before obtaining actual position values and actual index values of patches to be stored, the method further comprises:
determining a selected patch from a preset patch set;
if the position value of the selected patch is within the value range of the actual index value and the index value of the selected patch is within the value range of the actual index value, adding the selected patch into a target patch set;
and traversing each patch in the target patch set, and taking the current traversed patch as the patch to be stored.
12. A patch position information storage apparatus, comprising:
the device comprises an acquisition unit, a storage unit and a processing unit, wherein the acquisition unit is used for acquiring an actual position value and an actual index value of a surface patch to be stored;
the first compression unit is used for carrying out compression coding on the actual position value based on a first preset compression value to obtain a position storage value of the actual position value, wherein the position storage value comprises a high position value and a low position value;
the second compression unit is used for carrying out compression coding on the actual index value based on a second preset compression value to obtain an index storage value of the actual index value;
and the storage unit is used for generating an information storage map of the to-be-stored patch according to the high-order position value, the low-order position value and the index storage value, wherein a first pixel point in the information storage map is used for storing the high-order position value and the index storage value, and a second pixel point in the information storage map is used for storing the low-order position value and the index storage value.
13. An electronic device comprising a processor and a memory, the memory storing a plurality of instructions; the processor loads instructions from the memory to perform the patch position information storage method according to any one of claims 1 to 11.
14. A computer-readable storage medium storing a plurality of instructions, the instructions being suitable for being loaded by a processor to execute the method for storing patch position information according to any one of claims 1 to 11.
CN202211461018.2A 2022-11-17 2022-11-17 Method and device for storing patch position information, electronic equipment and storage medium Pending CN115861454A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211461018.2A CN115861454A (en) 2022-11-17 2022-11-17 Method and device for storing patch position information, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211461018.2A CN115861454A (en) 2022-11-17 2022-11-17 Method and device for storing patch position information, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115861454A true CN115861454A (en) 2023-03-28

Family

ID=85664563

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211461018.2A Pending CN115861454A (en) 2022-11-17 2022-11-17 Method and device for storing patch position information, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115861454A (en)

Similar Documents

Publication Publication Date Title
CN111815755A (en) Method and device for determining shielded area of virtual object and terminal equipment
CN109584341B (en) Method and device for drawing on drawing board
CN111597003B (en) Picture rendering method and device, computer equipment and medium
CN110288710B (en) Three-dimensional map processing method and device and terminal equipment
CN112370783A (en) Virtual object rendering method and device, computer equipment and storage medium
CN111491169B (en) Digital image compression method, device, equipment and medium
CN111583373A (en) Model rendering method, device, equipment and storage medium
CN110198473B (en) Video processing method and device, electronic equipment and computer readable storage medium
CN111931600B (en) Intelligent pen image processing method and device and electronic equipment
CN112419430B (en) Animation playing method and device and computer equipment
CN115393251A (en) Defect detection method and device for printed circuit board, storage medium and electronic equipment
CN115861454A (en) Method and device for storing patch position information, electronic equipment and storage medium
CN109559319B (en) Normal map processing method and terminal
CN115620321A (en) Table identification method and device, electronic equipment and storage medium
CN109241059A (en) A kind of building method of point cloud data, device, electronic equipment and storage medium
CN111104566B (en) Feature index encoding method, device, electronic equipment and storage medium
CN112102483B (en) Method and device for dynamically displaying three-dimensional model on electronic teaching whiteboard
CN108876873B (en) Image generation method, device, equipment and storage medium
US20230119741A1 (en) Picture annotation method, apparatus, electronic device, and storage medium
CN108959073B (en) Method and device for testing algorithm library, storage medium and electronic equipment
CN108829600B (en) Method and device for testing algorithm library, storage medium and electronic equipment
CN117908994A (en) Method, device and equipment for processing media information and readable storage medium
CN117193552A (en) Touch screen point determining method and device, computer equipment and storage medium
CN117899472A (en) Object rendering method, device, medium and equipment
CN116310029A (en) Model rendering method and device, medium and electronic equipment

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