Method, device and equipment for adjusting brightness of map and storage medium
By determining the target brightness of the texture based on physically based rendering and adjusting it step by step, the problem of iterative texture brightness adjustment is solved, and the texture adaptability in different environments and the natural and reasonable appearance of the game screen are achieved.
Patent Information
- Application Number
- CN202111178193.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-09
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2041-10-09
AI Technical Summary
In existing technologies, adjusting texture brightness requires repeated attempts, and the final adjusted texture brightness has low adaptability to different environments, resulting in poor game visual effects.
The target brightness of the texture is determined by physically based color rendering, and the next adjustment parameters are calculated based on the target brightness and the previous adjustment parameters until the adjusted brightness is equal to the target brightness. Finally, the texture adjusted to the target brightness is output.
It improves the adaptability of textures to different environments, ensuring that the game screen does not become distorted after changes in lighting, and increases the reusability of game resources.
Smart Images

Figure CN113920239B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to game technology, and in particular to a method and device for adjusting the brightness of a texture, a device, and a storage medium. BACKGROUND
[0002] The role of a texture is to describe the material of an object surface, so as to interact with light in a game engine (virtual world), so that the object in the game presents the light law in the existing world. The brightness of the texture will affect the final effect presented in the game, so the brightness of the texture needs to be adjusted.
[0003] Currently, to adjust the brightness of a texture, one way is to create a game model in a three-dimensional model, determine the texture of the game model, and then export the texture to other retouching software, such as PhotoShop (PS), to manually adjust the brightness of the texture. Another way is to directly adjust the scaling value of the brightness of the BaseColor in the game engine according to the picture performance of the game model in the scene, and determine whether the adjusted game picture achieves the expected game picture effect by visual observation.
[0004] In summary, both of the above-mentioned methods need to be repeatedly tried, and the brightness of the texture finally adjusted has low adaptability to different environments. SUMMARY
[0005] The present application provides a method and device for adjusting the brightness of a texture, a device, and a storage medium, to solve the problem of the need to repeatedly adjust the brightness of the texture and verify the picture effect, and the brightness of the texture finally adjusted has low adaptability to different environments.
[0006] In a first aspect, the present application provides a method for adjusting the brightness of a texture, comprising the following steps: step a, for a texture in a game model to be adjusted in brightness, determining the target brightness of the texture according to the color based on physical rendering; step b, determining the adjustment parameter of the i-th time according to the target brightness and the adjustment parameter of the i-1-th time, the adjustment parameter of the i-th time being the adjustment parameter of the current time, i being a positive integer greater than 2; step c, adjusting the brightness of the texture according to the adjustment parameter of the i-th time to obtain the adjusted brightness of the i-th time; step d, if the adjusted brightness of the i-th time is not equal to the target brightness, determining the value of i+1 as the new value of i, and repeating steps b to d until the adjusted brightness of the i-th time is equal to the target brightness; step e, outputting the texture adjusted to the target brightness.
[0007] In a second aspect, the application provides a device for adjusting brightness of a texture, comprising: a first determining module configured to determine a target brightness of a texture to be adjusted in a game model according to a color based on physical rendering; a second determining module configured to determine an i-th adjustment parameter according to the target brightness and an (i-1)-th adjustment parameter, the i-th adjustment parameter being a current adjustment parameter, and i being a positive integer greater than 2; an adjusting module configured to adjust brightness of the texture according to the i-th adjustment parameter to obtain an i-th adjusted brightness; a third determining module configured to determine a value of i+1 as a new value of i if the i-th adjusted brightness is not equal to the target brightness, and repeat the second determining module, the adjusting module and the third determining module until the i-th adjusted brightness is equal to the target brightness; and an output module configured to output the texture adjusted to the target brightness.
[0008] In a third aspect, the application provides an electronic device, comprising: a processor, and a memory connected to the processor in communication; the memory stores computer-executable instructions; and the processor executes the computer-executable instructions stored in the memory to implement the method of the first aspect.
[0009] In a fourth aspect, the application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are executed by a processor to implement the method of the first aspect.
[0010] In a fifth aspect, the application provides a computer program product, comprising a computer program, and the computer program is executed by a processor to implement the method of the first aspect.
[0011] The application provides a map brightness adjustment method and device, equipment and a storage medium. The method comprises the following steps: determining a target brightness of a map to be adjusted in a game model according to a color based on physical rendering; determining an i-th adjustment parameter according to the target brightness and an (i-1)-th adjustment parameter; adjusting the brightness of the map according to the i-th adjustment parameter to obtain an i-th adjusted brightness; if the i-th adjusted brightness is not equal to the target brightness, determining a value of i+1 as a new value of i, and repeating the above steps until the i-th adjusted brightness is equal to the target brightness; and outputting the map adjusted to the target brightness. The target brightness of the map to be adjusted in the game model is determined according to the color based on physical rendering, and the brightness of the map is adjusted based on the target brightness. The color based on physical rendering can express the inherent color of an object itself, and is not affected by light. Therefore, the map brightness does not need to be repeatedly adjusted and the picture effect needs to be verified. After the light condition changes, the correct picture performance can be ensured, so that the adaptability of the map to different environments can be improved. In addition, when the map resource adjusted in brightness is transplanted to other games or engines, the correct picture performance can still be ensured, so that the reuse rate of game resources can be improved. BRIEF DESCRIPTION OF DRAWINGS
[0012] The accompanying drawings, which are incorporated herein and form part of the specification, illustrate embodiments consistent with the present application and, together with the description, further serve to explain the principles of the application.
[0013] Figure 1 A three-dimensional game model production flowchart provided by an embodiment of the application;
[0014] Figure 2 A three-dimensional model schematic diagram provided by an embodiment of the application;
[0015] Figure 3 A UV map provided by an embodiment of the application for a three-dimensional model in a game; Figure 2
[0016] Figure 4 A map brightness adjustment method flowchart provided by an embodiment of the application Figure 1 ;
[0017] Figure 5 A map brightness adjustment process principle diagram provided by an embodiment of the application;
[0018] Figure 6 A map brightness adjustment method flowchart provided by an embodiment of the application Figure 2 ;
[0019] Figure 7 A structure diagram of an adjusting device for map brightness provided by an embodiment of the present application is shown in the figure.
[0020] Figure 8 A structure diagram of an electronic device provided by an embodiment of the present application is shown in the figure.
[0021] The specific embodiments of the present application have been shown in the above figures, and will be described in more detail hereinafter. These figures and the written description are not intended to limit the scope of the present application in any way, but to illustrate the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0022] The exemplary embodiments will be described in detail herein with reference to the attached drawings. The same or similar components are denoted by the same reference numerals throughout the drawings and the following description, unless otherwise specified. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the present application as detailed in the appended claims.
[0023] First, the terms involved in the present application are explained:
[0024] PBR: Physically Based Rendering, which means a rendering method using a method conforming to the basic physical laws of the real world to simulate light.
[0025] BaseColor map: a texture map that stores color information of the surface of a model material.
[0026] HSV: Hue (hue), Saturation (saturation), Value (brightness), a hexagonal cone space for measuring color according to the intuitive characteristics of color.
[0027] sRGB: standard Red Green Blue, a color language protocol, a standard method for defining color, so that various computer external devices and application software for color have a common language for color.
[0028] The quality of game pictures is important for the game experience of players, and high-quality game pictures can attract players. Game pictures include multiple objects, such as characters, monsters, and buildings. To make a game picture present the final effect in the game, a complete production process is needed.
[0029] Figure 1A schematic diagram of a production process of a three-dimensional game model is provided for an embodiment of the present application.
[0030] As shown in the figure, Figure 1 the production process of the three-dimensional game model includes modeling, UV unwrapping and material division.
[0031] The modeling refers to modeling an object to be presented in a game, which can be realized by creating a geometry of the object in a three-dimensional software. The created geometry can be a character model, a monster model, a building model, etc.
[0032] Figure 2 A schematic diagram of a three-dimensional model is provided for an embodiment of the present application.
[0033] As shown in the figure, Figure 2 the three-dimensional model is only a skeleton of the object, which lacks detailed information such as texture information compared with the effect finally presented in a game picture.
[0034] In order to add detailed information to the three-dimensional model, the three-dimensional model can be subjected to operations such as UV unwrapping and material division. That is, the three-dimensional model is unwrapped in a two-dimensional UV coordinate system, with the horizontal direction being U and the vertical direction being V.
[0035] The UV unwrapping refers to unwrapping a three-dimensional object model into a plane, and spreading a face of a three-dimensional model into a corresponding two-dimensional coordinate image. In this way, the three-dimensional model can correctly display the two-dimensional material assigned thereto according to the two-dimensional coordinates.
[0036] Figure 3 A schematic diagram of unwrapping a three-dimensional model in Figure 2 is provided for an embodiment of the present application.
[0037] As shown in the figure, Figure 3 the cube in Figure 2 is unwrapped into a two-dimensional plane image.
[0038] Please continue to refer to Figure 3 The two-dimensional plane image includes a plurality of faces, and detailed information needs to be added to each face, which requires assigning material, texture and other information to each face.
[0039] The texture information is assigned to each face by adding a map to the face. However, the brightness of the map displayed on each face of the three-dimensional model is actually different, and therefore, the brightness of the map needs to be adjusted.
[0040] Currently, there are two ways to adjust the brightness of the map.
[0041] In the first mode, the map of the three-dimensional model is exported to other retouching software, such as PS, to adjust the brightness of the map. This mode needs to export the map to other retouching software and then re-import the three-dimensional model, which is relatively complex to operate, and needs to manually verify the effect repeatedly, resulting in the need for repeated operation multiple times, which is very high in labor cost.
[0042] In the second mode, in the Unreal Engine 4 (UE4), the brightness scaling value of the BaseColor map is directly adjusted according to the picture performance of the game model in the game scene. Specifically, in the UE4 engine, the user adjusts the adjustment parameter manually, such as adjustment multiple, and then observes the effect of the adjusted map by naked eye, and determines whether the adjusted effect reaches the expected effect by naked eye observation.
[0043] The second mode needs to be tried repeatedly, has no benchmark, and has no method to approach the "target value". When the brightness ratio is large enough, the brightness change of the map can be ignored, so it is difficult to measure the map change by adjusting the adjustment multiple in the actual adjustment process. For example, when the brightness multiple is adjusted to 10000 and 1000000, the change of the map is not obvious, and it is difficult to observe this change by naked eye, so it is considered to reach the expected effect, which results in low accuracy of brightness adjustment.
[0044] Directly adjusting the brightness of the BaseColor map can only meet the picture performance under the light condition when adjusting the brightness of the map. When the light changes, the overall picture will have a strong sense of discomfort. For example, when a map has a poor picture effect under the light condition of night, the brightness of the map under the light condition of night will be directly adjusted in UE4, and the picture performance of the map under the light condition of day will also change, so the brightness of the map under the light condition of night will be modified again, and so on, until a balance point is found, so that the picture effect under the light condition of night and day reaches a better effect. This adjustment method also needs to be adjusted repeatedly, which is time-consuming and laborious.
[0045] In addition, when a change is made to a game model, the adaptation between other resources placed together will be a problem, which will also produce more errors. For example, in a map including house, ground, grass and other materials, the brightness of the ground map is too low, and in order to achieve the picture performance, the brightness of the grass map will also be lowered.
[0046] In summary, the above-mentioned adjustment method of the brightness of the map needs to be repeatedly adjusted, which is time-consuming and laborious, and the adjusted picture effect is not good. In view of the above problems, the inventors of the present application found that the phenomenon of the game model placed in the game scene appears to be inconsistent, and many times it is because the game model is not made in accordance with the actual physical meaning. For example, the picture effect is usually produced under certain lighting conditions, so the game picture effect needs to be modified under the corresponding light conditions at that time, and when the lighting conditions change, the picture effect will be poor, and it is difficult to meet all the lighting conditions. For example, the color of the game picture seen by the naked eye of the player is actually the common effect of the game model itself + different lighting conditions. The existing adjustment scheme needs to adjust the model itself, and then verify the picture effect under different lighting conditions, and repeatedly adjust, and the purpose of the adjustment is to achieve the "final picture, or the expected picture".
[0047] Therefore, the present application proposes that when adjusting the brightness of the map, the map is separated from the influence of the light, and the map is adapted to the corresponding real physical meaning. Then the game model itself can be directly corrected, without the need to adapt to the light.
[0048] The technical solutions of the present application and how the technical solutions of the present application solve the above-mentioned technical problems will be described in detail in specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes can not be described in some embodiments. The embodiments of the present application will be described below with reference to the accompanying drawings.
[0049] Figure 4 The flow of the adjustment method of the brightness of the map provided in the embodiments of the present application Figure 1 As shown in FIG. 1, the adjustment method of the brightness of the map comprises the following steps: Figure 4
[0050] Step a, for the map to be adjusted in brightness in the game model, the target brightness of the map is determined according to the color based on physical rendering.
[0051] The map in this embodiment is a BaseColor map. The map of the game model can make the game model rich. For a tree model, the map includes a tree trunk map and a leaf map. Any one of the tree trunk map and the leaf map can be a map to be adjusted in brightness.
[0052] The execution subject of the embodiment can be a terminal device capable of adjusting brightness, such as a computer. Specifically, the UE4 software is installed on the terminal device, and the map to be adjusted in brightness can be obtained by importing the map to be adjusted in brightness into the UE4 software. Optionally, the user can manually import the UE4 software.
[0053] In this embodiment, the game model refers to a model obtained by three-dimensional modeling of an object in a game scene.
[0054] Specifically, the target brightness of the map is determined according to the color based on the physical rendering.
[0055] More specifically, the target brightness of the map is determined according to the color based on the physical rendering, comprising:
[0056] Step a11, for each pixel point in the plurality of pixel points, determining the target color of the pixel point, the target color being the color based on the physical rendering, which can also be understood as the standard color under the PBR light.
[0057] The brightness of the BaseColor map reflects the feedback intensity of the model material surface to the light in the PBR light calculation. A reasonable BaseColor map brightness can make the model in the scene more reasonable and natural. Therefore, the standard color based on PBR in this embodiment can be understood as the color presented by the object surface after absorbing the PBR light under the PBR light.
[0058] The target color based on PBR corresponding to different materials is shown in Table 1 as follows:
[0059] Table 1: Target color based on PBR
[0060]
[0061]
[0062]
[0063] In Table 1, the sRGB color value is the standard color of the BaseColor map in the sRGB space. According to the following formula (1) and the sRGB color value of each pixel point in the map, the target brightness of the pixel point can be obtained. The average value of the sum of the target brightness of all valid pixel points in the map is the target brightness of the map in the sRGB space.
[0064] The linear color value is the color value obtained by converting the sRGB color value to the linear space. According to the linear color value, the target brightness of the map in the linear space can be obtained.
[0065] Step a12, determining the target brightness of the pixel point according to the standard color of the pixel point.
[0066] Wherein, step a12 can be represented as the following formula (1):
[0067] Target brightness = sum of target brightness of valid pixel points / number of valid pixel points
[0068] The valid pixel points refer to all pixel points in the map except invalid black pixels (R / G / B value is 0 and the map is set to ignore black pixels) and invalid open alpha channel pixels (the map opens A channel and the alpha value is 0).
[0069] Step a13, the average value of the target brightness of the plurality of pixel points is determined as the target brightness of the map.
[0070] Step b, the i-th adjustment parameter is determined according to the target brightness and the (i-1)-th adjustment parameter, the i-th adjustment parameter is the current adjustment parameter, and i is a positive integer greater than 2.
[0071] Step c, the brightness of the map is adjusted according to the i-th adjustment parameter to obtain the i-th adjusted brightness.
[0072] In this embodiment, the adjustment parameter can be an adjustment multiple. The brightness of the pixel point obtained by corresponding calculation is adjusted by the adjustment multiple, and the adjusted brightness of the pixel point is obtained by exponential operation.
[0073] Figure 5 The principle diagram of the adjustment process of the map brightness provided by the embodiment of the application.
[0074] As shown in Figure 5 In the adjustment process, from the first adjustment, if the adjustment is in the positive adjustment direction (the direction shown by the horizontal arrow in the figure), if the i-th adjustment direction is different from the (i-1)-th adjustment direction, it can be understood that the adjustment step of the (i-1)-th adjustment is too large, resulting in that the brightness after the (i-1)-th adjustment is greater than the target brightness, that is, the (i-1)-th adjustment is excessive. From the figure, it can be seen that the target brightness is located between the (i-1)-th adjusted brightness and the i-th adjusted brightness, therefore, it is necessary to reduce the adjustment step so that the adjusted brightness gradually approaches the target brightness.
[0075] For the reverse adjustment, it is similar and will not be described here.
[0076] Step d, whether the i-th adjusted brightness is equal to the target brightness, if the i-th adjusted brightness is not equal to the target brightness, the value of i+1 is determined as the new value of i, and steps b to d are repeated until the i-th adjusted brightness is equal to the target brightness.
[0077] Step e, outputting the map adjusted to the target brightness.
[0078] Specifically, the map adjusted to the target brightness can be further adjusted, or the map adjusted to the target brightness can be directly output to a renderer for rendering.
[0079] The embodiment determines the target brightness of the map to be adjusted in the game model according to the color based on physical rendering, determines the adjustment parameter of the i-th time according to the target brightness and the adjustment parameter of the i-1-th time, adjusts the brightness of the map according to the adjustment parameter of the i-th time to obtain the adjusted brightness of the i-th time, determines the value of i+1 as the new value of i if the adjusted brightness of the i-th time is not equal to the target brightness, and repeats the above steps until the adjusted brightness of the i-th time is equal to the target brightness, and outputs the map adjusted to the target brightness. Since the target brightness of the map to be adjusted in the game model is determined according to the color based on physical rendering, and the brightness of the map is adjusted based on the target brightness, the color based on physical rendering can express the inherent color of the object itself, which is not affected by lighting and does not need to repeatedly adjust the brightness of the map and verify the picture effect, and the correct picture performance can be ensured after the lighting condition changes, so that the adaptability of the map to different environments can be improved. Moreover, the target brightness of the map can ensure that the game picture will not appear distorted, high-brightness, dead black and other abnormal conditions after the lighting changes, so that the performance of the rendered game picture is more natural and reasonable. In addition, when the map resource adjusted in brightness is transplanted to other games or engines, the correct picture performance can still be ensured, thereby improving the reuse rate of game resources.
[0080] Figure 6 The map brightness adjustment method provided by the embodiment of the application Figure 2 As shown in Figure 6 , the map brightness adjustment method specifically includes the following steps:
[0081] Step b1, determining the adjustment direction of the i-th time according to the target brightness and the adjustment parameter of the i-1-th time.
[0082] The adjustment direction includes positive adjustment or reverse adjustment, the positive adjustment is used to indicate that the current brightness of the map is adjusted in the direction of decreasing, and the reverse adjustment is used to indicate that the current brightness of the map is adjusted in the direction of increasing.
[0083] Specifically, determining the adjustment direction of the i-th time according to the target brightness and the adjustment parameter of the i-1-th time includes: if the adjusted brightness of the i-1-th time is greater than the target brightness, determining that the adjustment direction of the i-th time is positive adjustment; if the adjusted brightness of the i-1-th time is less than the target brightness, determining that the adjustment direction of the i-th time is reverse adjustment.
[0084] Step b2, determining the adjustment step length of the i-th time according to the adjustment direction of the i-th time, the adjustment direction of the (i-1)-th time and the adjustment step length of the (i-1)-th time.
[0085] In an implementation manner, if the adjustment direction of the i-th time is same as the adjustment direction of the (i-1)-th time, the adjustment step length of the (i-1)-th time is increased to obtain the adjustment step length of the i-th time. Specifically, the adjustment step length of the (i-1)-th time multiplied by a preset multiple is determined as the adjustment step length of the i-th time.
[0086] The preset multiple can be an integer greater than 1.
[0087] For example, the preset multiple is 2, and the current adjustment is the third adjustment. If the adjustment directions of the second and third times are both positive adjustment, and the adjustment step length of the second time is 16, the adjustment step length of the third time is 16*2=32.
[0088] In another implementation manner, if the adjustment direction of the i-th time is not same as the adjustment direction of the (i-1)-th time, the adjustment step length of the (i-1)-th time is decreased to obtain the adjustment step length of the i-th time. Specifically, the adjustment step length of the (i-1)-th time divided by a preset multiple is determined as the adjustment step length of the i-th time.
[0089] The preset multiple can be an integer greater than 1.
[0090] For example, the preset multiple is 2, and the current adjustment is the third adjustment. If the adjustment direction of the second time is positive adjustment, the adjustment direction of the third time is reverse adjustment, and the adjustment step length of the second time is 16, the adjustment step length of the third time is 16 / 2=8.
[0091] Step b3, determining the adjustment parameter of the i-th time according to the adjustment parameter of the (i-1)-th time, the adjustment direction of the i-th time and the adjustment step length of the i-th time.
[0092] The adjustment parameter in the embodiment can be an adjustment multiple. In the embodiment, the brightness of the map is adjusted by the adjustment multiple, and the adjustment step length is adjusted for the adjustment multiple.
[0093] In an implementation manner, step b3 includes: if the adjustment direction of the i-th time is positive adjustment, the sum of the adjustment parameter of the (i-1)-th time and the adjustment step length of the i-th time is determined as the adjustment parameter of the i-th time. For example, if the adjustment direction of the i-th time is positive adjustment, the sum of the adjustment multiple of the (i-1)-th time and the adjustment step length of the i-th time is determined as the adjustment multiple of the i-th time; and the brightness of the map is adjusted according to the adjustment multiple of the i-th time.
[0094] In another implementation, step b3 includes: if the adjustment direction of the i-th time is reverse adjustment, determining the difference between the adjustment parameter of the (i-1)-th time and the adjustment step of the i-th time as the adjustment parameter of the i-th time.
[0095] Taking the adjustment parameter as an adjustment multiple as an example, the implementation process of the above two implementation manners can be expressed as the following formula (2):
[0096] Adjustment multiple i = Adjustment multiple i-1 + (Adjustment direction i * Adjustment step i ); (2)
[0097] Wherein, the adjustment direction i may indicate whether the brightness correction of the map is overcorrected, that is, whether the target brightness is exceeded, which determines whether the adjustment multiple of the (i-1)-th time is added or subtracted by the adjustment step of the i-th time to determine the adjustment multiple of the i-th time.
[0098] Exemplarily, the positive adjustment can be represented by a positive sign, and the reverse adjustment can be represented by a negative sign. Then, if the adjustment direction i is positive adjustment, that is, the adjustment multiple of the (i-1)-th time is added by the adjustment step of the i-th time to obtain the adjustment multiple of the i-th time; if the adjustment direction i is reverse adjustment, that is, the adjustment multiple of the (i-1)-th time is subtracted by the adjustment step of the i-th time to obtain the adjustment multiple of the i-th time.
[0099] Exemplarily, the adjustment multiple of each time can be expressed as the following formula:
[0100] scale1 = scale0 + t1, scale0 = 1, t1 = abs(1-target brightness value / current brightness value);
[0101] scale2 = scale1 + t2, t2 = t1 / 2;
[0102] ...
[0103] scalei = scalei-1 + ti, ti = ti-1 / 2;
[0104] scalei+1 = scalei + ti+1, ti+1 = ti / 2;
[0105] scalei+2 = scalei+1 + ti+2, ti+2 = ti+1 / 2;
[0106] In the above formula, scale is the adjustment multiple, and t is the adjustment step.
[0107] The embodiment adjusts the adjustment direction of the i-th time to be performed in the game model, and the adjustment direction includes positive adjustment or reverse adjustment. If the adjustment direction of the i-th time is the same as the adjustment direction of the i-1-th time, the adjustment step of the i-1-th time is increased to obtain the adjustment step of the i-th time. If the adjustment direction of the i-th time is not the same as the adjustment direction of the i-1-th time, the adjustment step of the i-1-th time is reduced to obtain the adjustment step of the i-th time. Then, the adjustment parameter of the i-th time is determined according to the adjustment parameter of the i-1-th time, the adjustment step of the i-th time and the adjustment direction of the i-th time, and the brightness of the map is adjusted according to the adjustment parameter of the i-th time to obtain the adjusted brightness of the i-th time. If the adjusted brightness of the i-th time is not equal to the preset target brightness, the value of i+1 is determined as the new value of i, and the above steps are repeated until the adjusted brightness of the i-th time is equal to the preset target brightness. Finally, the brightness of the map adjusted to the target brightness is output. In the adjustment process of each time, the adjustment direction of the current adjustment is determined, and in the case that the adjustment direction of the current adjustment is the same as the adjustment direction of the last adjustment, the adjustment step of the last adjustment is increased as the adjustment step of the current adjustment, or in the case that the adjustment direction of the current adjustment is not the same as the adjustment direction of the last adjustment, the adjustment step of the last adjustment is reduced as the adjustment step of the current adjustment. That is, if the adjustment direction is correct, the adjustment step will continue to increase, so that the brightness of the map quickly approaches the target brightness, that is, the difference between the brightness of the map and the target brightness is quickly reduced. When the brightness of the adjusted map exceeds (including greater than or less than) the target brightness, it is considered that the target brightness has been approached, and the adjustment step can be reduced for fine adjustment of the brightness of the map, so that the brightness of the map reaches the target brightness.
[0108] In addition, as introduced above, i in the embodiment is an integer greater than 2, that is, the above embodiment is taken as the second adjustment as a starting point, and the second adjustment needs to depend on the adjustment step and the adjustment direction of the first adjustment. The adjustment direction and the adjustment step of the first adjustment can be determined by initialization.
[0109] The adjustment direction of the first adjustment is initialized, including: determining the adjustment direction of the first time according to the initial brightness of the map and the target brightness.
[0110] Specifically, the adjustment direction of the first time is determined according to the initial brightness of the map and the target brightness, including: if the initial brightness of the map is greater than the target brightness, the adjustment direction of the first time is determined as positive adjustment; if the initial brightness of the map is less than the target brightness, the adjustment direction of the i-th time is determined as reverse adjustment.
[0111] The adjustment step of the first adjustment is initialized, including: determining the adjustment step of the first time according to the difference between the preset value and the target ratio, and the target ratio is the ratio of the target brightness to the initial brightness of the map. Specifically, the initial step can be represented as formula (3) as follows:
[0112] Initial step size = abs (1 - target brightness / initial brightness) (3) ;
[0113] Wherein, abs represents taking absolute value.
[0114] Specifically, after determining the first adjustment direction and the first adjustment step size, the second adjustment direction and the second adjustment step size can be determined according to the first adjustment direction and the first adjustment step size, and the third adjustment direction and the third adjustment step size can be determined according to the second adjustment direction and the second adjustment step size, and so on, until the brightness of the map is adjusted to the target brightness.
[0115] On the basis of the above embodiment, the i-th adjustment brightness can be determined according to the following two kinds of implementation:
[0116] In an alternative embodiment, the map includes a plurality of pixel points, each pixel point corresponding to a first brightness, the first brightness being the brightness in the sRGB space, and if the brightness adjustment of the map is adjusted in the sRGB space, the i-th adjustment brightness can be determined according to the ratio of the sum of the first brightness of the effective pixels to the number of effective pixels. Specifically, it can be expressed as the following formula (4):
[0117] The i-th first brightness = the sum of the first brightness of the effective pixels / the number of effective pixels; (4).
[0118] Wherein, the effective pixel refers to all pixel points in the map except the invalid black pixel (R / G / B value is 0 and the map is set to ignore the black pixel) and the invalid open alpha (Alpha) channel pixel (the map opens the A channel and the Alpha value is 0).
[0119] Since the color value in the map obtained in step a is the color value in the sRGB space, and the brightness of each pixel point is also the brightness in the sRGB space, the i-th first brightness can be directly determined according to the above formula in this embodiment.
[0120] In another alternative embodiment, the map includes a plurality of pixel points, each pixel point corresponding to a first brightness, and if the brightness adjustment of the map is adjusted in the linear space, the first brightness of each pixel point needs to be converted to the linear space, and the specific conversion process includes:
[0121] Step s1, for each of the plurality of effective pixel points, respectively converting the first color, the second color and the third color of the effective pixel point in the sRGB color space to the linear space to obtain the first color in the linear space, the second color in the linear space and the third color in the linear space.
[0122] If the first color, the second color or the third color of the valid pixel point in the sRGB color space is greater than a preset color value, for example, 10.31475, the valid pixel point is converted in space according to the following formula (5):
[0123] Linear space color value = [(color value in sRGB color space / 255+0.055) / 1.055]^2.4; (5)
[0124] If the first color, the second color or the third color of the valid pixel point in the sRGB color space is less than or equal to the preset color value, the valid pixel point is converted in space according to the following formula:
[0125] Linear space color value = (color value in sRGB color space / 255) / 12.92; (6)
[0126] Step s2, determining the luminance of the valid pixel point in the linear space according to the first color in the linear space, the second color in the linear space and the third color in the linear space of the valid pixel point.
[0127] Step s2 can be expressed as the following formula (7):
[0128] Linear space luminance value = 0.2126*R+0.7152*G+0.0722*B; (7)
[0129] In formula (6), R is the first color value in the linear space, G is the second color value in the linear space, and B is the third color value in the linear space.
[0130] Step s3, determining the sum of the luminance of the plurality of valid pixel points in the linear space according to the luminance of the valid pixel point in the linear space.
[0131] Step s4, determining the luminance in the linear space according to the ratio of the sum of the luminance of the plurality of valid pixel points in the linear space to the number of the plurality of valid pixel points.
[0132] The implementation process of step s4 can refer to the calculation process of formula (4).
[0133] Figure 7 The structure schematic diagram of the map luminance adjustment device provided by the embodiment of the present application is shown in FIG. 1. Figure 7As shown, the map brightness adjustment device comprises a first determination module 71, a second determination module 72, an adjustment module 73, a third determination module 74 and an output module 75. The first determination module 71 is configured to determine a target brightness of a map to be adjusted in a game model according to a color based on physical rendering. The second determination module 72 is configured to determine an i-th adjustment parameter according to the target brightness and an (i-1)-th adjustment parameter, the i-th adjustment parameter being a current adjustment parameter, and i being a positive integer greater than 2. The adjustment module 73 is configured to adjust the brightness of the map according to the i-th adjustment parameter to obtain an i-th adjusted brightness. The third determination module 74 is configured to determine a value of i+1 as a new value of i if the i-th adjusted brightness is not equal to the target brightness, and repeat the method of the first determination module 71, the second determination module 72, the adjustment module 73 and the third determination module 74 until the i-th adjusted brightness is equal to the target brightness. The output module 75 is configured to output the map adjusted to the target brightness.
[0134] In an embodiment of the present application, the second determination module 72 determines the i-th adjustment parameter according to the target brightness and the (i-1)-th adjustment parameter, specifically comprising: determining an i-th adjustment direction according to the target brightness and an (i-1)-th adjusted brightness; determining an i-th adjustment step according to the i-th adjustment direction, an (i-1)-th adjustment direction and an (i-1)-th adjustment step; and determining the i-th adjustment parameter according to the (i-1)-th adjustment parameter, the i-th adjustment direction and the i-th adjustment step.
[0135] In an embodiment of the present application, the second determination module 72 determines the i-th adjustment step according to the i-th adjustment direction, the (i-1)-th adjustment direction and the (i-1)-th adjustment step, specifically comprising: if the i-th adjustment direction is the same as the (i-1)-th adjustment direction, increasing the (i-1)-th adjustment step to obtain the i-th adjustment step.
[0136] In an embodiment of the present application, the second determination module 72 increases the (i-1)-th adjustment step to obtain the i-th adjustment step, comprising: multiplying the (i-1)-th adjustment step by a preset multiple to obtain the i-th adjustment step.
[0137] In an embodiment of the present application, the second determination module 72 determines the i-th adjustment step according to the i-th adjustment direction, the (i-1)-th adjustment direction and the (i-1)-th adjustment step, further comprising: if the i-th adjustment direction is not the same as the (i-1)-th adjustment direction, decreasing the (i-1)-th adjustment step to obtain the i-th adjustment step.
[0138] In an embodiment of the present application, the second determining module 72 reduces the i-1th adjustment step to obtain the ith adjustment step, including: dividing the i-1th adjustment step by a preset multiple to obtain the result, and determining the result as the ith adjustment step.
[0139] In an embodiment of the present application, the second determining module 72 determines the adjustment direction of the ith time according to the target brightness and the i-1th adjusted brightness, including: if the i-1th adjusted brightness is greater than the target brightness, determining the adjustment direction of the ith time as positive adjustment; if the i-1th adjusted brightness is less than the target brightness, determining the adjustment direction of the ith time as negative adjustment.
[0140] In an embodiment of the present application, the adjusting module 73 adjusts the brightness of the map according to the ith adjustment parameter to obtain the ith adjusted brightness, specifically including: if the adjustment direction of the ith time is positive adjustment, determining the sum of the i-1th adjustment parameter and the ith adjustment step as the ith adjustment parameter; and adjusting the brightness of the map according to the ith adjustment parameter.
[0141] In an embodiment of the present application, the adjusting module 73 adjusts the brightness of the map according to the ith adjustment parameter to obtain the ith adjusted brightness, further including: if the adjustment direction of the ith time is negative adjustment, determining the difference between the i-1th adjustment parameter and the ith adjustment step as the ith adjustment parameter; and adjusting the brightness of the map according to the ith adjustment parameter.
[0142] In an embodiment of the present application, the first determining module 71 determines the target brightness of the map according to the color based on physical rendering for the map to be adjusted in brightness in the game model, specifically including: determining the standard color of each pixel point in the plurality of pixel points, the standard color being the color based on physical rendering; determining the target brightness of the pixel point according to the standard color of the pixel point; and determining the average value of the target brightness of the plurality of pixel points as the target brightness of the map.
[0143] In an embodiment of the present application, the adjustment direction of the first time is determined according to the initial brightness of the map and the target brightness; and the adjustment step of the first time is determined according to the difference between a preset value and a target ratio, the target ratio being the ratio of the target brightness to the initial brightness of the map.
[0144] The map brightness adjustment device provided in the embodiments of the present application can be used to execute the technical solutions of the map brightness adjustment method in the above embodiments, and has similar implementation principles and technical effects, which will not be described here again.
[0145] It should be noted that the division of each module of the above apparatus is only a logical functional division, and all or part of the modules can be integrated into one physical entity or physically separated in actual implementation. The modules can all be implemented in the form of software invoked by a processing element; all can be implemented in the form of hardware; or some modules are implemented in the form of software invoked by a processing element and some modules are implemented in the form of hardware. For example, the second determination module 72 can be a separately arranged processing element, or can be integrated in a chip of the above apparatus, and in addition, can be stored in the form of program code in the memory of the above apparatus, and the functions of the above second determination module 72 are invoked and executed by a processing element of the above apparatus. The implementation of other modules is similar. In addition, all or part of the modules can be integrated together or independently implemented. The processing element herein can be an integrated circuit having a signal processing capability. In the implementation process, each step of the above method or each module can be completed by the integrated logic circuit of hardware or the instruction of software in the processing element.
[0146] Figure 8 The structure schematic diagram of the electronic device provided by the embodiment of the present application is shown in the figure. Figure 8 As shown in the figure, the electronic device can include a transceiver 81, a processor 82, and a memory 83.
[0147] The processor 82 executes the computer execution instructions stored in the memory, so that the processor 82 executes the scheme in the above embodiment. The processor 82 can be a general-purpose processor, including a central processing unit CPU, a network processor NP, etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.
[0148] The memory 83 is connected with the processor 82 through a system bus and completes mutual communication, and the memory 83 is used for storing computer program instructions.
[0149] The transceiver 81 can be used to acquire a map.
[0150] The system bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus or the like. The system bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is used in the figure, but it does not represent only one bus or only one type of bus. The transceiver is used to realize the communication between the database access device and other computers (such as clients, read-write libraries and read-only libraries). The memory can include random access memory (RAM) and can also include non-volatile memory.
[0151] The embodiment of the present application further provides a chip for running instructions, which is used for executing the technical solution of the map brightness adjustment method in the above embodiment.
[0152] The embodiment of the present application further provides a computer readable storage medium, which stores computer instructions, and when the computer instructions run on a computer, the computer executes the technical solution of the map brightness adjustment method in the above embodiment.
[0153] The embodiment of the present application further provides a computer program product, which includes a computer program stored in a computer readable storage medium, at least one processor can read the computer program from the computer readable storage medium, and when the at least one processor executes the computer program, the technical solution of the map brightness adjustment method in the above embodiment can be realized.
[0154] Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. The specification and examples given are exemplary only and the true scope and spirit of the application are indicated by the following claims. The true scope and spirit of the application are indicated by the following claims.
[0155] It should be understood that the application is not limited to the precise construction that has been described above and shown in the accompanying drawings, and that various modifications and changes can be made by those skilled in the art without departing from the scope of the application. The scope of the application is limited only by the appended claims.
[0156] Finally, it should be noted that the above-mentioned embodiments are merely intended for describing and illustrating, not limiting the technical solutions of the present application; even if the technical solutions of the present application are explained in detail with reference to the above-mentioned embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the above-mentioned embodiments, or make equivalent replacement for part or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.
[0157] Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. It is intended that the specification and examples be considered as exemplary only, with the true scope and spirit of the application being indicated by the following claims.
[0158] It should be understood that the application is not limited to the precise construction that has been described above and shown in the accompanying drawings, and that various modifications and changes can be made by those of ordinary skill in the art without departing from the scope of the application. The scope of the application is limited only by the appended claims.
Claims
1. A method of adjusting the brightness of a texture, characterized in that, The method comprises the following steps: Step a, determining a target brightness of a map to be adjusted in brightness in a game model according to a color determined based on physical rendering; Step b, determining an i-th adjustment parameter according to the target brightness and an (i-1)-th adjustment parameter, the i-th adjustment parameter being a current adjustment parameter, i being a positive integer greater than 2; Step c, adjusting the brightness of the map according to the i-th adjustment parameter to obtain an i-th adjusted brightness; Step d, if the i-th adjusted brightness is not equal to the target brightness, determining a value of i+1 as a new value of i, and repeating steps b to d until the i-th adjusted brightness is equal to the target brightness; Step e, outputting the map adjusted to the target brightness. The determination of the i-th adjustment parameter according to the target brightness and the (i-1)-th adjustment parameter comprises: determining an i-th adjustment direction according to the target brightness and an (i-1)-th adjusted brightness; determining an i-th adjustment step according to the i-th adjustment direction, the (i-1)-th adjustment direction and an (i-1)-th adjustment step; determining the i-th adjustment parameter according to the (i-1)-th adjustment parameter, the i-th adjustment direction and the i-th adjustment step.
2. The method of claim 1, wherein, The determination of the i-th adjustment step according to the i-th adjustment direction, the (i-1)-th adjustment direction and the (i-1)-th adjustment step comprises: if the i-th adjustment direction is the same as the (i-1)-th adjustment direction, increasing the (i-1)-th adjustment step to obtain the i-th adjustment step.
3. The method of claim 2, wherein, The increasing of the (i-1)-th adjustment step to obtain the i-th adjustment step comprises: multiplying the (i-1)-th adjustment step by a preset multiple to obtain the i-th adjustment step.
4. The method of claim 2, wherein, The determination of the i-th adjustment step according to the i-th adjustment direction, the (i-1)-th adjustment direction and the (i-1)-th adjustment step further comprises: if the i-th adjustment direction is not the same as the (i-1)-th adjustment direction, decreasing the (i-1)-th adjustment step to obtain the i-th adjustment step.
5. The method of claim 4, wherein, The decreasing of the (i-1)-th adjustment step to obtain the i-th adjustment step comprises: dividing the (i-1)-th adjustment step by a preset multiple to obtain the i-th adjustment step.
6. The method according to any one of claims 2-5, characterized in that, The determination of the i-th adjustment direction according to the target brightness and the (i-1)-th adjusted brightness comprises: if the (i-1)-th adjusted brightness is greater than the target brightness, determining the i-th adjustment direction as a positive adjustment direction; if the (i-1)-th adjusted brightness is less than the target brightness, determining the i-th adjustment direction as a reverse adjustment direction.
7. The method of claim 6, wherein, The adjustment of the brightness of the map according to the i-th adjustment parameter to obtain the i-th adjusted brightness comprises: if the i-th adjustment direction is the positive adjustment direction, determining a sum of the (i-1)-th adjustment parameter and the i-th adjustment step as the i-th adjustment parameter; adjusting the brightness of the map according to the i-th adjustment parameter.
8. The method of claim 6, wherein, The adjusting the brightness of the map according to the i-th adjustment parameter obtains an i-th adjusted brightness, and the method further includes: If the i-th adjustment direction is reverse adjustment, a difference between the i-1-th adjustment parameter and the i-th adjustment step is determined as the i-th adjustment parameter; The adjusting the brightness of the map according to the i-th adjustment parameter obtains an i-th adjusted brightness.
9. The method according to any one of claims 1 to 5, characterized in that, If the map includes a plurality of pixel points, the method of determining the target brightness of the map according to the color based on physical rendering includes: For each pixel point of the plurality of pixel points, a target color of the pixel point is determined, and the target color is the color based on physical rendering; A target brightness of the pixel point is determined according to the target color of the pixel point; An average value of the target brightnesses of the plurality of pixel points is determined as the target brightness of the map.
10. The method according to any one of claims 2-5, characterized in that, The first adjustment direction is determined according to the initial brightness and the target brightness of the map; The first adjustment step is determined according to a difference between a preset value and a target ratio, and the target ratio is a ratio of the target brightness to the initial brightness of the map.
11. An apparatus for adjusting the brightness of a map, characterized by The method includes: A first determining module is configured to determine a target brightness of a map to be adjusted in a game model according to a color based on physical rendering; A second determining module is configured to determine an i-th adjustment parameter according to the target brightness and an i-1-th adjustment parameter, the i-th adjustment parameter being a current adjustment parameter, and i being a positive integer greater than 2; An adjusting module is configured to adjust the brightness of the map according to the i-th adjustment parameter to obtain an i-th adjusted brightness; A third determining module is configured to determine a new i value as i+1 if the i-th adjusted brightness is not equal to the target brightness, and repeat the method of the second determining module, the adjusting module and the third determining module until the i-th adjusted brightness is equal to the target brightness; An output module is configured to output the map adjusted to the target brightness. The second determining module is specifically configured to determine an i-th adjustment direction according to the target brightness and an i-1-th adjusted brightness, determine an i-th adjustment step according to the i-th adjustment direction, an i-1-th adjustment direction and an i-1-th adjustment step, and determine the i-th adjustment parameter according to an i-1-th adjustment parameter, the i-th adjustment direction and the i-th adjustment step.
12. An electronic device, comprising: The method includes: A processor and a memory connected to the processor in communication; The memory stores computer execution instructions; The processor executes the computer execution instructions stored in the memory to implement the method of any one of claims 1-10.
13. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer execution instructions, and the computer execution instructions are executed by the processor to implement the method of any one of claims 1-10.
14. A computer program product, characterised in that, The computer program is executed by the processor to implement the method of any one of claims 1-10.
Citation Information
Patent Citations
Image processing method and device, electronic equipment and storage medium
CN113018856A
Scene rendering method and device, computer storage medium and electronic equipment
CN113144611A