Data processing method, device, electronic device and readable storage medium
By storing the surface type and influence intensity of each pixel position in the two-dimensional expansion diagram of the target model, the problems of large storage space and low art controllability of real-time rendering technology in the prior art are solved, and the effects of memory saving, performance optimization and compatibility improvement are achieved.
Patent Information
- Application Number
- CN202411794491.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-04-04
AI Technical Summary
The existing method of real-time rendering technology through cache data has the problem of large traffic data and excessive storage space; while the method achieved through random algorithms is low in art controllability, complex algorithms, high performance consumption, and poor compatibility.
By obtaining the preset surface type of each position of the target model surface, a two-dimensional expansion diagram of the target model is determined. Each pixel position corresponds to the surface type, and the affected surface type and its influence intensity are determined based on the distance between the pixel position and other positions, and this information is stored in the data channel of the preset image so that the terminal can render and display the target model based on the preset image.
Reduces the memory required to store data, reduces performance consumption, improves compatibility performance, makes this method suitable on different devices and improves art controllability.
Smart Images

Figure CN119762647A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data processing method, device, electronic device and computer-readable storage medium. Background Art
[0002] In game development, real-time rendering technology can be used to create realistic space scenes and planetary environments, improving the realism and immersion of the game. At present, the ways to implement real-time rendering technology include cached data and random algorithms. Cached data mainly means that players can download map data while playing games, such as navigation software, Microsoft's flight simulator. Random algorithms mainly generate different planetary environments through random seeds. However, the current way of implementing real-time rendering technology through cached data has the problem of large traffic data. The cloud needs to store a large amount of data, and the storage space occupied is too large. The way to implement real-time rendering technology through random algorithms has low artistic controllability and complex algorithms, so the performance consumption is large and the compatibility with devices is poor. Summary of the invention
[0003] The present application provides a data processing method, device, electronic device and computer-readable storage medium, which reduces the memory required for storing data, reduces performance consumption and improves compatibility. The specific scheme is as follows:
[0004] In a first aspect, an embodiment of the present application provides a data processing method, the method comprising:
[0005] Obtaining a preset surface type corresponding to each position on the surface of the target model;
[0006] Determine a two-dimensional unfolded image of the target model, wherein each pixel position of the two-dimensional unfolded image has a corresponding surface type;
[0007] Determine one or more target surface types that have an impact on the surface performance of the target pixel position according to the distances between the target pixel position and at least one first position, wherein the target pixel position is one of the pixel positions of the two-dimensional unfolded image, and the first position is one of the pixel positions in the two-dimensional unfolded image except the target pixel position;
[0008] Determining the influence intensity of the target surface type on the target pixel position;
[0009] The target surface type and the influence strength of the target surface type on the target pixel position are stored in a data channel of a preset image, so as to render and display the target model based on the preset image through a terminal.
[0010] In a second aspect, an embodiment of the present application provides a data processing device, the device comprising:
[0011] An acquisition unit, used for acquiring a preset surface type corresponding to each position on the surface of the target model;
[0012] A determination unit, configured to determine a two-dimensional unfolded image of the target model, wherein each pixel position of the two-dimensional unfolded image has a corresponding surface type;
[0013] The determination unit is further configured to determine one or more target surface types that have an impact on the surface performance of the target pixel position according to the distances between the target pixel position and at least one first position, wherein the target pixel position is one of the pixel positions of the two-dimensional unfolded image, and the first position is one of the pixel positions in the two-dimensional unfolded image except the target pixel position;
[0014] The determination unit is further used to determine the influence intensity of the target surface type on the target pixel position;
[0015] A processing unit is used to store the target surface type and the influence intensity of the target surface type on the target pixel position in a data channel of a preset image, so as to render and display the target model based on the preset image through a terminal.
[0016] In a third aspect, the present application further provides an electronic device, including:
[0017] Processor; and
[0018] The memory is used to store a data processing program. After the electronic device is powered on and the program is run by the processor, the method described in the first aspect is executed.
[0019] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium storing a data processing program, which is executed by a processor to perform the method described in the first aspect.
[0020] Compared with the prior art, this application has the following advantages:
[0021] The data processing method provided in the embodiment of the present application includes the following steps: obtaining a preset surface type corresponding to each position on the surface of a target model; determining a two-dimensional unfolded map of the target model, wherein each pixel position of the two-dimensional unfolded map has a corresponding surface type; determining one or more target surface types that have an impact on the surface performance of the target pixel position based on the distance between the target pixel position and at least one first position, wherein the target pixel position is one of the pixel positions in the two-dimensional unfolded map, and the first position is one of the pixel positions in the two-dimensional unfolded map other than the target pixel position; determining the intensity of the impact of the target surface type on the target pixel position; storing the target surface type and the intensity of the impact of the target surface type on the target pixel position in the data channel of a preset image, so as to render and display the target model based on the preset image through a terminal. It can be seen that in the present application, for each pixel position on the two-dimensional unfolded image of the target model, one or more target surface types and their influence strength that have an impact on the surface performance of each pixel position can be determined, and the target surface type and its influence strength are stored in the data channel of the preset image. Then, when rendering the target model, the surface performance of the target model surface can be restored according to the content stored in the preset image, and there is no need to store data separately for the contribution of each surface type to the surface, thereby reducing the memory required for storing data; compared with the random algorithm, the complexity of the scheme is reduced, the performance consumption is reduced, and the compatibility is improved, so that the method can be applicable on different devices; in addition, the surface performance of the target model can be controlled by presetting the surface type for the pixel position, and the strategy for determining the target surface type and its influence strength that has an impact on the surface performance of the pixel position, so that the artistic controllability is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 It is a flowchart of a data processing method provided in an embodiment of the present application;
[0023] Figure 2 is a schematic diagram of a sphere model and a two-dimensional unfolded view of the sphere model provided in an embodiment of the present application;
[0024] Figure 3 It is a schematic diagram of an implementation method of a data processing method provided in an embodiment of the present application;
[0025] Figure 4 is a structural block diagram of an example of a data rendering device provided in an embodiment of the present application;
[0026] Figure 5 It is a structural block diagram of an example of an electronic device for a data processing method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] Many specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application, so the present application is not limited by the specific implementation disclosed below.
[0028] It should be noted that the terms "first", "second", "third", etc. in the claims, description and drawings of the present application are used to distinguish similar objects and are not used to describe a specific order or sequence. The data used in this way are interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including", "having" and their variants are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0029] It should be understood that in the embodiments of the present application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" is merely a way to describe the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and subsequent associated objects are in an "or" relationship. "Including A, B and / or C" means including any one, any two, or any three of A, B, and C.
[0030] It should be understood that in the embodiments of the present application, "B corresponding to A", "B corresponding to A", "A corresponds to B", or "B corresponds to A" means that B is associated with A, and B can be determined according to A. Determining B according to A does not mean determining B only according to A, and B can also be determined according to A and / or other information.
[0031] In game development, real-time rendering technology can be used to create realistic space scenes and planetary environments, improving the realism and immersion of the game. At present, the ways to implement real-time rendering technology include cached data and random algorithms. Cached data mainly means that players can download map data while playing games, such as navigation software, Microsoft's flight simulator. Random algorithms mainly generate different planetary environments through random seeds. However, the current method of implementing real-time rendering technology through cached data has the problem of large traffic data. The cloud needs to store a large amount of data, which occupies too much storage space. The method of implementing real-time rendering technology through random algorithms has low artistic controllability and poor compatibility.
[0032] For example, the surface is generally represented by a fixed ecology. Even if there is a transition, it is a sharp edge on the planetary scale. It can be approximately regarded that the surface properties of the entire planet are fixed. Therefore, there will be no mixture of multiple plots in the surface mixing. Traditional surface mixing requires recording the contribution of each surface layer to the ground. For example, one image is required to record the contribution of one surface layer to the ground, and two images are required to record the contribution of two surface layers to the ground. The larger the amount of data that needs to be recorded, the more resources are consumed. However, this solution only needs to store the surface type and its weight in the data channel of one image to achieve surface mixing.
[0033] Based on the background technology, in order to ensure the rationality of memory usage and improve compatibility on different devices. The first embodiment of the present application provides a data processing method, which is applied to an electronic device, which can be a server, a terminal device (such as a mobile phone, a computer) and other electronic devices with data processing capabilities, which is not specifically limited in the embodiments of the present application.
[0034] The technical solution of the present application is described in detail below through specific embodiments. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0035] Figure 1 Schematic diagram of the data processing method provided in the embodiment of the present application. Figure 1 As shown, the method may include S101 to S106. S101 to S106 are described in detail below.
[0036] S101. Obtain a preset surface type corresponding to each position on the surface of a target model.
[0037] Exemplarily, the target model may include a spherical model. Each surface type has preset color data corresponding to it. For example, if the surface type is a desert, the color data corresponding to the desert may be preset as yellow, and if the surface type is an ocean, the color data corresponding to the ocean may be preset as blue.
[0038] S102: Determine a two-dimensional unfolded view of the target model.
[0039] Exemplarily, each pixel position of the two-dimensional expansion map has a corresponding surface type. When the target model is a spherical model, each face of the spherical model can be expanded along the axial direction with reference to the expansion effect of a multidimensional cube array to obtain a two-dimensional expansion map of the spherical model. Figure 2 It is a schematic diagram of a sphere model and a two-dimensional unfolded diagram of the sphere model provided in an embodiment of the present application.
[0040] S103: Determine one or more target surface types that have an impact on the surface expression of the target pixel position according to the distances between the target pixel position and at least one first position.
[0041] Exemplarily, the target pixel position is one of the pixel positions in the two-dimensional unfolded image, and the first position is one of the pixel positions in the two-dimensional unfolded image except the target pixel position. The distance between the target pixel position and at least one first position is the Manhattan distance. The above-mentioned surface type is preset with an influence distance threshold, and the target first position that has an influence on the surface performance of the target pixel position can be determined from at least one first position according to the distance between the target pixel position and at least one first position; then the surface type corresponding to the target first position is determined as the target surface type that has an influence on the surface performance of the target pixel position.
[0042] S104: Determine the influence intensity of the target surface type on the target pixel position.
[0043] Exemplarily, the influence intensity of the target surface type on the target pixel position may be determined according to the target first position corresponding to the same target surface type.
[0044] Specifically, when there is only one target surface type, the influence strength of all target first positions included in the target surface type on the target pixel position can be determined, and then the influence strength of the target first positions included in the target surface type on the target pixel position is summed to obtain the sum of the influence strengths of the target first positions of the target surface type on the target pixel position. Finally, the sum of the influence strengths is normalized to map the sum of the influence strengths to a preset interval, such as [0, 1], to obtain the influence strength of the target surface type on the target pixel position.
[0045] When there are multiple target surface types, the influence strength of all target first positions included in one of the multiple target surface types on the target pixel position can be determined, and then the influence strength of the target first positions included in the target surface type on the target pixel position is summed to obtain the sum of the influence strengths of the target first positions of the target surface type on the target pixel position. The sum of the influence strengths is then normalized to map the sum of the influence strengths to a preset interval, such as [0, 1], to obtain the influence strength of the target surface type on the target pixel position. Similarly, the influence strength of each target surface type on the target pixel position can be determined in turn with reference to the above method.
[0046] Optionally, determining the intensity of influence of the target first position corresponding to one of the target surface types on the target pixel position can be achieved in the following manner: determining the quotient of a preset parameter and an influence distance threshold corresponding to one of the target surface types as a first value; determining the distance between the target first position and the target pixel position as a second value; determining the difference between the influence distance threshold corresponding to the target surface type and the second value as a third value; determining the product of the first value and the third value to obtain a first product, the first product being the intensity of influence of the target first position corresponding to one of the target surface types on the target pixel position.
[0047] For example, the above implementation can be expressed by formula (1).
[0048] checking_point_weight=(1.0 / checking_point_influence_factor)*(checking_point_influence_factor-checking_point_influence_distance formula (1)
[0049] Among them, checking_point_weight represents the influence strength of the target first position corresponding to the same target surface type on the target pixel position, 1.0 represents the preset parameter, checking_point_influence_factor represents the influence distance threshold corresponding to the target surface type, and checking_point_influence_distance represents the distance between the target first position and the target pixel position.
[0050] S105. Storing the target surface type and the influence strength of the target surface type on the target pixel position in the data channel of the preset image, so as to render and display the target model based on the preset image through the terminal.
[0051] Exemplarily, the preset image has the same image size and number of pixels as the two-dimensional unfolded image of the spherical model, for example, both are M×N pixels. The data channel may include one or more of the following: color channel, transparency channel. All target surface types and the intensity of influence of the target surface type on the target pixel position can be stored in the data channel of the preset image. It is also possible to sort the target surface types and the intensity of influence of the target surface type on the target pixel position from high to low according to the number of selected data channels, and select the top K positions for storage. Among them, K is the number of data channels for storing the target surface type and the intensity of influence of the target surface type on the target pixel position. For example, 3 data channels (such as RGB color channels) can be selected, and the top 3 surface types and their influence intensity on the surface type of the target position can be selected from the sorting, and stored in the 3 data channels respectively.
[0052] For example, when the influence intensity of surface type A on the target pixel position is 0.5, the influence intensity of surface type B on the target pixel position is 0.9, the influence intensity of surface type C on the target pixel position is 0.8, the influence intensity of surface type D on the target pixel position is 0.6, the influence intensity of surface type E on the target pixel position is 0.4, and the influence intensity of surface type F on the target pixel position is 0.2, the influence intensity of each surface type on the target position can be sorted from high to low, and 0.9>0.8>0.6>0.5>0.4>0.2 is obtained, that is, the influence intensity of each surface type on the target position is sorted from high to low as follows: surface type B>surface type C>surface type D>surface type A>surface type E>surface type F. Surface type B and the intensity of the influence of surface type B on the target position, surface type C and the intensity of the influence of surface type C on the target position, surface type D and the intensity of the influence of surface type D on the target position, surface type A and the intensity of the influence of surface type A on the target position can be selected for storage. The above data can be stored in four channels of RGBA to achieve storage of the above data. For example, surface type B and 0.9 are stored in the R channel, surface type C and 0.8 are stored in the G channel, surface type D and 0.6 are stored in the B channel, and surface type A and 0.5 are stored in the A channel. For example, the R channel data can be represented by an 8-bit byte, the first 4 bits can be used to store the surface type B, and the last 4 bits can be used to store the intensity of the influence of surface type B on the surface type of the target position, and the other channels can be deduced in the same way.
[0053] In some embodiments, the “rendering and displaying the target model based on a preset image by a terminal” in the above S105 may include S201 to S203.
[0054] S201. In response to a rendering instruction, the terminal reads the target surface type and the intensity of influence of the target surface type on the target pixel position stored in the data channel of the target pixel position from the preset image for a second position on the target model surface corresponding to the target pixel position in the preset image.
[0055] S202: Determine color data of a second position according to the surface type corresponding to the target pixel position, the target surface type, and the intensity of influence of the target surface type on the target pixel position.
[0056] S203: Display the second position according to the color data of the second position.
[0057] Based on the above embodiments, for example, color data preset for the surface type corresponding to the target pixel position and color data preset for the target surface type can be obtained, and for the second position on the surface of the spherical model corresponding to the target pixel position in the preset image, the target surface type and the intensity of influence of the target surface type on the target pixel position stored in the data channel of the target pixel position are read from the preset image, and then the color data of the surface type corresponding to the target pixel position and the color data of the target surface type are weighted, with the intensity of influence of the target surface type on the target pixel position being used as a weight, to obtain the color data of the second position.
[0058] For example, when the preset color data of the target surface type A is a, the influence intensity of the target surface type A on the target pixel position is 0.9, the preset color data of the target surface type B is b, the influence intensity of the target surface type B on the target pixel position is 0.7, the preset color data of the target surface type C is c, the influence intensity of the target surface type C on the target pixel position is 0.6, the preset color data of the target surface type D is d, the influence intensity of the target surface type D on the target pixel position is 0.5, and the preset color data of the surface type corresponding to the target pixel position is e, then the color data of the second position on the surface of the spherical model corresponding to the target pixel position in the preset image can be determined by a×0.9+b×0.7+c×0.6+d×0.5+e.
[0059] Based on the above embodiments, for example, according to the requirements of the actual application scenario, when it is necessary to render and display the spherical model on the terminal, the terminal responds to the rendering instruction for the spherical model, and the server can send the color data preset for the surface type corresponding to the target pixel position, the color data preset for the target surface type, and the above preset image to the terminal, and the terminal can render and display the spherical model according to the color data preset for the surface type corresponding to the target pixel position, the color data preset for the target surface type, and the above preset image. Among them, the color data preset for the surface type corresponding to the target pixel position and the color data preset for the target surface type can be stored in two different images respectively, or in the data channel of the preset image, which is not specifically limited in the embodiments of the present application.
[0060] In some embodiments, the above-mentioned determination of the target first position that has an impact on the surface manifestation of the target pixel position from at least one first position based on the distance between the target pixel position and at least one first position may include: judging whether the distance between the target pixel position and the first position is less than or equal to the impact distance threshold corresponding to the surface type corresponding to the first position; if the distance between the target pixel position and the first position is less than or equal to the impact distance threshold corresponding to the surface type corresponding to the first position, determining the first position as the target first position that has an impact on the surface manifestation of the target pixel position.
[0061] Exemplarily, the Manhattan distances between the target pixel position and all the first positions in the two-dimensional expansion image can be determined, and the distances between the target pixel position and all the first positions in the two-dimensional expansion image can be compared with the influence distance thresholds corresponding to the surface type corresponding to the first position. When the distance between the target pixel position and the first position is less than or equal to the influence distance threshold corresponding to the surface type corresponding to the first position, the first position is determined to be a target first position that has an influence on the surface performance of the target pixel position.
[0062] For example, the Manhattan distance between the target pixel position and the first position 1 in the two-dimensional expansion image is 2, and the influence distance threshold of the surface type corresponding to the first position 1 is 3; the Manhattan distance between the target pixel position and the first position 2 in the two-dimensional expansion image is 4, and the influence distance threshold of the surface type corresponding to the first position 2 is 3; the Manhattan distance between the target pixel position and the first position 3 in the two-dimensional expansion image is 2, and the influence distance threshold of the surface type corresponding to the first position 3 is 4; the Manhattan distance between the target pixel position and the first position 4 in the two-dimensional expansion image is 6, and the influence distance threshold of the surface type corresponding to the first position 4 is 2; the Manhattan distance between the target pixel position and the first position 5 in the two-dimensional expansion image is 4, and the influence distance threshold of the surface type corresponding to the first position 5 is 5; the Manhattan distance between the target pixel position and the first position 6 in the two-dimensional expansion image is 3, and the influence distance threshold of the surface type corresponding to the first position 6 is 6; the Manhattan distance between the target pixel position and the first position 7 in the two-dimensional expansion image is 5, and the influence distance threshold of the surface type corresponding to the first position 7 is 5; the Manhattan distance between the target pixel position and the first position 8 in the two-dimensional expansion image is 2, and the influence distance threshold of the surface type corresponding to the first position 8 is 4. By comparing the distances between the above-mentioned target pixel position and all the first positions in the two-dimensional expansion map with the influence distance thresholds of the surface types corresponding to the first positions, it can be seen that the distances between the target pixel position and the first position 1, the first position 3, the first position 6, the first position 7 and the first position 8 are less than or equal to the influence distance thresholds of the surface types corresponding to the first position 1, the first position 3, the first position 6, the first position 7 and the first position 8, respectively. Then, it can be determined that the first position 1, the first position 3, the first position 6, the first position 7 and the first position 8 are the target first positions that have an impact on the surface performance of the target pixel position.
[0063] Optionally, determining a target first position that has an impact on the surface representation of the target pixel position from at least one first position based on the distance between the target pixel position and at least one first position respectively may include: determining at least one first position that is no more than a preset distance away from the first position from all first positions in the two-dimensional unfolded image; determining a target first position that has an impact on the surface representation of the target pixel position from at least one first position based on the distance between the target pixel position and at least one first position respectively.
[0064] For example, when the first position includes A, B, C, D, E, and F, the preset distance is 5. If the Manhattan distance between B, C, D, and F in the first position and the target pixel position does not exceed 5, then according to the Manhattan distance between B, C, D, and F and the target pixel position respectively and the influence distance threshold of the surface type corresponding to B, C, D, and F, the target first position that has an influence on the surface performance of the target pixel position is determined from B, C, D, and F.
[0065] In some embodiments, the above-mentioned determining the target first position that has an impact on the surface manifestation of the target pixel position from at least one first position based on the distance between the target pixel position and at least one first position includes: performing Manhattan correction on the distance between the target pixel position and at least one first position; determining the target first position that has an impact on the surface manifestation of the target pixel position from at least one first position based on the Manhattan corrected distance between the target pixel position and at least one first position.
[0066] Exemplarily, the target model includes a spherical model, which is a three-dimensional model. When recording three-dimensional coordinate information in a two-dimensional space, the current three-dimensional model needs to be parsed, wherein the parsing method can refer to longitude and latitude projection. However, when the three-dimensional model is projected, the curvature of the two-dimensional unfolded image will be changed, that is, the surface is stretched, not proportional. At this time, the distance between the target pixel position and at least one first position needs to be Manhattan corrected. Figure 3 Schematic diagram of a data processing method provided in an embodiment of the present application. Figure 3 As shown, when the target pixel position is Q, it is necessary to determine the target first position that has an impact on the surface performance of the target pixel position Q in the circular area with Q as the center and the preset Manhattan distance as the radius, that is, the target first position that has an impact on the surface performance of the target pixel position Q in the circular area α. However, the first position in the β area is offset when the spherical model is converted into a two-dimensional unfolded diagram. The position of at least one first position in the β area on the two-dimensional unfolded diagram can be determined according to the tangent direction and the binormal direction of the target pixel position Q on the spherical model and the preset Manhattan distance. For example, at least one first position in the β area is mapped to the γ area on the two-dimensional unfolded diagram. The target first position that has an impact on the surface performance of the target pixel position can be determined from at least one first position according to the impact distance threshold of the surface type corresponding to at least one first position in the γ area and the Manhattan correction distance between Q and at least one first position in the γ area, thereby determining the impact intensity of the target surface type corresponding to the target first position on the target pixel position Q.
[0067] The above is a specific implementation of a model training example. In the specific implementation, the model training can also be performed in other feasible ways, and the embodiments of the present application are not limited thereto.
[0068] Corresponding to the data processing method provided in the first embodiment of the present application, the second embodiment of the present application further provides a data rendering device, such as Figure 4 As shown, the data rendering device 400 includes:
[0069] An acquisition unit 401 is used to acquire a preset surface type corresponding to each position on the surface of the target model;
[0070] A determination unit 402 is used to determine a two-dimensional unfolded image of the target model, wherein each pixel position of the two-dimensional unfolded image has a corresponding surface type;
[0071] The determination unit 402 is further configured to determine one or more target surface types that have an impact on the surface representation of the target pixel position according to the distances between the target pixel position and at least one first position, wherein the target pixel position is one of the pixel positions in the two-dimensional unfolded image, and the first position is one of the pixel positions in the two-dimensional unfolded image except the target pixel position;
[0072] The determination unit 402 is further used to determine the influence intensity of the target surface type on the target pixel position;
[0073] The processing unit 403 is used to store the target surface type and the influence strength of the target surface type on the target pixel position in the data channel of the preset image, so as to render and display the target model based on the preset image through the terminal.
[0074] Optionally, the terminal responds to the rendering instruction and reads the target surface type and the influence intensity of the target surface type on the target pixel position stored in the data channel of the target pixel position from the preset image for a second position on the target model surface corresponding to the target pixel position in the preset image;
[0075] Determining color data of a second position according to a surface type corresponding to the target pixel position, the target surface type, and the intensity of influence of the target surface type on the target pixel position;
[0076] The second position is displayed according to the color data of the second position.
[0077] Optionally, the terminal obtains color data preset for a surface type corresponding to a target pixel position and color data preset for a target surface type in response to a rendering instruction;
[0078] Taking the influence intensity of the target surface type on the target pixel position as the weight, the color data of the surface type corresponding to the target pixel position and the color data of the target surface type are weightedly summed to obtain the color data of the second position.
[0079] Optionally, an influence distance threshold is preset corresponding to the surface type, and the determination unit 402 is specifically used to determine the target first position that has an influence on the surface performance of the target pixel position from at least one first position based on the distance between the target pixel position and at least one first position; and determine that the surface type corresponding to the target first position is the target surface type that has an influence on the surface performance of the target pixel position.
[0080] Optionally, an influence distance threshold is preset corresponding to the surface type, and the determination unit 402 is specifically used to determine whether the distances between the target pixel position and the first position are less than or equal to the influence distance threshold corresponding to the surface type corresponding to the first position; if the distances between the target pixel position and the first position are less than or equal to the influence distance threshold corresponding to the surface type corresponding to the first position, the first position is determined to be a target first position that has an influence on the surface performance of the target pixel position.
[0081] Optionally, the determination unit 402 is specifically used to determine at least one first position that is no more than a preset distance away from the first position from all the first positions in the two-dimensional unfolded image; and determine a target first position that has an impact on the surface manifestation of the target pixel position from at least one first position based on the distance between the target pixel position and the at least one first position.
[0082] Optionally, the determination unit 402 is specifically used to perform Manhattan correction on the distances between the target pixel position and at least one first position; based on the Manhattan corrected distances between the target pixel position and at least one first position, determine the target first position that has an impact on the surface manifestation of the target pixel position from at least one first position.
[0083] Optionally, the determination unit 402 is specifically configured to determine the influence intensity of one of the target surface types on the target pixel position according to the target first position corresponding to one of the target surface types.
[0084] Optionally, determination unit 402 is specifically used to determine the influence strength of the target first position corresponding to one of the target surface types on the target pixel position; sum the influence strengths of the target first position corresponding to one of the target surface types on the target pixel position to obtain the sum of the influence strengths of the target first position of one of the target surface types on the target pixel position; normalize the sum of the influence strengths to obtain the influence strength of one of the target surface types on the target pixel position.
[0085] Optionally, determination unit 402 is specifically used to determine that the quotient of a preset parameter and an impact distance threshold corresponding to one of the target surface types is a first value; determine that the distance between the target first position and the target pixel position is a second value; determine that the difference between the impact distance threshold corresponding to the target surface type and the second value is a third value; determine the product of the first value and the third value to obtain a first product, and the first product is the intensity of the impact of the target first position corresponding to one of the target surface types on the target pixel position.
[0086] Optionally, the data channel includes one or more of the following: a color channel and a transparency channel.
[0087] Optionally, the distance between the target pixel position and at least one first position is a Manhattan distance.
[0088] Corresponding to the data processing method provided in the first embodiment of the present application, the third embodiment of the present application also provides an electronic device for data rendering.
[0089] like Figure 5 , which is a structural block diagram of an example of an electronic device for a data processing method provided in an embodiment of the present application.
[0090] In this embodiment, an optional hardware structure of the electronic device 500 can be as follows: Figure 5 As shown, it includes: at least one processor 501, at least one memory 502 and at least one communication bus 505; the memory 502 contains a program 503 and data 504.
[0091] The bus 505 may be a communication device for transmitting data between components inside the electronic device 500, such as an internal bus (e.g., a CPU-memory bus, where the processor is a central processing unit, CPU for short), an external bus (e.g., a universal serial bus port, a peripheral component interconnect express port), etc.
[0092] In addition, the electronic device also includes: at least one network interface 506, at least one peripheral interface 507. The network interface 506 provides wired or wireless communication related to an external network 508 (for example, the Internet, an intranet, a local area network, a mobile communication network, etc.); in some embodiments, the network interface 506 may include any number of network interface controllers (NICs), radio frequency (RF) modules, repeaters, transceivers, modems, routers, gateways, any combination of wired network adapters, wireless network adapters, Bluetooth adapters, infrared adapters, near field communication (NFC) adapters, cellular network chips, etc.
[0093] The peripheral interface 507 is used to connect to the peripheral device, and the peripheral device can be the peripheral device 1 ( Figure 5 509), peripheral 2 ( Figure 5 510) and peripheral 3 ( Figure 5 511 in the figure). Peripherals are peripheral devices, which may include but are not limited to cursor control devices (such as mice, touch pads or touch screens), keyboards, displays (such as cathode ray tube displays, liquid crystal displays), displays or light emitting diode displays, video input devices (such as cameras or communication interfaces coupled to video files), etc.
[0094] The processor 501 may be a CPU, or an application specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present application.
[0095] The memory 502 may include a high-speed RAM (full name: Random Access Memory) memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0096] The processor 501 calls the program and data stored in the memory 502 to perform the following steps:
[0097] Obtaining a preset surface type corresponding to each position on the surface of the target model;
[0098] Determine a two-dimensional unfolded image of the target model, wherein each pixel position of the two-dimensional unfolded image has a corresponding surface type;
[0099] Determine one or more target surface types that have an impact on the surface performance of the target pixel position according to the distances between the target pixel position and at least one first position, wherein the target pixel position is one of the pixel positions in the two-dimensional unfolded image, and the first position is one of the pixel positions in the two-dimensional unfolded image except the target pixel position;
[0100] Determine the intensity of the influence of the target surface type on the target pixel position;
[0101] The target surface type and the influence strength of the target surface type on the target pixel position are stored in the data channel of the preset image, so as to render and display the target model based on the preset image through the terminal.
[0102] Corresponding to the data processing method provided in the first embodiment of the present application, the fourth embodiment of the present application provides a computer-readable storage medium storing a program of the data processing method, which is executed by a processor to perform the following steps:
[0103] Obtaining a preset surface type corresponding to each position on the surface of the target model;
[0104] Determine a two-dimensional unfolded image of the target model, wherein each pixel position of the two-dimensional unfolded image has a corresponding surface type;
[0105] Determine one or more target surface types that have an impact on the surface performance of the target pixel position according to the distances between the target pixel position and at least one first position, wherein the target pixel position is one of the pixel positions in the two-dimensional unfolded image, and the first position is one of the pixel positions in the two-dimensional unfolded image except the target pixel position;
[0106] Determine the intensity of the influence of the target surface type on the target pixel position;
[0107] The target surface type and the influence strength of the target surface type on the target pixel position are stored in the data channel of the preset image, so as to render and display the target model based on the preset image through the terminal.
[0108] It should be noted that for the detailed description of the devices, electronic devices and computer-readable storage media provided in the second, third and fourth embodiments of the present application, reference can be made to the relevant description of the first embodiment of the present application, and no further details will be given here.
[0109] Although the present application is disclosed as above in the form of a preferred embodiment, it is not intended to limit the present application. Any technical personnel in this field may make possible changes and modifications without departing from the spirit and scope of the present application. Therefore, the scope of protection of the present application shall be based on the scope defined by the claims of the present application.
[0110] In a typical configuration, a node device in a blockchain includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0111] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0112] 1. Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), random access memory (RAM) of other attributes, read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage media or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined in this article, computer-readable media does not include non-transitory media such as modulated data signals and carrier waves.
[0113] 2. Those skilled in the art should understand that the embodiments of the present application can be provided as methods, systems or computer program products. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0114] Although the present application is disclosed as above in the form of a preferred embodiment, it is not intended to limit the present application. Any technical personnel in this field may make possible changes and modifications without departing from the spirit and scope of the present application. Therefore, the scope of protection of the present application shall be based on the scope defined by the claims of the present application.
Claims
1. A data processing method, characterized in that: The method comprises: Obtaining a preset surface type corresponding to each position on the surface of the target model; Determine a two-dimensional unfolded image of the target model, wherein each pixel position of the two-dimensional unfolded image has a corresponding surface type; Determine one or more target surface types that have an impact on the surface performance of the target pixel position according to the distances between the target pixel position and at least one first position, wherein the target pixel position is one of the pixel positions of the two-dimensional unfolded image, and the first position is one of the pixel positions in the two-dimensional unfolded image except the target pixel position; Determining the influence intensity of the target surface type on the target pixel position; The target surface type and the influence strength of the target surface type on the target pixel position are stored in a data channel of a preset image, so as to render and display the target model based on the preset image through a terminal.
2. The method according to claim 1, characterized in that The rendering and displaying of the target model based on the preset image by a terminal includes: In response to the rendering instruction, the terminal reads the target surface type and the influence intensity of the target surface type on the target pixel position stored in the data channel of the target pixel position from the preset image for a second position on the target model surface corresponding to the target pixel position in the preset image; determining color data of the second position according to the surface type corresponding to the target pixel position, the target surface type, and the intensity of influence of the target surface type on the target pixel position; The second position is displayed according to the color data of the second position.
3. The method according to claim 2, characterized in that The determining the color data of the second position according to the surface type corresponding to the target pixel position, the target surface type, and the influence intensity of the target surface type on the target pixel position includes: Acquire color data preset for the surface type corresponding to the target pixel position, and color data preset for the target surface type; Taking the influence intensity of the target surface type on the target pixel position as a weight, weighted sum is performed on the color data of the surface type corresponding to the target pixel position and the color data of the target surface type to obtain the color data of the second position.
4. The method according to claim 1, characterized in that The surface type is correspondingly preset with an influence distance threshold, and the determining of the target surface type having an influence on the surface performance of the target pixel position according to the distances between the target pixel position and at least one first position includes: Determine, from the at least one first position, a target first position having an influence on the surface representation of the target pixel position according to the distances between the target pixel position and the at least one first position respectively; The surface type corresponding to the target first position is determined to be a target surface type that has an impact on the surface performance of the target pixel position.
5. The method according to claim 4, characterized in that The surface type is correspondingly preset with an influence distance threshold, and determining, from the at least one first position, a target first position having an influence on the surface performance of the target pixel position according to the distances between the target pixel position and the at least one first position, comprises: Determine whether the distance between the target pixel position and the first position is less than or equal to the influence distance threshold corresponding to the surface type corresponding to the first position; If the distance between the target pixel position and the first position is less than or equal to the influence distance threshold corresponding to the surface type corresponding to the first position, the first position is determined to be the target first position that has an influence on the surface performance of the target pixel position.
6. The method according to claim 4, characterized in that The determining, from the at least one first position, a target first position having an influence on the surface performance of the target pixel position according to the distances between the target pixel position and the at least one first position, comprises: Determine at least one first position from all first positions in the two-dimensional unfolded image, the first position being within a preset distance from the first position; According to the distances between the target pixel position and at least one first position, a target first position having an influence on the surface expression of the target pixel position is determined from the at least one first position.
7. The method according to claim 4, characterized in that According to the distances between the target pixel position and at least one first position, determining a target first position having an influence on the surface expression of the target pixel position from the at least one first position, comprising: Performing Manhattan correction on the distances between the target pixel position and at least one first position respectively; According to the Manhattan modified distances between the target pixel position and at least one first position, a target first position having an influence on the surface expression of the target pixel position is determined from the at least one first position.
8. The method according to claim 4, characterized in that The determining the influence intensity of the target surface type on the target pixel position includes: According to the target first position corresponding to one of the target surface types, the influence intensity of one of the target surface types on the target pixel position is determined.
9. The method according to claim 8, characterized in that The determining, based on the target first position corresponding to one of the target surface types, the influence intensity of the one of the target surface types on the target pixel position includes: Determine the influence intensity of the target first position corresponding to one of the target surface types on the target pixel position; Summing the influence strength of the target first position corresponding to one of the target surface types on the target pixel position to obtain the sum of the influence strengths of the target first position of one of the target surface types on the target pixel position; The sum of the influence intensities is normalized to obtain the influence intensity of one of the target surface types on the target pixel position.
10. The method according to claim 9, characterized in that The determining of the influence strength of the target first position corresponding to one of the target surface types on the target pixel position includes: Determine that a quotient of a preset parameter and an impact distance threshold corresponding to one of the target surface types is a first value; Determine a distance between the target first position and the target pixel position as a second value; Determine that the difference between the impact distance threshold corresponding to the target surface type and the second value is a third value; The product of the first value and the third value is determined to obtain a first product, where the first product is the influence intensity of the target first position corresponding to one of the target surface types on the target pixel position.
11. The method according to claim 1, characterized in that The data channel includes one or more of the following: a color channel and a transparency channel.
12. The method according to claim 1, characterized in that The distances between the target pixel positions and at least one first position are Manhattan distances.
13. A data rendering device, characterized in that: The device comprises: An acquisition unit, used for acquiring a preset surface type corresponding to each position on the surface of the target model; A determination unit, configured to determine a two-dimensional unfolded image of the target model, wherein each pixel position of the two-dimensional unfolded image has a corresponding surface type; The determination unit is further configured to determine one or more target surface types that have an impact on the surface performance of the target pixel position according to the distances between the target pixel position and at least one first position, wherein the target pixel position is one of the pixel positions of the two-dimensional unfolded image, and the first position is one of the pixel positions in the two-dimensional unfolded image except the target pixel position; The determination unit is further used to determine the influence intensity of the target surface type on the target pixel position; A processing unit is used to store the target surface type and the influence intensity of the target surface type on the target pixel position in a data channel of a preset image, so as to render and display the target model based on the preset image through a terminal.
14. An electronic device, characterized in that: include: processor; as well as The memory is used to store a data processing program. After the electronic device is powered on and the program is run by the processor, the method according to any one of claims 1 to 12 is executed.
15. A computer-readable storage medium, characterized in that: A data processing program is stored, and the program is run by a processor to execute the method according to any one of claims 1 to 12.