Image processing method and device, electronic equipment, storage medium and program product
Patent Information
- Application Number
- CN202210805313.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-08
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2042-07-08
AI Technical Summary
[0003]在虚拟场景中经常会出现场景变换的情形,例如季节变换,从而夏季变换到冬季,从而虚拟场景的夏季地形会变换到冬季地形,相关技术在场景变换的过程中需要对夏季地形的贴图以及冬季地形的贴图进行采样,导致较低的采样效率,从而降低图像资源的处理效率
[0034]在初始贴图的基础上插入结果贴图的像素,得到地形图层的合成贴图,在初始贴图和结果贴图中处于相同位置的两个像素在合成贴图中位置相邻、且构成相邻像素对;根据每个相邻像素对的纹理偏移点对合成贴图进行采样处理,得到地形图层的纹理采样值,由于纹理采样值是根据双线性过滤机制计算得到的,且由于纹理偏移点是根据场景变换进度得到的,从而纹理偏移点的纹理采样值可以准确表征相邻像素对与场景变换进度适配的权重混合结果,相当于通过单次采样代替两次采样,提高场景变换过程中的贴图采样效率。
Smart Images

Figure CN117409128B_ABST
Abstract
Description
Technical Field
[0001] This application relates to image processing technology for virtual scenes, and more particularly to an image processing method, apparatus, electronic device, computer-readable storage medium, and computer program product for virtual scenes. Background Technology
[0002] Display technologies based on graphics processing hardware have expanded the channels for perceiving the environment and acquiring information. In particular, multimedia technologies for virtual scenes, with the help of human-computer interaction engine technology, can realize diverse interactions between virtual objects controlled by users or artificial intelligence according to actual application needs. They have various typical application scenarios. For example, in virtual scenes such as games, they can simulate the real battle process between virtual objects.
[0003] In virtual scenes, scene changes often occur, such as seasonal changes, such as changing from summer to winter. As a result, the summer terrain in the virtual scene will change to the winter terrain. During the scene change process, related technologies need to sample the textures of the summer terrain and the winter terrain, resulting in low sampling efficiency and thus reducing the processing efficiency of image resources. Summary of the Invention
[0004] This application provides an image processing method, apparatus, electronic device, computer-readable storage medium, and computer program product for virtual scenes, which can improve the texture sampling efficiency during scene transformation.
[0005] The technical solution of this application embodiment is implemented as follows:
[0006] This application provides an image processing method for a virtual scene, including:
[0007] Obtain the initial texture of the terrain layer before the virtual scene transformation, and obtain the resulting texture of the terrain layer after the virtual scene transformation;
[0008] The resulting texture is inserted into the initial texture to obtain a composite texture of the terrain layer. In the composite texture, two pixels that are in the same position in the initial texture and the resulting texture are adjacent to each other and form an adjacent pixel pair.
[0009] The texture offset point of each adjacent pixel pair is determined according to the transformation progress of the virtual scene, and the composite texture of the terrain layer is sampled according to each texture offset point to obtain the texture sampling value of the terrain layer, wherein the texture sampling value is calculated based on the bilinear filtering mechanism;
[0010] Rendering is performed based on the texture sampling values of the synthesized texture to obtain an image that matches the transformation progress of the virtual scene.
[0011] This application provides an image processing apparatus for a virtual scene, comprising:
[0012] The acquisition module is used to acquire the initial texture of the terrain layer before the virtual scene transformation, and to acquire the result texture of the terrain layer after the virtual scene transformation.
[0013] The compositing module is used to insert pixels of the result map based on the initial map to obtain a composite map of the terrain layer, wherein two pixels that are in the same position in the initial map and the result map are adjacent in the composite map and form an adjacent pixel pair;
[0014] The sampling module is used to determine the texture offset point of each adjacent pixel pair according to the transformation progress of the virtual scene, and to perform sampling processing on the composite texture of the terrain layer according to each texture offset point to obtain the texture sampling value of the terrain layer, wherein the texture sampling value is calculated based on the bilinear filtering mechanism;
[0015] The rendering module is used to perform rendering processing based on the texture sampling values of the composite texture to obtain an image that matches the transformation progress of the virtual scene.
[0016] In the above scheme, the acquisition module is further configured to: acquire the initial albedo map of the terrain layer before the virtual scene transformation, and acquire the initial normal map of the terrain layer before the virtual scene transformation, and use the initial albedo map and the initial normal map as the initial map.
[0017] In the above scheme, the acquisition module is further configured to: acquire the albedo map of the terrain layer after the virtual scene transformation, and acquire the normal map of the terrain layer after the virtual scene transformation, and use the albedo map and the normal map as the result map.
[0018] In the above solution, the synthesis module is further configured to: perform the following processing on a first pixel with an abscissa of n and an ordinate of m in the initial texture: take 2n as the abscissa of the first pixel in the synthesized texture, and take m as the ordinate of the first pixel in the synthesized texture; perform the following processing on a second pixel with an abscissa of n and an ordinate of m in the result texture: take 2n+1 as the abscissa of the second pixel in the synthesized texture, and take m as the ordinate of the second pixel in the synthesized texture; wherein the length of each of the initial texture and the result texture is N, the width of each of the initial texture and the result texture is M, N and M are integers greater than or equal to 2, the value range of n is 0≤n<N-1, and the value range of m is 0≤m<M-1; generate the synthesized texture based on the abscissa and ordinate of each said first pixel in the initial texture in the synthesized texture, and the abscissa and ordinate of each said second pixel in the result texture in the synthesized texture.
[0019] In the above solution, the synthesis module is further configured to: perform the following processing on each said adjacent pixel pair: acquire a connecting line between the first center of the first pixel and the second center of the second pixel in the adjacent pixel pair, and determine a first distance from the midpoint of the connecting line to the left edge of the synthesized texture; multiply the first distance by the value of the transformation progress, and perform normalization processing on the multiplication result to obtain a first corrected distance; acquire an offset distance that is positively correlated with the first corrected distance; and take a point on the connecting line whose distance to the first center is the offset distance as a texture offset point.
[0020] In the above solution, the synthesis module is further configured to: perform the following processing on a first pixel with an abscissa of n and an ordinate of m in the initial texture: take n as the abscissa of the first pixel in the synthesized texture, and take 2m as the ordinate of the first pixel in the synthesized texture; perform the following processing on a second pixel with an abscissa of n and an ordinate of m in the result texture: take n as the abscissa of the second pixel in the synthesized texture, and take 2m+1 as the ordinate of the second pixel in the synthesized texture; wherein the length of each of the initial texture and the result texture is N, the width of each of the initial texture and the result texture is M, N and M are integers greater than or equal to 2, the value range of n is 0≤n<N-1, and the value range of m is 0≤m<M-1; generate the synthesized texture based on the abscissa and ordinate of each said first pixel in the initial texture in the synthesized texture, and the abscissa and ordinate of each said second pixel in the result texture in the synthesized texture.
[0021] In the above scheme, the compositing module is further configured to: perform the following processing for each of the adjacent pixel pairs: obtain the line connecting the first center of the first pixel and the second center of the second pixel in the adjacent pixel pair, and determine the second distance from the midpoint of the line to the upper edge of the composite texture; multiply the second distance with the value of the transformation progress, and normalize the multiplication result to obtain a second correction distance; obtain the offset distance that is positively correlated with the second correction distance; and take the point on the line whose distance from the first center is the offset distance as the texture offset point.
[0022] In the above scheme, the sampling module is further configured to: obtain the line connecting the first center of the first pixel and the second center of the second pixel in the adjacent pixel pair, wherein the first pixel is a pixel of the initial texture and the second pixel is a pixel of the result texture; obtain the offset distance positively correlated with the transformation progress; and determine the point on the line whose distance from the first center is the offset distance as the texture offset point of the adjacent pixel pair.
[0023] In the above scheme, the sampling module is further configured to: before determining the texture offset point of each adjacent pixel pair according to the transformation progress of the virtual scene, obtain the complete transformation time of the virtual scene, and obtain the duration between the real time and the start time of the scene transformation; obtain the ratio between the duration and the complete transformation time, and determine the ratio as the transformation progress.
[0024] In the above scheme, the sampling module is further configured to: perform the following processing on each of the composite textures of the terrain layer: sample the composite texture according to each texture offset point to obtain the color value of each texture offset point in the composite texture, and use the color value of each texture offset point as the texture sampling value of the composite texture.
[0025] In the above scheme, the sampling module is further configured to: before sampling the composite texture according to each texture offset point to obtain the color value of each texture offset point in the composite texture, perform the following processing for each texture offset point: obtain the first color value of the first pixel and the second color value of the second pixel in the composite texture, wherein the first pixel and the second pixel are derived from the adjacent pixel pair corresponding to the texture offset point; obtain the third distance between the texture offset point and the first pixel and the fourth distance between the texture offset point and the second pixel; obtain the first weight negatively correlated with the third distance and the second weight negatively correlated with the fourth distance; obtain the first multiplication result of the first weight and the first color value, and the second multiplication result of the second weight and the second color value; and use the sum of the first multiplication result and the second multiplication result as the color value of the texture offset point.
[0026] In the above scheme, the compositing module is further configured to: insert pixels of the resulting albedo map into the initial albedo map to obtain a composite albedo map of the terrain layer; insert pixels of the resulting normal map into the initial normal map to obtain a composite normal map of the terrain layer; and use the composite albedo map and the composite normal map as the composite map of the terrain layer.
[0027] In the above scheme, the rendering module is further configured to: when there are multiple terrain layers, perform the following processing for each terrain layer: perform rendering processing based on the texture sampling value of each adjacent pixel pair in the composite texture of the terrain layer to obtain a first image that matches the transformation progress of the virtual scene; and perform fusion processing on multiple first images that correspond one-to-one with multiple terrain layers to obtain an image that matches the transformation progress of the virtual scene.
[0028] This application provides an electronic device, including:
[0029] Memory, used to store executable instructions;
[0030] The processor, when executing executable instructions stored in the memory, implements the image processing method for virtual scenes provided in the embodiments of this application.
[0031] This application provides a computer-readable storage medium storing executable instructions, which, when executed by a processor, implement the image processing method for a virtual scene provided in this application.
[0032] This application provides a computer program product, including a computer program or instructions, which are executed by a processor to implement the image processing method for virtual scenes provided in this application.
[0033] The embodiments of this application have the following beneficial effects:
[0034] The resulting texture's pixels are inserted into the initial texture to obtain a composite texture of the terrain layer. Two pixels in the same position in the initial and resulting textures are adjacent in the composite texture, forming adjacent pixel pairs. The composite texture is sampled based on the texture offset point of each adjacent pixel pair to obtain the texture sample value of the terrain layer. Since the texture sample value is calculated based on the bilinear filtering mechanism, and since the texture offset point is obtained based on the scene transformation progress, the texture sample value of the texture offset point can accurately represent the weighted mixing result of the adjacent pixel pair and the scene transformation progress. This is equivalent to replacing two samples with a single sample, improving the texture sampling efficiency during the scene transformation process. Attached Figure Description
[0035] Figure 1 This is a schematic diagram of texture transformation for scene changes in related technologies;
[0036] Figure 2 This is a schematic diagram of the structure of the image processing system for a virtual scene provided in the embodiments of this application;
[0037] Figure 3 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application;
[0038] Figures 4A-4C This is a flowchart illustrating the image processing method for a virtual scene provided in an embodiment of this application;
[0039] Figures 5A-5C This is a schematic diagram of the interface of the image processing method for a virtual scene provided in the embodiments of this application;
[0040] Figure 6 This is a schematic diagram of the pixel arrangement of the image processing method for a virtual scene provided in the embodiments of this application;
[0041] Figure 7 This is a schematic diagram of the pixel arrangement of the composite texture provided in the embodiments of this application;
[0042] Figure 8 This is a schematic diagram of the interface of the image processing method for a virtual scene provided in the embodiments of this application;
[0043] Figure 9 This is a schematic diagram of the interface of the image processing method for a virtual scene provided in the embodiments of this application;
[0044] Figure 10 This is a flowchart of an image processing method for a virtual scene provided in an embodiment of this application;
[0045] Figure 11 This is a schematic diagram of the pixel arrangement of the image processing method for a virtual scene provided in the embodiments of this application;
[0046] Figure 12 This is a schematic diagram of the pixel arrangement of the composite texture provided in the embodiments of this application;
[0047] Figure 13 This is a schematic diagram of the interface of the image processing method for a virtual scene provided in the embodiments of this application. Detailed Implementation
[0048] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0049] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0050] In the following description, the terms "first, second, third" are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0051] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0052] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.
[0053] 1) Bilinear filtering refers to a texture filtering method that smooths the texture during scaling. Typically, the texture displayed on the screen is unlikely to be exactly the same as the saved texture without any loss. Pixels can be represented using texels, which can be assumed to be located at the center, top left, or other positions of each unit. Bilinear filtering uses bilinear interpolation based on the four nearest texels surrounding the pixel.
[0054] 2) Terrain layer: Represents a single type of terrain, containing albedo and normal maps. A terrain is created by blending multiple terrain layers. For example, grassland is one terrain layer, sand is another, and grassland and sand are blended in different areas in a certain proportion to create a terrain that contains both grassland and sand.
[0055] 3) Virtual scenes utilize scenes output by devices that differ from the real world. Visual perception of virtual scenes can be formed with the naked eye or with the assistance of devices. For example, two-dimensional images are output through a display screen, and three-dimensional images are output through stereoscopic display technologies such as stereoscopic projection, virtual reality, and augmented reality. In addition, various possible hardware can be used to form various perceptions that simulate the real world, such as auditory perception, tactile perception, olfactory perception, and motion perception.
[0056] 4) Client: An application that runs in a terminal and provides various services, such as a game client.
[0057] 5) Cloud storage is a new concept that extends and develops from cloud computing. It refers to a system that uses cluster applications, grid technology, or distributed file systems to aggregate a large number of storage devices of various types across a network to work collaboratively and provide data storage and business access functions. When the core of cloud computing system operations and processing is the storage and management of large amounts of data, a large number of storage devices need to be configured in the cloud computing system. Thus, the cloud computing system transforms into a cloud storage system. Therefore, cloud storage is a cloud computing system with data storage and management at its core.
[0058] In related technologies, to demonstrate seasonal changes in a virtual scene to users, it's necessary to sample both the initial texture of the Terrain layer before the seasonal change and the resulting texture of the Terrain layer after the seasonal change. Then, the weights of the two textures are calculated according to the progress of the seasonal change, and a weighted average is applied. Taking the gradual change of terrain A from summer to winter as an example, for the albedo texture of a Terrain layer in terrain A, it's necessary to sample from... Figure 1The grass texture (initial texture) gradually transforms into a snow texture (resulting texture). After the seasonal change begins, the grass texture is sampled first to obtain the color value Cs, and then the snow texture is sampled to obtain the color value Cw. Let the duration of the seasonal change be T, and the time difference between the real-time moment and the start time of the seasonal change be t. Then the progress p of the seasonal change is... The final color value C can be calculated using formula (1):
[0059] C = p × Cs + (1-p) × Cw (1);
[0060] Where C is the final color value, p is the progress of the seasonal change, Cs is the color value sampled from the grass texture, and Cw is the color value sampled from the snow texture.
[0061] All the Albedo maps of all the Terrain layers in Terrain A can be blended in the manner described above, as can the normal maps of all the Terrain layers in Terrain A, to obtain the final color values of the Albedo maps and the final color values of the normal maps of each Terrain layer.
[0062] The drawback of this technology is that it requires a large number of texture samplings. If there is no seasonal change, only the grass texture needs to be sampled and the rendering is based on the sampling results to form the summer grass effect of terrain A. If a seasonal change is required, both the grass texture and the snow texture need to be sampled, which doubles the number of Albedo textures and normal maps that need to be sampled.
[0063] This application provides an image processing method, apparatus, electronic device, computer-readable storage medium, and computer program product for virtual scenes. It can sample the texture offset points of a composite texture and return texture sampling values calculated based on a bilinear filtering mechanism. This improves texture sampling efficiency during scene transformation while accurately representing the weighted mixing results of adjacent pixel pairs adapted to the scene transformation progress. The following describes exemplary applications of the electronic device provided in this application. The electronic device can be implemented as various types of user terminals such as laptops, tablets, desktop computers, set-top boxes, and mobile devices (e.g., mobile phones, portable music players, personal digital assistants, dedicated messaging devices, portable gaming devices).
[0064] To facilitate a clearer understanding of the image processing method for virtual scenes provided in this application, an exemplary implementation scenario of the image processing method for virtual scenes provided in this application will be described first. The virtual scene can be output entirely based on the terminal, or output based on the collaboration between the terminal and the server.
[0065] In some embodiments, the virtual scene can be an environment for game characters to interact, such as a virtual scene for game characters to fight each other. By controlling the actions of virtual objects, two parties can interact in the virtual scene, thereby allowing users to relieve life stress during the game.
[0066] In another implementation scenario, see Figure 2 , Figure 2 This is a schematic diagram of the application mode of the image processing method for virtual scenes provided in the embodiments of this application. It is applied to the terminal 400 and the server 200. Generally, it is suitable for application modes that rely on the computing power of the server 200 to complete the calculation of virtual scenes and output the virtual scenes on the terminal 400.
[0067] As an example, before the terminal runs the client (in an offline state), the server 200 obtains the initial texture of the terrain layer before the virtual scene transformation, and the resulting texture of the terrain layer after the virtual scene transformation. The server 200 inserts pixels of the resulting texture into the initial texture to obtain a composite texture of the terrain layer. Two pixels in the same position in the initial texture and the resulting texture are adjacent in the composite texture and form adjacent pixel pairs. After the client (e.g., a network version of a game application) running on the terminal 400 is logged in, the client is in a running state (online state). The client receives a scene transformation request and sends the scene transformation request to the server 200. The texture offset point of each adjacent pixel pair is determined according to the transformation progress of the virtual scene, and the composite texture of the terrain layer is sampled according to each texture offset point to obtain the texture sampling value of the terrain layer. The texture sampling value is calculated based on a bilinear filtering mechanism. Rendering processing is performed based on the texture sampling value of the composite texture to obtain an image that matches the transformation progress of the virtual scene. The server 200 returns the image to the terminal 400 for presentation.
[0068] As an example, before the terminal runs the client (in an offline state), the terminal 400 acquires the initial texture of the terrain layer before the virtual scene transformation, and the resulting texture of the terrain layer after the virtual scene transformation. The terminal 400 inserts pixels from the resulting texture into the initial texture to obtain a composite texture of the terrain layer. Two pixels in the same position in the initial and resulting textures are adjacent in the composite texture and form adjacent pixel pairs. After logging into the client running on the terminal 400 (e.g., a network version of a game application), the client is in a running state (online state). The texture offset point of each adjacent pixel pair is determined according to the transformation progress of the virtual scene, and the composite texture of the terrain layer is sampled according to each texture offset point to obtain the texture sampling value of the terrain layer. The texture sampling value is calculated based on a bilinear filtering mechanism. Rendering is performed based on the texture sampling value of the composite texture to obtain an image that matches the transformation progress of the virtual scene, and the image is presented on the terminal 400.
[0069] In some embodiments, the terminal 400 can implement the image processing method for the virtual scene provided in this application embodiment by running a computer program. For example, the computer program can be a native program or software module in an operating system; it can be a native application (APP), that is, a program that needs to be installed in the operating system to run, such as a game APP (i.e., the client mentioned above) or a live streaming APP; it can also be a mini-program, that is, a program that only needs to be downloaded into a browser environment to run; or it can be a game mini-program that can be embedded in any APP. In short, the above-mentioned computer program can be any form of application, module or plugin.
[0070] The embodiments of this application can be implemented with the help of cloud technology, which refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or local area network to realize the computation, storage, processing, and sharing of data.
[0071] Cloud technology is a general term encompassing network technology, information technology, integration technology, management platform technology, and application technology based on the cloud computing business model. It can form resource pools, allowing for on-demand use with flexibility and convenience. Cloud computing technology will become a crucial support. The backend services of cloud computing systems require substantial computing and storage resources.
[0072] As an example, server 200 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server 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, CDN, and big data and artificial intelligence platforms. Terminal 400 can be a smartphone, tablet, laptop, desktop computer, smart speaker, or smartwatch, but is not limited to these. Terminal 400 and server 200 can be directly or indirectly connected via wired or wireless communication, which is not limited in this embodiment.
[0073] See Figure 3 , Figure 3 This is a schematic diagram of the structure of an electronic device for the image processing method of applying virtual scenes provided in the embodiments of this application. The description takes the electronic device as a terminal as an example. Figure 3 The terminal 400 shown includes at least one processor 410, a memory 450, at least one network interface 420, and a user interface 430. The various components in the terminal 400 are coupled together via a bus system 440. It is understood that the bus system 440 is used to implement communication between these components. In addition to a data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for clarity, ... Figure 3 The general labeled all buses as Bus System 440.
[0074] The processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc.
[0075] User interface 430 includes one or more output devices 431 that enable the presentation of media content, including one or more speakers and / or one or more visual displays. User interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0076] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state storage, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices physically located away from the processor 410.
[0077] The memory 450 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), and the volatile memory may be random access memory (RAM). The memory 450 described in this application embodiment is intended to include any suitable type of memory.
[0078] In some embodiments, memory 450 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or subsets or supersets thereof, as illustrated below.
[0079] Operating system 451 includes system programs for handling various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, driver layer, etc., for implementing various basic business functions and handling hardware-based tasks;
[0080] The network communication module 452 is used to reach other computing devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 including: Bluetooth, WiFi, and Universal Serial Bus (USB), etc.
[0081] Presentation module 453 is configured to enable the presentation of information (e.g., a user interface for operating peripheral devices and displaying content and information) via one or more output devices 431 (e.g., a display screen, a speaker, etc.) associated with user interface 430;
[0082] The input processing module 454 is used to detect and translate one or more user inputs or interactions from one or more input devices 432.
[0083] In some embodiments, the image processing apparatus for virtual scenes provided in this application can be implemented in software. Figure 3 An image processing device 455 for a virtual scene stored in memory 450 is shown. It may be software in the form of programs and plug-ins, including the following software modules: acquisition module 4551, compositing module 4552, sampling module 4553, and rendering module 4554. These modules are logically related and can therefore be arbitrarily combined or further divided according to the functions they implement. The functions of each module will be described below.
[0084] The image processing method for virtual scenes provided in this application will be described in conjunction with exemplary applications and implementations of the terminals provided in the embodiments of this application.
[0085] See Figure 4A , Figure 4A This is a flowchart illustrating the image processing method for a virtual scene provided in this application embodiment, which will be combined with... Figure 4A Steps 101 to 104 are described below.
[0086] In step 101, the initial texture of the terrain layer before the virtual scene transformation is obtained, and the resulting texture of the terrain layer after the virtual scene transformation is obtained.
[0087] In some embodiments, obtaining the initial texture of the terrain layer before the virtual scene transformation in step 101 can be achieved by the following technical solution: obtaining the initial albedo texture of the terrain layer before the virtual scene transformation, and obtaining the initial normal texture of the terrain layer before the virtual scene transformation, and using the initial albedo texture and the initial normal texture as the initial texture.
[0088] In some embodiments, obtaining the resulting texture of the terrain layer after the virtual scene transformation in step 101 can be achieved by the following technical solution: obtaining the resulting albedo texture of the terrain layer after the virtual scene transformation, and obtaining the resulting normal texture of the terrain layer after the virtual scene transformation, and using the resulting albedo texture and the resulting normal texture as the resulting texture.
[0089] By acquiring albedo maps and normal maps, the texture realism of land parcels in the virtual scene can be ensured simultaneously, thus enabling the rendering of more realistic land parcel styles.
[0090] As an example, the initial texture is the texture before the virtual scene transformation, and the resulting texture is the texture after the virtual scene transformation. The virtual scene transformation could be from summer to winter (i.e., the initial texture is a summer texture and the resulting texture is a winter texture), or it could be from spring to autumn (i.e., the initial texture is a spring texture and the resulting texture is an autumn texture). Regardless of whether it's the initial texture or the winter texture, the texture can include two types: normal maps and albedo maps.
[0091] As an example, a normal map creates normals at every point on the bumpy surface of the original object, using red, green, and blue color channels to indicate the direction of the normals. The normal map is essentially a separate surface parallel to the original bumpy surface; in reality, it's just a smooth plane. Visually, it's more efficient than the original bumpy surface. By applying a light source at a specific location, it can generate highly detailed and precise lighting directions and reflections on surfaces with low detail. Albedo maps are used to represent the texture and color of a model. An albedo map itself is a color and texture map.
[0092] In step 102, pixels of the result texture are inserted on the basis of the initial texture to obtain a composite texture of the terrain layer.
[0093] As an example, two pixels at the same position in the initial texture and the result texture are adjacent to each other in the composite texture and form an adjacent pixel pair.
[0094] In some embodiments, inserting pixels of the result texture on the basis of the initial texture in step 102 to obtain the composite texture of the terrain layer may be implemented by the following technical solutions: inserting pixels of the result albedo texture on the basis of the initial albedo texture to obtain a composite albedo texture of the terrain layer; inserting pixels of the result normal texture on the basis of the initial normal texture to obtain a composite normal texture of the terrain layer; and taking the composite albedo texture and the composite normal texture as the composite texture of the terrain layer.
[0095] As an example, since the textures include two types (the normal texture and the albedo texture), the composite textures also include two types (the composite normal texture and the composite albedo texture). The composite albedo texture is obtained based on the initial albedo texture and the result albedo texture, and the composite normal texture is obtained based on the initial normal texture and the result normal texture.
[0096] In some embodiments, referring to Figure 4B , Figure 4B which is a schematic flowchart of an image processing method for a virtual scene provided in the embodiments of the present application, inserting pixels of the result texture on the basis of the initial texture in step 102 to obtain the composite texture of the terrain layer may be implemented through steps 1021 to 1023 in Figure 4B .
[0097] In step 1021, the following processing is performed on a first pixel with an abscissa of n and an ordinate of m in the initial texture: 2n is taken as the abscissa of the first pixel in the composite texture, and m is taken as the ordinate of the first pixel in the composite texture.
[0098] In step 1022, the following processing is performed on a second pixel with an abscissa of n and an ordinate of m in the result texture: 2n+1 is taken as the abscissa of the second pixel in the composite texture, and m is taken as the ordinate of the second pixel in the composite texture.
[0099] As an example, the length of each of the initial texture and the result texture is N, and the width of each of the initial texture and the result texture is M, where N and M are integers greater than or equal to 2, the value range of n is 0≤n<N-1, and the value range of m is 0≤m<M-1.
[0100] In step 1023, a composite texture is generated based on the x-coordinate and y-coordinate of each first pixel in the initial texture in the composite texture, and the x-coordinate and y-coordinate of each second pixel in the result texture in the composite texture.
[0101] By using the insertion method of arranging adjacent pixels on the left and right, the difficulty and number of sampling times can be reduced. Only one sampling is required for adjacent pixel pairs, which replaces the scheme of sampling the initial texture and the result texture twice, thus improving the sampling efficiency.
[0102] As an example, when the initial texture is the initial albedo texture and the resulting texture is also the resulting albedo texture, the composite texture is the composite albedo texture; when the initial texture is the initial normal texture and the resulting texture is also the resulting normal texture, the composite texture is the composite normal texture.
[0103] As an example, both the initial and resulting textures are a*a in size, where a is a positive integer. A(u, v) represents the number of pixels in the initial texture at coordinates (u, v), and B(u, v) represents the number of pixels in the resulting texture at coordinates (u, v). The composite texture C has twice the length of the initial texture and the same width; the size of the composite texture C is 2a*a. See also... Figure 6 , Figure 6 This is a schematic diagram of the pixel arrangement of the image processing method for a virtual scene provided in this application embodiment. Pixel A and pixel B are arranged according to... Figure 6 The pixel is arranged as shown, with pixel A positioned at coordinates (2u, v) within the composite texture C, and pixel B positioned at coordinates (2u+1, v) within the composite texture C. That is, pixels A and B are arranged as adjacent pixels in the composite texture. See also... Figure 7 , Figure 7 This is a schematic diagram of the pixel arrangement of the composite texture provided in the embodiments of this application. The arrangement of each pixel in the composite texture C is as follows: Figure 7 As shown. See also Figure 8 , Figure 8 This is a schematic diagram of the interface of the image processing method for a virtual scene provided in this application embodiment. The two original textures (each with a size of 512*512) are processed offline to obtain a composite texture (each with a size of 1024*512). Each terrain layer needs to be processed in the above manner. For 10 terrain layers, 10 composite textures will be obtained one by one.
[0104] In some embodiments, in step 102, inserting the pixels of the result map on the basis of the initial map to obtain the composite map of the terrain layer can be implemented by the following technical solution: perform the following processing on the first pixel with the abscissa n and the ordinate m in the initial map: take n as the abscissa of the first pixel in the composite map, and take 2m as the ordinate of the first pixel in the composite map; perform the following processing on the second pixel with the abscissa n and the ordinate m in the result map: take n as the abscissa of the second pixel in the composite map, and take 2m+1 as the ordinate of the second pixel in the composite map; wherein the length of both the initial map and the result map is N, the width of both the initial map and the result map is M, N and M are integers greater than or equal to 2, the value range of n is 0≤n<N-1, and the value range of m is 0≤m<M-1; generate the composite map based on the abscissa and ordinate of each first pixel in the initial map in the composite map, and the abscissa and ordinate of each second pixel in the result map in the composite map.
[0105] The insertion method arranged adjacently up and down can reduce the sampling difficulty and sampling times, and only one sampling needs to be performed for the adjacent pixel pair to replace the solution of performing two samplings on the initial map and the result map, which improves the sampling efficiency.
[0106] As an example, the size of both the initial map and the result map is a*a, where a is a positive integer, A(u, v) is the pixel of the initial map at the coordinate (u, v), and B(u, v) is the pixel of the result map at the coordinate (u, v). The width of the composite map C is twice that of the initial map, the length is the same as that of the initial map, and the size of the composite map C is a*2a. See Figure 11 , Figure 11 is a schematic diagram of pixel arrangement of the image processing method for a virtual scene provided by the embodiments of the present application, pixel A and pixel B are arranged in the arrangement manner shown in Figure 11 , pixel A is arranged at the position with the coordinate (u, 2v) in the composite map C, and pixel B is arranged at the position with the coordinate (u, 2v+1) in the composite map C, that is, pixel A and pixel B are arranged as two adjacent pixels in the composite map. See Figure 12 , Figure 12 is a schematic diagram of pixel arrangement of the composite map provided by the embodiments of the present application, and the arrangement of each pixel in the composite map C is as shown in Figure 12 . See Figure 13 , Figure 13 is a schematic interface diagram of the image processing method for a virtual scene provided by the embodiments of the present application, two actual original maps (each with a size of 512*512) are subjected to offline synthesis processing to obtain a composite map (each with a size of 512*1024).
[0107] In step 103, the texture offset point of each adjacent pixel pair is determined according to the transformation progress of the virtual scene, and the composite texture of the terrain layer is sampled according to each texture offset point to obtain the texture sampling value of the terrain layer.
[0108] In some embodiments, before determining the texture offset point of each adjacent pixel pair according to the transformation progress of the virtual scene in step 103, the complete transformation time of the virtual scene is obtained, and the duration between the real time and the start time of the scene transformation is obtained; the ratio between the duration and the complete transformation time is obtained, and the ratio is determined as the transformation progress.
[0109] The ratio of duration to total time can be used to measure the progress of virtual scene transformation from a time perspective, thus making the transformation progress more interpretable.
[0110] As an example, the time taken for a complete transformation of the virtual scene is pre-configured. For instance, the pre-configured time for a complete transformation from summer to winter is 3 seconds. The scene transformation starts at 2:14:25 PM, the real-time time is 2:14:26 PM, and the duration is 1 second. Therefore, the ratio between the duration and the total time taken is 1 / 3, which means the transformation progress is 1 / 3.
[0111] In some embodiments, see Figure 4C , Figure 4C This is a flowchart illustrating the image processing method for a virtual scene provided in this application embodiment. In step 103, the texture offset point of each adjacent pixel pair is determined according to the transformation progress of the virtual scene. This can be achieved by performing [the necessary steps] on each adjacent pixel pair. Figure 4C Steps 1031 to 1032 are implemented.
[0112] In step 1031, the line connecting the first center of the first pixel and the second center of the second pixel in the adjacent pixel pair is obtained.
[0113] In step 1032, the offset distance that is positively correlated with the transformation progress is obtained, and the point on the connecting line whose distance from the first center is the offset distance is determined as the texture offset point of the adjacent pixel pair.
[0114] As an example, the first pixel is the pixel of the initial texture, and the second pixel is the pixel of the resulting texture. See also Figure 9 , Figure 9 This is a schematic diagram of the interface of the image processing method for a virtual scene provided in this application embodiment. The two endpoints of the dashed line are the centers of the first pixel A and the second pixel B. Point M is the sampling position used as the texture offset point. The texture offset point can be described by the distance x from the first pixel A. The formula for calculating the distance x is: t is the real-time point, and T is the time taken for the complete transformation of the virtual scene.
[0115] By determining the texture offset point through an offset distance that is positively correlated with the transformation progress, the sampling position at each real-time moment can be effectively controlled. This allows for precise control over the degree to which the texture sampling value at each real-time moment is biased toward the resulting texture and away from the initial texture, thereby improving the accuracy and realism of the rendering effect.
[0116] In some embodiments, the texture sampling value in step 103 is pre-calculated based on a bilinear filtering mechanism. Step 103 involves sampling the composite map of the terrain layer according to each texture offset point to obtain the texture sampling value for each adjacent pixel pair in the composite map. This can be achieved through the following technical solution: Perform the following processing on each composite map of the terrain layer: sample the composite map according to each texture offset point to obtain the color value of each texture offset point in the composite map, and use the color value of each texture offset point as the texture sampling value of the composite map.
[0117] As an example, the terrain layer includes two composite maps: a composite normal map and a composite albedo map. Sampling is performed on each composite map. Taking the composite albedo map as an example, when the initial albedo map is 512*512 pixels, the resulting albedo map is 512*512 pixels, and the composite albedo map is 1024*512 pixels, the composite albedo map contains 512 adjacent pixel pairs. Therefore, sampling the composite albedo map can return 512 texture sample values. The texture sample values are the color values of texture offset points, and each adjacent pixel pair corresponds to a texture offset point.
[0118] In some embodiments, before sampling the composite map according to each texture offset point to obtain the color value of each texture offset point in the composite map, the following processing is performed for each texture offset point: obtaining the first color value of the first pixel and the second color value of the second pixel in the composite map, wherein the first pixel and the second pixel are derived from the adjacent pixel pair of the corresponding texture offset point; obtaining the third distance between the texture offset point and the first pixel and the fourth distance between the texture offset point and the second pixel; obtaining the first weight negatively correlated with the third distance and the second weight negatively correlated with the fourth distance; obtaining the first multiplication result of the first weight and the first color value, and the second multiplication result of the second weight and the second color value; and using the sum of the first multiplication result and the second multiplication result as the color value of the texture offset point.
[0119] The first and second weights are determined by the third and fourth distances, and the first and second weights are used to fuse the first and second color values, which is equivalent to implementing the interpolation of the bilinear filtering mechanism. The interpolation is used to accurately represent the color value of the texture offset point.
[0120] As an example, see Figure 9 , Figure 9 This is a schematic diagram of the interface of the image processing method for the virtual scene provided in the embodiment of this application. The two endpoints of the dashed line are the center points of the first pixel A and the second pixel B. Point M is the sampling position as the texture offset point. By performing texture sampling at point M, the color value of point M can be obtained. The color value of point M is the result of mixing the first pixel A and the second pixel B with weights WA and WB. Obtain the first color value of the first pixel A and the second color value of the second pixel B in the composite texture. Obtain the third distance x between the texture offset point (point M) and the first pixel A, and the fourth distance y between the texture offset point M and the second pixel B. Obtain the first weight (e.g., 1-x) which is negatively correlated with the third distance and the second weight which is negatively correlated with the fourth distance (1-y). Obtain the first multiplication result of the first weight and the first color value, and the second multiplication result of the second weight and the second color value. Use the sum of the first multiplication result and the second multiplication result as the color value of the texture offset point. This is equivalent to performing a weighted summation of the first color value and the second color value. The closer the texture offset point (point M) is to the first pixel A (the smaller the third distance), the greater the weight of the first color value. The closer the texture offset point (point M) is to the second pixel B (the smaller the fourth distance), the greater the weight of the second color value.
[0121] In some embodiments, determining the texture offset point of each adjacent pixel pair according to the transformation progress of the virtual scene in step 103 can be achieved by the following technical solution: performing the following processing for each adjacent pixel pair: obtaining the line connecting the first center of the first pixel and the second center of the second pixel in the adjacent pixel pair, and determining the first distance from the midpoint of the line to the left edge of the composite texture; multiplying the first distance with the value of the transformation progress, and normalizing the multiplication result to obtain the first correction distance; obtaining the offset distance positively correlated with the first correction distance; and taking the point on the line whose distance from the first center is the offset distance as the texture offset point.
[0122] By determining the texture offset point through an offset distance that is positively correlated with the transformation progress, the sampling position at each real-time moment can be effectively controlled. This allows for precise control over the degree to which the texture sampling value at each position at each real-time moment is biased toward the resulting texture and away from the initial texture, thereby improving the accuracy and realism of the rendering effect.
[0123] As an example, both the initial and resulting textures are a*a in size, where a is a positive integer. A(u, v) represents the number of pixels in the initial texture at coordinates (u, v), and B(u, v) represents the number of pixels in the resulting texture at coordinates (u, v). The composite texture C has twice the length of the initial texture and the same width; the size of the composite texture C is 2a*a. See also... Figure 6 , Figure 6 This is a schematic diagram of the pixel arrangement of the image processing method for a virtual scene provided in this application embodiment. Pixel A and pixel B are arranged according to... Figure 6 The pixel is arranged as shown, with pixel A positioned at coordinates (2u, v) within the composite texture C, and pixel B positioned at coordinates (2u+1, v) within the composite texture C. That is, pixels A and B are arranged as adjacent pixels in the composite texture. See also... Figure 7 , Figure 7 This is a schematic diagram of the pixel arrangement of the composite texture provided in the embodiments of this application. The arrangement of each pixel in the composite texture C is as follows: Figure 7 As shown.
[0124] Because different pixel pairs occupy different positions in the composite texture, different texture offset points can be determined for different pixel pairs. When the texture offset point is closer to the first pixel, it indicates that the sampled value is closer to the initial texture. When the texture offset point is closer to the second pixel, it indicates that the sampled value is closer to the final texture. For the texture offset points of adjacent pixel pairs at different positions, different scene transformation effects can be reflected. For example, for the same transformation progress (i.e., the same real-time time), adjacent pixel pair A is closer to the left edge of the composite texture than adjacent pixel pair B (corresponding to the first distance of adjacent pixel pair A being less than the first distance of adjacent pixel pair B). At this time, the distance between the texture sampling point of adjacent pixel pair A and the first pixel is less than the distance between the texture sampling point of adjacent pixel pair B and the first pixel. Therefore, at any given moment, the texture sampling point of adjacent pixel pair A is more biased towards the initial texture than the texture sampling point of adjacent pixel pair B. As a result, uneven transformation effects will occur during the scene transformation process. The right part of the plot will transform to the winter effect before the left part, and at every moment, the right part of the plot is closer to the winter effect than the left part.
[0125] In some embodiments, determining the texture offset point of each adjacent pixel pair according to the transformation progress of the virtual scene in step 103 can be achieved by the following technical solution: performing the following processing for each adjacent pixel pair: obtaining the line connecting the first center of the first pixel and the second center of the second pixel in the adjacent pixel pair, and determining the second distance from the midpoint of the line to the upper edge of the composite texture; multiplying the second distance with the value of the transformation progress, and normalizing the multiplication result to obtain the second correction distance; obtaining the offset distance that is positively correlated with the second correction distance; and taking the point on the line whose distance from the first center is the offset distance as the texture offset point.
[0126] By determining the texture offset point through an offset distance that is positively correlated with the transformation progress, the sampling position at each real-time moment can be effectively controlled. This allows for precise control over the degree to which the texture sampling value at each position at each real-time moment is biased towards the resulting texture and away from the initial texture, thereby improving the accuracy and realism of the rendering effect.
[0127] As an example, both the initial and resulting textures are a*a in size, where a is a positive integer. A(u, v) represents the number of pixels in the initial texture at coordinates (u, v), and B(u, v) represents the number of pixels in the resulting texture at coordinates (u, v). The composite texture C is twice the width of the initial texture and has the same length. The size of the composite texture C is a*2a. See also Figure 11 , Figure 11 This is a schematic diagram of the pixel arrangement of the image processing method for a virtual scene provided in this application embodiment. Pixel A and pixel B are arranged according to... Figure 11 The pixel is arranged as shown, with pixel A positioned at coordinates (u, 2v) within the composite texture C, and pixel B positioned at coordinates (u, 2v+1) within the composite texture C. That is, pixels A and B are arranged as adjacent pixels in the composite texture. See also... Figure 12 , Figure 12 This is a schematic diagram of the pixel arrangement of the composite texture provided in the embodiments of this application. The arrangement of each pixel in the composite texture C is as follows: Figure 12 As shown.
[0128] Because different pixel pairs occupy different positions in the composite texture, different texture offset points can be determined for different pixel pairs. When the texture offset point is closer to the first pixel, it indicates that the sampled value is closer to the initial texture. When the texture offset point is closer to the second pixel, it indicates that the sampled value is closer to the final texture. For the texture offset points of adjacent pixel pairs at different positions, different scene transformation effects can be reflected. For example, for the same transformation progress (i.e., the same real-time time), adjacent pixel pair A is closer to the top edge of the composite texture than adjacent pixel pair B (corresponding to the first distance of adjacent pixel pair A being less than the first distance of adjacent pixel pair B). At this time, the distance between the texture sampling point of adjacent pixel pair A and the first pixel is less than the distance between the texture sampling point of adjacent pixel pair B and the first pixel. Therefore, at any given moment, the texture sampling point of adjacent pixel pair A is more biased towards the initial texture than the texture sampling point of adjacent pixel pair B. As a result, uneven transformation effects will occur during the scene transformation process. The lower part of the plot will transform to the winter effect before the upper part, and at every moment, the lower part of the plot is closer to the winter effect than the upper part.
[0129] In step 104, rendering is performed based on the texture sampling values of the composite map to obtain an image that matches the transformation progress of the virtual scene.
[0130] In some embodiments, the rendering process performed in step 104 based on the texture sampling values of the composite map to obtain an image that matches the transformation progress of the virtual scene can be achieved through the following technical solution: when there are multiple terrain layers, the following processing is performed for each terrain layer: rendering processing is performed based on the texture sampling values of each adjacent pixel pair in the composite map of the terrain layer to obtain a first image that matches the transformation progress of the virtual scene; multiple first images that correspond one-to-one with multiple terrain layers are fused to obtain an image that matches the transformation progress of the virtual scene.
[0131] As an example, for any plot of land in a virtual scene, each plot can have at least one terrain layer. For a certain terrain layer A, multiple texture sample values of the composite normal map and multiple texture sample values of the composite albedo map can be obtained. Based on the multiple texture sample values of the composite normal map and the multiple texture sample values of the composite albedo map, the first image of the corresponding terrain layer A can be rendered. When the plot has terrain layer A and terrain layer B, the first image of terrain layer A and the first image of terrain layer B are merged. During merging, the merging can be performed according to the weight of each terrain layer. For example, for the top left pixel of the first image of terrain layer A and the top left pixel of the first image of terrain layer B, the color values of the two pixels are merged according to the weight of their respective terrain layers to obtain the color value of the top left pixel of the image.
[0132] The resulting texture's pixels are inserted into the initial texture to obtain a composite texture of the terrain layer. Two pixels in the same position in the initial and resulting textures are adjacent in the composite texture, forming adjacent pixel pairs. The composite texture is sampled based on the texture offset point of each adjacent pixel pair to obtain the texture sample value of the terrain layer. Since the texture sample value is calculated based on the bilinear filtering mechanism, and since the texture offset point is obtained based on the scene transformation progress, the texture sample value of the texture offset point can accurately represent the weighted mixing result of the adjacent pixel pair and the scene transformation progress. This is equivalent to replacing two samples with a single sample, improving the texture sampling efficiency during the scene transformation process.
[0133] The following will describe an exemplary application of the embodiments of this application in a real-world application scenario.
[0134] In some embodiments, the client is a game client. Taking the scene change from summer to winter as an example, before the terminal runs the client (in an offline state), the server obtains the grass texture of the terrain layer before the virtual scene change and the snow texture of the terrain layer after the virtual scene change. The server inserts the pixels of the snow texture into the grass texture to obtain a composite texture of the terrain layer. Two pixels in the same position in the grass texture and snow texture are adjacent in the composite texture and form adjacent pixel pairs. After the account logs in to the client running on the terminal (e.g., a network version of a game application), the client is in a running state (online state). The client receives the user's scene change request and sends the scene change request to the server. The server determines the texture offset point of each adjacent pixel pair according to the change progress of the virtual scene. The progress is the duration between the real time and the time when the scene change request is received. The server samples the composite texture of the terrain layer according to each texture offset point to obtain the texture sampling value of the terrain layer. The texture sampling value is calculated based on a bilinear filtering mechanism. Rendering is performed based on the texture sampling value of the composite texture to obtain an image that matches the change progress of the virtual scene. The server returns the image to the terminal for presentation.
[0135] This application embodiment uses a special pixel arrangement to process the textures of terrain layers for different seasons offline. Thus, when rendering terrain during seasonal changes in real time, the bilinear filtering feature reduces the number of texture samples for the terrain layer by half, thereby improving rendering efficiency.
[0136] In some embodiments, the terrain display effect in a virtual scene needs to gradually change from one season to another within a set time (e.g., 3 seconds). For example, to illustrate a transition from summer to winter, see [link to relevant documentation]. Figures 5A-5C , Figures 5A-5C This is a schematic diagram of the interface of the image processing method for a virtual scene provided in the embodiments of this application. Figure 5A The terrain, dominated by grasslands in summer, transforms at a certain point in the seasonal transition. Figure 5B The terrain shown, a mixture of grass and snow, gradually transforms into... Figure 5C The terrain shown is predominantly snow-covered.
[0137] In some embodiments, the terrain layer textures are processed offline. For example, for a terrain layer T1 and a terrain layer T2 that has undergone seasonal changes, the albedo textures of both terrain layers T1 and T2 are n*n in size, where n is a positive integer. A(u, v) is the pixel of the albedo texture of terrain layer T1 at coordinates (u, v), and B(u, v) is the pixel of the albedo texture of terrain layer T2 at coordinates (u, v). The albedo textures of terrain layer T1 and terrain layer T2 obtained through offline processing are combined into a composite texture M. The length of composite texture M is twice that of the original albedo texture, and the width is the same as the original albedo texture. The size of composite texture M is 2n*n.
[0138] See Figure 6 , Figure 6 This is a schematic diagram of the pixel arrangement of the image processing method for a virtual scene provided in this application embodiment. Pixel A and pixel B are arranged according to... Figure 6 The pixel arrangement shown is as follows: pixel A is positioned at coordinates (2u, v) within the composite texture M, and pixel B is positioned at coordinates (2u+1, v) within the composite texture M. That is, pixels A and B are arranged as adjacent pixels in the composite texture. See also... Figure 7 , Figure 7 This is a schematic diagram of the pixel arrangement of the composite texture provided in the embodiments of this application. The arrangement of each pixel in the composite texture M is as follows: Figure 7 As shown.
[0139] See Figure 8 , Figure 8 This is a schematic diagram of the interface of the image processing method for a virtual scene provided in this application embodiment. The two original textures (each with a size of 512*512) are processed offline to obtain a composite texture (each with a size of 1024*512). Each terrain layer needs to be processed in the above manner. For n terrain layers, n composite textures will be obtained one by one.
[0140] In some embodiments, the sampling position needs to be calculated in real time according to the progress of seasonal changes during game runtime. Taking pixels A and B as an example again, at real time t, the weights for blending pixels A and B are WA and WB, respectively. In the composite texture M obtained after offline processing, as long as the appropriate texture coordinates are calculated and sampled using these texture coordinates, the result of blending pixels A and B with weights WA and WB can be obtained. This is based on the principle of bilinear filtering. The principle of bilinear filtering is that it can obtain the weighted average of the color values of the four neighboring pixels near the sampling position. Therefore, in this embodiment, only one sampling is needed to obtain the weighted average of the color values of the two neighboring pixels near the sampling position, that is, the result of blending pixels A and B with weights WA and WB.
[0141] See Figure 9 , Figure 9 This is a schematic diagram of the interface of the image processing method for a virtual scene provided in this application embodiment. The two endpoints of the dashed line are the center points of pixel A and pixel B, and point M is the sampling position. Texture sampling is performed at point M to obtain the color value of point M. The color value of point M is the result of mixing pixel A and pixel B with weights WA and WB. The sampling position can be described by the distance x between the texture offset point and pixel A. The formula for calculating the texture offset point value x is x = T t t is the real-time point, and T is the time taken for the complete transformation of the virtual scene.
[0142] In some embodiments, for each terrain layer, the same texture offset point value is sampled in the composite texture obtained after offline processing to obtain the color value of the sampled location for subsequent blending calculations.
[0143] See Figure 10 , Figure 10This is a flowchart of an image processing method for a virtual scene provided in an embodiment of this application. During offline processing, in step 1001, all terrain layers are acquired; in step 1002, the Albedo map and normal map of a specific terrain layer before the seasonal change are acquired; in step 1003, the Albedo map and normal map of the same terrain layer after the seasonal change are acquired; in step 1004, the Albedo maps before and after the seasonal change are merged using a set pixel arrangement to obtain a composite Albedo map; in step 1005, the normal maps before and after the seasonal change are merged using a set pixel arrangement to obtain a composite normal map. If there are still unprocessed terrain layers, step 1002 is executed; if there are no unprocessed terrain layers, the offline processing process ends. During game operation, in step 1006, texture offset point values are calculated based on the seasonal change progress. In step 1007, composite textures of all terrain layers are obtained. In step 1008, Albedo textures are sampled based on texture offset point values. In step 1009, normal maps are sampled based on texture offset point values. If there are still unprocessed terrain layers, step 1008 is executed. If there are no unprocessed terrain layers, step 1010 is executed. In step 1010, multiple terrain layers are blended and lit based on the sampling results.
[0144] This application embodiment processes the textures of different seasons of the terrain layer offline and uses bilinear filtering to sample the Albedo texture and normal map during real-time rendering. A single sampling can obtain a result of the two seasons mixed together, which reduces the number of texture samples for a certain terrain layer by half and improves the rendering efficiency of the terrain.
[0145] The following description continues to illustrate the exemplary structure of the virtual scene image processing device 455 provided in the embodiments of this application as a software module. In some embodiments, such as Figure 2As shown, the software modules stored in the image processing apparatus 455 for the virtual scene in the memory 450 may include: an acquisition module 4551, configured to acquire an initial texture map of the terrain layer before the virtual scene is transformed, and acquire a resulting texture map of the terrain layer after the virtual scene is transformed; a synthesis module 4552, configured to insert the pixels of the resulting texture map on the basis of the initial texture map to obtain a synthesized texture map of the terrain layer, wherein two pixels at the same position in the initial texture map and the resulting texture map are adjacent in position in the synthesized texture map and form an adjacent pixel pair; a sampling module 4553, configured to determine a texture offset point for each adjacent pixel pair according to the transformation progress of the virtual scene, and perform sampling processing on the synthesized texture map of the terrain layer according to each texture offset point to obtain a texture sampling value of the terrain layer, wherein the texture sampling value is calculated based on a bilinear filtering mechanism; and a rendering module 4554, configured to perform rendering processing based on the texture sampling value of the synthesized texture map to obtain an image matching the transformation progress of the virtual scene.
[0146] In some embodiments, the acquisition module 4551 is further configured to: acquire an initial albedo map of the terrain layer before the virtual scene is transformed, acquire an initial normal map of the terrain layer before the virtual scene is transformed, and take the initial albedo map and the initial normal map as the initial texture map.
[0147] In some embodiments, the acquisition module 4551 is further configured to: acquire a resulting albedo map of the terrain layer after the virtual scene is transformed, acquire a resulting normal map of the terrain layer after the virtual scene is transformed, and take the resulting albedo map and the resulting normal map as the resulting texture map.
[0148] In some embodiments, the synthesis module 4552 is further configured to perform the following processing for a first pixel with an abscissa of n and an ordinate of m in the initial texture map: taking 2n as the abscissa of the first pixel in the synthesized texture map, and taking m as the ordinate of the first pixel in the synthesized texture map; perform the following processing for a second pixel with an abscissa of n and an ordinate of m in the resulting texture map: taking 2n+1 as the abscissa of the second pixel in the synthesized texture map, and taking m as the ordinate of the second pixel in the synthesized texture map; wherein the length of each of the initial texture map and the resulting texture map is N, the width of each of the initial texture map and the resulting texture map is M, N and M are integers greater than or equal to 2, the value range of n is 0≤n<N-1, and the value range of m is 0≤m<M-1; and generate the synthesized texture map based on the abscissa and ordinate of each first pixel in the initial texture map in the synthesized texture map, and the abscissa and ordinate of each second pixel in the resulting texture map in the synthesized texture map.
[0149] In some embodiments, the synthesis module 4552 is further configured to: perform the following processing for each adjacent pixel pair: acquire a connecting line between the first center of the first pixel and the second center of the second pixel in the adjacent pixel pair, and determine a first distance from the midpoint of the connecting line to the left edge of the synthesized map; multiply the first distance by the value of the transformation progress, and normalize the multiplication result to obtain a first corrected distance; acquire an offset distance that is positively correlated with the first corrected distance; and take a point on the connecting line that is the offset distance away from the first center as a texture offset point.
[0150] In some embodiments, the synthesis module 4552 is further configured to: perform the following processing for a first pixel with an abscissa of n and an ordinate of m in the initial map: take n as the abscissa of the first pixel in the synthesized map, and take 2m as the ordinate of the first pixel in the synthesized map; perform the following processing for a second pixel with an abscissa of n and an ordinate of m in the result map: take n as the abscissa of the second pixel in the synthesized map, and take 2m+1 as the ordinate of the second pixel in the synthesized map; wherein the length of each of the initial map and the result map is N, the width of each of the initial map and the result map is M, N and M are integers greater than or equal to 2, the value range of n is 0≤n<N-1, and the value range of m is 0≤m<M-1; generate the synthesized map based on the abscissa and ordinate of each first pixel in the synthesized map in the initial map, and the abscissa and ordinate of each second pixel in the synthesized map in the result map.
[0151] In some embodiments, the synthesis module 4552 is further configured to: perform the following processing for each adjacent pixel pair: acquire a connecting line between the first center of the first pixel and the second center of the second pixel in the adjacent pixel pair, and determine a second distance from the midpoint of the connecting line to the top edge of the synthesized map; multiply the second distance by the value of the transformation progress, and normalize the multiplication result to obtain a second corrected distance; acquire an offset distance that is positively correlated with the second corrected distance; and take a point on the connecting line that is the offset distance away from the first center as a texture offset point.
[0152] In some embodiments, the sampling module 4553 is further configured to: acquire a connecting line between the first center of the first pixel and the second center of the second pixel in the adjacent pixel pair, wherein the first pixel is a pixel of the initial map, and the second pixel is a pixel of the result map; acquire an offset distance that is positively correlated with the transformation progress; and determine a point on the connecting line that is the offset distance away from the first center as the texture offset point of the adjacent pixel pair.
[0153] In some embodiments, the sampling module 4553 is further configured to: obtain the complete transformation time of the virtual scene before determining the texture offset point of each adjacent pixel pair according to the transformation progress of the virtual scene, and obtain the duration between the real time and the start time of the scene transformation; obtain the ratio between the duration and the complete transformation time, and determine the ratio as the transformation progress.
[0154] In some embodiments, the sampling module 4553 is further configured to: perform the following processing for each composite texture of the terrain layer: sample the composite texture according to each texture offset point to obtain the color value of each texture offset point in the composite texture, and use the color value of each texture offset point as the texture sampling value of the composite texture.
[0155] In some embodiments, the sampling module 4553 is further configured to: before sampling the composite map according to each texture offset point to obtain the color value of each texture offset point in the composite map, perform the following processing for each texture offset point: obtain the first color value of the first pixel and the second color value of the second pixel in the composite map, wherein the first pixel and the second pixel are derived from the adjacent pixel pair of the corresponding texture offset point; obtain the third distance between the texture offset point and the first pixel and the fourth distance between the texture offset point and the second pixel; obtain the first weight negatively correlated with the third distance and the second weight negatively correlated with the fourth distance; obtain the first multiplication result of the first weight and the first color value, and the second multiplication result of the second weight and the second color value; and use the sum of the first multiplication result and the second multiplication result as the color value of the texture offset point.
[0156] In some embodiments, the compositing module 4552 is further configured to: insert pixels of the resulting albedo map into the initial albedo map to obtain a composite albedo map of the terrain layer; insert pixels of the resulting normal map into the initial normal map to obtain a composite normal map of the terrain layer; and use the composite albedo map and the composite normal map as the composite map of the terrain layer.
[0157] In some embodiments, the rendering module 4554 is further configured to: when there are multiple terrain layers, perform the following processing for each terrain layer: perform rendering processing based on the texture sampling values of each adjacent pixel pair in the composite texture of the terrain layer to obtain a first image that matches the transformation progress of the virtual scene; and perform fusion processing on multiple first images that correspond one-to-one with multiple terrain layers to obtain an image that matches the transformation progress of the virtual scene.
[0158] This application provides a computer program product or computer program that includes 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 virtual scene image processing method described above in this application.
[0159] This application provides a computer-readable storage medium storing executable instructions. When these executable instructions are executed by a processor, they cause the processor to perform an image processing method for a virtual scene provided in this application. For example, ... Figures 4A-4C The image processing method for the virtual scene is shown.
[0160] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EP ROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or it may be a variety of devices including one or any combination of the above-mentioned memories.
[0161] In some embodiments, executable instructions may take the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a standalone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.
[0162] As an example, executable instructions may, but do not necessarily, correspond to files in a file system. They may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple collaborating files (e.g., a file that stores one or more modules, subroutines, or code sections).
[0163] As an example, executable instructions can be deployed to execute on a single computing device, or on multiple computing devices located in one location, or on multiple computing devices distributed across multiple locations and interconnected via a communication network.
[0164] In summary, by inserting pixels of the result texture onto the initial texture in this embodiment, a composite texture of the terrain layer is obtained. Two pixels in the same position in the initial and result textures are adjacent in the composite texture and form adjacent pixel pairs. The composite texture is sampled based on the texture offset point of each adjacent pixel pair to obtain the texture sampling value of the terrain layer. Since the texture sampling value is calculated based on the bilinear filtering mechanism and the texture offset point is obtained based on the scene transformation progress, the texture sampling value of the texture offset point can accurately represent the weighted mixing result of the adjacent pixel pair and the scene transformation progress. This is equivalent to replacing two samples with a single sample, thereby improving the texture sampling efficiency during the scene transformation process.
[0165] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, and improvements made within the spirit and scope of this application are included within the scope of protection of this application.
Claims
1. An image processing method for a virtual scene, characterized in that, The method includes: Obtain the initial texture of the terrain layer before the virtual scene transformation, and obtain the resulting texture of the terrain layer after the virtual scene transformation; The resulting texture is inserted into the initial texture to obtain a composite texture of the terrain layer. In the composite texture, two pixels that are in the same position in the initial texture and the resulting texture are adjacent to each other and form an adjacent pixel pair. The texture offset point of each adjacent pixel pair is determined according to the transformation progress of the virtual scene, and the composite texture of the terrain layer is sampled according to each texture offset point to obtain the texture sampling value of each adjacent pixel pair in the composite texture, wherein the texture sampling value is calculated based on the bilinear filtering mechanism; Rendering is performed based on the texture sampling values of the synthesized texture to obtain an image that matches the transformation progress of the virtual scene.
2. The method according to claim 1, characterized in that, The process of inserting pixels of the resulting texture onto the initial texture to obtain the composite texture of the terrain layer includes: For the first pixel with an abscissa of n and a ordinate of m in the initial texture, the following processing is performed: n is used as the abscissa of the first pixel in the composite texture, and 2m is used as the ordinate of the first pixel in the composite texture; For the second pixel with horizontal coordinate n and vertical coordinate m in the result texture, the following processing is performed: n is used as the horizontal coordinate of the second pixel in the composite texture, and 2m+1 is used as the vertical coordinate of the second pixel in the composite texture; Wherein, the length of both the initial texture and the resulting texture is N, and the width of both the initial texture and the resulting texture is M, where N and M are integers greater than or equal to 2, and the range of n is... The range of values for m is ; The composite texture is generated based on the x-coordinate and y-coordinate of each first pixel in the initial texture in the composite texture, and the x-coordinate and y-coordinate of each second pixel in the result texture in the composite texture.
3. The method according to claim 1, characterized in that, The process of inserting pixels of the resulting texture onto the initial texture to obtain the composite texture of the terrain layer includes: For the first pixel with an x-coordinate of n and a y-coordinate of m in the initial texture, the following processing is performed: 2n is used as the x-coordinate of the first pixel in the composite texture, and m is used as the y-coordinate of the first pixel in the composite texture; For the second pixel with horizontal coordinate n and vertical coordinate m in the result texture, the following processing is performed: 2n+1 is used as the horizontal coordinate of the second pixel in the composite texture, and m is used as the vertical coordinate of the second pixel in the composite texture; Wherein, the length of both the initial texture and the resulting texture is N, and the width of both the initial texture and the resulting texture is M, where N and M are integers greater than or equal to 2, and the range of n is... The range of values for m is ; The composite texture is generated based on the x-coordinate and y-coordinate of each first pixel in the initial texture in the composite texture, and the x-coordinate and y-coordinate of each second pixel in the result texture in the composite texture.
4. The method according to claim 3, characterized in that, Determining the texture offset point of each adjacent pixel pair based on the transformation progress of the virtual scene includes: For each of the adjacent pixel pairs, the following processing is performed: Obtain the line connecting the first center of the first pixel and the second center of the second pixel in the adjacent pixel pair, and determine the first distance from the midpoint of the line to the left edge of the composite texture; The first distance is multiplied by the value of the transformation progress, and the multiplication result is normalized to obtain the first corrected distance. Obtain the offset distance that is positively correlated with the first corrected distance; The point on the connecting line that is at the offset distance from the first center is taken as the texture offset point.
5. The method according to claim 1, characterized in that, Determining the texture offset point of each adjacent pixel pair based on the transformation progress of the virtual scene includes: For each of the adjacent pixel pairs, the following processing is performed: Obtain the line connecting the first center of the first pixel and the second center of the second pixel in the adjacent pixel pair, wherein the first pixel is a pixel of the initial texture and the second pixel is a pixel of the result texture; Obtain the offset distance that is positively correlated with the transformation progress; The point on the connecting line whose distance from the first center is the offset distance is determined as the texture offset point of the adjacent pixel pair.
6. The method according to claim 1, 4, or 5, characterized in that, Before determining the texture offset point of each adjacent pixel pair based on the transformation progress of the virtual scene, the method further includes: Obtain the complete transformation time of the virtual scene, and obtain the duration between the real-time moment and the start time of the virtual scene transformation; Obtain the ratio between the duration and the total transformation time, and determine the ratio as the transformation progress.
7. The method according to claim 1, characterized in that, The step of sampling the composite texture of the terrain layer based on each texture offset point to obtain the texture sampling value of each adjacent pixel pair in the composite texture includes: For each composite map of the terrain layer, the following processing is performed: The composite texture is sampled based on each texture offset point to obtain the color value of each texture offset point in the composite texture, and the color value of each texture offset point is used as the texture sampling value of the composite texture.
8. The method according to claim 7, characterized in that, Before sampling the composite texture based on each texture offset point to obtain the color value of each texture offset point in the composite texture, the method further includes: For each of the texture offset points, the following processing is performed: Obtain the first color value of the first pixel and the second color value of the second pixel in the composite texture, wherein the first pixel and the second pixel are derived from adjacent pixel pairs corresponding to the texture offset point; Obtain the third distance between the texture offset point and the first pixel, and the fourth distance between the texture offset point and the second pixel; Obtain a first weight negatively correlated with the third distance and a second weight negatively correlated with the fourth distance; Obtain the first multiplication result of the first weight and the first color value, and the second multiplication result of the second weight and the second color value; The sum of the first multiplication result and the second multiplication result is used as the color value of the texture offset point.
9. The method according to claim 1, characterized in that, The process of obtaining the initial texture of the terrain layer before the virtual scene transformation includes: Obtain the initial albedo map of the terrain layer before the virtual scene transformation, and obtain the initial normal map of the terrain layer before the virtual scene transformation. Use the initial albedo map and the initial normal map as the initial map. The step of obtaining the resulting texture map of the terrain layer after the virtual scene transformation includes: Obtain the albedo map of the terrain layer after the virtual scene transformation, and obtain the normal map of the terrain layer after the virtual scene transformation. Use the albedo map and the normal map as the result map.
10. The method according to claim 9, characterized in that, The process of inserting pixels of the resulting texture onto the initial texture to obtain the composite texture of the terrain layer includes: The pixels of the resulting albedo map are inserted into the initial albedo map to obtain the composite albedo map of the terrain layer; The resulting normal map pixels are inserted into the initial normal map to obtain the composite normal map of the terrain layer; The composite albedo map and the composite normal map are used as composite maps for the terrain layer.
11. The method according to claim 1, characterized in that, The rendering process based on the texture sampling values of the synthesized texture to obtain an image that matches the transformation progress of the virtual scene includes: When there are multiple terrain layers, the following processing is performed for each terrain layer: Rendering is performed on the texture sampling values of each pair of adjacent pixels in the composite texture of the terrain layer to obtain a first image that matches the transformation progress of the virtual scene; Multiple first images corresponding one-to-one with multiple terrain layers are fused to obtain an image that matches the transformation progress of the virtual scene.
12. An image processing device for a virtual scene, characterized in that, The device includes: The acquisition module is used to acquire the initial texture of the terrain layer before the virtual scene transformation, and to acquire the result texture of the terrain layer after the virtual scene transformation. The compositing module is used to insert pixels of the result map based on the initial map to obtain a composite map of the terrain layer, wherein two pixels that are in the same position in the initial map and the result map are adjacent in the composite map and form an adjacent pixel pair; The sampling module is used to determine the texture offset point of each adjacent pixel pair according to the transformation progress of the virtual scene, and to perform sampling processing on the composite texture of the terrain layer according to each texture offset point to obtain the texture sampling value of each adjacent pixel pair in the composite texture, wherein the texture sampling value is calculated based on the bilinear filtering mechanism; The rendering module is used to perform rendering processing based on the texture sampling values of the composite texture to obtain an image that matches the transformation progress of the virtual scene.
13. The apparatus according to claim 12, characterized in that, The synthesis module is also used for: For the first pixel with an abscissa of n and a ordinate of m in the initial texture, the following processing is performed: n is used as the abscissa of the first pixel in the composite texture, and 2m is used as the ordinate of the first pixel in the composite texture; For the second pixel with horizontal coordinate n and vertical coordinate m in the result texture, the following processing is performed: n is used as the horizontal coordinate of the second pixel in the composite texture, and 2m+1 is used as the vertical coordinate of the second pixel in the composite texture; Wherein, the length of both the initial texture and the resulting texture is N, and the width of both the initial texture and the resulting texture is M, where N and M are integers greater than or equal to 2, and the range of n is... The range of values for m is ; The composite texture is generated based on the x-coordinate and y-coordinate of each first pixel in the initial texture in the composite texture, and the x-coordinate and y-coordinate of each second pixel in the result texture in the composite texture.
14. The apparatus according to claim 12, characterized in that, The synthesis module is also used for: For the first pixel with an x-coordinate of n and a y-coordinate of m in the initial texture, the following processing is performed: 2n is used as the x-coordinate of the first pixel in the composite texture, and m is used as the y-coordinate of the first pixel in the composite texture; For the second pixel with horizontal coordinate n and vertical coordinate m in the result texture, the following processing is performed: 2n+1 is used as the horizontal coordinate of the second pixel in the composite texture, and m is used as the vertical coordinate of the second pixel in the composite texture; Wherein, the length of both the initial texture and the resulting texture is N, and the width of both the initial texture and the resulting texture is M, where N and M are integers greater than or equal to 2, and the range of n is... The range of values for m is ; The composite texture is generated based on the x-coordinate and y-coordinate of each first pixel in the initial texture in the composite texture, and the x-coordinate and y-coordinate of each second pixel in the result texture in the composite texture.
15. The apparatus according to claim 14, characterized in that, The synthesis module is also used for: For each of the adjacent pixel pairs, the following processing is performed: Obtain the line connecting the first center of the first pixel and the second center of the second pixel in the adjacent pixel pair, and determine the first distance from the midpoint of the line to the left edge of the composite texture; The first distance is multiplied by the value of the transformation progress, and the multiplication result is normalized to obtain the first corrected distance. Obtain the offset distance that is positively correlated with the first corrected distance; The point on the connecting line that is at the offset distance from the first center is taken as the texture offset point.
16. The apparatus according to claim 12, characterized in that, The sampling module is also used for: Obtain the line connecting the first center of the first pixel and the second center of the second pixel in the adjacent pixel pair, wherein the first pixel is a pixel of the initial texture and the second pixel is a pixel of the result texture; Obtain the offset distance that is positively correlated with the transformation progress; The point on the connecting line whose distance from the first center is the offset distance is determined as the texture offset point of the adjacent pixel pair.
17. The apparatus according to claim 12, 15 or 16, characterized in that, Before determining the texture offset point of each adjacent pixel pair according to the transformation progress of the virtual scene, the sampling module is further configured to: Obtain the complete transformation time of the virtual scene, and obtain the duration between the real-time moment and the start time of the virtual scene transformation; Obtain the ratio between the duration and the total transformation time, and determine the ratio as the transformation progress.
18. The apparatus according to claim 12, characterized in that, The sampling module is also used for: For each composite map of the terrain layer, the following processing is performed: The composite texture is sampled based on each texture offset point to obtain the color value of each texture offset point in the composite texture, and the color value of each texture offset point is used as the texture sampling value of the composite texture.
19. The apparatus according to claim 18, characterized in that, Before sampling the composite texture according to each texture offset point to obtain the color value of each texture offset point in the composite texture, the sampling module is further configured to: For each of the texture offset points, the following processing is performed: Obtain the first color value of the first pixel and the second color value of the second pixel in the composite texture, wherein the first pixel and the second pixel are derived from adjacent pixel pairs corresponding to the texture offset point; Obtain the third distance between the texture offset point and the first pixel, and the fourth distance between the texture offset point and the second pixel; Obtain a first weight negatively correlated with the third distance and a second weight negatively correlated with the fourth distance; Obtain the first multiplication result of the first weight and the first color value, and the second multiplication result of the second weight and the second color value; The sum of the first multiplication result and the second multiplication result is used as the color value of the texture offset point.
20. The apparatus according to claim 12, characterized in that, The acquisition module is also used for: Obtain the initial albedo map of the terrain layer before the virtual scene transformation, and obtain the initial normal map of the terrain layer before the virtual scene transformation. Use the initial albedo map and the initial normal map as the initial map. Obtain the albedo map of the terrain layer after the virtual scene transformation, and obtain the normal map of the terrain layer after the virtual scene transformation. Use the albedo map and the normal map as the result map.
21. The apparatus according to claim 20, characterized in that, The synthesis module is also used for: The pixels of the resulting albedo map are inserted into the initial albedo map to obtain the composite albedo map of the terrain layer; The resulting normal map pixels are inserted into the initial normal map to obtain the composite normal map of the terrain layer; The composite albedo map and the composite normal map are used as composite maps for the terrain layer.
22. The apparatus according to claim 12, characterized in that, The rendering module is also used for: When there are multiple terrain layers, the following processing is performed for each terrain layer: Rendering is performed on the texture sampling values of each pair of adjacent pixels in the composite texture of the terrain layer to obtain a first image that matches the transformation progress of the virtual scene; Multiple first images corresponding one-to-one with multiple terrain layers are fused to obtain an image that matches the transformation progress of the virtual scene.
23. An electronic device, characterized in that, The electronic device includes: Memory, used to store executable instructions; A processor, when executing executable instructions stored in the memory, implements the image processing method for the virtual scene according to any one of claims 1 to 11.
24. A computer-readable storage medium storing executable instructions, characterized in that, When the executable instructions are executed by the processor, they implement the image processing method for the virtual scene according to any one of claims 1 to 11.
25. A computer program product comprising computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the image processing method for the virtual scene according to any one of claims 1 to 11.
Citation Information
Patent Citations
Weather rendering method and device in virtual environment, equipment and storage medium
CN112263837A
Image processing method and device, storage medium and computer equipment
CN112843697A