Facial sheet position information storage method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202211461018.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-17
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2042-11-17
AI Technical Summary
[0003]但是,本申请发明人在实际研发过程中发现:在低端设备(如低配置的手机)上无法采样如EXR贴图等高精度贴图,而只能采样如TGA贴图等低精度贴图,因此在低端设备只能采用如TGA贴图等低精度贴图记录帧动画特效,这将会导致帧动画出现过于跳跃的效果,使得画面效果较差
[0009]本申请实施例通过将待存储面片的实际位置值进行压缩编码为高位位置值和低位位置值,采用信息存储贴图中2个不同像素点(第一像素点、第二像素点)分别存储高位位置值和低位位置值;第一方面,相对于1个像素,采用2个像素用于存储一个实际位置值,可以在提高存储的值域范围基础上提高数据存储精度;第二方面,由于采用第一预设压缩至对实际位置值压缩编码后,可以使得小数点后的数值可以精确地保存,从而提高如TGA贴图等低精度贴图的数据存储精度,使得通过如TGA贴图等低精度贴图进行采样的面片位置值更精确,避免了因如TGA贴图等低精度贴图的数据存储精度较低、而导致的面片位置值的存储误差大的问题,进而避免帧动画出现跳跃的情况;从而提高低端设备上显示的帧动画的画面效果。
Smart Images

