A method of object rendering, related apparatus, device, and storage medium
By acquiring indoor and outdoor spatial information of dynamic objects, determining and blending the weight values of outdoor and custom environment textures, the problem of abrupt changes in environmental reflection effects in game scenes was solved, improving the realism of visual effects.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2021-06-30
- Publication Date
- 2026-07-03
AI Technical Summary
In game scenes, when dynamic objects move between indoor and outdoor spaces, the environmental reflection effects change abruptly, resulting in visual effects that do not match the real-world display.
By acquiring indoor and outdoor spatial information of dynamic objects, the weight values of outdoor environment maps and custom environment maps are determined and blended during the rendering process to generate a rendering result with brightness transition effects.
It improves the visual effect, making it more in line with the display effect of the real world, and solves the problem of abrupt changes in environmental reflection effects when switching between indoor and outdoor spaces.
Smart Images

Figure CN115546378B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to a method, related apparatus, device, and storage medium for object rendering. Background Technology
[0002] With the development of internet technology, games have also experienced rapid growth, and game graphics have become increasingly sophisticated. Environmental reflection features provide effective, smooth reflections in every part of the game scene. Important materials, such as metals, rely on reflections from various directions. Within the hardware limitations of terminal devices, achieving near-realistic effects has always been a goal pursued by many engine and game developers.
[0003] Currently, the implementation of environment reflection mainly involves pre-placing cube-shaped region blocks in the game scene to capture the surrounding environment onto a cube map. Then, during real-time rendering, the object selects the nearest intersecting region block and uses its cube map as the source of environment reflection.
[0004] However, with Figure 1 Taking the scenes shown in Figures (A) and (B) as examples, the overall environmental reflection of the eyepiece circled in white changes abruptly when crossing the boundary of the indoor space, resulting in a poor visual effect that does not conform to the display effect of the real world. Summary of the Invention
[0005] This application provides a method, related apparatus, device, and storage medium for object rendering. During the rendering process, a custom environment map and an outdoor environment map are mixed based on the updated brightness value to obtain a rendering result with a brightness transition effect, thereby improving the visual effect and making it more consistent with the display effect of the real world.
[0006] In view of this, this application provides a method for object rendering, including:
[0007] Obtain indoor and outdoor space information of dynamic objects, where indoor and outdoor space information represents the area ratio occupied by dynamic objects in indoor and outdoor spaces respectively;
[0008] Based on indoor and outdoor spatial information, determine the first weight value corresponding to the outdoor environment map and the second weight value corresponding to the custom environment map, wherein the custom environment map is a pre-set grayscale image;
[0009] Dynamic objects are rendered using a first weight value, a second weight value, an outdoor environment map, and a custom environment map.
[0010] This application also provides an object rendering apparatus, comprising:
[0011] The acquisition module is used to acquire indoor and outdoor space information of dynamic objects, where indoor and outdoor space information represents the area ratio occupied by dynamic objects in indoor space and outdoor space respectively.
[0012] The determination module is used to determine the first weight value corresponding to the outdoor environment map and the second weight value corresponding to the custom environment map based on the indoor and outdoor space information. The custom environment map is a pre-set grayscale image.
[0013] The rendering module is used to render dynamic objects using a first weight value, a second weight value, an outdoor environment map, and a custom environment map.
[0014] In one possible design, in another implementation of another aspect of the embodiments of this application,
[0015] The determination module is specifically used to determine, based on indoor and outdoor space information, the proportion in which a dynamic object occupies a first proportion in the indoor space and the proportion in the outdoor space, wherein the sum of the first proportion and the second proportion is a fixed proportion.
[0016] If the first ratio is a fixed ratio and the second ratio is 0, then the first weight value corresponding to the outdoor environment texture is determined to be 0, and the second weight value corresponding to the custom environment texture is determined to be the maximum weight value.
[0017] If the second ratio is a fixed ratio and the first ratio is 0, then the first weight value corresponding to the outdoor environment texture is determined as the maximum weight value, and the second weight value corresponding to the custom environment texture is determined as 0.
[0018] In one possible design, in another implementation of another aspect of the embodiments of this application,
[0019] The rendering module is specifically used to update the first initial weight value to the first weight value for the outdoor environment texture.
[0020] For the custom environment texture, the second initial weight value is updated to the second weight value;
[0021] Based on the first weight value and the second weight value, the outdoor environment map and the custom environment map are blended by the graphics processor to obtain the rendering result of the dynamic object.
[0022] In one possible design, in another implementation of another aspect of the embodiments of this application,
[0023] The acquisition module is also used to acquire an outdoor environment texture, wherein the outdoor environment texture corresponds to a target time point, the target time point is included in at least one time point, and each time point in the at least one time point corresponds to a candidate outdoor environment texture.
[0024] The acquisition module is also used to acquire a custom environment map, wherein the custom environment map includes at least one pre-set highlight area, and the average brightness value of each highlight area is greater than the average brightness value of the custom environment map.
[0025] In one possible design, in another implementation of another aspect of the embodiments of this application, the object rendering apparatus further includes a processing module and a generation module;
[0026] The acquisition module is also used to acquire the indoor environment texture corresponding to the target indoor space where the indoor static object is located. The indoor environment texture includes K pixels, where K is an integer greater than 1.
[0027] The processing module is used to normalize the indoor environment texture to obtain a first indoor environment texture, wherein the first indoor environment texture includes K pixels that have undergone brightness normalization.
[0028] The acquisition module is also used to acquire global illumination information based on the spatial position information of the static object in the target indoor space if there is a light source in the target indoor space. The global illumination information includes K preset color information, each preset color information corresponding to a pixel.
[0029] The generation module is used to generate a second indoor environment map based on the first indoor environment map and global lighting information;
[0030] The rendering module is also used to render indoor static objects using a second indoor environment map.
[0031] In one possible design, in another implementation of another aspect of the embodiments of this application,
[0032] The acquisition module is also used to acquire the indoor environment textures to be processed corresponding to N indoor spaces, where N indoor spaces include the target indoor space and N is an integer greater than 1;
[0033] The processing module is also used to encode the indoor environment texture to be processed, so as to obtain a cube texture.
[0034] The processing module is also used to decode the cube map to obtain the indoor environment map;
[0035] The acquisition module is specifically used to obtain the indoor environment map as the indoor environment map corresponding to the target indoor space where the indoor static object is located.
[0036] In one possible design, in another implementation of another aspect of the embodiments of this application,
[0037] The processing module is specifically used to obtain the color information corresponding to each pixel in the indoor environment texture.
[0038] Based on the color information corresponding to each pixel in the indoor environment texture, determine the brightness value corresponding to each pixel in the indoor environment texture.
[0039] Based on the brightness value corresponding to each pixel in the indoor environment texture, determine the average indoor brightness value corresponding to the indoor environment texture.
[0040] Divide the brightness value of each pixel in the indoor environment map by the average indoor brightness value to obtain the first indoor environment map.
[0041] In one possible design, in another implementation of another aspect of the embodiments of this application,
[0042] The generation module is specifically used to obtain the color information corresponding to each pixel in the first indoor environment texture.
[0043] Multiply the color information corresponding to each pixel in the first indoor environment texture with the preset color information of the corresponding pixel in the global illumination information to obtain the color information corresponding to each of the K pixels.
[0044] A second indoor environment texture is generated based on the color information corresponding to each of the K pixels.
[0045] In one possible design, in another implementation of another aspect of the embodiments of this application,
[0046] The acquisition module is used to acquire at least two candidate outdoor environment textures corresponding to the outdoor space where the outdoor static object is located, wherein each candidate outdoor environment texture in the at least two candidate outdoor environment textures corresponds to a time point.
[0047] The acquisition module is also used to acquire the outdoor environment map corresponding to the target time point from at least two candidate outdoor environment maps, wherein the outdoor environment map includes Q pixels, where Q is an integer greater than 1;
[0048] The processing module is also used to normalize the outdoor environment texture to obtain a first outdoor environment texture, wherein the first outdoor environment texture includes Q pixels that have undergone brightness normalization.
[0049] The generation module is also used to generate a second outdoor environment map based on the first outdoor environment map and outdoor lighting information. The outdoor lighting information includes Q preset color information, each preset color information corresponds to a pixel, and the outdoor lighting information has a corresponding relationship with the target time point.
[0050] The rendering module is also used to render outdoor static objects using a second outdoor environment map.
[0051] In one possible design, in another implementation of another aspect of the embodiments of this application,
[0052] The acquisition module is specifically used to determine the first time point and the second time point based on the target time point, wherein the first time point is the time point immediately preceding the target time point, and the second time point is the time point immediately following the target time point;
[0053] If the duration between the target time point and the first time point is less than the duration between the target time point and the second time point, then the candidate outdoor environment texture corresponding to the first time point will be determined as the outdoor environment texture corresponding to the target time point.
[0054] If the duration between the target time point and the first time point is greater than the duration between the target time point and the second time point, then the candidate outdoor environment texture corresponding to the second time point will be determined as the outdoor environment texture corresponding to the target time point.
[0055] In one possible design, in another implementation of another aspect of the embodiments of this application,
[0056] The processing module is specifically used to obtain the color information corresponding to each pixel in the outdoor environment texture.
[0057] Based on the color information corresponding to each pixel in the outdoor environment texture, determine the brightness value corresponding to each pixel in the outdoor environment texture.
[0058] Obtain the average outdoor brightness value corresponding to the outdoor environment texture. The average outdoor brightness value is determined based on the brightness value corresponding to each pixel in the outdoor environment texture. Alternatively, the average outdoor brightness value is determined based on the candidate outdoor environment textures corresponding to two adjacent time points. The two adjacent time points are the time point before the target time point and the time point after the target time point.
[0059] Divide the brightness value of each pixel in the outdoor environment map by the average outdoor brightness value to obtain the first outdoor environment map.
[0060] In one possible design, in another implementation of another aspect of the embodiments of this application,
[0061] The generation module is specifically used to obtain the color information corresponding to each pixel in the first outdoor environment texture.
[0062] Multiply the color information corresponding to each pixel in the first outdoor environment texture with the preset color information of the corresponding pixel in the outdoor lighting information to obtain the color information corresponding to each of the Q pixels.
[0063] A second outdoor environment texture is generated based on the color information corresponding to each of the Q pixels.
[0064] This application also provides a method for object rendering, including:
[0065] Obtain the indoor environment texture corresponding to the target indoor space where the indoor static object is located. The indoor environment texture includes K pixels, where K is an integer greater than 1.
[0066] The indoor environment texture is normalized to obtain the first indoor environment texture, which includes K pixels after brightness normalization.
[0067] If there is a light source in the target indoor space, global illumination information is obtained based on the spatial position information of the static objects in the target indoor space. The global illumination information includes K preset color information, and each preset color information corresponds to a pixel.
[0068] A second indoor environment map is generated based on the first indoor environment map and global illumination information;
[0069] The second indoor environment map is used to render the indoor static objects.
[0070] In one possible design, in another implementation of another aspect of the embodiments of this application, the object rendering method further includes:
[0071] Obtain the indoor environment textures to be processed corresponding to N indoor spaces, where N indoor spaces include the target indoor space and N is an integer greater than 1;
[0072] The indoor environment texture to be processed is encoded to obtain a cube texture;
[0073] Decode the cube map to obtain the indoor environment map;
[0074] Obtain the interior environment texture corresponding to the target interior space where the static interior object is located, including:
[0075] Use the indoor environment map as the indoor environment map corresponding to the target indoor space where the indoor static object is located.
[0076] In one possible design, in another implementation of another aspect of the embodiments of this application, the indoor environment map is normalized to obtain a first indoor environment map, including:
[0077] Obtain the color information corresponding to each pixel in the indoor environment texture;
[0078] Based on the color information corresponding to each pixel in the indoor environment texture, determine the brightness value corresponding to each pixel in the indoor environment texture.
[0079] Based on the brightness value corresponding to each pixel in the indoor environment texture, determine the average indoor brightness value corresponding to the indoor environment texture.
[0080] Divide the brightness value of each pixel in the indoor environment map by the average indoor brightness value to obtain the first indoor environment map.
[0081] In one possible design, in another implementation of another aspect of the embodiments of this application, generating a second indoor environment map based on a first indoor environment map and global illumination information includes:
[0082] Obtain the color information corresponding to each pixel in the first indoor environment texture;
[0083] Multiply the color information corresponding to each pixel in the first indoor environment texture with the preset color information of the corresponding pixel in the global illumination information to obtain the color information corresponding to each of the K pixels.
[0084] A second indoor environment texture is generated based on the color information corresponding to each of the K pixels.
[0085] In one possible design, in another implementation of another aspect of the embodiments of this application, the object rendering method further includes:
[0086] Obtain indoor and outdoor space information of dynamic objects, where indoor and outdoor space information represents the area ratio occupied by dynamic objects in indoor and outdoor spaces respectively;
[0087] Based on indoor and outdoor spatial information, determine the first weight value corresponding to the outdoor environment map and the second weight value corresponding to the custom environment map, wherein the custom environment map is a pre-set grayscale image;
[0088] Dynamic objects are rendered using a first weight value, a second weight value, an outdoor environment map, and a custom environment map.
[0089] In one possible design, in another implementation of another aspect of the embodiments of this application, determining a first weight value corresponding to the outdoor environment map and a second weight value corresponding to the custom environment map based on indoor and outdoor space information includes:
[0090] Based on indoor and outdoor space information, determine the first proportion of dynamic objects in indoor space and the second proportion in outdoor space, wherein the sum of the first proportion and the second proportion is a fixed proportion.
[0091] If the first ratio is a fixed ratio and the second ratio is 0, then the first weight value corresponding to the outdoor environment texture is determined to be 0, and the second weight value corresponding to the custom environment texture is determined to be the maximum weight value.
[0092] If the second ratio is a fixed ratio and the first ratio is 0, then the first weight value corresponding to the outdoor environment texture is determined as the maximum weight value, and the second weight value corresponding to the custom environment texture is determined as 0.
[0093] In one possible design, in another implementation of another aspect of the embodiments of this application, a first weight value, a second weight value, an outdoor environment map, and a custom environment map are used to render the dynamic object, including:
[0094] For outdoor environment textures, update the first initial weight value to the first weight value;
[0095] For custom environment textures, update the second initial weight value to the second weight value;
[0096] Based on the first and second weight values, the outdoor environment map and the custom environment map are blended by the graphics processor to obtain the rendering result of the dynamic object.
[0097] In one possible design, in another implementation of another aspect of the embodiments of this application, the object rendering method further includes:
[0098] Obtain an outdoor environment texture, wherein the outdoor environment texture corresponds to a target time point, the target time point is included in at least one time point, and each time point in the at least one time point corresponds to a candidate outdoor environment texture;
[0099] Obtain a custom environment map, wherein the custom environment map includes at least one pre-defined highlight area, and the average brightness value of each highlight area is greater than the average brightness value of the custom environment map.
[0100] In one possible design, in another implementation of another aspect of the embodiments of this application, the object rendering method further includes:
[0101] Obtain at least two candidate outdoor environment textures corresponding to the outdoor space where the outdoor static object is located, wherein each candidate outdoor environment texture in the at least two candidate outdoor environment textures corresponds to a point in time.
[0102] Obtain the outdoor environment map corresponding to the target time point from at least two candidate outdoor environment maps, wherein the outdoor environment map includes Q pixels, where Q is an integer greater than 1;
[0103] The outdoor environment texture is normalized to obtain the first outdoor environment texture, which includes Q pixels after brightness normalization.
[0104] Based on the first outdoor environment texture and outdoor lighting information, a second outdoor environment texture is generated. The outdoor lighting information includes Q preset color information, each preset color information corresponds to a pixel, and the outdoor lighting information has a corresponding relationship with the target time point.
[0105] The second outdoor environment map is used to render outdoor static objects.
[0106] In one possible design, in another implementation of another aspect of the embodiments of this application, obtaining the outdoor environment texture corresponding to the target time point from at least two candidate outdoor environment textures includes:
[0107] The first time point and the second time point are determined based on the target time point. The first time point is the time point immediately preceding the target time point, and the second time point is the time point immediately following the target time point.
[0108] If the duration between the target time point and the first time point is less than the duration between the target time point and the second time point, then the candidate outdoor environment texture corresponding to the first time point will be determined as the outdoor environment texture corresponding to the target time point.
[0109] If the duration between the target time point and the first time point is greater than the duration between the target time point and the second time point, then the candidate outdoor environment texture corresponding to the second time point will be determined as the outdoor environment texture corresponding to the target time point.
[0110] In one possible design, in another implementation of another aspect of the embodiments of this application, the outdoor environment map is normalized to obtain a first outdoor environment map, including:
[0111] Obtain the color information corresponding to each pixel in the outdoor environment texture;
[0112] Based on the color information corresponding to each pixel in the outdoor environment texture, determine the brightness value corresponding to each pixel in the outdoor environment texture.
[0113] Obtain the average outdoor brightness value corresponding to the outdoor environment texture. The average outdoor brightness value is determined based on the brightness value corresponding to each pixel in the outdoor environment texture. Alternatively, the average outdoor brightness value is determined based on the candidate outdoor environment textures corresponding to two adjacent time points. The two adjacent time points are the time point before the target time point and the time point after the target time point.
[0114] Divide the brightness value of each pixel in the outdoor environment map by the average outdoor brightness value to obtain the first outdoor environment map.
[0115] In one possible design, in another implementation of another aspect of the embodiments of this application, generating a second outdoor environment map based on a first outdoor environment map and outdoor lighting information includes:
[0116] Obtain the color information corresponding to each pixel in the first outdoor environment texture;
[0117] Multiply the color information corresponding to each pixel in the first outdoor environment texture with the preset color information of the corresponding pixel in the outdoor lighting information to obtain the color information corresponding to each of the Q pixels.
[0118] A second outdoor environment texture is generated based on the color information corresponding to each of the Q pixels.
[0119] This application also provides a method for object rendering, including:
[0120] Obtain at least two candidate outdoor environment textures corresponding to the outdoor space where the outdoor static object is located, wherein each candidate outdoor environment texture in the at least two candidate outdoor environment textures corresponds to a point in time.
[0121] Obtain the outdoor environment map corresponding to the target time point from at least two candidate outdoor environment maps, wherein the outdoor environment map includes Q pixels, where Q is an integer greater than 1;
[0122] The outdoor environment texture is normalized to obtain the first outdoor environment texture, which includes Q pixels after brightness normalization.
[0123] Based on the first outdoor environment texture and outdoor lighting information, a second outdoor environment texture is generated. The outdoor lighting information includes Q preset color information, each preset color information corresponds to a pixel, and the outdoor lighting information has a corresponding relationship with the target time point.
[0124] The second outdoor environment map is used to render outdoor static objects.
[0125] In one possible design, in another implementation of another aspect of the embodiments of this application, obtaining the outdoor environment texture corresponding to the target time point from at least two candidate outdoor environment textures includes:
[0126] The first time point and the second time point are determined based on the target time point. The first time point is the time point immediately preceding the target time point, and the second time point is the time point immediately following the target time point.
[0127] If the duration between the target time point and the first time point is less than the duration between the target time point and the second time point, then the candidate outdoor environment texture corresponding to the first time point will be determined as the outdoor environment texture corresponding to the target time point.
[0128] If the duration between the target time point and the first time point is greater than the duration between the target time point and the second time point, then the candidate outdoor environment texture corresponding to the second time point will be determined as the outdoor environment texture corresponding to the target time point.
[0129] In one possible design, in another implementation of another aspect of the embodiments of this application, the outdoor environment map is normalized to obtain a first outdoor environment map, including:
[0130] Obtain the color information corresponding to each pixel in the outdoor environment texture;
[0131] Based on the color information corresponding to each pixel in the outdoor environment texture, determine the brightness value corresponding to each pixel in the outdoor environment texture.
[0132] Obtain the average outdoor brightness value corresponding to the outdoor environment texture. The average outdoor brightness value is determined based on the brightness value corresponding to each pixel in the outdoor environment texture. Alternatively, the average outdoor brightness value is determined based on the candidate outdoor environment textures corresponding to two adjacent time points. The two adjacent time points are the time point before the target time point and the time point after the target time point.
[0133] Divide the brightness value of each pixel in the outdoor environment map by the average outdoor brightness value to obtain the first outdoor environment map.
[0134] In one possible design, in another implementation of another aspect of the embodiments of this application, generating a second outdoor environment map based on a first outdoor environment map and outdoor lighting information includes:
[0135] Obtain the color information corresponding to each pixel in the first outdoor environment texture;
[0136] Multiply the color information corresponding to each pixel in the first outdoor environment texture with the preset color information of the corresponding pixel in the outdoor lighting information to obtain the color information corresponding to each of the Q pixels.
[0137] A second outdoor environment texture is generated based on the color information corresponding to each of the Q pixels.
[0138] In one possible design, in another implementation of another aspect of the embodiments of this application, the object rendering method further includes:
[0139] Obtain indoor and outdoor space information of dynamic objects, where indoor and outdoor space information represents the area ratio occupied by dynamic objects in indoor and outdoor spaces respectively;
[0140] Based on indoor and outdoor spatial information, determine the first weight value corresponding to the outdoor environment map and the second weight value corresponding to the custom environment map, wherein the custom environment map is a pre-set grayscale image;
[0141] Dynamic objects are rendered using a first weight value, a second weight value, an outdoor environment map, and a custom environment map.
[0142] In one possible design, in another implementation of another aspect of the embodiments of this application, determining a first weight value corresponding to the outdoor environment map and a second weight value corresponding to the custom environment map based on indoor and outdoor space information includes:
[0143] Based on indoor and outdoor space information, determine the first proportion of dynamic objects in indoor space and the second proportion in outdoor space, wherein the sum of the first proportion and the second proportion is a fixed proportion.
[0144] If the first ratio is a fixed ratio and the second ratio is 0, then the first weight value corresponding to the outdoor environment texture is determined to be 0, and the second weight value corresponding to the custom environment texture is determined to be the maximum weight value.
[0145] If the second ratio is a fixed ratio and the first ratio is 0, then the first weight value corresponding to the outdoor environment texture is determined as the maximum weight value, and the second weight value corresponding to the custom environment texture is determined as 0.
[0146] In one possible design, in another implementation of another aspect of the embodiments of this application, a first weight value, a second weight value, an outdoor environment map, and a custom environment map are used to render the dynamic object, including:
[0147] For outdoor environment textures, update the first initial weight value to the first weight value;
[0148] For custom environment textures, update the second initial weight value to the second weight value;
[0149] Based on the first and second weight values, the outdoor environment map and the custom environment map are blended by the graphics processor to obtain the rendering result of the dynamic object.
[0150] In one possible design, in another implementation of another aspect of the embodiments of this application, the object rendering method further includes:
[0151] Obtain an outdoor environment texture, wherein the outdoor environment texture corresponds to a target time point, the target time point is included in at least one time point, and each time point in the at least one time point corresponds to a candidate outdoor environment texture;
[0152] Obtain a custom environment map, wherein the custom environment map includes at least one pre-defined highlight area, and the average brightness value of each highlight area is greater than the average brightness value of the custom environment map.
[0153] In one possible design, in another implementation of another aspect of the embodiments of this application, the object rendering method further includes:
[0154] Obtain the indoor environment texture corresponding to the target indoor space where the indoor static object is located. The indoor environment texture includes K pixels, where K is an integer greater than 1.
[0155] The indoor environment texture is normalized to obtain the first indoor environment texture, which includes K pixels after brightness normalization.
[0156] If there is a light source in the target indoor space, global illumination information is obtained based on the spatial position information of the static objects in the target indoor space. The global illumination information includes K preset color information, and each preset color information corresponds to a pixel.
[0157] A second indoor environment map is generated based on the first indoor environment map and global illumination information;
[0158] The second indoor environment map is used to render the indoor static objects.
[0159] In one possible design, in another implementation of another aspect of the embodiments of this application, the object rendering method further includes:
[0160] Obtain the indoor environment textures to be processed corresponding to N indoor spaces, where N indoor spaces include the target indoor space and N is an integer greater than 1;
[0161] The indoor environment texture to be processed is encoded to obtain a cube texture;
[0162] Decode the cube map to obtain the indoor environment map;
[0163] Obtain the interior environment texture corresponding to the target interior space where the static interior object is located, including:
[0164] Use the indoor environment map as the indoor environment map corresponding to the target indoor space where the indoor static object is located.
[0165] In one possible design, in another implementation of another aspect of the embodiments of this application, the indoor environment map is normalized to obtain a first indoor environment map, including:
[0166] Obtain the color information corresponding to each pixel in the indoor environment texture;
[0167] Based on the color information corresponding to each pixel in the indoor environment texture, determine the brightness value corresponding to each pixel in the indoor environment texture.
[0168] Based on the brightness value corresponding to each pixel in the indoor environment texture, determine the average indoor brightness value corresponding to the indoor environment texture.
[0169] Divide the brightness value of each pixel in the indoor environment map by the average indoor brightness value to obtain the first indoor environment map.
[0170] In one possible design, in another implementation of another aspect of the embodiments of this application, generating a second indoor environment map based on a first indoor environment map and global illumination information includes:
[0171] Obtain the color information corresponding to each pixel in the first indoor environment texture;
[0172] Multiply the color information corresponding to each pixel in the first indoor environment texture with the preset color information of the corresponding pixel in the global illumination information to obtain the color information corresponding to each of the K pixels.
[0173] A second indoor environment texture is generated based on the color information corresponding to each of the K pixels.
[0174] This application also provides a method for object rendering, including:
[0175] Display the dynamic object in the first position of the target space;
[0176] In response to control operations on dynamic objects, the dynamic objects are rendered using a first weight value, a second weight value, an outdoor environment map, and a custom environment map to obtain the rendered dynamic objects. The first weight value is determined based on the indoor and outdoor space information of the dynamic objects and the outdoor environment map, and the second weight value is determined based on the indoor and outdoor space information of the dynamic objects and the custom environment map. The indoor and outdoor space information represents the area ratio occupied by the dynamic objects in the indoor and outdoor spaces, respectively, and the custom environment map is a pre-set grayscale image.
[0177] In the second position of the target space, the rendered dynamic object is displayed, which has different lighting effects than the other dynamic object.
[0178] This application also provides a method for object rendering, including:
[0179] Display static objects within the target interior space at the target location;
[0180] If there is a light source in the target indoor space, the second indoor environment map is used to render the indoor static object to obtain the rendered indoor static object. The second indoor environment map is generated based on the first indoor environment map and global illumination information. The global illumination information is obtained based on the spatial position information of the indoor static object in the target indoor space. The global illumination information includes K preset color information, each preset color information corresponding to one pixel. The first indoor environment map is obtained after normalizing the indoor environment map. The first indoor environment map includes K pixels after brightness normalization. The indoor environment map is the environment map corresponding to the target indoor space. The indoor environment map includes K pixels, where K is an integer greater than 1.
[0181] At the target location in the target indoor space, a rendered indoor static object is displayed, wherein the rendered indoor static object has different lighting effects than the other indoor static object.
[0182] This application also provides a method for object rendering, including:
[0183] At the first point in time, display the outdoor static object at the target location in the outdoor space;
[0184] At the second time point, the outdoor static object is rendered using the second outdoor environment map to obtain the rendered outdoor static object. The second outdoor environment map is generated based on the first outdoor environment map and outdoor lighting information. The outdoor lighting information includes Q preset color information, each preset color information corresponding to one pixel, and the outdoor lighting information has a corresponding relationship with the target time point. The first outdoor environment map is obtained by normalizing the outdoor environment map. The first outdoor environment map includes Q pixels after brightness normalization. The outdoor environment map is derived from at least two candidate outdoor environment maps. Each candidate outdoor environment map in the at least two candidate outdoor environment maps corresponds to one time point. The outdoor environment map includes Q pixels, where Q is an integer greater than 1.
[0185] At the target location in the outdoor space, a rendered outdoor static object is displayed, which has different lighting effects than the other outdoor static objects.
[0186] This application also provides a computer device, including: a memory, a processor, and a bus system;
[0187] The memory is used to store programs;
[0188] The processor is used to execute the program in the memory, and the processor is used to execute the methods described above according to the instructions in the program code;
[0189] The bus system is used to connect the memory and the processor to enable communication between the memory and the processor.
[0190] Another aspect of this application provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the methods described above.
[0191] Another aspect of this application provides a computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the above aspects.
[0192] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:
[0193] This application provides a method for object rendering. First, indoor and outdoor spatial information of the target dynamic object is obtained. Then, based on the indoor and outdoor spatial information, a first weight value corresponding to the outdoor environment map and a second weight value corresponding to the custom environment map are determined. Thus, the dynamic object is rendered using the first weight value, the second weight value, the outdoor environment map, and the custom environment map. Through this method, for the dynamic object, the brightness weight values of the custom environment map and the outdoor environment map can be controlled according to the ratio of the current indoor and outdoor space of the dynamic object. During the rendering process, the custom environment map and the outdoor environment map are blended based on the updated brightness values, thereby obtaining a rendering result with a brightness transition effect, thus improving the visual effect and making it more consistent with the display effect of the real world. Attached Figure Description
[0194] Figure 1 This is a diagram illustrating a situation where the environment texture content changes abruptly in existing technology.
[0195] Figure 2 This is a schematic diagram of the architecture of the object rendering system in an embodiment of this application;
[0196] Figure 3 This is a schematic diagram illustrating the capture of the environment onto a cube map in an embodiment of this application;
[0197] Figure 4 This is a schematic diagram illustrating the use of cube mapping to achieve environmental reflection effects in an embodiment of this application;
[0198] Figure 5 This is a schematic diagram of a framework for rendering based on object type and environment type in an embodiment of this application;
[0199] Figure 6 This is a flowchart illustrating an object rendering method in an embodiment of this application.
[0200] Figure 7(A) is a schematic diagram of the area occupied by dynamic objects in indoor and outdoor spaces in an embodiment of this application;
[0201] Figure 7(B) is another schematic diagram of the area occupied by dynamic objects in indoor and outdoor spaces in the embodiments of this application;
[0202] Figure 7(C) is another schematic diagram showing the area occupied by dynamic objects in indoor and outdoor spaces in an embodiment of this application;
[0203] Figure 8 This is a schematic diagram of outdoor environment textures and custom environment textures in the embodiments of this application;
[0204] Figure 9This is a schematic diagram comparing the effects of dynamic objects moving indoors and outdoors in an embodiment of this application;
[0205] Figure 10 This is a comparative illustration of the effects of dynamic objects moving indoors and outdoors in this application and existing solutions;
[0206] Figure 11 This is another flowchart illustrating the object rendering method in an embodiment of this application;
[0207] Figure 12 This is a flowchart illustrating the process of prioritizing the environment reflection cube map in an embodiment of this application.
[0208] Figure 13 This is another flowchart illustrating the optimized environment reflection cubemap in this application embodiment;
[0209] Figure 14 This is a flowchart illustrating the processing of indoor static objects in an embodiment of this application;
[0210] Figure 15 This is a comparative illustration of the effects of static indoor objects in this application and existing solutions in different indoor spaces;
[0211] Figure 16 This is another flowchart illustrating the object rendering method in an embodiment of this application;
[0212] Figure 17 This is a schematic diagram of a candidate outdoor environment texture sequence in an embodiment of this application;
[0213] Figure 18 This is a flowchart illustrating the processing of outdoor static objects in an embodiment of this application.
[0214] Figure 19 This is a comparative illustration of the effects of outdoor static objects in this application and existing solutions at different points in time.
[0215] Figure 20 This is a schematic diagram of an object rendering apparatus in an embodiment of this application;
[0216] Figure 21 This is another schematic diagram of the object rendering apparatus in an embodiment of this application;
[0217] Figure 22 This is another schematic diagram of the object rendering apparatus in an embodiment of this application;
[0218] Figure 23 This is a schematic diagram of the structure of a terminal device in an embodiment of this application. Detailed Implementation
[0219] This application provides a method, related apparatus, device, and storage medium for object rendering. It can control the brightness weight values of a custom environment map and an outdoor environment map according to the indoor-outdoor space ratio of the dynamic object. During the rendering process, the custom environment map and the outdoor environment map are mixed based on the updated brightness values to obtain a rendering result with brightness transition effect, thereby improving the visual effect and making it more consistent with the display effect of the real world.
[0220] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “corresponding to,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0221] It should be understood that the object rendering method provided in this application can be applied to the rendering of game graphics, making the game graphics more realistic. Taking a game scene provided by a first-person shooter (FPS) game as an example, the player controls the game character to perform tasks, such as the character needing to enter an indoor space from outdoors to retrieve a potion, or the character needing to infiltrate a designated area to ambush when the game scene turns black. However, the content of the game screen seen by the player will change depending on the time and space. For example, in an outdoor space, the character's helmet should reflect a brighter light, while in an indoor space, the character's helmet will become darker. For another example, when performing a mission at dusk, the character's helmet should reflect the color of the sunset, while when performing a mission at noon, the character's helmet should reflect the color of a clear sky.
[0222] To achieve better rendering results in the above scenarios, this application proposes an object rendering method, which is applied to... Figure 2The object rendering system shown in the figure includes terminal devices, with clients deployed on these devices. These clients can run on the terminal devices via a browser or as standalone applications (APPs), etc. The specific presentation format of the client is not limited here. The object rendering system may also include servers. The servers involved in this application can be independent physical servers, server clusters composed of multiple physical servers, or distributed systems. They can also be cloud servers providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. Terminal devices can be smartphones, tablets, laptops, PDAs, personal computers, smart TVs, smartwatches, in-vehicle devices, wearable devices, etc., but are not limited to these. Terminal devices and servers can be directly or indirectly connected via wired or wireless communication, which is not limited here. The number of servers and terminal devices is also not limited. The solution provided in this application can be completed independently by the terminal device, independently by the server, or jointly by the terminal device and the server. This application does not make any specific limitations on this.
[0223] For example, in a single-player game, the player controls the game character to execute corresponding commands through a terminal device. The terminal device responds to the player's commands and renders the game screen in real time to present it to the player. For example, in an online game, the player controls the game character to execute corresponding commands through a terminal device and uploads these commands to a server. The server responds to the player's commands and sends the command execution results back to the terminal device (e.g., the game character's position in the game and in-game time information). The terminal device then renders the game screen in real time based on the command execution results to present it to the player. For example, in a cloud game, the player controls the game character to execute corresponding commands through a terminal device and uploads these commands to a cloud server. The cloud server responds to the player's commands and renders the game screen in real time, sending the rendering results back to the terminal device for presentation to the player.
[0224] Because this application involves some technical terms, these technical terms will be introduced below for ease of understanding.
[0225] (1) Real-time rendering: This refers to rendering and displaying images simultaneously. Its characteristics include real-time control and interaction, processing 3D images at very high speeds to achieve realistic effects. Real-time rendering can be applied to film and animation, virtual reality, disaster simulation, and 3D games. Real-time rendering requires an output speed of at least 24 frames per second.
[0226] (2) Global Illumination: In real nature, light travels from the sun to the ground through multiple reflections and refractions. In real-time rendering, the result of simulating these multiple reflections and refractions of light is global illumination. However, due to limitations in the performance of terminal devices, completely accurate global illumination cannot be achieved. People often use efficient but degraded methods to approximate global illumination.
[0227] (3) Ambient Reflection: Also known as Image Based Lighting (IBL), this is a method for approximating global illumination in real-time rendering. Its principle is to capture surrounding environmental information into a cube map, perform some preprocessing on this cube map, and then read the incident light information from the environment from the cube map during rendering. See also... Figure 3 , Figure 3 This is a schematic diagram illustrating the capture of the environment onto a cube map in an embodiment of this application. As shown in the figure, a cube map includes six faces (top, bottom, front, back, left, and right). Folding these six faces into a cube simulates a space. Environment reflection is widely used for reflection effects; for easier understanding, please refer to [link to relevant documentation]. Figure 4 , Figure 4 This is a schematic diagram of using a cube map to achieve an environment reflection effect in an embodiment of this application. As shown in the figure, the smoothness of the small balls increases sequentially from left to right when using an environment cube map to achieve an environment reflection effect.
[0228] (4) Red, green, and blue channels and a multiplier (RGBM) encoding: This is a lossy encoding format that compresses a large RGB color value into a smaller range of values. Smaller values require less storage space, thus optimizing storage and memory usage. The principle of RGBM is based on the fact that the human eye is more sensitive to darker colors than brighter ones. It sacrifices some precision for brighter colors, allocating more data precision to darker colors.
[0229] Based on this, the following will combine Figure 5 This section introduces three types of scenarios involved in the object rendering method provided in this application. Please refer to [link / reference]. Figure 5 , Figure 5This is a schematic diagram of a framework for rendering based on object type and environment type in this application embodiment. As shown in the figure, the preprocessing process first divides the space into indoor and outdoor spaces. Scenario 1: For static objects (e.g., a stationary ball) in the indoor space, the same environment map is used. During real-time rendering, adaptive processing is performed according to changes in the indoor environment to achieve the rendering result of the static object in the indoor space. Scenario 2: For static objects in the outdoor space, multiple candidate outdoor environment maps at different time points are pre-saved. During real-time rendering, the outdoor environment map is selected, and adaptive processing is performed as the outdoor environment changes to achieve the rendering result of the static object in the outdoor space. Scenario 3: For dynamic objects moving between indoor and outdoor spaces, a custom environment map is obtained. During real-time rendering, the outdoor environment map is selected, and the custom environment map and the outdoor environment map are blended using weight values to achieve the rendering result of the dynamic object in both indoor and outdoor spaces.
[0230] Based on the above introduction, the following section will use the rendering process of dynamic objects as an example to describe the object rendering method in this application. Please refer to [link / reference needed]. Figure 6 One embodiment of the object rendering method in this application includes:
[0231] 110. Obtain the indoor and outdoor space information of dynamic objects, where the indoor and outdoor space information represents the area ratio occupied by the dynamic object in indoor space and outdoor space respectively;
[0232] In one or more embodiments, the object rendering apparatus acquires indoor and outdoor spatial information corresponding to a dynamic object at a target time point. This indoor and outdoor spatial information represents the area proportions of the dynamic object in indoor and outdoor spaces, respectively. For example, if the dynamic object's area proportion in indoor space is 20% and its area proportion in outdoor space is 80%, then 20% and 80% constitute the indoor and outdoor spatial information. The target time point can be the current time point or any specified time point; no limitation is made here.
[0233] It should be noted that the object rendering device can be deployed on terminal devices, servers, or object rendering systems consisting of terminal devices and servers; no limitation is made here.
[0234] 120. Based on indoor and outdoor spatial information, determine the first weight value corresponding to the outdoor environment map and the second weight value corresponding to the custom environment map, wherein the custom environment map is a pre-set grayscale image;
[0235] In one or more embodiments, the object rendering apparatus also needs to acquire a custom environment map and an outdoor environment map. The outdoor environment map is an environment map captured under outdoor lighting conditions, and the custom environment map is a grayscale image preset by the user. The custom environment map can also be a pure white or pure black image, and there is no limitation here.
[0236] Specifically, based on indoor and outdoor spatial information, the area proportions occupied by dynamic objects in indoor and outdoor spaces can be determined, respectively. From this, a first weight value corresponding to the outdoor environment map and a second weight value corresponding to the custom environment map are calculated. Generally, the larger the proportion of dynamic objects in the outdoor space, the larger the first weight value and the smaller the second weight value. Conversely, the larger the proportion of dynamic objects in the indoor space, the larger the second weight value and the smaller the first weight value.
[0237] 130. Render dynamic objects using the first weight value, the second weight value, outdoor environment texture, and custom environment texture.
[0238] In one or more embodiments, the object rendering apparatus updates the outdoor environment map with a first initial weight value, wherein the first initial weight value is a pre-set weight for the outdoor environment map.
[0239] The object rendering device uses a graphics processing unit (GPU) to render dynamic objects. Specifically, GPU rendering is done on a pixel-by-pixel basis. Taking pixel A as an example, pixel A corresponds to pixel B at position P1 of the outdoor environment map and pixel C at position P2 of the custom environment map. Based on this, a first weight value is applied to pixel B, and a second weight value is applied to pixel C, thereby rendering the dynamic object. The rendered dynamic object can display lighting effects.
[0240] It should be noted that the difference between dynamic and static objects lies in the fact that dynamic objects need to handle the abrupt changes in environment maps when moving within indoor and outdoor spaces. In this application, if the same cube map is used throughout the indoor space, then dynamic objects do not need to consider the accuracy of the map content.
[0241] Based on the above description, another embodiment of the object rendering method provided in this application will be described below.
[0242] The terminal device displays the dynamic object at the first position in the target space;
[0243] The terminal device responds to control operations on dynamic objects by rendering the dynamic objects using a first weight value, a second weight value, an outdoor environment map, and a custom environment map. The first weight value is determined based on the indoor and outdoor space information of the dynamic objects and the outdoor environment map. The second weight value is also determined based on the indoor and outdoor space information of the dynamic objects and the custom environment map. The indoor and outdoor space information represents the area ratio of the dynamic objects in the indoor and outdoor spaces, respectively. The custom environment map is a pre-set grayscale image.
[0244] The terminal device displays a rendered dynamic object at a second location in the target space, wherein the rendered dynamic object has different lighting effects than the dynamic object.
[0245] In this embodiment, taking a game application as an example, a dynamic object is displayed at a first position in the target space. For example, the dynamic object is a small ball that the player can control. The player can trigger commands to control the dynamic object to move within the target space provided by the game application.
[0246] Specifically, the terminal device can acquire real-time indoor and outdoor spatial information corresponding to a dynamic object at the current point in time. This information represents the area proportion of the dynamic object in the indoor and outdoor spaces, respectively. Additionally, it needs to acquire a custom environment map and an outdoor environment map. The outdoor environment map is an environment map captured under outdoor lighting conditions, while the custom environment map is a pre-set grayscale image. Based on this, the area proportion of the dynamic object in the indoor and outdoor spaces can be determined, and thus the first weight value corresponding to the outdoor environment map and the second weight value corresponding to the custom environment map can be calculated. Generally, the greater the proportion of the dynamic object in the outdoor space, the larger the first weight value and the smaller the second weight value. Conversely, the greater the proportion of the dynamic object in the indoor space, the larger the second weight value and the smaller the first weight value.
[0247] Therefore, the initial weight value corresponding to the outdoor environment map is updated to the first weight value, where the first initial weight value is a pre-set weight for the outdoor environment map. Finally, the dynamic object is rendered using the GPU, resulting in a rendered dynamic object, which is then displayed at a second position in the target space. The rendered dynamic object has different lighting effects than the standard dynamic object; for example, the rendered dynamic object may appear brighter or darker.
[0248] This application provides a method for object rendering. Using this method, for dynamic objects, the brightness weight values of a custom environment map and an outdoor environment map can be controlled according to the indoor / outdoor space ratio of the dynamic object. During rendering, the custom environment map and the outdoor environment map are blended based on the updated brightness values, thereby obtaining a rendering result with brightness transition effects, thus improving the visual effect and making it more consistent with the display effect of the real world.
[0249] Optionally, in the above Figure 6 Based on the corresponding embodiments, in another optional embodiment provided by this application, determining the first weight value corresponding to the outdoor environment texture and the second weight value corresponding to the custom environment texture based on indoor and outdoor space information may specifically include:
[0250] Based on indoor and outdoor space information, determine the first proportion of dynamic objects in indoor space and the second proportion in outdoor space, wherein the sum of the first proportion and the second proportion is a fixed proportion.
[0251] If the first ratio is a fixed ratio and the second ratio is 0, then the first weight value corresponding to the outdoor environment texture is determined to be 0, and the second weight value corresponding to the custom environment texture is determined to be the maximum weight value.
[0252] If the second ratio is a fixed ratio and the first ratio is 0, then the first weight value corresponding to the outdoor environment texture is determined as the maximum weight value, and the second weight value corresponding to the custom environment texture is determined as 0.
[0253] In one or more embodiments, a method for determining weight values based on the proportion of a dynamic object in indoor and outdoor space is described. As described in the foregoing embodiments, the object rendering device needs to determine, based on the indoor and outdoor space information of the dynamic object at a target time point, the proportion in which the dynamic object occupies indoor space and the proportion in which it occupies outdoor space, respectively. The sum of the first and second proportions is a fixed proportion (e.g., 100%). Based on this, a first weight value and a second weight value can be determined according to the first and second proportions, where the sum of the first and second weight values is a fixed value (e.g., 1 or 1.5). If the proportion of the dynamic object occupying indoor space is larger, the weight value of the custom environment map is larger, and the weight value of the outdoor environment map is smaller. If the proportion of the dynamic object occupying outdoor space is larger, the weight value of the outdoor environment map is larger, and the weight value of the custom environment map is smaller. This will be explained below with examples.
[0254] For illustrative purposes, please refer to Figure 7(A). Figure 7(A) is a schematic diagram of the area occupied by a dynamic object in indoor and outdoor spaces in an embodiment of this application. Assuming the white circle represents the dynamic object, as shown in the figure, most of the area of the dynamic object is in the outdoor space, and a small portion is in the indoor space. Specifically, the application can provide relevant data, thereby determining the proportion of outdoor space that the dynamic object can see from its current location (i.e., the second proportion). Based on a fixed proportion, the proportion of indoor space that the dynamic object can see from its current location (i.e., the first proportion) can also be determined. The first weight value and the second weight value can be determined based on a pre-set conversion rule. For example, if the first proportion is 90% and the second proportion is 10%, then the first weight value is 0.1 and the second weight value is 0.9.
[0255] For example, for ease of explanation, please refer to Figure 7(B). Figure 7(B) is another schematic diagram of the area occupied by dynamic objects in indoor and outdoor spaces in an embodiment of this application. As shown in the figure, if the dynamic object occupies a first proportion in the indoor space to a fixed proportion, that is, 100%, it means that the entire dynamic object is in the indoor space. Therefore, the first weight value corresponding to the outdoor environment texture is determined to be 0, and the second weight value corresponding to the custom environment texture is determined to be the maximum weight value.
[0256] For example, for ease of explanation, please refer to Figure 7(C), which is another schematic diagram of the area occupied by the dynamic object in the indoor and outdoor spaces in an embodiment of this application. As shown in the figure, if the dynamic object occupies a second proportion in the outdoor space to a fixed proportion, that is, 100%, it means that the entire dynamic object is in the outdoor space. Therefore, the first weight value corresponding to the outdoor environment map is determined as the maximum weight value, and the second weight value corresponding to the custom environment map is determined as 0.
[0257] It can be seen that when a dynamic object is in an outdoor space, the first weight value corresponding to the outdoor environment map is the largest. When the dynamic object enters an indoor space, the first weight value corresponding to the outdoor environment map gradually decreases, while the second weight value corresponding to the custom environment map gradually increases.
[0258] Secondly, in this embodiment of the application, a method is provided to determine the weight value based on the proportion of a dynamic object in indoor and outdoor space. Through the above method, based on the proportion of the dynamic object in indoor space and the proportion in outdoor space, the weight values of outdoor environment map and custom environment map can be dynamically adjusted, thereby obtaining a visual experience that is closer to the real lighting effect.
[0259] Optionally, in the above Figure 6Based on the corresponding embodiments, in another optional embodiment provided by this application, a first weight value, a second weight value, an outdoor environment texture, and a custom environment texture are used to render the dynamic object, which may specifically include:
[0260] For outdoor environment textures, update the first initial weight value to the first weight value;
[0261] For custom environment textures, update the second initial weight value to the second weight value;
[0262] Based on the first and second weight values, the outdoor environment map and the custom environment map are blended by the graphics processor to obtain the rendering result of the dynamic object.
[0263] In one or more embodiments, a method for generating rendering results is described. As can be seen from the foregoing embodiments, a first weight value for an outdoor environment texture and a second weight value for a custom environment texture can be obtained, and the outdoor environment texture and the custom environment texture can be blended by combining the first weight value and the second weight value.
[0264] Specifically, taking pixel A as an example, pixel A corresponds to pixel B at position P1 of the outdoor environment texture and pixel C at position P2 of the custom environment texture. Positions P1 and P2 are corresponding. Based on this, a first weight value is applied to pixel B, i.e., B*B1, where B1 represents the first weight value. Similarly, a second weight value is applied to pixel C, i.e., C*C1, where C1 represents the second weight value. Thus, the rendering result of pixel A is B*B1+C*C1. It should be noted that the coordinates of pixel A, pixel B, and pixel C are all the same, for example, coordinates (1,1).
[0265] For easier understanding, please refer to Figure 8 , Figure 8 This is a schematic diagram of an outdoor environment texture and a custom environment texture in an embodiment of this application. As shown in the figure, the outdoor environment texture can be an environment texture with color information, such as including the sky and trees, while the custom environment texture is designed by an artist or can be a solid color image.
[0266] Secondly, this application embodiment provides a method for generating rendering results. Through the above method, the outdoor environment texture and the custom environment texture are rendered using the first weight value and the second weight value to achieve the effect of hybrid rendering, thereby increasing the feasibility and operability of the solution.
[0267] Optionally, in the above Figure 6Based on the corresponding embodiments, another optional embodiment provided in this application may further include:
[0268] Obtain an outdoor environment texture, wherein the outdoor environment texture corresponds to a target time point, the target time point is included in at least one time point, and each time point in the at least one time point corresponds to a candidate outdoor environment texture;
[0269] Obtain a custom environment map, wherein the custom environment map includes at least one pre-defined highlight area, and the average brightness value of each highlight area is greater than the average brightness value of the custom environment map.
[0270] In one or more embodiments, a method for obtaining a custom environment map and selecting an outdoor environment map based on the current time is described. This will be illustrated below with examples.
[0271] Specifically, dynamic objects often have different outdoor environment textures at different times. For example, at 2 PM, the sky in the outdoor environment texture is blue, while at 6 PM, the sky is a sunset red. Therefore, the outdoor environment texture corresponding to the target time point can be determined based on that target time point. Typically, several candidate outdoor environment textures are pre-saved, with each candidate texture corresponding to a specific time point. In this way, the candidate outdoor environment texture corresponding to the time point closest to the target time point can be used as the outdoor environment texture for subsequent applications.
[0272] For custom environment maps, artists can also design them themselves. For example, at least one highlight area (or light spot) can be pre-set on the custom environment map, and the average brightness value of each highlight area (or light spot) is greater than the average brightness value of the custom environment map. Placing these highlight areas (or light spots) on the custom environment map can achieve a more realistic lighting effect.
[0273] For easier understanding, please refer to Figure 9 , Figure 9 This is a schematic diagram comparing the effects of dynamic objects moving indoors and outdoors in an embodiment of this application. As shown in the figure, from Figure 9 Figures (A) to (D) in the diagram simulate the process of a dynamic object moving from outdoors to indoors. During this process, the first weight value corresponding to the outdoor environment map gradually decreases to 0. This method avoids abrupt changes in the content of the environment map and can support certain custom artistic effects.
[0274] Furthermore, in this embodiment of the application, a method for obtaining a custom environment texture and selecting an outdoor environment texture based on the current time is provided. Through the above method, an outdoor environment texture that is closer to the light color and brightness at the target time point can be selected. In addition, according to the design of the artists, several areas with higher brightness are set on the custom environment texture to simulate the real lighting effect, thereby improving the realism of the rendering effect.
[0275] Based on this, the following diagrams will illustrate the differences in rendering effects between this application and existing solutions. For clarity, please refer to [link / reference]. Figure 10 , Figure 10 This is a comparative illustration of the effects of dynamic objects moving indoors and outdoors in this application and existing solutions. In the existing solutions, with Figure 10 Taking (A) and (B) as examples, the white line in the middle represents the boundary between the indoor and outdoor areas. When a dynamic object moves between the two areas (from indoor to outdoor or from outdoor to indoor), the content of the environment map will change abruptly, resulting in poor visual effects and not conforming to the display effect of the real world.
[0276] In this application, Figure 10 Taking (C) and (D) as examples, the white line in the middle represents the boundary between the indoor and outdoor areas. When a dynamic object moves between the two areas (from indoor to outdoor or from outdoor to indoor), the content of the environment map does not change, resulting in a good visual effect that matches the real-world display.
[0277] Based on the above introduction, the following section will use the rendering process of indoor static objects as an example to describe the object rendering method in this application. Figure 6 Based on the corresponding embodiments, or independently of Figure 6 Based on the described embodiments, please refer to Figure 11 Another embodiment of the object rendering method in this application includes:
[0278] 210. Obtain the indoor environment texture corresponding to the target indoor space where the indoor static object is located. The indoor environment texture includes K pixels, where K is an integer greater than 1.
[0279] In one or more embodiments, the object rendering apparatus acquires an interior environment map corresponding to a target interior space, where a static interior object is located within the target interior space. The interior environment map comprises K pixels; for example, the size of the interior environment map is 256*256, which means it comprises 65536 pixels.
[0280] It should be noted that the object rendering device can be deployed on terminal devices, servers, or object rendering systems consisting of terminal devices and servers; no limitation is made here.
[0281] 220. Normalize the indoor environment map to obtain the first indoor environment map, wherein the first indoor environment map includes K pixels after brightness normalization.
[0282] In one or more embodiments, the object rendering apparatus normalizes the interior environment map, that is, it normalizes the brightness of each pixel in the interior environment map, thereby obtaining a first interior environment map. It is understood that the purpose of brightness normalization is to remove the brightness information from the interior environment map so that the color of global illumination can be used to replace it in subsequent processing.
[0283] 230. If there is a light source in the target indoor space, then obtain global illumination information based on the spatial position information of the static object in the target indoor space. The global illumination information includes K preset color information, and each preset color information corresponds to a pixel.
[0284] In one or more embodiments, if a light source exists in the target indoor space, the object rendering apparatus needs to determine the spatial position information of the indoor static object within the target indoor space. Since the indoor static object is stationary relative to the target indoor space, its spatial position information can be determined. Taking a spherical indoor static object as an example, the spatial position information may include the three-dimensional coordinates of the sphere's center.
[0285] Specifically, based on the spatial location information of a static indoor object within the target indoor space, the corresponding global illumination information can be determined. Understandably, the object rendering device pre-calculates the reflection results of various lights and stores them in data structures. The application can then obtain the global illumination information for a specific spatial location through calculations and transformations. For example, assuming there is a red light source in the target indoor space, global illumination will incorporate the various reflections of red light, resulting in reddish global illumination information near the light source. Furthermore, global illumination information may also include the colors of other colors of light reflected off the object.
[0286] 240. Generate a second indoor environment map based on the first indoor environment map and global illumination information;
[0287] In one or more embodiments, the global illumination information obtained by the object rendering device includes K preset color information, each preset color information corresponding to a pixel. For example, the preset color information corresponding to pixel A is (1,1,2). Based on this, for each pixel in the first indoor environment texture, the color information of each pixel after the change is calculated using the color information corresponding to each pixel and the preset color information of its corresponding position, thereby obtaining the second indoor environment texture.
[0288] 250. Use the second indoor environment map to render indoor static objects.
[0289] In one or more embodiments, the object rendering apparatus uses a second interior environment map as a map for an interior static object and renders the interior static object, so that the rendered interior static object can display the lighting effects in the interior.
[0290] Based on the above description, another embodiment of the object rendering method provided in this application will be described below.
[0291] The terminal device displays static objects within the target indoor space at the target location.
[0292] If there is a light source in the target indoor space, the terminal device uses the second indoor environment map to render the indoor static object to obtain the rendered indoor static object. The second indoor environment map is generated based on the first indoor environment map and global illumination information. The global illumination information is obtained based on the spatial position information of the indoor static object in the target indoor space. The global illumination information includes K preset color information, each preset color information corresponding to one pixel. The first indoor environment map is obtained after normalizing the indoor environment map. The first indoor environment map includes K pixels after brightness normalization. The indoor environment map is the environment map corresponding to the target indoor space. The indoor environment map includes K pixels, where K is an integer greater than 1.
[0293] The terminal device displays rendered indoor static objects at the target location in the target indoor space. The rendered indoor static objects have different lighting effects than other indoor static objects.
[0294] In this embodiment, taking a game application as an example, an indoor static object is displayed at a target location in the target indoor space. For example, the indoor static object is a stationary ball indoors.
[0295] Specifically, the terminal device acquires the indoor environment map corresponding to the target indoor space, where the static indoor object is located. Then, the indoor environment map needs to be normalized, specifically, the brightness of each pixel in the map is normalized, thus obtaining the first indoor environment map. Understandably, the purpose of brightness normalization is to remove the brightness information from the indoor environment map so that the color of global illumination can be used to replace it later. If there is a light source in the target indoor space, then the spatial position information of the static indoor object within that space needs to be determined. Since the static indoor object is stationary relative to the target indoor space, its spatial position information can be determined.
[0296] Based on this, for each pixel in the first indoor environment texture, the color information corresponding to each pixel and the preset color information of its corresponding position are used to calculate the changed color information of each pixel, thus obtaining the second indoor environment texture. The second indoor environment texture is then used as the texture for an indoor static object, which is then rendered. The rendered indoor static object can display the lighting effects within the room; that is, the rendered indoor static object has different lighting effects than other indoor static objects.
[0297] In this embodiment of the application, an object rendering method is provided. In this way, for static objects in an indoor space, when there is a light source in the indoor space, global illumination information is used to adaptively process the indoor environment texture to match the color and brightness of the light source in the indoor space, thereby improving the visual effect and making it more in line with the display effect of the real world.
[0298] Optionally, in the above Figure 11 Based on the corresponding embodiments, another optional embodiment provided in this application may further include:
[0299] Obtain the indoor environment textures to be processed corresponding to N indoor spaces, where N indoor spaces include the target indoor space and N is an integer greater than 1;
[0300] The indoor environment texture to be processed is encoded to obtain a cube texture;
[0301] Decode the cube map to obtain the indoor environment map;
[0302] Obtain the interior environment texture corresponding to the target interior space where the static interior object is located. Specifically, this may include:
[0303] Use the indoor environment map as the indoor environment map corresponding to the target indoor space where the indoor static object is located.
[0304] In one or more embodiments, a method for sharing a single indoor environment map in indoor spaces is described. To minimize rendering performance overhead, the number of environment maps used simultaneously in the scene can be limited, for example, to two. The outdoor space environment map stores the sky, while the environment maps for all indoor spaces share the same cube map captured under white lighting conditions.
[0305] Specifically, the default approach in Unreal Engine 4 (UE4) is that the environment map for each interior area block must match the environment, meaning that the content of each cube map is different. For clarity, please refer to [link to relevant documentation]. Figure 12 , Figure 12 This is a flowchart illustrating the environment cube map process before priority in this embodiment of the application. As shown in the figure, it is assumed that indoor area block 1 and indoor area block 2 use the same environment cube map (e.g., environment cube map). Figure 1 However, the environmental cube sticker Figure 1 Two different cube maps (e.g., cube maps) need to be preprocessed and encoded separately and stored on disk and in memory. Figure 1 _1 and cube sticker Figure 1 _2).
[0306] It is evident that optimization not only increases disk and memory usage but also complicates rendering instantiation and increases the number of draw calls. Therefore, to maximize the performance optimization of the indoor shared environment map method, the environment reflection process in UE4 can be optimized by modifying the UE source code. The environment reflection process refers to how the central processing unit (CPU) processes an existing environment map into a texture resource that can be directly used by the GPU.
[0307] For easier understanding, please refer to Figure 13 , Figure 13 This is another flowchart illustrating the optimized environment reflection cube map in this application embodiment. As shown in the figure, assume that N indoor spaces include indoor region block 1 and indoor region block 2. For both indoor region block 1 and indoor region block 2, the same indoor environment map to be processed (e.g., environment cube map) is used. Figure 1 Then, the indoor environment texture is preprocessed and RGBM encoded to obtain a cube map (e.g., a cube map). Figure 1 _1). Therefore, the cube map is serialized to disk, and then it can be decoded to obtain the interior environment map. Based on this, the interior environment map can be directly used as the interior environment map corresponding to the target interior space where the static interior object is located.
[0308] Understandably, preprocessing can transform environment maps into a resource that the GPU can directly read. For example, the environment map might have a high resolution, but the GPU doesn't need such a high resolution; therefore, resolution conversion can be performed.
[0309] Secondly, this application provides a method for sharing a single indoor environment texture in an indoor space. Using this method, all indoor area blocks use the same cube map, requiring only one preprocessing and encoding before serialization to disk. This reduces disk and memory usage, and because the GPU uses the same cube map instance, the rendering instantiation process is not interrupted.
[0310] Optionally, in the above Figure 11 Based on the corresponding embodiments, in another optional embodiment provided by this application, the indoor environment texture is normalized to obtain a first indoor environment texture, including:
[0311] Obtain the color information corresponding to each pixel in the indoor environment texture;
[0312] Based on the color information corresponding to each pixel in the indoor environment texture, determine the brightness value corresponding to each pixel in the indoor environment texture.
[0313] Based on the brightness value corresponding to each pixel in the indoor environment texture, determine the average indoor brightness value corresponding to the indoor environment texture.
[0314] Divide the brightness value of each pixel in the indoor environment map by the average indoor brightness value to obtain the first indoor environment map.
[0315] In one or more embodiments, a method for brightness normalization of an indoor environment map is described. During rendering, the indoor environment map is not used directly; instead, it is first subjected to brightness normalization. The brightness normalization operation divides each pixel on the indoor environment map by the average brightness of all pixels in the entire indoor environment map (i.e., the average indoor brightness value). This operation primarily removes the brightness information from the map.
[0316] Specifically, assuming the indoor environment texture is 256*256 pixels, it contains 65536 pixels. For each pixel, its corresponding color information can be obtained, which can be represented as red, green, and blue (RGB) information, for example, (10, 20, 30). Based on this, the brightness value of each pixel can be calculated using the following formula:
[0317] Y=(0.299*R)+(0.587*G)+(0.114*B);
[0318] Where Y represents the brightness value, R represents the red (red, R) value of the pixel, G represents the green (green, G) value of the pixel, and B represents the blue (blue, B) value of the pixel.
[0319] Based on this, the brightness values corresponding to each pixel in the indoor environment texture are summed and averaged to obtain the average indoor brightness value. Finally, for each pixel in the indoor environment texture, the brightness value corresponding to each pixel is divided by the average indoor brightness value to obtain a normalized brightness value. Based on the normalized brightness value of each pixel, the first normalized indoor environment texture is obtained.
[0320] It should be noted that the normalization in this application does not remove the color information of the indoor environment texture, and the cube texture used in this application was captured in a white lighting environment.
[0321] Secondly, in this embodiment of the application, a method for brightness normalization processing of indoor environment textures is provided. By doing so, the brightness information in the indoor environment textures can be removed so that the color of global illumination can be used to replace it in the future, thereby achieving a rendering effect that is closer to real lighting.
[0322] Optionally, in the above Figure 11 Based on the corresponding embodiments, in another optional embodiment provided by this application, a second indoor environment map is generated according to the first indoor environment map and global illumination information, which may specifically include:
[0323] Obtain the color information corresponding to each pixel in the first indoor environment texture;
[0324] Multiply the color information corresponding to each pixel in the first indoor environment texture with the preset color information of the corresponding pixel in the global illumination information to obtain the color information corresponding to each of the K pixels.
[0325] A second indoor environment texture is generated based on the color information corresponding to each of the K pixels.
[0326] In one or more embodiments, a method for generating a second indoor environment texture is described. As can be seen from the foregoing embodiments, after obtaining the first indoor environment texture, it is necessary to perform color adaptation processing on the first indoor environment texture. The reason for the change in the indoor environment may be that the light sources in different locations are different; for example, some locations may have a very strong light, while other locations may not have a light. Since all indoor spaces in this application use the same indoor environment texture to be processed, there may be a mismatch between the actual environment and the texture content. Therefore, this application will perform an adaptation processing on the first indoor environment texture during rendering to reduce the degree of mismatch.
[0327] Specifically, assuming the size of the first indoor environment texture is 256*256, it includes 65536 pixels (i.e., K is 65536). For each pixel, its corresponding color information can be obtained, where the color information can be represented as RGB information, for example, (10, 20, 30). Based on this, the color information corresponding to each pixel can be calculated using the following formula:
[0328] R' = R*a;
[0329] G' = G*b;
[0330] B' = B * c;
[0331] Where R' represents the R value of the pixel in the second indoor environment map, R represents the R value of the pixel in the first indoor environment map, and a represents the adjustment value of R in the preset color information corresponding to the pixel. G' represents the G value of the pixel in the second indoor environment map, G represents the G value of the pixel in the first indoor environment map, and b represents the adjustment value of G in the preset color information corresponding to the pixel. B' represents the B value of the pixel in the second indoor environment map, B represents the B value of the pixel in the first indoor environment map, and c represents the adjustment value of B in the preset color information corresponding to the pixel.
[0332] Specifically, for ease of understanding, please refer to Figure 14 , Figure 14This is a flowchart illustrating the processing of indoor static objects in this embodiment of the application. As shown in the figure, the brightness value corresponding to each pixel in the indoor environment texture is calculated. Based on this, the brightness values corresponding to each pixel in the indoor environment texture are summed and averaged to obtain the average indoor brightness value. For each pixel in the indoor environment texture, the brightness value corresponding to each pixel is divided by the average indoor brightness value to obtain a normalized brightness value. Based on the normalized brightness value of each pixel, a normalized first indoor environment texture is obtained. Then, each pixel in the first indoor environment texture is multiplied by global illumination information, thereby obtaining the adapted second indoor environment texture.
[0333] Furthermore, in this embodiment of the application, a method for generating a second indoor environment texture is provided. The reason for the change in the indoor environment through the above method is mainly that the light sources in different spatial locations may be different. Some spatial locations have very strong light sources, while some spatial locations have no light sources. Therefore, the color information of each pixel in the first indoor environment texture is adjusted based on global illumination information to achieve a reflection effect that adapts to global illumination.
[0334] Based on this, the following diagrams will illustrate the differences in rendering effects between this application and existing solutions. For clarity, please refer to [link / reference]. Figure 15 , Figure 15 This is a comparative illustration of the effects of static indoor objects in this application and existing solutions in different indoor spaces. In the existing solutions, the effect is... Figure 15 Taking (A) and (B) as examples, regardless of the environment, the helmet circled in white reflects the same environmental information and does not change due to environmental differences (e.g., changes in sky color or indoor light sources), resulting in a poor visual effect that does not conform to the display effect of the real world. In this application, taking... Figure 15 Taking (C) and (D) as examples, in different environments, the areas circled in white show the same content in the environment map, but the rendering result adapts to the global illumination of the location. Using this method, good visual effects are achieved even with only one indoor environment map, and it conforms to the display effect of the real world.
[0335] Based on the above introduction, the following section will use the rendering process of outdoor static objects as an example to describe the object rendering method in this application. Figure 6 and / or Figure 11 Based on the corresponding embodiments, or independently of Figure 6 and / or Figure 11 Based on the described embodiments, please refer to Figure 16 Another embodiment of the object rendering method in this application includes:
[0336] 310. Obtain at least two candidate outdoor environment textures corresponding to the outdoor space where the outdoor static object is located, wherein each candidate outdoor environment texture in the at least two candidate outdoor environment textures corresponds to a point in time.
[0337] In one or more embodiments, the object rendering apparatus acquires at least two candidate outdoor environment textures corresponding to an outdoor space, wherein the outdoor static object is located in the outdoor space.
[0338] Specifically, each candidate outdoor environment texture corresponds to a point in time. For ease of understanding, please refer to Table 1, which is a schematic diagram of the correspondence between candidate outdoor environment textures and points in time.
[0339] Table 1
[0340] Outdoor environment textures to be selected Time point Outdoor Environment Texture A 8:00 Outdoor Environment Texture B 9:00 Outdoor environment texture C 10:00 Outdoor Environment Map D 11:00 Outdoor Environment Texture E 12:00 Outdoor Environment Texture F 13:00 Outdoor Environment Texture G 14:00 Outdoor Environment Texture H 15:00 Outdoor Environment Texture I 16:00 Outdoor Environment Texture J 16:30 Outdoor Environment Texture K 17:00 Outdoor Environment Texture L 17:30 Outdoor Environment Texture M 18:00 Outdoor environment texture N 19:00
[0341] As shown in Table 1, considering the relatively small changes in sky and brightness between 8:00 and 16:00, a time point is set every hour. However, the changes in sky and brightness are larger between 16:00 and 18:00, so a time point is set every half hour. It is understood that the time point division method shown in Table 1 is merely illustrative and should not be construed as a limitation of this application.
[0342] It should be noted that the object rendering device can be deployed on terminal devices, servers, or object rendering systems consisting of terminal devices and servers; no limitation is made here.
[0343] 320. Obtain the outdoor environment map corresponding to the target time point from at least two candidate outdoor environment maps, wherein the outdoor environment map includes Q pixels, where Q is an integer greater than 1;
[0344] In one or more embodiments, the object rendering apparatus selects an outdoor environment map corresponding to a target time point from at least two candidate outdoor environment maps. The target time point can be the current time or a specified time point; no limitation is made here. The outdoor environment map comprises Q pixels; for example, the size of the outdoor environment map is 256*256, which includes 65536 pixels.
[0345] 330. Normalize the outdoor environment texture to obtain the first outdoor environment texture, wherein the first outdoor environment texture includes Q pixels that have undergone brightness normalization.
[0346] In one or more embodiments, the object rendering apparatus normalizes the outdoor environment map, that is, it normalizes the brightness of each pixel in the outdoor environment map, thereby obtaining a first outdoor environment map. It is understood that the purpose of brightness normalization is to remove the brightness information from the outdoor environment map so that the color of global illumination can be used to replace it in subsequent processing.
[0347] 340. Generate a second outdoor environment map based on the first outdoor environment map and the outdoor lighting information. The outdoor lighting information includes Q preset color information, each preset color information corresponds to a pixel, and the outdoor lighting information has a corresponding relationship with the target time point.
[0348] In one or more embodiments, the object rendering apparatus can directly acquire outdoor lighting information corresponding to a target time point. The outdoor lighting information includes Q preset color information values, each corresponding to a pixel. For example, the preset color information corresponding to pixel A is (1,1,2). Based on this, for each pixel in the first outdoor environment texture, the color information corresponding to each pixel and the preset color information at its corresponding position are used to calculate the changed color information of each pixel, thereby obtaining the second outdoor environment texture.
[0349] 350. Use a second outdoor environment map to render outdoor static objects.
[0350] In one or more embodiments, the object rendering apparatus uses a second outdoor environment map as a map for an outdoor static object and renders the outdoor static object, so that the rendered outdoor static object can display the lighting effects outdoors.
[0351] Based on the above description, another embodiment of the object rendering method provided in this application will be described below.
[0352] At the first point in time, the terminal device displays an outdoor static object at the target location in the outdoor space;
[0353] At the second time point, the terminal device uses the second outdoor environment map to render the outdoor static object, obtaining the rendered outdoor static object. The second outdoor environment map is generated based on the first outdoor environment map and outdoor lighting information. The outdoor lighting information includes Q preset color information, each preset color information corresponding to one pixel, and the outdoor lighting information has a corresponding relationship with the target time point. The first outdoor environment map is obtained after normalizing the outdoor environment map. The first outdoor environment map includes Q pixels after brightness normalization. The outdoor environment map is derived from at least two candidate outdoor environment maps. Each candidate outdoor environment map in the at least two candidate outdoor environment maps corresponds to one time point. The outdoor environment map includes Q pixels, where Q is an integer greater than 1.
[0354] The terminal device displays rendered outdoor static objects at the target location in the outdoor space. The rendered outdoor static objects have different lighting effects than the outdoor static objects.
[0355] In this embodiment, taking a game application as an example, an outdoor static object is displayed at a target location in an outdoor space. For example, the outdoor static object is a stationary ball outdoors.
[0356] Specifically, at the first time point, the terminal device displays a static outdoor object at the target location in the outdoor space. After a period of time, at the second time point, the outdoor environment map corresponding to the second time point is selected from at least two candidate outdoor environment maps. Then, the outdoor environment map is normalized, that is, the brightness of each pixel in the outdoor environment map is normalized, thereby obtaining the first outdoor environment map. It can be understood that the purpose of brightness normalization is to remove the brightness information in the outdoor environment map so that the color of global illumination can be used to replace it in subsequent steps.
[0357] Based on this, the terminal device can also directly obtain outdoor lighting information corresponding to the target time point. This outdoor lighting information includes Q preset color information values, each corresponding to a pixel. For each pixel in the first outdoor environment map, the color information corresponding to each pixel and its corresponding position's preset color information are used to calculate the changed color information of each pixel, thus obtaining the second outdoor environment map. This second outdoor environment map is then used as the texture for an outdoor static object, and the outdoor static object is rendered to obtain a rendered outdoor static object. The rendered outdoor static object can display outdoor lighting effects; that is, the rendered outdoor static object has different lighting effects than the original outdoor static object.
[0358] In this embodiment of the application, an object rendering method is provided. In this way, for static objects in outdoor spaces, when there are light sources in the outdoor space, considering the changes in lighting at different times, the outdoor environment texture at the most recent time point is selected as the environmental reflection source during real-time rendering, thereby improving the visual effect and making it more in line with the display effect of the real world.
[0359] Optionally, in the above Figure 17 Based on the corresponding embodiments, in another optional embodiment provided by this application, obtaining the outdoor environment texture corresponding to the target time point from at least two candidate outdoor environment textures may specifically include:
[0360] The first time point and the second time point are determined based on the target time point. The first time point is the time point immediately preceding the target time point, and the second time point is the time point immediately following the target time point.
[0361] If the duration between the target time point and the first time point is less than the duration between the target time point and the second time point, then the candidate outdoor environment texture corresponding to the first time point will be determined as the outdoor environment texture corresponding to the target time point.
[0362] If the duration between the target time point and the first time point is greater than the duration between the target time point and the second time point, then the candidate outdoor environment texture corresponding to the second time point will be determined as the outdoor environment texture corresponding to the target time point.
[0363] In one or more embodiments, a method for selecting outdoor environment textures based on a target time point is introduced. As described in the foregoing embodiments, changes in outdoor lighting environment differ from changes in indoor lighting environment. Outdoor lighting environment changes are typically time-related; for example, from 12:00 to 18:00, the sky changes from blue to sunset red. Therefore, multiple candidate outdoor environment textures corresponding to different time points can be pre-saved. During real-time rendering, the candidate outdoor environment texture at the closest time point is selected as the environmental reflection source based on the target time point. It is understood that the pre-set time point distribution is usually uneven. For example, the lighting change from 12:00 to 14:00 is not significant, so only one time point needs to be set. However, from 17:00 to 18:00, due to the significant changes in the sunset environment, the sky color may change from blue to sunset red in a short period of time, in which case a denser distribution of time points is required.
[0364] Specifically, for ease of understanding, please refer to Figure 17 , Figure 17This is a schematic diagram of a sequence of candidate outdoor environment textures in an embodiment of this application. Six candidate outdoor environment textures are stored for each time point from 3 PM to 6 PM. Assuming the target time period is 5:50 PM, the preceding time point is 5:30 PM (i.e., the first time point is 5:30 PM), and the following time point is 6 PM (i.e., the second time point is 6 PM). The duration between the target time point and the first time point is 20 minutes, and the duration between the target time point and the second time point is 10 minutes. Therefore, the duration between the target time point and the first time point is greater than the duration between the target time point and the second time point. Thus, the candidate outdoor environment texture corresponding to the second time point (i.e., 6 PM) is determined as the outdoor environment texture corresponding to the target time point.
[0365] Assuming the target time period is 5:10 PM, then the preceding time point is 5:00 PM (i.e., the first time point is 5:00 PM), and the following time point is 5:30 PM (i.e., the second time point is 5:30 PM). The duration between the target time point and the first time point is 10 minutes, and the duration between the target time point and the second time point is 20 minutes. Therefore, the duration between the target time point and the first time point is less than the duration between the target time point and the second time point. Thus, the candidate outdoor environment texture corresponding to the first time point (5:00 PM) is determined as the outdoor environment texture corresponding to the target time point.
[0366] Secondly, in this embodiment of the application, a method for selecting an outdoor environment texture based on a target time point is provided. In this method, considering that the changes in outdoor lighting environment are different from those indoors, and are usually unrelated to location but related to time, the method finds the time point closest to the target time point and uses the candidate outdoor environment texture corresponding to that time point as the outdoor environment texture of the target time point, thereby improving the visual effect and making it more in line with the display effect of the real world.
[0367] Optionally, in the above Figure 17 Based on the corresponding embodiments, in another optional embodiment provided by this application, the outdoor environment texture is normalized to obtain a first outdoor environment texture, which may specifically include:
[0368] Obtain the color information corresponding to each pixel in the outdoor environment texture;
[0369] Based on the color information corresponding to each pixel in the outdoor environment texture, determine the brightness value corresponding to each pixel in the outdoor environment texture.
[0370] Obtain the average outdoor brightness value corresponding to the outdoor environment texture. The average outdoor brightness value is determined based on the brightness value corresponding to each pixel in the outdoor environment texture. Alternatively, the average outdoor brightness value is determined based on the candidate outdoor environment textures corresponding to two adjacent time points. The two adjacent time points are the time point before the target time point and the time point after the target time point.
[0371] Divide the brightness value of each pixel in the outdoor environment map by the average outdoor brightness value to obtain the first outdoor environment map.
[0372] In one or more embodiments, a method for brightness normalization processing of outdoor environment textures is described. As can be seen from the foregoing embodiments, during real-time rendering, the outdoor environment texture at the most recent time point is selected as the environmental reflection source based on the target time point. To reduce the impact of texture content jumps over time, the average outdoor brightness value depends on the brightness values stored in the candidate outdoor environment textures at the two most recent time points.
[0373] Specifically, assuming the outdoor environment texture is 256*256 pixels, comprising 65536 pixels, the color information for each pixel can be obtained. This color information can be represented as RGB information, for example, (10, 20, 30). Based on this, the brightness value of each pixel can be calculated using the following formula:
[0374] Y=(0.299*R)+(0.587*G)+(0.114*B);
[0375] Where Y represents the brightness value, R represents the R value of the pixel, G represents the G value of the pixel, and B represents the B value of the pixel.
[0376] In addition, the following two methods can be used to obtain the average outdoor brightness value.
[0377] For example, the average outdoor brightness value is obtained by summing the brightness values corresponding to each pixel in the outdoor environment texture.
[0378] For example, the preceding time point and the following time point adjacent to the target time point are determined, and the candidate outdoor environment textures corresponding to these two adjacent time points are obtained respectively. Then, smooth interpolation is performed on these two candidate outdoor environment textures. Assuming the target time point is 18:00, the average outdoor brightness value can be the result of smooth interpolation based on the candidate outdoor environment textures at 17:30 and 18:30.
[0379] Based on this, for each pixel in the outdoor environment texture, the brightness value corresponding to each pixel is divided by the average outdoor brightness value to obtain a normalized brightness value. Based on the normalized brightness value of each pixel, the normalized first outdoor environment texture is obtained.
[0380] It should be noted that the normalization in this application does not remove the color information of the outdoor environment texture.
[0381] Secondly, this application provides a method for normalizing the brightness of an outdoor environment texture. By doing so, the brightness information in the outdoor environment texture can be removed so that the color of global illumination can be used to replace it in the future, thereby achieving a rendering effect that is closer to real lighting.
[0382] Optionally, in the above Figure 17 Based on the corresponding embodiments, in another optional embodiment provided by this application, a second outdoor environment map is generated according to the first outdoor environment map and outdoor lighting information, which may specifically include:
[0383] Obtain the color information corresponding to each pixel in the first outdoor environment texture;
[0384] Multiply the color information corresponding to each pixel in the first outdoor environment texture with the preset color information of the corresponding pixel in the outdoor lighting information to obtain the color information corresponding to each of the Q pixels.
[0385] A second outdoor environment texture is generated based on the color information corresponding to each of the Q pixels.
[0386] In one or more embodiments, a method for generating a second outdoor environment texture is described. As can be seen from the foregoing embodiments, after obtaining the first outdoor environment texture, it is necessary to perform color adaptation processing on the first outdoor environment texture. Since outdoor lighting information varies at different times, this application performs an adaptation processing on the first outdoor environment texture during rendering to reduce the degree of mismatch.
[0387] Specifically, assuming the size of the first outdoor environment texture is 256*256, it includes 65536 pixels (i.e., Q is 65536). For each pixel, its corresponding color information can be obtained, where the color information can be represented as RGB information, for example, (10, 20, 30). Based on this, the color information corresponding to each pixel can be calculated using the following formula:
[0388] R2 = R1 * a1;
[0389] G2 = G1 * b1;
[0390] B2 = B1 * c1;
[0391] Where R2 represents the R value of the pixel in the second outdoor environment map, R1 represents the R value of the pixel in the first outdoor environment map, and a1 represents the adjustment value of R corresponding to the pixel in the preset color information. G2 represents the G value of the pixel in the second outdoor environment map, G1 represents the G value of the pixel in the first outdoor environment map, and b1 represents the adjustment value of G corresponding to the pixel in the preset color information. B2 represents the B value of the pixel in the second outdoor environment map, B1 represents the B value of the pixel in the first outdoor environment map, and c1 represents the adjustment value of B corresponding to the pixel in the preset color information.
[0392] Specifically, for ease of understanding, please refer to Figure 18 , Figure 18 This is a flowchart illustrating the processing of outdoor static objects in this embodiment of the application. As shown in the figure, firstly, the outdoor environment texture with the closest time point is selected, and then the brightness value corresponding to each pixel in the outdoor environment texture is calculated. Based on this, the brightness values corresponding to each pixel in the outdoor environment texture are summed and averaged to obtain the average outdoor brightness value. For each pixel in the outdoor environment texture, the brightness value corresponding to each pixel is divided by the average outdoor brightness value to obtain a normalized brightness value. Based on the normalized brightness value of each pixel, a normalized first outdoor environment texture is obtained. Then, each pixel in the first outdoor environment texture is multiplied by outdoor lighting information, thereby obtaining the adapted second outdoor environment texture.
[0393] Furthermore, in this embodiment of the application, a method for generating a second outdoor environment texture is provided. In this method, considering that the changes in outdoor lighting environment are different from those indoors, and are usually independent of location but related to time, the color information of each pixel in the first outdoor environment texture is adjusted based on the outdoor lighting information corresponding to the target time point to achieve a reflection effect that adapts to global lighting.
[0394] Based on this, the following diagrams will illustrate the differences in rendering effects between this application and existing solutions. For clarity, please refer to [link / reference]. Figure 19 , Figure 19 This is a comparative illustration of the effects of outdoor static objects in this application and existing solutions at different points in time. In the existing solutions, the effect is... Figure 19 Taking (A) and (B) as examples, the brightness of the ball's reflection is the same at any given time. Due to equipment performance limitations, environmental conditions... Figure 1Generally, pre-generated cube maps are chosen. When the runtime environment changes, the lack of update to the cube map leads to rendering errors. The inability to support dynamic lighting changes results in poor visual effects that do not conform to real-world display. In this application, [the following is an example / method]... Figure 19 Taking (C), (D), (E), and (F) as examples, the brightness of the ball's reflection adapts to the ambient light at different times, thus achieving a better visual effect that matches the display effect of the real world. The processing during the rendering process is basically consistent with the default behavior of the UE4 engine.
[0395] The object rendering apparatus in this application is described in detail below. Please refer to [link / reference]. Figure 20 , Figure 20 This is a schematic diagram of one embodiment of the object rendering apparatus in this application. The object rendering apparatus 40 includes:
[0396] The acquisition module 410 is used to acquire the indoor and outdoor space information of the dynamic object, wherein the indoor and outdoor space information represents the area ratio occupied by the dynamic object in the indoor space and the outdoor space respectively.
[0397] The determination module 420 is used to determine the first weight value corresponding to the outdoor environment map and the second weight value corresponding to the custom environment map based on the indoor and outdoor space information, wherein the custom environment map is a pre-set grayscale image;
[0398] The rendering module 430 is used to render dynamic objects using a first weight value, a second weight value, an outdoor environment map, and a custom environment map.
[0399] In this embodiment, an object rendering apparatus is provided. Using this apparatus, for dynamic objects, the brightness weight values of a custom environment map and an outdoor environment map can be controlled according to the indoor / outdoor space ratio of the dynamic object. During rendering, the custom environment map and the outdoor environment map are blended based on the updated brightness values, thereby obtaining a rendering result with a brightness transition effect, thus improving the visual effect and making it more consistent with the display effect of the real world.
[0400] Optionally, in the above Figure 20 Based on the corresponding embodiments, in another embodiment of the object rendering apparatus 40 provided in this application,
[0401] The determination module 420 is specifically used to determine, based on indoor and outdoor space information, the first proportion in which the dynamic object occupies the indoor space and the second proportion in the outdoor space, wherein the sum of the first proportion and the second proportion is a fixed proportion.
[0402] If the first ratio is a fixed ratio and the second ratio is 0, then the first weight value corresponding to the outdoor environment texture is determined to be 0, and the second weight value corresponding to the custom environment texture is determined to be the maximum weight value.
[0403] If the second ratio is a fixed ratio and the first ratio is 0, then the first weight value corresponding to the outdoor environment texture is determined as the maximum weight value, and the second weight value corresponding to the custom environment texture is determined as 0.
[0404] This application provides an object rendering apparatus. Using this apparatus, based on the proportion of a dynamic object occupying indoor space and the proportion occupying outdoor space, the weight values of the outdoor environment map and the custom environment map can be dynamically adjusted, thereby obtaining a visual experience closer to realistic lighting effects.
[0405] Optionally, in the above Figure 20 Based on the corresponding embodiments, in another embodiment of the object rendering apparatus 40 provided in this application,
[0406] The rendering module 430 is specifically used to update the first initial weight value to the first weight value for the outdoor environment texture.
[0407] For the custom environment texture, the second initial weight value is updated to the second weight value;
[0408] Based on the first weight value and the second weight value, the outdoor environment map and the custom environment map are blended by the graphics processor to obtain the rendering result of the dynamic object.
[0409] This application provides an object rendering apparatus. Using this apparatus, outdoor environment textures and custom environment textures are rendered using a first weight value and a second weight value, achieving a hybrid rendering effect, thereby increasing the feasibility and operability of the solution.
[0410] Optionally, in the above Figure 20 Based on the corresponding embodiments, in another embodiment of the object rendering apparatus 40 provided in this application,
[0411] The acquisition module 410 is also used to acquire an outdoor environment texture, wherein the outdoor environment texture corresponds to a target time point, the target time point is included in at least one time point, and each time point in the at least one time point corresponds to a candidate outdoor environment texture.
[0412] The acquisition module 410 is also used to acquire a custom environment map, wherein the custom environment map includes at least one pre-set highlight area, and the average brightness value of each highlight area is greater than the average brightness value of the custom environment map.
[0413] This application provides an object rendering apparatus. Using this apparatus, an outdoor environment texture map that more closely matches the lighting color and brightness at a target time point can be selected. Furthermore, based on the artist's design, several high-brightness areas can be set on the custom environment texture map to simulate realistic lighting effects, thereby improving the realism of the rendering effect.
[0414] Optionally, in the above Figure 20 Based on the corresponding embodiments, in another embodiment of the object rendering apparatus 40 provided in this application, the object rendering apparatus 40 further includes a processing module 440 and a generation module 450;
[0415] The acquisition module 410 is also used to acquire the indoor environment texture corresponding to the target indoor space where the indoor static object is located, wherein the indoor environment texture includes K pixels, where K is an integer greater than 1;
[0416] The processing module 440 is also used to normalize the indoor environment texture to obtain a first indoor environment texture, wherein the first indoor environment texture includes K pixels after brightness normalization.
[0417] The acquisition module 410 is also used to acquire global illumination information based on the spatial position information of the indoor static object in the target indoor space if there is a light source in the target indoor space. The global illumination information includes K preset color information, each preset color information corresponding to a pixel.
[0418] The generation module 450 is used to generate a second indoor environment map based on the first indoor environment map and global lighting information.
[0419] The rendering module 430 is also used to render indoor static objects using a second indoor environment map.
[0420] In this embodiment, an object rendering apparatus is provided. Using this apparatus, for static objects in an indoor space, when a light source exists in the indoor space, global illumination information is used to adaptively process the indoor environment texture to match the color and brightness of the light source in the indoor space, thereby improving the visual effect and making it more consistent with the display effect of the real world.
[0421] Optionally, in the above Figure 20 Based on the corresponding embodiments, in another embodiment of the object rendering apparatus 40 provided in this application,
[0422] The acquisition module 410 is also used to acquire the indoor environment texture maps to be processed corresponding to N indoor spaces, wherein the N indoor spaces include the target indoor space and N is an integer greater than 1;
[0423] The processing module 440 is also used to encode the indoor environment texture to be processed to obtain a cube texture.
[0424] The processing module 440 is also used to decode the cube map to obtain the indoor environment map;
[0425] The acquisition module 410 is specifically used to obtain the indoor environment map as the indoor environment map corresponding to the target indoor space where the indoor static object is located.
[0426] This application provides an object rendering apparatus. Using this apparatus, all indoor area blocks use the same cube map, and the cube map only needs to be preprocessed and encoded once before being serialized to disk. This reduces disk and memory usage, and because the GPU uses the same cube map instance, the rendering instantiation process is not interrupted.
[0427] Optionally, in the above Figure 20 Based on the corresponding embodiments, in another embodiment of the object rendering apparatus 40 provided in this application,
[0428] The processing module 440 is specifically used to obtain the color information corresponding to each pixel in the indoor environment texture.
[0429] Based on the color information corresponding to each pixel in the indoor environment texture, determine the brightness value corresponding to each pixel in the indoor environment texture.
[0430] Based on the brightness value corresponding to each pixel in the indoor environment texture, determine the average indoor brightness value corresponding to the indoor environment texture.
[0431] Divide the brightness value of each pixel in the indoor environment map by the average indoor brightness value to obtain the first indoor environment map.
[0432] This application provides an object rendering apparatus. Using this apparatus, brightness information in indoor environment textures can be removed so that global illumination colors can be used to replace it, thereby achieving a rendering effect closer to real-world lighting.
[0433] Optionally, in the above Figure 20 Based on the corresponding embodiments, in another embodiment of the object rendering apparatus 40 provided in this application,
[0434] The generation module 450 is specifically used to obtain the color information corresponding to each pixel in the first indoor environment texture.
[0435] Multiply the color information corresponding to each pixel in the first indoor environment texture with the preset color information of the corresponding pixel in the global illumination information to obtain the color information corresponding to each of the K pixels.
[0436] A second indoor environment texture is generated based on the color information corresponding to each of the K pixels.
[0437] In this embodiment of the application, an object rendering apparatus is provided. The reason for the changes in the indoor environment caused by the above apparatus is mainly that the light sources in different spatial locations may be different; some spatial locations have very strong light sources, while others have no light sources. Therefore, the color information of each pixel in the first indoor environment texture is adjusted based on global illumination information to achieve a reflection effect adapted to global illumination.
[0438] Optionally, in the above Figure 20 Based on the corresponding embodiments, in another embodiment of the object rendering apparatus 40 provided in this application,
[0439] The acquisition module 410 is used to acquire at least two candidate outdoor environment textures corresponding to the outdoor space where the outdoor static object is located, wherein each candidate outdoor environment texture in the at least two candidate outdoor environment textures corresponds to a time point.
[0440] The acquisition module 410 is also used to acquire the outdoor environment map corresponding to the target time point from at least two candidate outdoor environment maps, wherein the outdoor environment map includes Q pixels, where Q is an integer greater than 1;
[0441] The processing module 440 is also used to normalize the outdoor environment texture to obtain a first outdoor environment texture, wherein the first outdoor environment texture includes Q pixels after brightness normalization.
[0442] The generation module 450 is also used to generate a second outdoor environment map based on the first outdoor environment map and outdoor lighting information. The outdoor lighting information includes Q preset color information, each preset color information corresponds to a pixel, and the outdoor lighting information has a corresponding relationship with the target time point.
[0443] The rendering module 430 is also used to render outdoor static objects using a second outdoor environment map.
[0444] This application provides an object rendering apparatus. Using this apparatus, for static objects in outdoor spaces, considering the changes in lighting at different times and the presence of light sources, the most recent outdoor environment texture is selected as the environmental reflection source during real-time rendering, thereby improving the visual effect and making it more consistent with the real-world display effect.
[0445] Optionally, in the above Figure 20 Based on the corresponding embodiments, in another embodiment of the object rendering apparatus 40 provided in this application,
[0446] The acquisition module 410 is specifically used to determine a first time point and a second time point based on the target time point, wherein the first time point is the time point immediately preceding the target time point, and the second time point is the time point immediately following the target time point.
[0447] If the duration between the target time point and the first time point is less than the duration between the target time point and the second time point, then the candidate outdoor environment texture corresponding to the first time point will be determined as the outdoor environment texture corresponding to the target time point.
[0448] If the duration between the target time point and the first time point is greater than the duration between the target time point and the second time point, then the candidate outdoor environment texture corresponding to the second time point will be determined as the outdoor environment texture corresponding to the target time point.
[0449] In this embodiment, an object rendering apparatus is provided. Using this apparatus, considering that outdoor lighting conditions differ from indoor lighting and are generally independent of location but related to time, a time point closest to the target time point is found, and the candidate outdoor environment texture corresponding to that time point is used as the outdoor environment texture for the target time point, thereby improving the visual effect and making it more consistent with the display effect of the real world.
[0450] Optionally, in the above Figure 20 Based on the corresponding embodiments, in another embodiment of the object rendering apparatus 40 provided in this application,
[0451] The processing module 440 is specifically used to obtain the color information corresponding to each pixel in the outdoor environment texture.
[0452] Based on the color information corresponding to each pixel in the outdoor environment texture, determine the brightness value corresponding to each pixel in the outdoor environment texture.
[0453] Obtain the average outdoor brightness value corresponding to the outdoor environment texture. The average outdoor brightness value is determined based on the brightness value corresponding to each pixel in the outdoor environment texture. Alternatively, the average outdoor brightness value is determined based on the candidate outdoor environment textures corresponding to two adjacent time points. The two adjacent time points are the time point before the target time point and the time point after the target time point.
[0454] Divide the brightness value of each pixel in the outdoor environment map by the average outdoor brightness value to obtain the first outdoor environment map.
[0455] This application provides an object rendering apparatus. Using this apparatus, brightness information in outdoor environment textures can be removed so that global illumination colors can be used to replace it, thereby achieving a rendering effect closer to real-world lighting.
[0456] Optionally, in the above Figure 20 Based on the corresponding embodiments, in another embodiment of the object rendering apparatus 40 provided in this application,
[0457] The generation module 450 is specifically used to obtain the color information corresponding to each pixel in the first outdoor environment texture.
[0458] Multiply the color information corresponding to each pixel in the first outdoor environment texture with the preset color information of the corresponding pixel in the outdoor lighting information to obtain the color information corresponding to each of the Q pixels.
[0459] A second outdoor environment texture is generated based on the color information corresponding to each of the Q pixels.
[0460] In this embodiment, an object rendering apparatus is provided. Using this apparatus, considering that outdoor lighting environments differ from indoor ones and are generally independent of location but related to time, the color information of each pixel in the first outdoor environment texture is adjusted based on the outdoor lighting information corresponding to the target time point to achieve a reflection effect adapted to global illumination.
[0461] The object rendering apparatus in this application is described in detail below. Please refer to [link / reference]. Figure 21 , Figure 21 This is a schematic diagram of one embodiment of the object rendering apparatus in this application. The object rendering apparatus 50 includes:
[0462] The acquisition module 510 is used to acquire the indoor environment texture corresponding to the target indoor space where the indoor static object is located. The indoor environment texture includes K pixels, where K is an integer greater than 1.
[0463] The processing module 520 is used to normalize the indoor environment texture to obtain a first indoor environment texture, wherein the first indoor environment texture includes K pixels after brightness normalization.
[0464] The acquisition module 510 is also used to acquire global illumination information based on the spatial position information of the indoor static object in the target indoor space if there is a light source in the target indoor space. The global illumination information includes K preset color information, each preset color information corresponding to a pixel.
[0465] The generation module 530 is used to generate a second indoor environment map based on the first indoor environment map and global lighting information.
[0466] Rendering module 540 is used to render indoor static objects using a second indoor environment map.
[0467] The object rendering apparatus in this application is described in detail below. Please refer to [link / reference]. Figure 22 , Figure 22 This is a schematic diagram of one embodiment of the object rendering apparatus in this application. The object rendering apparatus 60 includes:
[0468] The acquisition module 610 is used to acquire at least two candidate outdoor environment textures corresponding to the outdoor space where the outdoor static object is located, wherein each candidate outdoor environment texture in the at least two candidate outdoor environment textures corresponds to a time point.
[0469] The acquisition module 610 is also used to acquire the outdoor environment map corresponding to the target time point from at least two candidate outdoor environment maps, wherein the outdoor environment map includes Q pixels, where Q is an integer greater than 1;
[0470] The processing module 620 is used to normalize the outdoor environment texture to obtain a first outdoor environment texture, wherein the first outdoor environment texture includes Q pixels after brightness normalization.
[0471] The generation module 630 is used to generate a second outdoor environment map based on the first outdoor environment map and outdoor lighting information. The outdoor lighting information includes Q preset color information, each preset color information corresponds to a pixel, and the outdoor lighting information has a corresponding relationship with the target time point.
[0472] Rendering module 640 is used to render outdoor static objects using a second outdoor environment map.
[0473] This application also provides another object rendering apparatus, which is deployed on a computer device, which can be a terminal device or a server. Taking a computer device as a terminal device as an example, such as... Figure 23As shown, for ease of explanation, only the parts related to the embodiments of this application are shown. For specific technical details not disclosed, please refer to the method section of the embodiments of this application. In the embodiments of this application, a smartphone is used as an example for illustration:
[0474] Figure 23 This is a block diagram illustrating a portion of the structure of a smartphone related to the terminal device provided in the embodiments of this application. (Reference) Figure 23 The smartphone includes components such as a radio frequency (RF) circuit 710, a memory 720, an input unit 730, a display unit 740, a sensor 750, an audio circuit 760, a wireless fidelity (WiFi) module 770, a processor 780, and a power supply 790. Those skilled in the art will understand that... Figure 23 The smartphone structure shown does not constitute a limitation on smartphones and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0475] The following is combined with Figure 23 A detailed introduction to the various components of a smartphone:
[0476] RF circuit 710 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink information from the base station and processes it with processor 780; additionally, it transmits uplink data to the base station. Typically, RF circuit 710 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier (LNA), and a duplexer. Furthermore, RF circuit 710 can also communicate wirelessly with networks and other devices. The aforementioned wireless communication can use any communication standard or protocol, including but not limited to Global System for Mobile Communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, and Short Message Service (SMS).
[0477] The memory 720 can be used to store software programs and modules. The processor 780 executes various functions and data processing of the smartphone by running the software programs and modules stored in the memory 720. The memory 720 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created based on the use of the smartphone (such as audio data, phonebook, etc.). In addition, the memory 720 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0478] The input unit 730 can be used to receive input numerical or character information, and to generate key signal inputs related to user settings and function control of the smartphone. Specifically, the input unit 730 may include a touch panel 731 and other input devices 732. The touch panel 731, also known as a touch screen, can collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel 731), and drive the corresponding connected devices according to a pre-set program. Optionally, the touch panel 731 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 780, and can also receive and execute commands sent by the processor 780. In addition, the touch panel 731 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 731, the input unit 730 may also include other input devices 732. Specifically, other input devices 732 may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.
[0479] The display unit 740 can be used to display information input by the user or information provided to the user, as well as various menus of the smartphone. The display unit 740 may include a display panel 741, which may optionally be configured as a liquid crystal display (LCD), organic light-emitting diode (OLED), or similar form. Further, a touch panel 731 may cover the display panel 741. When the touch panel 731 detects a touch operation on or near it, it transmits the information to the processor 780 to determine the type of touch event. Subsequently, the processor 780 provides corresponding visual output on the display panel 741 based on the type of touch event. Although in Figure 23 In this embodiment, the touch panel 731 and the display panel 741 are two separate components to realize the input and output functions of the smartphone. However, in some embodiments, the touch panel 731 and the display panel 741 can be integrated to realize the input and output functions of the smartphone.
[0480] The smartphone may also include at least one sensor 750, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor. The ambient light sensor can adjust the brightness of the display panel 741 according to the ambient light level, and the proximity sensor can turn off the display panel 741 and / or the backlight when the smartphone is moved to the ear. As a type of motion sensor, an accelerometer sensor can detect the magnitude of acceleration in various directions (generally three axes) and can detect the magnitude and direction of gravity when stationary. It can be used for applications that recognize the smartphone's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition-related functions (such as pedometers, taps), etc. Other sensors that may be configured in the smartphone, such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be described in detail here.
[0481] Audio circuit 760, speaker 761, and microphone 762 provide an audio interface between the user and the smartphone. Audio circuit 760 converts received audio data into electrical signals and transmits them to speaker 761, where speaker 761 converts them into sound signals for output. On the other hand, microphone 762 converts collected sound signals into electrical signals, which are received by audio circuit 760, converted into audio data, and then processed by processor 780 before being transmitted via RF circuit 710 to, for example, another smartphone, or the audio data can be output to memory 720 for further processing.
[0482] WiFi is a short-range wireless transmission technology. Smartphones, through their WiFi module 770, can help users send and receive emails, browse web pages, and access streaming media, providing wireless broadband internet access. Although Figure 23 The WiFi module 770 is shown, but it is understood that it is not an essential component of a smartphone and can be omitted as needed without changing the nature of the invention.
[0483] The processor 780 is the control center of the smartphone, connecting various parts of the smartphone through various interfaces and lines. It performs various functions and processes data by running or executing software programs and / or modules stored in the memory 720, and by calling data stored in the memory 720, thereby providing overall monitoring of the smartphone. Optionally, the processor 780 may include one or more processing units; optionally, the processor 780 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the aforementioned modem processor may also not be integrated into the processor 780.
[0484] The smartphone also includes a power supply 790 (such as a battery) that powers various components. Optionally, the power supply can be logically connected to the processor 780 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system.
[0485] Although not shown, smartphones may also include a camera, Bluetooth module, etc., which will not be described in detail here.
[0486] The steps performed by the terminal device in the above embodiments can be based on this Figure 23 The terminal device structure is shown.
[0487] This application also provides a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to perform the methods described in the foregoing embodiments.
[0488] This application also provides a computer program product including a program, which, when run on a computer, causes the computer to perform the methods described in the foregoing embodiments.
[0489] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0490] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.
[0491] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0492] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0493] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0494] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method of object rendering, characterized by, include: Obtain indoor and outdoor space information of a dynamic object, wherein the indoor and outdoor space information represents the area ratio occupied by the dynamic object in indoor space and outdoor space, respectively; Based on the indoor and outdoor space information, a first weight value corresponding to the outdoor environment map and a second weight value corresponding to the custom environment map are determined, wherein the custom environment map is a pre-set grayscale image; The dynamic object is rendered using the first weight value, the second weight value, the outdoor environment texture, and the custom environment texture; The step of determining the first weight value corresponding to the outdoor environment texture and the second weight value corresponding to the custom environment texture based on the indoor and outdoor space information includes: Based on the indoor and outdoor space information, it is determined that the dynamic object occupies a first proportion in the indoor space and a second proportion in the outdoor space, wherein the sum of the first proportion and the second proportion is a fixed proportion. If the first ratio is the fixed ratio and the second ratio is 0, then the first weight value corresponding to the outdoor environment texture is determined to be 0, and the second weight value corresponding to the custom environment texture is determined to be the maximum weight value. If the second ratio is the fixed ratio and the first ratio is 0, then the first weight value corresponding to the outdoor environment texture is determined as the maximum weight value, and the second weight value corresponding to the custom environment texture is determined as 0.
2. The method according to claim 1, characterized in that, The step of rendering the dynamic object using the first weight value, the second weight value, the outdoor environment texture, and the custom environment texture includes: For the outdoor environment texture, the first initial weight value is updated to the first weight value; For the custom environment texture, the second initial weight value is updated to the second weight value; Based on the first weight value and the second weight value, the outdoor environment map and the custom environment map are blended by the graphics processor to obtain the rendering result of the dynamic object.
3. The method according to claim 1 or 2, characterized in that, The method further includes: Obtain the outdoor environment texture, wherein the outdoor environment texture corresponds to a target time point, the target time point is included in at least one time point, and each of the at least one time point corresponds to a candidate outdoor environment texture; Obtain the custom environment map, wherein the custom environment map includes at least one pre-set highlight area, and the average brightness value of each highlight area is greater than the average brightness value of the custom environment map.
4. The method according to claim 1, characterized in that, The method further includes: Obtain the indoor environment texture corresponding to the target indoor space where the indoor static object is located, wherein the indoor environment texture includes K pixels, and K is an integer greater than 1; The indoor environment texture is normalized to obtain a first indoor environment texture, wherein the first indoor environment texture includes K pixels that have undergone brightness normalization. If there is a light source in the target indoor space, global illumination information is obtained based on the spatial position information of the indoor static object in the target indoor space. The global illumination information includes K preset color information, and each preset color information corresponds to a pixel. A second indoor environment map is generated based on the first indoor environment map and the global illumination information; The second indoor environment texture is used to render the indoor static object.
5. The method according to claim 4, characterized in that, The method further includes: Obtain the indoor environment texture maps to be processed corresponding to N indoor spaces, wherein the N indoor spaces include the target indoor space, and N is an integer greater than 1; The indoor environment texture to be processed is encoded to obtain a cube texture; The cube map is decoded to obtain the indoor environment map; The step of obtaining the indoor environment texture corresponding to the target indoor space where the indoor static object is located includes: The indoor environment texture is used as the indoor environment texture corresponding to the target indoor space where the indoor static object is located.
6. The method according to claim 4, characterized in that, The normalization process for the indoor environment texture to obtain the first indoor environment texture includes: Obtain the color information corresponding to each pixel in the indoor environment texture; Based on the color information corresponding to each pixel in the indoor environment texture, determine the brightness value corresponding to each pixel in the indoor environment texture; Based on the brightness value corresponding to each pixel in the indoor environment texture, determine the average indoor brightness value corresponding to the indoor environment texture; Divide the brightness value corresponding to each pixel in the indoor environment texture by the average indoor brightness value to obtain the first indoor environment texture.
7. The method according to any one of claims 4 to 6, characterized in that, The step of generating a second indoor environment map based on the first indoor environment map and the global illumination information includes: Obtain the color information corresponding to each pixel in the first indoor environment texture; The color information corresponding to each pixel in the first indoor environment texture is multiplied with the preset color information of the corresponding pixel in the global illumination information to obtain the color information corresponding to each of the K pixels. The second indoor environment texture is generated based on the color information corresponding to each of the K pixels.
8. The method according to claim 1, characterized in that, The method further includes: Obtain at least two candidate outdoor environment textures corresponding to the outdoor space where the outdoor static object is located, wherein each candidate outdoor environment texture in the at least two candidate outdoor environment textures corresponds to a point in time. Obtain the outdoor environment map corresponding to the target time point from the at least two candidate outdoor environment maps, wherein the outdoor environment map includes Q pixels, and Q is an integer greater than 1; The outdoor environment texture is normalized to obtain a first outdoor environment texture, wherein the first outdoor environment texture includes Q pixels that have undergone brightness normalization. A second outdoor environment map is generated based on the first outdoor environment map and the outdoor lighting information. The outdoor lighting information includes Q preset color information, each preset color information corresponds to a pixel, and the outdoor lighting information has a corresponding relationship with the target time point. The outdoor static object is rendered using the second outdoor environment texture.
9. The method according to claim 8, characterized in that, The step of obtaining the outdoor environment texture corresponding to the target time point from the at least two candidate outdoor environment textures includes: A first time point and a second time point are determined based on the target time point, wherein the first time point is the time point immediately preceding the target time point, and the second time point is the time point immediately following the target time point; If the duration between the target time point and the first time point is less than the duration between the target time point and the second time point, then the candidate outdoor environment texture corresponding to the first time point is determined as the outdoor environment texture corresponding to the target time point. If the duration between the target time point and the first time point is greater than the duration between the target time point and the second time point, then the candidate outdoor environment texture corresponding to the second time point is determined as the outdoor environment texture corresponding to the target time point.
10. The method according to claim 8, characterized in that, The normalization process of the outdoor environment texture to obtain the first outdoor environment texture includes: Obtain the color information corresponding to each pixel in the outdoor environment texture; Based on the color information corresponding to each pixel in the outdoor environment texture, determine the brightness value corresponding to each pixel in the outdoor environment texture; Obtain the average outdoor brightness value corresponding to the outdoor environment texture, wherein the average outdoor brightness value is determined based on the brightness value corresponding to each pixel in the outdoor environment texture, or the average outdoor brightness value is determined based on the candidate outdoor environment textures corresponding to two adjacent time points, wherein the two adjacent time points are the time point before the target time point and the time point after the target time point. The brightness value corresponding to each pixel in the outdoor environment texture is divided by the average outdoor brightness value to obtain the first outdoor environment texture.
11. The method according to any one of claims 8 to 10, characterized in that, The step of generating a second outdoor environment map based on the first outdoor environment map and outdoor lighting information includes: Obtain the color information corresponding to each pixel in the first outdoor environment texture; The color information corresponding to each pixel in the first outdoor environment texture is multiplied by the preset color information of the corresponding pixel in the outdoor lighting information to obtain the color information corresponding to each of the Q pixels. The second outdoor environment texture is generated based on the color information corresponding to each of the Q pixels.
12. A method for rendering an object, characterized in that, include: Display the dynamic object in the first position of the target space; In response to control operations on a dynamic object, the dynamic object is rendered using a first weight value, a second weight value, an outdoor environment map, and a custom environment map to obtain a rendered dynamic object. The first weight value is determined based on the indoor and outdoor space information of the dynamic object and the outdoor environment map, and the second weight value is determined based on the indoor and outdoor space information of the dynamic object and the custom environment map. The indoor and outdoor space information represents the area ratio occupied by the dynamic object in the indoor space and the outdoor space, respectively, and the custom environment map is a pre-set grayscale image. At a second location in the target space, the rendered dynamic object is displayed, wherein the rendered dynamic object has different lighting effects from the dynamic object. The method further includes: Based on the indoor and outdoor space information, it is determined that the dynamic object occupies a first proportion in the indoor space and a second proportion in the outdoor space, wherein the sum of the first proportion and the second proportion is a fixed proportion. If the first ratio is the fixed ratio and the second ratio is 0, then the first weight value corresponding to the outdoor environment texture is determined to be 0, and the second weight value corresponding to the custom environment texture is determined to be the maximum weight value. If the second ratio is the fixed ratio and the first ratio is 0, then the first weight value corresponding to the outdoor environment texture is determined as the maximum weight value, and the second weight value corresponding to the custom environment texture is determined as 0.
13. The method according to claim 12, characterized in that, The method further includes: Display static objects within the target interior space at the target location; If the target indoor space still has a light source, the indoor static object is rendered using a second indoor environment map to obtain a rendered indoor static object. The second indoor environment map is generated based on a first indoor environment map and global illumination information. The global illumination information is obtained based on the spatial position information of the indoor static object within the target indoor space. The global illumination information includes K preset color information points, each corresponding to a pixel. The first indoor environment map is obtained by normalizing an indoor environment map. The first indoor environment map includes K pixels after brightness normalization. The indoor environment map is the environment map corresponding to the target indoor space, and the indoor environment map includes K pixels, where K is an integer greater than 1. At the target location in the target indoor space, the rendered indoor static object is displayed, wherein the rendered indoor static object has different lighting effects than the indoor static object.
14. The method according to claim 12, characterized in that, The method further includes: At the first point in time, display the outdoor static object at the target location in the outdoor space; At the second time point, the outdoor static object is rendered using the second outdoor environment map to obtain the rendered outdoor static object. The second outdoor environment map is generated based on the first outdoor environment map and outdoor lighting information. The outdoor lighting information includes Q preset color information, each preset color information corresponding to one pixel, and the outdoor lighting information has a corresponding relationship with the target time point. The first outdoor environment map is obtained by normalizing the outdoor environment map. The first outdoor environment map includes Q pixels after brightness normalization processing. The outdoor environment map originates from at least two candidate outdoor environment maps. Each candidate outdoor environment map in the at least two candidate outdoor environment maps corresponds to one time point. The outdoor environment map includes Q pixels, where Q is an integer greater than 1. At the target location in the outdoor space, the rendered outdoor static object is displayed, wherein the rendered outdoor static object has different lighting effects than the outdoor static object.
15. An object rendering apparatus, characterized in that, include: The acquisition module is used to acquire indoor and outdoor space information of a dynamic object, wherein the indoor and outdoor space information represents the area ratio occupied by the dynamic object in indoor space and outdoor space, respectively. The determination module is used to determine, based on the indoor and outdoor space information, a first weight value corresponding to the outdoor environment map and a second weight value corresponding to the custom environment map, wherein the custom environment map is a pre-set grayscale image; The rendering module is used to render the dynamic object using the first weight value, the second weight value, the outdoor environment texture, and the custom environment texture; Specifically, the determining module is used to determine, based on the indoor and outdoor space information, the dynamic object occupies a first proportion in the indoor space and a second proportion in the outdoor space, wherein the sum of the first proportion and the second proportion is a fixed proportion. If the first ratio is the fixed ratio and the second ratio is 0, then the first weight value corresponding to the outdoor environment texture is determined to be 0, and the second weight value corresponding to the custom environment texture is determined to be the maximum weight value. If the second ratio is the fixed ratio and the first ratio is 0, then the first weight value corresponding to the outdoor environment texture is determined as the maximum weight value, and the second weight value corresponding to the custom environment texture is determined as 0.
16. A computer device, characterized in that, include: Memory, processor, and bus system; The memory is used to store programs; The processor is configured to execute a program in the memory, and the processor is configured to execute the method of any one of claims 1 to 11 according to the instructions in the program code, or to execute the method of any one of claims 12 to 14; The bus system is used to connect the memory and the processor to enable communication between the memory and the processor.
17. A computer-readable storage medium comprising instructions, when executed on a computer, causing the computer to perform the method as claimed in any one of claims 1 to 11, or to perform the method as claimed in any one of claims 12 to 14.