Figure CN115861454B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of graphics processing technology, specifically to a method, apparatus, electronic device, and computer-readable storage medium for storing patch position information. Background Technology
[0002] High-precision textures, such as EXR textures, can store higher dynamic range and color precision than conventional 8-bit and 10-bit image formats. They support 16-bit floating-point, 32-bit floating-point, and 32-bit integer pixel color values, and can store values exceeding 1.
[0003] However, the inventors of this application discovered during the actual research and development process that: on low-end devices (such as low-configuration mobile phones), it is impossible to sample high-precision textures such as EXR textures, and only low-precision textures such as TGA textures can be sampled. Therefore, low-end devices can only use low-precision textures such as TGA textures to record frame animation effects, which will cause the frame animation to have an overly jumpy effect, resulting in poor picture quality. Summary of the Invention
[0004] This application provides a method, apparatus, electronic device, and computer-readable storage medium for storing patch position information, which can improve the storage accuracy of position information when using low-precision textures such as TGA textures to record frame animation effects.
[0005] In a first aspect, embodiments of this application provide a method for storing patch location information, including: Obtain the actual position and index value of the face to be stored; Based on a first preset compression value, the actual position value is compressed and encoded to obtain the position storage value of the actual position value, wherein the position storage value includes a high-order position value and a low-order position value. Based on the second preset compression value, the actual index value is compressed and encoded to obtain the index storage value of the actual index value; Based on the high-order position value, the low-order position value, and the index storage value, an information storage texture map of the patch to be stored is generated, wherein the first pixel in the information storage texture map is used to store the high-order position value and the index storage value, and the second pixel in the information storage texture map is used to store the low-order position value and the index storage value.
[0006] Secondly, embodiments of this application also provide a patch position information storage device, comprising: The acquisition unit is used to acquire the actual position value and actual index value of the face to be stored. The first compression unit is used to compress and encode 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 includes a high-order position value and a low-order position value. The second compression unit is used to compress and encode the actual index value based on the second preset compression value to obtain the index storage value of the actual index value; A storage unit is used to generate an information storage map of the patch to be stored based on the high-order position value, the low-order position value, and the index storage value, wherein a first pixel in the information storage map is used to store the high-order position value and the index storage value, and a second pixel in the information storage map is used to store the low-order position value and the index storage value.
[0007] Thirdly, embodiments of this application also provide an electronic device, including a memory storing multiple instructions; the processor loads instructions from the memory to execute any of the patch position information storage methods provided in embodiments of this application.
[0008] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to execute any of the patch position information storage methods provided in embodiments of this application.
[0009] This application embodiment compresses and encodes the actual position value of the area to be stored into a high-order position value and a low-order position value, and uses two different pixels (a first pixel and a second pixel) in the information storage map to store the high-order position value and the low-order position value respectively. Firstly, compared to one pixel, using two pixels to store one actual position value can improve the data storage accuracy while increasing the range of stored values. Secondly, since the actual position value is compressed and encoded using the first preset compression, the value after the decimal point can be accurately preserved, thereby improving the data storage accuracy of low-precision maps such as TGA maps. This makes the area position value sampled by low-precision maps such as TGA maps more accurate, avoiding the problem of large storage errors in area position values caused by the low data storage accuracy of low-precision maps such as TGA maps, and thus avoiding jumps in frame animation; thereby improving the picture effect of frame animation displayed on low-end devices. Attached Figure Description
[0010] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 This is a schematic diagram of a scenario of the patch location information storage system provided in the embodiments of this application; Figure 2 This is a schematic flowchart of an embodiment of the patch position information storage method provided in this application. Figure 3 This is a scene diagram of a set of preset facets provided in this embodiment; Figure 4 This is a schematic diagram of the storage structure of the information storage texture provided in the embodiments of this application; Figure 5 This is a scene diagram of the information storage texture provided in the embodiments of this application; Figure 6 This is a schematic diagram of an interface of the data storage tool provided in the embodiments of this application; Figure 7 This is a scene diagram showing the combined positions of the second set of UVs for all selected facets provided in this application embodiment. Figure 8 This is a schematic diagram of the structure of the patch position information storage device provided in the embodiments of this application; Figure 9 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0012] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application. At the same time, in the description of the embodiments of this application, the terms "first," "second," etc., are only used to distinguish descriptions and should not be construed as indicating or implying relative importance. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more of the described features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0013] This application provides a method, apparatus, electronic device, and computer-readable storage medium for storing patch location information.
[0014] Specifically, this embodiment will be described from the perspective of a patch location information storage device. This patch location information storage device can be integrated into an electronic device, that is, the patch location information storage method of this application embodiment can be executed by an electronic device, which can be a terminal, a server, or other devices. The terminal can be a mobile phone, tablet computer, smart Bluetooth device, laptop computer, touch screen, game console, or personal computer (PC), etc.; the server can be a single server or a server cluster composed of multiple servers.
[0015] In some embodiments, the patch location information storage device can also be integrated into multiple electronic devices. For example, the patch location information storage device can be integrated into multiple servers, with multiple servers implementing the patch location information storage method of this application. Alternatively, the patch location information storage device can be integrated into multiple terminals, with multiple terminals implementing the patch location information storage method of this application.
[0016] In some embodiments, the patch location information storage device may also be integrated into a terminal and server cluster.
[0017] In some embodiments, the server can also be implemented in the form of a terminal. For example, a personal computer can be set as a server to integrate the patch location information storage device, and the patch location information storage method of this application can be implemented by the server set up by the personal computer.
[0018] For example, the patch position information storage method provided in the embodiments of this application can be applied to, for example... Figure 1The illustrated patch location information storage system includes a terminal 101 and a server 102. The terminal 101 can be a device that includes both receiving and transmitting hardware, meaning it has receiving and transmitting hardware capable of performing bidirectional communication over a bidirectional communication link. Specifically, the terminal 101 can be a terminal device used to run game applications, such as a mobile phone, tablet computer, or laptop computer. The terminal 101 and server 102 can communicate bidirectionally via a network. The server 102 can store information such as the actual location value and actual index value of the patch to be stored. The terminal 101 obtains the actual location value and actual index value of the patch to be stored from the server via the network, and uses its processor (such as a CPU or GPU) to store the patch location information in an information storage texture and sample the information storage texture for image rendering. The server 102 can be a standalone server, or a server network or server cluster, including but not limited to computers, network hosts, single network servers, multiple network server sets, or cloud servers composed of multiple servers. The cloud server consists of a large number of computers or network servers based on cloud computing. For example, the terminal 101 can obtain the actual position value and actual index value of the area to be stored; based on a first preset compression value, the actual position value is compressed and encoded to obtain the position storage value of the actual position value, wherein the position storage value includes a high-order position value and a low-order position value; based on a second preset compression value, the actual index value is compressed and encoded to obtain the index storage value of the actual index value; and based on the high-order position value, the low-order position value, and the index storage value, an information storage texture of the area to be stored is generated, wherein the first pixel in the information storage texture is used to store the high-order position value and the index storage value, and the second pixel in the information storage texture is used to store the low-order position value and the index storage value.
[0019] The following is a detailed description in conjunction with the accompanying drawings. It should be noted that the order of description of the following embodiments is not intended to limit the preferred order of the embodiments. Although a logical order is shown in the flowcharts, in some cases, the steps shown or described may be performed in a different order than that shown in the drawings.
[0020] like Figure 2 As shown, the specific process of this patch location information storage method can be summarized in steps 201 to 204, wherein: 201. Obtain the actual position value and actual index value of the face to be stored.
[0021] Among them, the face to be stored refers to the face that needs to have its position value and index value stored.
[0022] The actual position value refers to the position value of the patch to be stored before compression and encoding. Specifically, the actual position value can include the first coordinate value of the patch on the first coordinate axis (e.g., x1 on the X-axis), the second coordinate value on the second coordinate axis (e.g., y1 on the Y-axis), and the third coordinate value on the third coordinate axis (e.g., z1 on the Z-axis). For example, the actual position value is (x1, y1, z1). For ease of explanation, this article uses the X-axis, Y-axis, and Z-axis coordinate values as examples, where the first, second, and third coordinate values are respectively.
[0023] The actual index value refers to the index value of the area to be stored before compression and encoding.
[0024] To clearly understand how the patch position storage method of this embodiment can maintain the storage accuracy of position information when using low-precision textures such as TGA textures to record frame animation effects, this embodiment will be explained using an 8-bit texture as an example.
[0025] In step 201, there are multiple ways to obtain the actual location value and the actual index value, including, for example: 1) The preset database stores the position value and index value of each facet. In step 201, the actual position value and actual index value of the facet to be stored are directly read from the preset database.
[0026] 2) During the creation of the face to be stored, the actual position value and actual index value are obtained in real time. For ease of understanding, taking the face to be stored as one face in a target face set, and storing the position values and index values of each face in the target face set into the same information storage texture as an example, the process of obtaining the actual index value of the face to be stored can be specifically described by the following steps ①~③: ① Create a facet to be stored and add it to a preset facet set. For example, you can create a facet in modeling software (such as 3ds Max), add it to a preset facet set, and set the facet's coordinate position in the modeling scene coordinate system.
[0027] ② Select the selected face from the preset face set and add it to the target face set.
[0028] For example, a modeler can select each facet from a preset set of faces. The selected faces are then added to a target set of faces, and the order in which they were selected is used as their index value. For example, as Figure 3 As shown, for ease of demonstration, Figure 3 The images are displayed in a tiled arrangement from the preset set of images (therefore, Figure 3 The modeling scene coordinate system only shows the X and Y axes. Figure 3The value in the preset set of facets indicates that there are 32 facets. Assuming that all 32 facets are selected and added to the target set of facets, the selection order of each selected facet will be used as the index value of each selected facet.
[0029] ③ Traverse each face in the target face set, and take the currently traversed face as the face to be stored. For example, the coordinates of the face to be stored in the modeling scene coordinate system set during step ① can be used as the actual position value of the face to be stored. The selection order of the faces to be stored in step ② can be used as the actual index value of the faces to be stored.
[0030] Furthermore, in order to improve the data storage accuracy of the information storage texture, thereby improving the accuracy of the position recording of frame animation effects and thus improving the picture effect of frame animation displayed on low-end devices, when creating the face to be stored in step ①, the coordinate values of the face to be stored on the X-axis, Y-axis and Z-axis of the modeling scene coordinate system are set within [0,10], so that the actual position value is set to a value within the range of [0,10].
[0031] In step ②, after selecting a face, it will be checked whether the actual position value of the selected face is within the range of actual position values [0,10]. If the actual position value of the selected face is within the range of actual position values [0,10], the selected face will be added to the target face set. If the actual position value of the selected face is outside the range of actual position values [0,10], the selected face will not be added to the target face set, and a prompt indicating that the position does not meet the requirements will be output (such as "x, y, or z axis position value is less than the minimum value", "x, y, or z axis position value is greater than the maximum value", etc.).
[0032] To make it easier to understand, the basic principle of storing position values in textures will be introduced below (in this article, HEX represents hexadecimal and DEC represents decimal): 1. Color value range of the texture. It is represented in binary as [0000 0000, 1111 1111], in decimal as [0, 255], and in hexadecimal as [00, FF], for a total of 256 color values.
[0033] 2. The color values of the texture range [0, 1]. Therefore, the actual stored values of the 256 color values [0, 255] in the 8-bit texture are: The first color value is 0: 0 / 255 = 0 The second color value is 1: 1 / 255 = 0.0039215... The third color value is 2: 2 / 255 = 0.0078431... ... The 256th color value is 255: 255 / 255 = 1 It is evident that using 8-bit textures for storage presents the following two precision issues: ① It cannot store values with a precision higher than 1 / 255 = 0.0039215... (such as 0.001); ② The storage error for relatively precise values is large (such as 0.1, which will be stored as an uncertain value 26 / 255 = 0.10196078... or 25 / 255 = 0.09803921).
[0034] To effectively improve the data storage accuracy of the information storage texture in step 204, thereby enhancing the accuracy of position recording for frame animation effects and improving the visual effect of frame animations displayed on low-end devices, the actual position value is set to a value within the range of [0,10] when creating the piece to be stored. The data (such as the actual position value and actual index value) is then stored in an 8-bit texture with a value range of [0,1] through compression and encoding. Why setting the actual position value to a value within the range of [0,10] improves data storage accuracy will be explained later (see section "II. Why the actual position value range of [0,10] affects data storage accuracy"), and will not be repeated here.
[0035] Similarly, to further improve the data storage accuracy of information storage textures and enhance the accuracy of index value recording for frame animation effects, the actual index value range can be set according to actual needs. For example, if the actual index value range is set to [0, 120], then in step ②, after selecting a face, it will check whether the number of selected faces already added to the target face set exceeds the preset limit (the preset limit = the maximum value within the actual index value range), that is, check whether the index value of the selected face is within the actual index value range [0, 120]. If the index value of the selected face is within the actual index value range [0, 120], then the selected face is added to the target face set; otherwise, the selected face is not added to the target face set, and a prompt indicating that the number of selected faces does not meet the requirements is output (such as "The number of face selections exceeds the maximum limit of 120").
[0036] 202. Based on the first preset compression value, the actual location value is compressed and encoded to obtain the location storage value of the actual location value.
[0037] The location storage value includes a high-order location value and a low-order location value.
[0038] The first preset compression value refers to the compression value used to compress and encode the actual location value. For example, 6550.
[0039] Among them, the location storage value refers to the value obtained by compressing and encoding the actual location value and storing it in the information storage texture.
[0040] Specifically, in order to ensure that the three decimal places of the actual position value can be stored accurately, the first preset compression value is set to ≥1000. By multiplying the actual position value with the first preset compression value and performing compression encoding, the three decimal places of the actual position value can be effectively retained, thereby effectively improving the data storage accuracy of the information storage texture in step 204, thereby improving the accuracy of the position recording of the frame animation effect, and thus improving the picture effect of the frame animation displayed on low-end devices.
[0041] For example, step 202 may specifically include the following steps 2021-2025: 2021. Multiply the actual position value by the first preset compression value to obtain the decimal value of the actual position value.
[0042] The actual position value is in decimal format, and the first preset compression value is less than the decimal value corresponding to the maximum storage value formed by the first pixel and the second pixel. For ease of expression, the "decimal value corresponding to the maximum storage value formed by the first pixel and the second pixel" is simply referred to as the "maximum storage value of two pixels". The maximum storage value formed by the first pixel and the second pixel is [FFFF].
[0043] As described later (see “I. Why using a value less than two pixels’ maximum storage value (e.g., 6550) as the first preset compression value can affect data storage accuracy”), by using a value less than two pixels’ maximum storage value as the first preset compression value, the data storage accuracy of the actual position value can be improved.
[0044] 2022. Convert the decimal value of the actual position value to obtain the hexadecimal value of the actual position value.
[0045] 2023. The hexadecimal value of the actual position value is split to obtain the high-order hexadecimal value and the low-order hexadecimal value of the actual position value.
[0046] 2024. Obtain the high-order position value based on the high-order hexadecimal value of the actual position value.
[0047] 2025. Obtain the low-order position value based on the low-order hexadecimal value of the actual position value.
[0048] The high-order position value refers to the first four digits of the hexadecimal value of the actual position value.
[0049] The low-order position value refers to the last four digits of the hexadecimal value of the actual position value.
[0050] For example, taking the actual position values (X-axis coordinate value, Y-axis coordinate value, Z-axis coordinate value) as an example, where the X-axis coordinate value is 0.123 and the first preset compression value is 6550. In steps 2021-2025: First, multiply the X-axis coordinate value by the first preset compression value to obtain the decimal value of the X-axis coordinate value (0.123): 0.123 6550 = 805.65 (DEC) = (rounded to the nearest integer) 805 (DEC). Multiplying the actual position value (e.g., 0.123) by 6550 serves two purposes: first, it preserves the actual position value to three decimal places; second, it ensures that the actual position value within the range [0,10] can be stored.
[0051] Then, the decimal value of the actual position value is converted to the hexadecimal value of the actual position value: 805(DEC) = 0325(HEX).
[0052] Next, the hexadecimal value of the actual position value is split to obtain the high-order hexadecimal value and the low-order hexadecimal value of the actual position value: 0325 is split into two parts: 03 (HEX) and 25 (HEX), so that the data can be stored in two pixels (the first and second pixels).
[0053] Finally, based on the high-order hexadecimal value of the actual position value, the high-order position value is obtained; based on the low-order hexadecimal value of the actual position value, the low-order position value is obtained. Specifically, the high-order and low-order hexadecimal values are first converted to decimal, resulting in the high-order decimal value 03 (HEX) = 3 (DEC) and the low-order decimal value 25 (HEX) = 37 (DEC); then, they are divided by 255 respectively, yielding the high-order position value 3 / 255 and the low-order position value 37 / 255. Thus, the high-order position value 3 / 255 and the low-order position value 37 / 255 of the X-axis coordinate value (0.123) can be obtained.
[0054] Similarly, the high and low position values of the Y-axis and Z-axis coordinates can be obtained. The high position values of the X-axis, Y-axis, and Z-axis coordinates are denoted as: first high position value, second high position value, and third high position value, respectively; the low position values of the X-axis, Y-axis, and Z-axis coordinates are denoted as: first low position value, second low position value, and third low position value, respectively.
[0055] 203. Based on the second preset compression value, the actual index value is compressed and encoded to obtain the index storage value of the actual index value.
[0056] Among them, the index storage value refers to the value obtained by compressing and encoding the actual index value and storing it in the information storage texture.
[0057] There are several ways to obtain the index storage location in step 203, including, for example: (1) The maximum value of the actual index value When the second preset compression value is ≤255, it means that using only one pixel is sufficient to accurately and completely store the actual index value. This is because the maximum value of the actual index value... The second preset compression value means that using only one pixel is sufficient to completely store the actual index value. Therefore, the index storage values stored in the first and second pixels can be the same. In this case, first multiply the actual index value by the second preset compression value as described in step 2031 below to obtain the decimal value of the actual index value; then, divide the decimal value of the actual index value by 255 to obtain the result as the index storage value of the actual index value. For example, assuming the maximum value of the actual index value is 15 and the second preset compression value is 15, then (the maximum value of the actual index value is 15) When the second preset compression value is 15)225=≤255, using only one pixel is enough to completely store the actual index value; at this time, the actual index value (such as 10) can be multiplied by the second preset compression value (i.e., 15) to obtain the decimal value of the actual index value (i.e., 150), then the index storage value = 150 / 255.
[0058] (2) The maximum value of the actual index value When the second preset compression value is greater than 255, that is, when using only one pixel is no longer sufficient to completely store the actual index value. In other words, the index storage value includes a high-order index value and a low-order index value. Using a compression encoding method similar to that used for the actual position values in steps 2021-2025, the actual index value is compressed to form a high-order index value and a low-order index value, which are stored in the first pixel and the second pixel respectively. At this time, step 203 may specifically include the following steps 2031-2035: 2031. Multiply the actual index value by the second preset compression value to obtain the decimal value of the actual index value.
[0059] The second preset compression value refers to the compression value used to compress and encode the actual index value. For example, 500.
[0060] 2032. Convert the decimal value of the actual index value to obtain the hexadecimal value of the actual index value.
[0061] 2033. Split the hexadecimal value of the actual index value to obtain the high-order hexadecimal value and the low-order hexadecimal value of the actual index value.
[0062] 2034. Obtain the high-order index value based on the high-order hexadecimal value of the actual index value.
[0063] 2035. Obtain the low-order index value based on the low-order hexadecimal value of the actual index value.
[0064] The high-order index value refers to the first four digits of the hexadecimal value of the actual index value.
[0065] The low-order position value refers to the last four digits of the hexadecimal value of the actual index value.
[0066] For example, taking an actual index value of 120 and a second preset compression value of 500 as an example. In steps 2031-2035: First, multiply the actual index value by the second preset compression value to obtain the decimal value of the actual index value: 120. 500 = 60000 (DEC). Similar to multiplying the actual position value by 6550, multiplying the actual index value of 120 by 500 ensures that the actual index value within the range [0, 120] can be stored. Since the value range that two pixels can store is [0000, FFFF] (HEX) = [0, 65535] (DEC), it is necessary to ensure that the product of the second preset compression value and the maximum value within the range of the actual index value is less than 65535 (i.e., the second preset compression value...). To ensure that the actual index value is stored within the range [0, 120], the second preset compression value must be less than (65535 / 120), i.e., the second preset compression value is less than 546.125. Therefore, the second preset compression value here is 500. It is understandable that this example illustrates the value of the second preset compression value using the actual index value range of [0, 120]. When the actual index value range changes, the maximum value within that range changes accordingly, and the second preset compression value also changes. However, to improve the storage precision of the actual index value, at least the product of the second preset compression value and the maximum value within the actual index value range must be less than 65535.
[0067] Then, the decimal value of the actual index value is converted to the hexadecimal value of the actual index value: 60000(DEC)=EA60(HEX).
[0068] Next, the hexadecimal value of the actual index value is split to obtain the high-order hexadecimal value and the low-order hexadecimal value of the actual index value: EA60 is split into two parts: EA(HEX) and 60(HEX), so that the data can be stored in two pixels (the first and second pixels).
[0069] Finally, based on the high-order hexadecimal value of the actual index value, the high-order index value is obtained; based on the low-order hexadecimal value of the actual index value, the low-order index value is obtained. Specifically, the high-order and low-order hexadecimal values are first converted to decimal to obtain the high-order decimal value EA(HEX) = 234(DEC) and the low-order decimal value 60(HEX) = 96(DEC); then, they are divided by 255 to obtain the high-order position value as 234 / 255 and the low-order position value as 96 / 255.
[0070] As can be seen, 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 using one pixel to store the actual index value, in order to minimize the storage error of the actual index value while ensuring complete storage of the index value, the storage error can be reduced by multiplying the actual index value by the maximum value of the actual index value. Given a second preset compression value ≤ 255, the second preset compression value should be made as large as possible. This means the second preset compression value can be ≤ 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 compression value can be set to 255 / 15 = 17. When using two pixels to store the actual index value, to minimize storage errors and ensure complete storage of the index value, the compression value can be set to the maximum value of the actual index value. Under the premise that the second preset compression value is ≤65535, the second preset compression value should be made as large as possible. That is, the second preset compression value can be ≤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 can be 65535 / 131≈500 (rounded to the nearest integer).
[0071] 204. Generate the information storage texture of the patch to be stored based on the high position value, the low position value and the index storage value.
[0072] The first pixel in the information storage image is used to store the high-order position value and the index storage value, and the second pixel in the information storage image is used to store the low-order position value and the index storage value.
[0073] Please refer to Figure 4 and Figure 5 For example, step 204 may specifically include the following steps 2041 to 2043: 2041. Obtain the storage pixel position of the area to be stored.
[0074] The stored pixel position includes the pixel position of the high-order position value and the pixel position of the low-order position value.
[0075] The pixel position of the high-order position value is used to indicate the row and column coordinates of the high-order position value in the information storage texture.
[0076] The pixel position of the low-order position value is used to indicate the row and column coordinates of the low-order position value in the information storage texture.
[0077] In step 2041, there are multiple ways to obtain the storage pixel position, including, for example: (1) In some embodiments, two pixel positions can be randomly selected as the pixel positions of the high bit position value and the low bit position value of the patch to be stored.
[0078] For example, the pixel positions of the high-order position value and low-order position value of the first facet in the target facet set are in the first row and first column of the texture and the third row and first column, respectively; the pixel positions of the high-order position value and low-order position value of the second facet are in the second row and second column of the texture and the second row and first column, respectively, ...
[0079] (2) In some embodiments, such as Figure 4 and Figure 5 As shown, the high-order position values of each facet in the target facet set can be recorded on the same row of pixels in the information storage map, and the low-order position values can also be recorded on the same row of pixels in the information storage map. That is, for a single facet to be stored, the pixel position of the high-order position value obtained in step 2041 and the corresponding map column coordinates of the pixel position of the low-order position value are the same.
[0080] Among them, the texture column coordinates and texture row coordinates refer to the column coordinates and row coordinates of the high or low position values in the information storage texture, respectively.
[0081] For example, the pixel positions of the high-order position values of the 1st, 2nd, ..., 32nd faces in the target face set are respectively row 1, column 1, row 1, column 2, ..., row 1, column 32, and the pixel positions of the low-order position values are respectively row 2, column 1, row 2, column 2, ..., row 2, column 32. It can be seen that the column coordinates of the same face (i.e., the face to be stored) are the same (e.g., the column coordinates of the high-order position value of the 1st face are).
[0082] Since an information storage map typically stores the actual position values of multiple faces, and map scanning is usually done line by line, by recording the high-order position values of each face in the target face set on the same row of pixels in the information storage map, and the low-order position values on the same row of pixels in the information storage map, subsequent scanning only requires scanning two rows of pixels in the information storage map to read all the high-order and low-order position values. Therefore, recording the high-order position values of each face in the target face set on the same row of pixels in the information storage map, and the low-order position values on the same row of pixels in the information storage map, can improve the speed of reading all the high-order and low-order position values in the information storage map later (e.g., during decoding).
[0083] (3) In some embodiments, the high-order position values of the actual position values of each patch in the target patch set may also be recorded on the same column of pixels in the information storage map, and the low-order position values may also be recorded on the same column 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 row coordinate corresponding to the pixel position of the low-order position value.
[0084] Similarly, when the texture is scanned column by column, by recording the high-order position values of each actual position value of each face in the target face set on the same column of pixels in the information storage texture, and recording the low-order position values on the same column of pixels in the information storage texture, subsequent scanning only needs to scan two columns of pixels in the information storage texture to read all the high-order and low-order position values in the information storage texture; thus, the speed of reading all the high-order and low-order position values in the information storage texture in subsequent processes (such as during decoding) can be improved.
[0085] 2042. Based on the high-order position value and the index storage value, generate the first pixel at the pixel position of the high-order position value.
[0086] In some embodiments, the high-order position values include the first coordinate value of the patch to be stored on the first coordinate axis, the second coordinate value on the second coordinate axis, and the third coordinate value on the third coordinate axis, which are compressed and encoded to obtain the first high-order position value (i.e., the high-order position value of the X-axis coordinate), the second high-order position value (i.e., the high-order position value of the Y-axis coordinate), and the third high-order position value (i.e., the high-order position value of the Z-axis coordinate). Please refer to... Figure 4 For example, step 2042 may specifically include the following steps A1 to A4: A1. Set the first high-order position value to the R-channel value of the pixel position of the high-order position value to generate a first pixel point whose R-channel stores the first high-order position value.
[0087] A2. Set the second high-order position value to the G-channel value of the pixel position of the high-order position value to generate a first pixel point whose G-channel stores the second high-order position value.
[0088] A3. Set the third high-order position value to the B-channel value of the pixel position of the high-order position value to generate a first pixel point whose B-channel stores the third high-order position value.
[0089] A4. Set the index storage value to the A channel value of the pixel position of the high-order position value to generate a first pixel point whose A channel stores the index storage value.
[0090] For example, such as Figure 4 As shown, this example illustrates how the position and index values of all 32 faces in a target face set are stored in the same information storage map, and the index storage values include both high-order and low-order index values. Assumptions: The actual stored value (x1, y1, z1) of the first facet is compressed and encoded in step 202 above to obtain the high-order position value (x1, y1, z1). , , ), low position value ( , , );in, , , These are the high-order position values of the X-axis, Y-axis, and Z-axis coordinates of the first patch, respectively. , , These are the low-order position values of the X-axis, Y-axis, and Z-axis coordinates of the first patch, respectively.
[0091] The actual stored value (x2, y2, z2) of the second facet is compressed and encoded in step 202 above to obtain the high-order position value (x2, y2, z2). , , ), low position value ( , , ); … The actual stored value (x32, y32, z32) of the 32nd face is compressed and encoded in step 202 above to obtain the high-order position value ( , , ), low position value ( , , ); After step 2041, the pixel positions of the high-order position values of the 1st, 2nd, ..., 32nd face are determined to be: row 1, column 1; row 1, column 2; ...; row 1, column 32; and the pixel positions of the high-order position values of the 1st, 2nd, ..., 32nd face are determined to be: row 2, column 1; row 2, column 2; ...; row 2, column 32.
[0092] At this point, in steps A1 to A4, the high-order position values of the X-axis, Y-axis, and Z-axis coordinates of the first patch can be obtained. , , Set the R, G, B, and A channel values of the pixel in the first row and first column respectively; set the high-order position values of the X, Y, and Z axes of the second patch. , , Set the R, G, B, and A channel values of the pixel in the 1st row and 2nd column respectively; ...; set the high-order position values of the X, Y, and Z axes of the 32nd patch. , , Set the channel values of the R channel, G channel, B channel, and A channel of the pixel in the 1st row and 32nd column, respectively.
[0093] 2043. Based on the low-order position value and the index storage value, generate the second pixel at the pixel position of the low-order position value.
[0094] In some embodiments, the low-order position values include the first coordinate value of the patch to be stored on the first coordinate axis, the second coordinate value on the second coordinate axis, and the third coordinate value on the third coordinate axis, which are compressed and encoded to obtain the first low-order position value (i.e., the low-order position value of the X-axis coordinate), the second low-order position value (i.e., the low-order position value of the Y-axis coordinate), and the third low-order position value (i.e., the low-order position value of the Z-axis coordinate). For example, step 2043 may specifically include the following steps B1 to B4: B1. Set the first low-order position value to the R channel value of the pixel position of the low-order position value to generate a second pixel point whose R channel stores the first low-order position value.
[0095] B2. Set the second low-order position value to the G channel value of the pixel position of the low-order position value to generate a second pixel point whose G channel stores the second low-order position value.
[0096] B3. Set the third low-order position value to the B channel value of the pixel position of the low-order position value to generate a second pixel point whose B channel stores the third low-order position value.
[0097] B4. Set the index storage value to the A channel value of the pixel position of the low-order position value to generate a second pixel point where the index storage value is stored in the A channel.
[0098] To facilitate understanding, let's continue with the examples in steps A1-A4 above. In steps B1-B4, the lower-order position values of the X-axis, Y-axis, and Z-axis coordinates of the first patch can be... , , Set the R, G, B, and A channel values of the pixel in the second row and first column respectively; set the low-order position values of the X, Y, and Z axis coordinates of the second patch. , , Set the R, G, B, and A channel values of the pixel in the 2nd row and 2nd column respectively; ...; set the low-order position values of the X, Y, and Z axes of the 32nd patch. , , Set the channel values of the R channel, G channel, B channel, and A channel of the pixel in the 2nd row and 32nd column, respectively.
[0099] Therefore, it is possible to generate a pixel with a high-order position value stored in the 1st row, 1st column, 1st row, 2nd column, ..., 1st row, 32nd column respectively. , , ), ( , , ), ..., ( , , The low-order position values are stored at the pixel positions in the 2nd row, 1st column, 2nd row, 2nd column, ..., 2nd row, 32nd column respectively. , , ), ( , , ), ..., ( , , Information storage texture.
[0100] Furthermore, to reduce the amount of data processing required when reading the actual position and index values of the patches to be stored from the information storage map (e.g., during image rendering using sampled information storage maps), in step 204, when generating the information storage map, the number of patches in the target patch set can be used as the horizontal pixel count of the information storage map to be generated; that is, the number of pixel columns in the generated information storage map equals the number of patches in the target patch set. Specifically, step 204 can include: obtaining the number of patches in the target patch set; and generating the information storage map based on the number of patches, the high-order position value, the low-order position value, and the index storage value. The number of pixel columns in the information storage map is the same as the number of patches. For example, if the number of patches in the target patch set is 32, then an information storage map with 32 pixel columns can be generated. Since the number of pixel columns in the information storage map is equal to the number of faces in the target face set, it is sufficient to store all faces in the target face set. Furthermore, at this time, all pixels in a row are used for face data storage, and there are no redundant pixels that need to be scanned. This reduces the amount of data processing required when reading the actual position and index values of the face to be stored from the information storage map.
[0101] Similarly, the number of pixel rows in the generated information storage map can be set to 2 to reduce the amount of data processing when reading the actual position value and actual index value of the face to be stored from the information storage map.
[0102] Furthermore, when it is necessary to read the actual position value and actual index value of the area to be stored from the information storage texture, for example, when performing image rendering by sampling the information storage texture, it is necessary to decode and restore the position storage value and index storage value stored in the information storage texture in compression encoding. The decoding process of the position storage value may include the following steps D1~D3: D1. Decode the high-order position value stored in the first pixel to obtain the high-order decoded value of the high-order position value.
[0103] D2. Decode the low-order position value stored in the second pixel to obtain the low-order decoded value of the low-order position value.
[0104] D3. Concatenate the high-bit decoded value of the high-bit position value and the low-bit decoded value of the low-bit position value to obtain the decoded position value of the patch to be stored.
[0105] To facilitate understanding, let's continue with the examples from steps 2021 to 2025 above. For instance, after compressing and encoding the X-axis coordinate value of 0.123, we obtain the high-order position value 3 / 255 and the low-order position value 37 / 255, which corresponds to steps D1 to D3. First, we decode the high-order position value 3 / 255 stored in the first pixel: the high-order position value 3 / 255 needs to be multiplied by 255. 256, which is (3 / 255) 255 256 = 768 (DEC). Decoding the low-order position value 37 / 255 stored in the first pixel: the low-order position value needs to be multiplied by 255, i.e., (37 / 255). 255 = 37 (DEC). Then, concatenate the high-order decoded value 768 (DEC) of the high-order position value with the low-order decoded value 37 (DEC) of the low-order position value to obtain the decoded position value of the X-axis coordinate: Decoded position value = (Low-order decoded value + High-order decoded value) / 6550 = (37 + 768) / 6550 ≈ 0.1229007 ≈ 0.123. Similarly, the decoded position values of the Y-axis and Z-axis coordinates can be obtained, thus providing the complete decoded position value of the area to be stored.
[0106] Similarly, if the index storage value is split and stored across two pixels, i.e., the index storage value includes a high-order index value and a low-order index value, the decoding process of the index storage value can include the following steps E1~E3: E1. Decode the high-order index value stored in the first pixel to obtain the high-order decoded value of the high-order index value.
[0107] E2. Decode the low-order index value stored in the second pixel to obtain the low-order decoded value of the low-order index value.
[0108] E3. Concatenate the high-bit decoded value of the high-bit index value and the low-bit decoded value of the low-bit index value to obtain the decoded index value of the patch to be stored.
[0109] Therefore, when the information storage texture is used to render the model to be rendered, the position storage value and index storage value stored in the information storage texture are decoded and restored to obtain the decoded position value and decoded index value of the face to be stored; and according to the decoded position value and decoded index value of the face to be stored, the face effect of the face to be stored is rendered into the model to be rendered.
[0110] The following provides some data evidence that the method in this embodiment can improve the data storage accuracy when storing 8-bit texture data (such as actual position values): Why does selecting a value less than the maximum storage value of two pixels (such as 6550) as the first preset compression value affect data storage accuracy?
[0111] To ensure that the actual position value is stored accurately to three decimal places, it needs to be multiplied by a value greater than 1000 (i.e., the first preset compression value ≥ 1000). The value range that two pixels can store is [0000, FFFF] (HEX) = [0, 65535] (DEC). Because the storable range needs to be maintained at [0, 10], 65535 / 10 = 6553.5. Multiplying by 6550 instead of 6553.5 allows for some margin, preventing the result from exceeding 65535 after multiplication. Taking an actual position value of 10 as an example, the compression encoding and decoding process of the actual position value is as follows: If multiplied by 6550: ① During compression encoding, first execute step 2021~2022:10 6550 = 65500 (DEC) = FFDC (HEX); where 10 multiplied by 6550 is used to retain 3 decimal places.
[0112] Next, execute steps 2023-2025: split FFDC into two parts: FF(HEX) and DC(HEX), so that the data can be stored in two pixels (the first and second pixels), FF(HEX) = 255(DEC), DC(HEX) = 220(DEC). That is, the high-order bit value is 255 / 255, and the low-order bit value is 220 / 255.
[0113] ②During decoding, execute steps D1~D3: The value of the lower digit needs to be multiplied by 255, i.e., (220 / 255). 255 = 220 (DEC).
[0114] The higher position value needs to be multiplied by 255. 256, which is (255 / 255) 255 256 = 65280 (DEC).
[0115] The final decoded position value is (low-bit decoded value + high-bit decoded value) / 6550 = (220 + 65280) / 6550 = 10.
[0116] If multiplied by 6553: Compression encoding: 6553 10 = 65530 (DEC) = FFFA (HEX), which can be split into FF (HEX) = 255 (DEC) and FA (HEX) = 250 (DEC). The high-order position value is 255 / 255, and the low-order position value is 250 / 255.
[0117] Decoding: The value of the low-order bit is (250 / 255) 255 = 250 (DEC), the value of the high-order bit is (255 / 255). 255 256 = 65280 (DEC), and the final decoded position value = (low-bit decoded value + high-bit decoded value) / 6553 = (250 + 65280) / 6553 ≈ 10.0610407 ≈ 10.061.
[0118] As can be seen, if the first preset compression value is greater than 6550, the calculation result will exceed this value, resulting in the decoded position value being greater than the actual position value, thus reducing storage accuracy. Therefore, setting the first preset compression value to a value less than 6553 can improve data storage accuracy.
[0119] II. Why does the actual position value range of [0,10] affect data storage accuracy? Referring to Table 1, the following examples illustrate why setting the actual position value to a value within the range of [0,10], [0,100], and [0,1000], and using 2-bit pixels for storage (i.e., a total of 65535 stored values can be stored, with compressed values of 6550, 655, and 65 respectively), can improve data storage accuracy when storing 8-bit texture data (such as actual position values).
[0120] As mentioned earlier, there may be errors when storing color values for a pixel. For example, in hexadecimal, F might be recorded as E, and 3 might be recorded as 2 or 4.
[0121] 1. Error in the range [0,10]. Taking an actual position value of 10 as an example: Code: 10 6550 = 65500(DEC) = FFDC(HEX) => High byte FF(HEX), Low byte DC(HEX).
[0122] There may be errors: FF-1=FE(HEX)=254(DEC), DC-1=DB(HEX)=219(DEC).
[0123] Decoding yields: (254) 256+219) / 6550≈9.960763358778626.
[0124] The error is: 10 - 9.960763358778626 = 0.039236641221374.
[0125] 2. Error in the range [0, 100]. Taking an actual position value of 100 as an example: Code: 100 655 = 65500(DEC) = FFDC(HEX) => High byte FF(HEX), Low byte DC(HEX).
[0126] There may be errors: FF-1=FE(HEX)=254(DEC), DC-1=DB(HEX)=219(DEC).
[0127] Decoding yields: (254) 256+219) / 655≈99.6076.
[0128] The error is: 100 - 99.6076 = 0.3924.
[0129] 3. Error in the range [0, 1000]. Taking an actual position value of 1000 as an example: Code: 1000 65 = 65500(DEC) = FFDC(HEX) => High byte FF(HEX), Low byte DC(HEX).
[0130] There may be errors: FF-1=FE(HEX)=254(DEC), DC-1=DB(HEX)=219(DEC).
[0131] Decoding yields: (254) 256+219) / 65≈1003.7384.
[0132] The error is: 1000-1003.7384=-3.7384.
[0133] It is evident that, when using two pixels (with a value range of [0000, FFFF]), the larger the range of the actual position value, the greater the error.
[0134] Table 1
[0135] 3. Why does using two pixels from a texture to store an actual position value affect data storage accuracy?
[0136] Using three pixels for storage will also result in errors, and the maximum error value will change from 0101 (HEX) to 010101 (HEX), making the error even larger. Each pixel's stored value will have a 0-1 error. The error value 0101 (HEX) consists of the 0-1 errors of the high-order and low-order positions; 010101 (HEX) consists of the 0-1 errors of the original high-order and low-order positions, plus the 0-1 error of the newly added third pixel's stored value. To maintain an error value of 0.0393, the storable value range remains [0,1]. The value range doesn't increase; instead, it increases the data processing required to add a single pixel, which is pointless.
[0137] If one pixel is used for storage, the range of values that can be stored is [00, FF], which is [0, 256]. If you want to retain three decimal places, you cannot store the value in this pixel. (Because retaining three decimal places requires multiplying by at least 1000, even if 1.001 is multiplied by 1000, it will become 1001. Since 1001 > 256, it is impossible to store data with three decimal places.)
[0138] It is evident that using two pixels to store an actual location value can improve data storage accuracy while increasing the range of stored values and reducing the amount of data processing required.
[0139] For a better understanding of the patch position information storage method in this embodiment, please refer to... Figure 3 , Figure 4 and Figure 5 The following example, using a real-world business scenario where a facet is created with its actual position value ranging from [0,10] and its actual index value ranging from [0,120], illustrates how to store the actual position value and actual index value of a facet. The storage procedure includes: 1. Create a facet in 3ds Max to obtain the following: Figure 3 The example shown contains a preset set of 32 facets. The X, Y, and Z coordinate values of the created facets are all within [0, 10]. The actual position values of the facets will be determined based on their X, Y, and Z coordinate values.
[0140] 2. Select all preset face sets from the first face to the last face (in this case, the selection order is the actual recorded index value) to obtain the target face set. For example... Figure 6 As shown, click Figure 6 The "Render Patch Position and Order" option in the data storage tool interface allows you to set the actual position and index value for each patch.
[0141] III. Figure 6As shown, click the "Output Image" button in the data storage tool to proceed to step four. Figure 6 In the middle, setting "Select UV Channel" to "UV2" indicates that the output is the position of the second set of UVs.
[0142] IV. The data storage tool will automatically calculate and output information storage textures. The tool's algorithm includes the following steps ①~⑦: ① After clicking the [Output Image] button, the selected facets are retrieved according to the selection order and stored in the array object_array.
[0143] ②Inspect the selected faces. After saving, inspect the selected faces, including: 1) If the number of faces in the target face set is less than or equal to 0, it means that no face was selected, and the check failed. 2) If the number of faces in the target face set is greater than the maximum number of objects limited by the tool (i.e., greater than the maximum value of the actual index value), then the check will fail in order to ensure accuracy. 3) Check all selected faces in the array and check whether their actual position values are within the set minimum and maximum range (i.e., whether they are within the range of actual position values [0,10]). 4) If the coordinate value of any of the XYZ axes of the selected face is less than the minimum value (i.e., 0), the check fails. 5) If the coordinate value of any of the XYZ axes of the selected face is greater than the maximum value (i.e., 10), the check will also fail.
[0144] ③ If the check passes, record the number of selected faces, which will be used as the horizontal pixel count of the information storage texture (pixel column count = pixel length = number of selected faces), such as Figure 4 As shown.
[0145] ④ Select and save the location for texture output. If the output location is empty, it means cancel saving.
[0146] Specifically, after clicking the "Output Image" button, if the check of the facets in step ② passes, a window will pop up to select the storage location. If you click the "Save" button, the file name (including the path) will be recorded. If you click the "Cancel" button, an empty value will be returned.
[0147] ⑤ If the location for storing the texture is not empty, all selected faces in the target face set will be traversed, and data will be set and stored one by one. For the current face being traversed, the following steps 1) to 5) will be executed. 1) Obtain the [UVW Unwrap] modifier for the current facet; 2) Set the UV channel of the current face using the Unwrap_UVW modifier, and set it to the second set of UVs; 3) Because all selected faces need to be merged into one face, the UVs of all selected faces will be merged together. However, after the UVs are merged, each selected face will sample the entire texture, which means that the pixels corresponding to the index values of each selected face cannot be accurately sampled. Therefore, it is necessary to move and scale them, where: The first set of UVs for the first facet will fully sample the frame animation texture information; The second set of UVs for the first facet is scaled and moved to the first position to ensure that the information of the first vertical row can be sampled. The second set of UVs for the second facet is scaled and moved to the second position to ensure that the information of the second vertical row can be sampled. The second set of UVs for the 32nd facet is scaled and moved to the 32nd position to ensure that information from the 32nd vertical row can be sampled. Merge the second set of UVs for the 32 faces to obtain the positions of the second set of UVs for all selected faces, such as... Figure 7 As shown, Figure 7 The position of each black dot in the image represents the position of the second set of UVs for a given face; the position of the second set of UVs for each selected face corresponds one-to-one with the pixel position stored in the exported texture map, such as... Figure 7 ( Figure 7 The CCP showed the location of the second set of UVs for the 32 facets) and Figure 5 ( Figure 5 The diagram shows the storage of the actual position values and actual index values for 32 facets. Figure 5 (Each matrix box represents one pixel, as shown in the figure.)
[0148] 4) Save the settings of the Unwrap_UVW modifier.
[0149] 5) Store the data of the current face. (That is, record the actual position value and actual index value of the current face. For specific storage methods, please refer to the relevant instructions on storing the actual position value and actual index value of the face to be stored above, which will not be repeated here.) ⑥ After the data storage of the current facet is completed, start rendering the texture based on the stored data.
[0150] The rendered information storage map will be saved to the output location selected in step ④. The pixel length of the rendered information storage map = the number of selected faces = the number of faces in the target face set.
[0151] ⑦ Once completed, a pop-up message box will appear indicating that rendering is complete and the obtained information will be stored as a texture.
[0152] As can be seen from the above, by compressing and encoding the actual position value of the area to be stored into high-order and low-order position values, and using two different pixels (the first pixel and the second pixel) in the information storage texture to store the high-order and low-order position values respectively, firstly, compared to one pixel, using two pixels to store one actual position value can improve the data storage accuracy while increasing the range of stored values; secondly, because the actual position value is compressed and encoded using the first preset compression, the values after the decimal point can be accurately preserved, thereby improving the data storage accuracy of low-precision textures such as TGA textures. This makes the area position values sampled by low-precision textures such as TGA textures more accurate, avoiding the problem of large storage errors in area position values caused by the low data storage accuracy of low-precision textures such as TGA textures, and thus avoiding jumps in frame animation; thereby improving the picture effect of frame animation displayed on low-end devices.
[0153] To better implement the above methods, this application also provides a patch location information storage device, which can be integrated into an electronic device, such as a computer device, which can be a terminal, server, or other similar device. The terminal can be a mobile phone, tablet computer, smart Bluetooth device, laptop computer, personal computer, or other similar device; the server can be a single server or a server cluster composed of multiple servers.
[0154] For example, in this embodiment, the method of this application embodiment will be described in detail by taking the specific integration of the patch location information storage device into a smartphone as an example.
[0155] For example, such as Figure 8 As shown, the patch position information storage device may include: The acquisition unit 801 is used to acquire the actual position value and actual index value of the face to be stored; The first compression unit 802 is used to compress and encode 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 includes a high-order position value and a low-order position value. The second compression unit 803 is used to compress and encode the actual index value based on the second preset compression value to obtain the index storage value of the actual index value; Storage unit 804 is used to generate an information storage map of the patch to be stored based on the high-order position value, the low-order position value and the index storage value, wherein the first pixel in the information storage map is used to store the high-order position value and the index storage value, and the second pixel in the information storage map is used to store the low-order position value and the index storage value.
[0156] In some embodiments, the storage unit 804 is specifically used for: Obtain the storage pixel position of the area to be stored, wherein the storage pixel position includes the pixel position of the high-order position value and the pixel position of the low-order position value; Based on the high-order position value and the index storage value, the first pixel is generated at the pixel position of the high-order position value; Based on the low-order position value and the index storage value, the second pixel is generated at the pixel position of the low-order position value.
[0157] In some embodiments, the actual position value includes the first coordinate value of the patch to be stored on the first coordinate axis, the second coordinate value on the second coordinate axis, and the third coordinate value on the third coordinate axis; the high-order position value includes a first high-order position value, a second high-order position value, and a third high-order position value obtained by compressing and encoding the first coordinate value, the second coordinate value, and the third coordinate value, respectively; the storage unit 804 is specifically used for: Set the first high-order position value to the R-channel value of the pixel position of the high-order position value to generate a first pixel point whose R-channel stores the first high-order position value; The second high-order position value is set to the G-channel value of the pixel position of the high-order position value to generate a first pixel point whose G-channel stores the second high-order position value; The third high-order position value is set to the B-channel value of the pixel position of the high-order position value to generate a first pixel point whose B-channel stores the third high-order position value; The index storage value is set to the A channel value of the pixel position of the high-order position value to generate a first pixel point whose A channel stores the index storage value.
[0158] In some embodiments, the actual position value includes the first coordinate value of the patch to be stored on the first coordinate axis, the second coordinate value on the second coordinate axis, and the third coordinate value on the third coordinate axis; the low-order position value includes a first low-order position value, a second low-order position value, and a third low-order position value obtained by compressing and encoding the first coordinate value, the second coordinate value, and the third coordinate value, respectively; the storage unit 804 is specifically used for: The first low-order position value is set to the R channel value of the pixel position of the low-order position value to generate a second pixel point whose R channel stores the first low-order position value. The second low-order position value is set to the G channel value of the pixel position of the low-order position value to generate a second pixel point whose G channel stores the second low-order position value; The third low-order position value is set to the B channel value of the pixel position of the low-order position value to generate a second pixel point whose B channel stores the third low-order position value; The index storage value is set to the A channel value of the pixel position of the low-order position value to generate a second pixel point whose A channel stores the index storage value.
[0159] In some embodiments, the texture column coordinates corresponding to the pixel position of the high-order position value are the same as the texture column coordinates corresponding to the pixel position of the low-order position value.
[0160] In some embodiments, the first compression unit 802 is specifically used for: Multiply the actual position value by the first preset compression value to obtain the decimal value of the actual position value, wherein the actual position value is in decimal format; The decimal value of the actual position value is converted to the hexadecimal value of the actual position value; The hexadecimal value of the actual position value is split to obtain the high-order hexadecimal value and the low-order hexadecimal value of the actual position value; The high-order position value is obtained based on the high-order hexadecimal value of the actual position value; The low-order position value is obtained based on the low-order hexadecimal value of the actual position value.
[0161] In some embodiments, the index storage value includes a high-order index value and a low-order index value, and the second compression unit 803 is specifically used for: Multiply the actual index value by the second preset compression value to obtain the decimal value of the actual index value; The decimal value of the actual index value is converted to the hexadecimal value of the actual index value; The hexadecimal value of the actual index value is split to obtain the high-order hexadecimal value and the low-order hexadecimal value of the actual index value; The high-order index value is obtained based on the high-order hexadecimal value of the actual index value; The low-order index value is obtained based on the low-order hexadecimal value of the actual index value.
[0162] In some embodiments, the patch position information storage device further includes a decoding unit (not shown in the figure), the decoding unit being specifically used for: When the information storage texture is used to render the model to be rendered, the high-bit position value stored in the first pixel is decoded to obtain the high-bit decoded value of the high-bit position value. The low-order position value stored in the second pixel is decoded to obtain the low-order decoded value of the low-order position value; The high-order decoded value and the low-order decoded value are concatenated to obtain the decoded position value of the patch to be stored; Based on the decoded position value, the surface effect of the surface to be stored is rendered onto the model to be rendered.
[0163] In some embodiments, the facets to be stored are facets in a target facet set, and the storage unit 804 is specifically used for: Obtain the number of faces in the target face set; The information storage map is generated based on 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 in the information storage map is the same as the number of patches.
[0164] In some embodiments, the information storage map is an 8-bit map, and the actual position value ranges from 0 to 10.
[0165] In some embodiments, the information storage texture is used to record the position value and index value of each patch in the target patch set. Before obtaining the actual position value and actual index value of the patch to be stored, the acquisition unit 801 is specifically used for: Select the selected face from the preset face set; If the position value of the selected face is within the range of the actual position value and the index value of the selected face is within the range of the actual index value, then the selected face will be added to the target face set. Traverse each face in the target face set and use the currently traversed face as the face to be stored.
[0166] Therefore, the patch position information storage device provided in this application embodiment can bring the following technical effects: by compressing and encoding the actual position value of the patch to be stored into a high-order position value and a low-order position value, and using two different pixels (a first pixel and a second pixel) in the information storage map to store the high-order position value and the low-order position value respectively; firstly, compared with one pixel, using two pixels to store one actual position value can improve the data storage accuracy while increasing the value range of storage; secondly, since the actual position value is compressed and encoded using the first preset compression, the value after the decimal point can be accurately saved, thereby improving the data storage accuracy of low-precision maps such as TGA maps, making the patch position value sampled by low-precision maps such as TGA maps more accurate, avoiding the problem of large storage error of patch position value caused by the low data storage accuracy of low-precision maps such as TGA maps, and thus avoiding the situation of frame animation jumping; thereby improving the picture effect of frame animation displayed on low-end devices.
[0167] Accordingly, this application also provides an electronic device, which can be a terminal, such as a smartphone, tablet computer, laptop computer, touch screen, game console, personal computer (PC), personal digital assistant (PDA), or other terminal device. Figure 9 As shown, Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this 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 and the memory 902 are electrically connected. Those skilled in the art will understand that the electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0168] The processor 901 is the control center of the electronic device 900. It connects various parts of the electronic device 900 via various interfaces and lines. By running or loading software programs and / or modules stored in the memory 902, and by calling data stored in the memory 902, it executes various functions and processes data of the electronic device 900, thereby providing overall monitoring of the electronic device 900. The processor 901 can be a central processing unit (CPU), a graphics processing unit (GPU), a network processor (NP), etc., and can implement or execute the methods, steps, and logic diagrams disclosed in the embodiments of this application.
[0169] In this embodiment, the processor 901 in the electronic device 900 loads the instructions corresponding to the processes of one or more applications into the memory 902 according to the following steps, and the processor 901 runs the applications stored in the memory 902 to realize various functions, such as: Obtain the actual position and index value of the face to be stored; Based on a first preset compression value, the actual position value is compressed and encoded to obtain the position storage value of the actual position value, wherein the position storage value includes a high-order position value and a low-order position value. Based on the second preset compression value, the actual index value is compressed and encoded to obtain the index storage value of the actual index value; Based on the high-order position value, the low-order position value, and the index storage value, an information storage texture map of the patch to be stored is generated, wherein the first pixel in the information storage texture map is used to store the high-order position value and the index storage value, and the second pixel in the information storage texture map is used to store the low-order position value and the index storage value.
[0170] In some embodiments, generating the information storage map of the patch to be stored based on the high-order position value, the low-order position value, and the index storage value includes: Obtain the storage pixel position of the area to be stored, wherein the storage pixel position includes the pixel position of the high-order position value and the pixel position of the low-order position value; Based on the high-order position value and the index storage value, the first pixel is generated at the pixel position of the high-order position value; Based on the low-order position value and the index storage value, the second pixel is generated at the pixel position of the low-order position value.
[0171] In some embodiments, the actual position value includes the first coordinate value of the patch to be stored on the first coordinate axis, the second coordinate value on the second coordinate axis, and the third coordinate value on the third coordinate axis, and the high-bit position value includes the first high-bit position value, the second high-bit position value, and the third high-bit position value obtained by compressing and encoding the first coordinate value, the second coordinate value, and the third coordinate value, respectively. The step of generating the first pixel at the pixel position of the high-order position value based on the high-order position value and the index storage value includes: Set the first high-order position value to the R-channel value of the pixel position of the high-order position value to generate a first pixel point whose R-channel stores the first high-order position value; The second high-order position value is set to the G-channel value of the pixel position of the high-order position value to generate a first pixel point whose G-channel stores the second high-order position value; The third high-order position value is set to the B-channel value of the pixel position of the high-order position value to generate a first pixel point whose B-channel stores the third high-order position value; The index storage value is set to the A channel value of the pixel position of the high-order position value to generate a first pixel point whose A channel stores the index storage value.
[0172] In some embodiments, the actual position value includes the first coordinate value of the patch to be stored on the first coordinate axis, the second coordinate value on the second coordinate axis, and the third coordinate value on the third coordinate axis, and the low-bit position value includes the first low-bit position value, the second low-bit position value, and the third low-bit position value obtained by compressing and encoding the first coordinate value, the second coordinate value, and the third coordinate value, respectively. The step of generating the second pixel at the pixel position of the low-order position value based on the low-order position value and the index storage value includes: The first low-order position value is set to the R channel value of the pixel position of the low-order position value to generate a second pixel point whose R channel stores the first low-order position value. The second low-order position value is set to the G channel value of the pixel position of the low-order position value to generate a second pixel point whose G channel stores the second low-order position value; The third low-order position value is set to the B channel value of the pixel position of the low-order position value to generate a second pixel point whose B channel stores the third low-order position value; The index storage value is set to the A channel value of the pixel position of the low-order position value to generate a second pixel point whose A channel stores the index storage value.
[0173] In some embodiments, the texture column coordinates corresponding to the pixel position of the high-order position value are the same as the texture column coordinates corresponding to the pixel position of the low-order position value.
[0174] In some embodiments, the step of compressing and encoding the actual location value based on a first preset compression value to obtain the location storage value of the actual location value includes: Multiply the actual position value by the first preset compression value to obtain the decimal value of the actual position value, wherein the actual position value is in decimal format; The decimal value of the actual position value is converted to the hexadecimal value of the actual position value; The hexadecimal value of the actual position value is split to obtain the high-order hexadecimal value and the low-order hexadecimal value of the actual position value; The high-order position value is obtained based on the high-order hexadecimal value of the actual position value; The low-order position value is obtained based on the low-order hexadecimal value of the actual position value.
[0175] In some embodiments, the index storage value includes a high-order index value and a low-order index value, wherein the high-order index value is stored at the first pixel and the low-order index value is stored at the second pixel; The step of compressing and encoding the actual index value based on the second preset compression value to obtain the index storage value of the actual index value includes: Multiply the actual index value by the second preset compression value to obtain the decimal value of the actual index value; The decimal value of the actual index value is converted to the hexadecimal value of the actual index value; The hexadecimal value of the actual index value is split to obtain the high-order hexadecimal value and the low-order hexadecimal value of the actual index value; The high-order index value is obtained based on the high-order hexadecimal value of the actual index value; The low-order index value is obtained based on the low-order hexadecimal value of the actual index value.
[0176] In some embodiments, the method further includes: When the information storage texture is used to render the model to be rendered, the high-bit position value stored in the first pixel is decoded to obtain the high-bit decoded value of the high-bit position value. The low-order position value stored in the second pixel is decoded to obtain the low-order decoded value of the low-order position value; The high-order decoded value and the low-order decoded value are concatenated to obtain the decoded position value of the patch to be stored; Based on the decoded position value, the surface effect of the surface to be stored is rendered onto the model to be rendered.
[0177] In some embodiments, the face to be stored is each face in a target face set, and generating an information storage map of the face to be stored based on the high-order position value, the low-order position value, and the index storage value includes: Obtain the number of faces in the target face set; The information storage map is generated based on 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 in the information storage map is the same as the number of patches.
[0178] In some embodiments, the information storage map is an 8-bit map, and the actual position value ranges from 0 to 10.
[0179] In some embodiments, the information storage map is used to record the position and index values of each facet in the target facet set. Before obtaining the actual position and index values of the facet to be stored, the method further includes: Select the selected face from the preset face set; If the position value of the selected face is within the range of the actual position value and the index value of the selected face is within the range of the actual index value, then the selected face will be added to the target face set. Traverse each face in the target face set and use the currently traversed face as the face to be stored.
[0180] Therefore, the electronic device 900 provided in this embodiment can bring the following technical effects: by compressing and encoding the actual position value of the area to be stored into a high-order position value and a low-order position value, and using two different pixels (a first pixel and a second pixel) in the information storage map to store the high-order position value and the low-order position value respectively; firstly, compared with one pixel, using two pixels to store one actual position value can improve the data storage accuracy while increasing the range of stored values; secondly, since the actual position value is compressed and encoded using the first preset compression, the value after the decimal point can be accurately saved, thereby improving the data storage accuracy of low-precision maps such as TGA maps, making the area position value sampled by low-precision maps such as TGA maps more accurate, avoiding the problem of large storage error of area position value caused by the low data storage accuracy of low-precision maps such as TGA maps, and thus avoiding the situation of frame animation jumping; thereby improving the picture effect of frame animation displayed on low-end devices.
[0181] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0182] Optional, such as Figure 9 As shown, the electronic device 900 also includes: a touch display screen 903, a radio frequency circuit 904, an audio circuit 905, an input unit 906, and a power supply 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 understand that... Figure 9 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0183] The touch display screen 903 can be used to display a graphical user interface (GUI) and receive operation commands generated by the user interacting with the GUI. The touch display screen 903 may include a display panel and a touch panel. The display panel can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the electronic device. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. Optionally, the display panel can be configured using a liquid crystal display (LCD), organic light-emitting diode (OLED), or other similar technologies. The touch panel can be used to collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel), generate corresponding operation commands, and execute the corresponding program according to the operation commands. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch location and the signal generated by the touch operation, transmitting the signal to the touch controller. The touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 901. It can also receive and execute commands from the processor 901. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it transmits the information to the processor 901 to determine the type of touch event. Subsequently, the processor 901 provides corresponding visual output on the display panel based on the type of touch event. In this embodiment, the touch panel and the display panel can be integrated into the touch display screen 903 to achieve input and output functions. However, in some embodiments, the touch panel and the touch display screen 903 can be implemented as two independent components to achieve input and output functions. That is, the touch display screen 903 can also be used as part of the input unit 906 to achieve input functions.
[0184] The radio frequency circuit 904 can be used to transmit and receive radio frequency signals to establish wireless communication with network devices or other electronic devices, and to transmit and receive signals with network devices or other electronic devices.
[0185] Audio circuitry 905 can be used to provide an audio interface between a user and an electronic device via a speaker and a microphone. Audio circuitry 905 converts received audio data into electrical signals, transmits them to the speaker, and the speaker converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuitry 905, converted back into audio data, and then processed by processor 901 before being transmitted via radio frequency circuitry 904 to, for example, another electronic device, or output to memory 902 for further processing. Audio circuitry 905 may also include an earphone jack to facilitate communication between peripheral headphones and electronic devices.
[0186] The input unit 906 can be used to receive input numbers, characters, or user characteristic information (such as fingerprints, iris, facial information, etc.), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
[0187] Power supply 907 is used to supply power to various components of electronic device 900. Optionally, power supply 907 can be logically connected to processor 901 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. Power supply 907 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0188] although Figure 9 As not shown in the diagram, the electronic device 900 may also include a camera, sensor, wireless fidelity module, Bluetooth module, etc., which will not be described in detail here.
[0189] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0190] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0191] Therefore, embodiments of this application provide a computer-readable storage medium storing multiple computer programs that can be loaded by a processor to execute any of the patch location information storage methods provided in this application. For example, the computer program can execute the steps of the following patch location information storage method: Obtain the actual position and index value of the face to be stored; Based on a first preset compression value, the actual position value is compressed and encoded to obtain the position storage value of the actual position value, wherein the position storage value includes a high-order position value and a low-order position value. Based on the second preset compression value, the actual index value is compressed and encoded to obtain the index storage value of the actual index value; Based on the high-order position value, the low-order position value, and the index storage value, an information storage texture map of the patch to be stored is generated, wherein the first pixel in the information storage texture map is used to store the high-order position value and the index storage value, and the second pixel in the information storage texture map is used to store the low-order position value and the index storage value.
[0192] In some embodiments, generating the information storage map of the patch to be stored based on the high-order position value, the low-order position value, and the index storage value includes: Obtain the storage pixel position of the area to be stored, wherein the storage pixel position includes the pixel position of the high-order position value and the pixel position of the low-order position value; Based on the high-order position value and the index storage value, the first pixel is generated at the pixel position of the high-order position value; Based on the low-order position value and the index storage value, the second pixel is generated at the pixel position of the low-order position value.
[0193] In some embodiments, the actual position value includes the first coordinate value of the patch to be stored on the first coordinate axis, the second coordinate value on the second coordinate axis, and the third coordinate value on the third coordinate axis, and the high-bit position value includes the first high-bit position value, the second high-bit position value, and the third high-bit position value obtained by compressing and encoding the first coordinate value, the second coordinate value, and the third coordinate value, respectively. The step of generating the first pixel at the pixel position of the high-order position value based on the high-order position value and the index storage value includes: Set the first high-order position value to the R-channel value of the pixel position of the high-order position value to generate a first pixel point whose R-channel stores the first high-order position value; The second high-order position value is set to the G-channel value of the pixel position of the high-order position value to generate a first pixel point whose G-channel stores the second high-order position value; The third high-order position value is set to the B-channel value of the pixel position of the high-order position value to generate a first pixel point whose B-channel stores the third high-order position value; The index storage value is set to the A channel value of the pixel position of the high-order position value to generate a first pixel point whose A channel stores the index storage value.
[0194] In some embodiments, the actual position value includes the first coordinate value of the patch to be stored on the first coordinate axis, the second coordinate value on the second coordinate axis, and the third coordinate value on the third coordinate axis, and the low-bit position value includes the first low-bit position value, the second low-bit position value, and the third low-bit position value obtained by compressing and encoding the first coordinate value, the second coordinate value, and the third coordinate value, respectively. The step of generating the second pixel at the pixel position of the low-order position value based on the low-order position value and the index storage value includes: The first low-order position value is set to the R channel value of the pixel position of the low-order position value to generate a second pixel point whose R channel stores the first low-order position value. The second low-order position value is set to the G channel value of the pixel position of the low-order position value to generate a second pixel point whose G channel stores the second low-order position value; The third low-order position value is set to the B channel value of the pixel position of the low-order position value to generate a second pixel point whose B channel stores the third low-order position value; The index storage value is set to the A channel value of the pixel position of the low-order position value to generate a second pixel point whose A channel stores the index storage value.
[0195] In some embodiments, the texture column coordinates corresponding to the pixel position of the high-order position value are the same as the texture column coordinates corresponding to the pixel position of the low-order position value.
[0196] In some embodiments, the step of compressing and encoding the actual location value based on a first preset compression value to obtain the location storage value of the actual location value includes: Multiply the actual position value by the first preset compression value to obtain the decimal value of the actual position value, wherein the actual position value is in decimal format; The decimal value of the actual position value is converted to the hexadecimal value of the actual position value; The hexadecimal value of the actual position value is split to obtain the high-order hexadecimal value and the low-order hexadecimal value of the actual position value; The high-order position value is obtained based on the high-order hexadecimal value of the actual position value; The low-order position value is obtained based on the low-order hexadecimal value of the actual position value.
[0197] In some embodiments, the index storage value includes a high-order index value and a low-order index value, wherein the high-order index value is stored at the first pixel and the low-order index value is stored at the second pixel; The step of compressing and encoding the actual index value based on the second preset compression value to obtain the index storage value of the actual index value includes: Multiply the actual index value by the second preset compression value to obtain the decimal value of the actual index value; The decimal value of the actual index value is converted to the hexadecimal value of the actual index value; The hexadecimal value of the actual index value is split to obtain the high-order hexadecimal value and the low-order hexadecimal value of the actual index value; The high-order index value is obtained based on the high-order hexadecimal value of the actual index value; The low-order index value is obtained based on the low-order hexadecimal value of the actual index value.
[0198] In some embodiments, the method further includes: When the information storage texture is used to render the model to be rendered, the high-bit position value stored in the first pixel is decoded to obtain the high-bit decoded value of the high-bit position value. The low-order position value stored in the second pixel is decoded to obtain the low-order decoded value of the low-order position value; The high-order decoded value and the low-order decoded value are concatenated to obtain the decoded position value of the patch to be stored; Based on the decoded position value, the surface effect of the surface to be stored is rendered onto the model to be rendered.
[0199] In some embodiments, the face to be stored is each face in a target face set, and generating an information storage map of the face to be stored based on the high-order position value, the low-order position value, and the index storage value includes: Obtain the number of faces in the target face set; The information storage map is generated based on 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 in the information storage map is the same as the number of patches.
[0200] In some embodiments, the information storage map is an 8-bit map, and the actual position value ranges from 0 to 10.
[0201] In some embodiments, the information storage map is used to record the position and index values of each facet in the target facet set. Before obtaining the actual position and index values of the facet to be stored, the method further includes: Select the selected face from the preset face set; If the position value of the selected face is within the range of the actual position value and the index value of the selected face is within the range of the actual index value, then the selected face will be added to the target face set. Traverse each face in the target face set and use the currently traversed face as the face to be stored.
[0202] As can be seen, the computer program can be loaded by the processor to execute any of the patch position information storage methods provided in the embodiments of this application, thereby bringing the following technical effects: by compressing and encoding the actual position value of the patch to be stored into a high-order position value and a low-order position value, and using two different pixels (a first pixel and a second pixel) in the information storage map to store the high-order position value and the low-order position value respectively; firstly, compared to one pixel, using two pixels to store one actual position value can improve the data storage accuracy while increasing the range of stored values; secondly, since the actual position value is compressed and encoded using the first preset compression, the value after the decimal point can be accurately saved, thereby improving the data storage accuracy of low-precision maps such as TGA maps, making the patch position value sampled by low-precision maps such as TGA maps more accurate, avoiding the problem of large storage error of patch position value caused by the low data storage accuracy of low-precision maps such as TGA maps, and thus avoiding the situation of frame animation jumping; thereby improving the picture effect of frame animation displayed on low-end devices.
[0203] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0204] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk, etc. 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 this application, it can achieve the beneficial effects that any of the patch location information storage methods provided in the embodiments of this application can achieve, as detailed in the preceding embodiments, and will not be repeated here.
[0205] In the above embodiments of the patch location information storage device, computer-readable storage medium, and electronic device, the descriptions of each embodiment have different focuses. Parts not described in detail in a particular embodiment can be referred to in the relevant descriptions of other embodiments. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process and beneficial effects of the patch location information storage device, computer-readable storage medium, electronic device, and their corresponding units described above can be referred to the description of the patch location information storage method in the above embodiments, and will not be repeated here.
[0206] The foregoing has provided a detailed description of a method, apparatus, electronic device, and computer-readable storage medium for storing patch position information according to embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for storing patch position information, characterized in that, include: Obtain the actual position and index value of the face to be stored; Based on the first preset compression value, the actual position value is compressed and encoded to obtain the position storage value of the actual position value. The position storage value includes a high position value and a low position value. The high position value includes the first four digits indicating the hexadecimal value of the actual position value, and the low position value includes the last four digits indicating the hexadecimal value of the actual position value. Based on the second preset compression value, the actual index value is compressed and encoded to obtain the index storage value of the actual index value; Based on the high-order position value, the low-order position value, and the index storage value, an information storage texture map of the patch to be stored is generated, wherein the first pixel in the information storage texture map is used to store the high-order position value and the index storage value, the second pixel in the information storage texture map is used to store the low-order position value and the index storage value, and the information storage texture map is an 8-bit map.
2. The method for storing patch position information as described in claim 1, characterized in that, The step of generating the information storage map of the patch to be stored based on the high-order position value, the low-order position value, and the index storage value includes: Obtain the storage pixel position of the area to be stored, wherein the storage pixel position includes the pixel position of the high-order position value and the pixel position of the low-order position value; Based on the high-order position value and the index storage value, the first pixel is generated at the pixel position of the high-order position value; Based on the low-order position value and the index storage value, the second pixel is generated at the pixel position of the low-order position value.
3. The method for storing patch position information as described in claim 2, characterized in that, The actual position value includes the first coordinate value of the patch to be stored on the first coordinate axis, the second coordinate value on the second coordinate axis, and the third coordinate value on the third coordinate axis. The high position value includes the first high position value, the second high position value, and the third high position value obtained by compressing and encoding the first coordinate value, the second coordinate value, and the third coordinate value, respectively. The step of generating the first pixel at the pixel position of the high-order position value based on the high-order position value and the index storage value includes: Set the first high-order position value to the R-channel value of the pixel position of the high-order position value to generate a first pixel point whose R-channel stores the first high-order position value; The second high-order position value is set to the G-channel value of the pixel position of the high-order position value to generate a first pixel point whose G-channel stores the second high-order position value; The third high-order position value is set to the B-channel value of the pixel position of the high-order position value to generate a first pixel point whose B-channel stores the third high-order position value; The index storage value is set to the A channel value of the pixel position of the high-order position value to generate a first pixel point whose A channel stores the index storage value.
4. The method for storing patch position information as described in claim 2, characterized in that, The actual position value includes the first coordinate value of the patch to be stored on the first coordinate axis, the second coordinate value on the second coordinate axis, and the third coordinate value on the third coordinate axis. The low-order position value includes the first low-order position value, the second low-order position value, and the third low-order position value obtained by compressing and encoding the first coordinate value, the second coordinate value, and the third coordinate value, respectively. The step of generating the second pixel at the pixel position of the low-order position value based on the low-order position value and the index storage value includes: The first low-order position value is set to the R channel value of the pixel position of the low-order position value to generate a second pixel point whose R channel stores the first low-order position value. The second low-order position value is set to the G channel value of the pixel position of the low-order position value to generate a second pixel point whose G channel stores the second low-order position value; The third low-order position value is set to the B channel value of the pixel position of the low-order position value to generate a second pixel point whose B channel stores the third low-order position value; The index storage value is set to the A channel value of the pixel position of the low-order position value to generate a second pixel point whose A channel stores the index storage value.
5. The method for storing patch position information as described in claim 2, characterized in that, The texture column coordinates corresponding to the pixel position of the high-order position value are the same as the texture column coordinates corresponding to the pixel position of the low-order position value.
6. The method for storing patch position information as described in claim 1, characterized in that, The step of compressing and encoding the actual location value based on a first preset compression value to obtain the location storage value of the actual location value includes: Multiply the actual position value by the first preset compression value to obtain the decimal value of the actual position value, wherein the actual position value is in decimal format; The decimal value of the actual position value is converted to the hexadecimal value of the actual position value; The hexadecimal value of the actual position value is split to obtain the high-order hexadecimal value and the low-order hexadecimal value of the actual position value; The high-order position value is obtained based on the high-order hexadecimal value of the actual position value; The low-order position value is obtained based on the low-order hexadecimal value of the actual position value.
7. The method for storing patch position information as described in claim 1, characterized in that, The index storage value includes a high-order index value and a low-order index value, wherein the high-order index value is stored at the first pixel and the low-order index value is stored at the second pixel; The step of compressing and encoding the actual index value based on the second preset compression value to obtain the index storage value of the actual index value includes: Multiply the actual index value by the second preset compression value to obtain the decimal value of the actual index value; The decimal value of the actual index value is converted to the hexadecimal value of the actual index value; The hexadecimal value of the actual index value is split to obtain the high-order hexadecimal value and the low-order hexadecimal value of the actual index value; The high-order index value is obtained based on the high-order hexadecimal value of the actual index value; The low-order index value is obtained based on the low-order hexadecimal value of the actual index value.
8. The method for storing patch position information as described in claim 1, characterized in that, The method further includes: When the information storage texture is used to render the model to be rendered, the high-bit position value stored in the first pixel is decoded to obtain the high-bit decoded value of the high-bit position value. The low-order position value stored in the second pixel is decoded to obtain the low-order decoded value of the low-order position value; The high-order decoded value and the low-order decoded value are concatenated to obtain the decoded position value of the patch to be stored; Based on the decoded position value, the surface effect of the surface to be stored is rendered onto the model to be rendered.
9. The method for storing patch position information as described in claim 1, characterized in that, The facets to be stored are each facet in the target facet set. Generating the information storage map of the facets to be stored based on the high-order position value, the low-order position value, and the index storage value includes: Obtain the number of faces in the target face set; The information storage map is generated based on 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 in the information storage map is the same as the number of patches.
10. The method for storing patch position information as described in claim 1, characterized in that, The actual location value ranges from 0 to 10.
11. The method for storing patch position information as described in claim 10, characterized in that, The information storage texture is used to record the position and index values of each facet in the target facet set. Before obtaining the actual position and index values of the facet to be stored, the process further includes: Select the selected face from the preset face set; If the position value of the selected face is within the range of the actual position value and the index value of the selected face is within the range of the actual index value, then the selected face will be added to the target face set. Traverse each face in the target face set and use the currently traversed face as the face to be stored.
12. A patch position information storage device, characterized in that, include: The acquisition unit is used to acquire the actual position value and actual index value of the face to be stored. The first compression unit is used to compress and encode the actual position value based on a first preset compression value to obtain a position storage value of the actual position value. The position storage value includes a high position value and a low position value. The high position value includes the first four digits indicating the hexadecimal value of the actual position value, and the low position value includes the last four digits indicating the hexadecimal value of the actual position value. The second compression unit is used to compress and encode the actual index value based on the second preset compression value to obtain the index storage value of the actual index value; A storage unit is used to generate an information storage map of the area to be stored based on the high-bit position value, the low-bit position value, and the index storage value. The first pixel in the information storage map is used to store the high-bit position value and the index storage value, and the second pixel in the information storage map is used to store the low-bit position value and the index storage value. The information storage map is an 8-bit map.
13. An electronic device, characterized in that, The device includes a processor and a memory, the memory storing multiple instructions; the processor loads instructions from the memory to execute the patch position information storage method as described in any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to execute the patch position information storage method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Data processing method and system, electronic equipment and computer readable medium
CN112489180A
Method and device for processing vertex animation
CN113450435A