Image processing method, device and electronic equipment for virtual scene

By performing channel separation and compression processing on virtual scene images, the problem of poor image quality in the prior art is solved, and a higher quality compression effect is achieved.

CN115814406BActive Publication Date: 2025-08-15TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111616886.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2021-09-17
Filing Date
2021-12-27
Publication Date
2025-08-15
Estimated Expiration
2041-12-27

AI Technical Summary

Technical Problem

In the prior art, the indiscriminate compression of the channels of virtual scene images leads to excessive information loss and poor image quality after compression.

Method used

By channel separation of the object images in the virtual scene, the data of the color and transparency channels are compressed and merged, and compressed to obtain the compressed object images.

Benefits of technology

Reduces information loss during compression and improves the quality of compressed object images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115814406B_ABST
    Figure CN115814406B_ABST
Patent Text Reader

Abstract

This application provides a method, device, electronic device, and computer-readable storage medium for processing an image of a virtual scene. The method includes: determining an object image corresponding to a virtual object in the virtual scene; performing channel separation processing on the object image to obtain color data corresponding to the color channel and transparency data corresponding to the transparency channel; compressing the color data to obtain compressed color data and compressing the transparency data to obtain compressed transparency data; and performing channel merging processing on the compressed color data and the compressed transparency data to obtain a compressed object image of the object image. This application can reduce information loss during the compression process and improve the quality of the resulting compressed object image.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] Priority Statement

[0002] This application is a divisional application with application number 202111093082.5, application date September 17, 2021, and name: Image processing method, device and electronic device for virtual scene. Technical Field

[0003] The present application relates to computer technology, and in particular to a method, device, electronic device, and computer-readable storage medium for processing an image of a virtual scene. Background Art

[0004] With the rapid development of computer technology, virtual modeling technology has been widely used in game production, animation production and virtual reality (VR) and other fields. Through virtual modeling technology, virtual scenes that are different from the real world can be displayed on the screen, thereby realizing a three-dimensional and realistic scene display.

[0005] Virtual scenes contain a large number of images, so these images are often compressed to reduce the associated processing pressure. However, in the solutions provided by related technologies, all channels of the image are usually compressed indiscriminately, which leads to excessive information loss during the compression process and further poor quality of the compressed image. Summary of the Invention

[0006] The embodiments of the present application provide a method, device, electronic device, and computer-readable storage medium for processing an image of a virtual scene, which can improve the quality of the compressed object image while compressing the object image.

[0007] The technical solution of the embodiment of the present application is implemented as follows:

[0008] The present invention provides a method for processing an image of a virtual scene, including:

[0009] determining an object image corresponding to a virtual object in a virtual scene;

[0010] Performing channel separation processing on the object image to obtain color data corresponding to the color channel and transparency data corresponding to the transparency channel;

[0011] compressing the color data to obtain compressed color data, and compressing the transparency data to obtain compressed transparency data;

[0012] The compressed color data and the compressed transparency data are subjected to channel merging processing to obtain a compressed object image of the object image.

[0013] The present invention provides an image processing device for a virtual scene, comprising:

[0014] A determination module, configured to determine an object image corresponding to a virtual object in a virtual scene;

[0015] a channel separation module, configured to perform channel separation processing on the object image to obtain color data corresponding to the color channel and transparency data corresponding to the transparency channel;

[0016] a compression module, configured to compress the color data to obtain compressed color data, and compress the transparency data to obtain compressed transparency data;

[0017] The channel merging module is used to perform channel merging processing on the compressed color data and the compressed transparency data to obtain a compressed object image of the object image.

[0018] An embodiment of the present application provides an electronic device, including:

[0019] a memory for storing executable instructions;

[0020] The processor is used to implement the image processing method of the virtual scene provided in the embodiment of the present application when executing the executable instructions stored in the memory.

[0021] An embodiment of the present application provides a computer-readable storage medium storing executable instructions for causing a processor to execute instructions to implement the image processing method for a virtual scene provided in the embodiment of the present application.

[0022] The embodiments of the present application have the following beneficial effects:

[0023] The object image is subjected to channel separation processing to obtain color data of the corresponding color channel and transparency data of the corresponding transparency channel, and then the color data and transparency data are compressed separately. Since the compression processing will constrain the storage space of the data, compared with the scheme provided by the related technology that performs indiscriminate compression processing on all channels, the embodiment of the present application can reduce the information loss of color data and transparency data during the compression processing process, and improve the quality of the compressed object image finally obtained. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 is a schematic diagram of a storage space after compression provided in an embodiment of the present application;

[0025] Figure 2 It is a schematic diagram of the compression effect of the solution provided by the related art;

[0026] Figure 3Schematic diagram of the architecture of the image processing system for the virtual scene provided in an embodiment of the present application;

[0027] Figure 4 This is a schematic diagram of the architecture of a terminal device provided in an embodiment of the present application;

[0028] Figure 5 This is a schematic diagram of the principles of the virtual scene engine provided by an embodiment of the present application;

[0029] Figure 6A 1 is a flow chart of an image processing method for a virtual scene provided in an embodiment of the present application;

[0030] Figure 6B 1 is a flow chart of an image processing method for a virtual scene provided in an embodiment of the present application;

[0031] Figure 6C 1 is a flow chart of an image processing method for a virtual scene provided in an embodiment of the present application;

[0032] Figure 7 is a schematic diagram of a non-square image provided in an embodiment of the present application;

[0033] Figure 8 1 is a flow chart of an image processing method for a virtual scene provided in an embodiment of the present application;

[0034] Figure 9 is a schematic diagram of an image obtained through size expansion processing provided in an embodiment of the present application;

[0035] Figure 10 is a schematic diagram of an image obtained through size expansion and padding processing provided in an embodiment of the present application;

[0036] Figure 11 is a schematic diagram of a storage space after compression provided by an embodiment of the present application;

[0037] Figure 12 is a comparative schematic diagram of different channels provided in the embodiments of the present application;

[0038] Figure 13 This is a schematic diagram of the compression effect provided in an embodiment of the present application. DETAILED DESCRIPTION

[0039] In order to make the purpose, 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 limiting this application. All other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0040] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be 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.

[0041] In the following description, the terms "first" and "second" are used merely to distinguish similar objects and do not represent a specific ordering of the objects. It is understood that the specific order or sequence of "first" and "second" can be interchanged where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In the following description, the term "plurality" refers to at least two.

[0042] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.

[0043] Before further explaining the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.

[0044] 1) In response to: used to indicate the conditions or states on which the executed operations depend. When the dependent conditions or states are met, one or more operations executed can be in real time or with a set delay. Unless otherwise specified, there is no restriction on the order in which the multiple operations executed are executed.

[0045] 2) Virtual scene: Utilize electronic devices to output scenes that are different from the real world, and form visual perception of the virtual scene with the naked eye or the assistance of equipment, such as two-dimensional images output by a display screen, and three-dimensional images output by stereoscopic display technologies such as stereo projection, virtual reality, and augmented reality. In addition, various possible hardware can also be used to form various perceptions of the simulated real world, such as auditory perception, tactile perception, olfactory perception, and motion perception. A virtual scene can be a simulation of the real world, a semi-simulated and semi-fictional virtual environment, or a purely fictional virtual environment. The embodiment of the present application does not limit the dimension of the virtual scene, for example, it can be a three-dimensional virtual scene.

[0046] 3) Virtual Objects: These are the images of various people and objects that can interact in a virtual scene, or movable objects within the virtual scene. These movable objects can be virtual people, virtual animals, cartoon characters, etc. For example, people, animals, plants, oil drums, walls, rocks, etc. displayed in a virtual scene. A virtual scene can include multiple virtual objects, each of which has its own shape and volume and occupies a portion of the space within the virtual scene.

[0047] 4) Object image: An image used to represent the entire or partial image of a virtual object. For example, an object image can be a texture used to represent the surface details of a virtual object.

[0048] 5) Channel: A component of an image. An image can be composed of multiple channels. In an embodiment of the present application, the channels of an image may include color channels and transparency channels (also known as alpha channels). The color channel is used to store color data, and the transparency channel is used to store transparency data. It is worth noting that the type of color channel depends on the color mode adopted. For example, when the RGB color mode is adopted, the color channel may include a red channel, a green channel, and a blue channel; when the CMYK color mode is adopted, the color channel may include a cyan channel, a magenta channel, a yellow channel, and a black channel.

[0049] 6) Virtual Scene Engine: A set of codes (instructions) designed for electronic devices that output virtual scenes and recognized by the electronic device, used to control how the virtual scene is created and output. From another perspective, the virtual scene engine can refer to a virtual scene development environment that encapsulates hardware operations and image algorithms. In the embodiments of this application, the camera component and shading component in the virtual scene engine can be used to implement image processing.

[0050] For image compression, the solutions provided by related technologies usually perform indiscriminate compression processing on all channels of the image. However, since compression processing will restrict the storage space of data (such as the number of bits), this solution will cause excessive information loss during the compression process, further resulting in poor quality of the compressed image. Taking the RGBA Compressed PVRTC 4bits algorithm under the PowerVR Texture Compression (PVRTC) algorithm as an example, combined with Figure 1As shown in the figure, when compressing an image including a color channel and a transparency channel, 3 bits of space are constrained to be used to store compressed transparency data (referring to the result obtained by compressing the transparency data in the image, and the same applies below), 4 bits of space are used to store compressed red data, 4 bits of space are used to store compressed green data, and 4 bits of space are used to store compressed blue data. Therefore, due to the limitation of storage space, the color data of the RGB channels will produce a large information loss during the compression process, resulting in poor quality of the compressed image.

[0051] For ease of understanding, the present application provides the following examples: Figure 2 The schematic diagram shown in Figure 2 In the figure, image 21 is the image before compression, including the color channel and the transparency channel; image 22 is the image obtained by compressing image 21 using the solution provided by the related art. Compared with image 21, image 22 has very obvious burrs and edge contours, indicating that the quality of image 22 is poor and the compression effect of the solution provided by the related art is poor.

[0052] The present invention provides a method, apparatus, electronic device, and computer-readable storage medium for processing images of a virtual scene, which can achieve image compression while improving the quality of the resulting compressed image. The following describes exemplary applications of the electronic device provided by the present invention. The electronic device provided by the present invention can be implemented as various types of terminal devices or as a server.

[0053] See also Figure 3 , Figure 3 This is an architectural diagram of the image processing system 100 for a virtual scene provided in an embodiment of the present application. The terminal device 400 is connected to the server 200 via the network 300, wherein the network 300 can be a wide area network or a local area network, or a combination of the two.

[0054] In some embodiments, taking the electronic device as a terminal device as an example, the image processing method of the virtual scene provided in the embodiment of the present application can be implemented by the terminal device. For example, the terminal device 400 determines the object image corresponding to the virtual object in the virtual scene; performs channel separation processing on the object image to obtain color data of the corresponding color channel and transparency data of the corresponding transparency channel; compresses the color data to obtain compressed color data, and compresses the transparency data to obtain compressed transparency data; performs channel merging processing on the compressed color data and the compressed transparency data to obtain a compressed object image of the object image. The terminal device 400 can render the compressed object image to output the compressed object image with the help of graphics output hardware (such as a screen). For example, the compressed object image can be displayed in the human-computer interaction interface of a smartphone, wherein the compressed object image can produce a visual perception of the virtual scene.

[0055] In some embodiments, taking the electronic device as a server as an example, the image processing method of the virtual scene provided in the embodiments of the present application can also be implemented by the server. For example, the server 200 can perform a series of processing on the object image to obtain a compressed object image. The server 200 can also further process the compressed object image, for example, packaging the compressed object images corresponding to multiple virtual objects to obtain an installation package for the virtual scene (such as a game installation package), which is used to be deployed to the terminal device 400 so that the terminal device 400 can display the compressed object image according to the installation package.

[0056] In some embodiments, the image processing method of the virtual scene provided in the embodiments of the present application can also be implemented collaboratively by a terminal device and a server. For example, the terminal device 400 can determine the object image corresponding to the virtual object in the virtual scene and send the object image to the server 200. The server 200 performs a series of processing on the received object image to obtain a compressed object image, and sends the compressed object image to the terminal device 400 so that the terminal device 400 displays it. Alternatively, the server 200 can also send the obtained compressed color data and compressed transparency data to the terminal device 400 after performing a series of processing on the received object image, so that the terminal device 400 performs channel merging processing on the received compressed color data and compressed transparency data to obtain a compressed object image.

[0057] In some embodiments, various results involved in the image processing process (such as object images, compressed color data, compressed transparency data, compressed object images, etc.) can be stored in the blockchain. Due to the tamper-proof nature of the blockchain, the accuracy of the data in the blockchain can be guaranteed. Electronic devices can send query requests to the blockchain to query the data stored in the blockchain. For example, when it is necessary to display a compressed object image, the terminal device 400 can query the compressed object image stored in the blockchain and perform rendering processing.

[0058] In some embodiments, the terminal device 400 or the server 200 can implement the image processing method of the virtual scene provided in the embodiments of the present application by running a computer program. For example, the computer program can be a native program or software module in the operating system; it can be a native application (APP, Application), that is, a program that needs to be installed in the operating system before it can be run, such as Figure 3 The client 410 shown; it can also be a small program, that is, a program that can be run only by downloading it into a browser environment; it can also be a small program that can be embedded in any APP, which can be controlled to run or closed by the user. In short, the above-mentioned computer program can be an application, module or plug-in in any form. In the case where the computer program is a game application, the games involved include but are not limited to first-person shooting (First-Person Shooting, FPS) games, third-person shooting (Third-Personal Shooting, TPS) games, multiplayer online tactical competitive (Multiplayer Online Battle Arena, MOBA) games and multiplayer gun battle survival games, without limitation.

[0059] In some embodiments, the server 200 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. Among them, the cloud service can be an image processing service for virtual scenes for the terminal device 400 to call. The terminal device 400 can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart TV, a smart watch, etc., but is not limited to this. The terminal device and the server can be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present application.

[0060] Taking the electronic device provided in the embodiment of the present application as an example, it can be understood that in the case where the electronic device is a server, Figure 4 Some of the structures shown in FIG (such as the user interface, presentation module, and input processing module) may be omitted. Figure 4 , Figure 4 is a schematic diagram of the structure of a terminal device 400 provided in an embodiment of the present application. Figure 4 The terminal device 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 device 400 are coupled together via a bus system 440. It is understood that the bus system 440 is used to achieve connection and communication between these components. In addition to including a data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, the bus system 440 is not shown in FIG. Figure 4 Various buses are labeled as bus system 440 .

[0061] 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., where the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0062] The user interface 430 includes one or more output devices 431 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The 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.

[0063] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard drives, optical drives, etc. The memory 450 may optionally include one or more storage devices that are physically remote from the processor 410.

[0064] The memory 450 includes volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.

[0065] In some embodiments, the memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplified below.

[0066] Operating system 451, including system programs for processing various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, and driver layer, which are used to implement various basic services and process hardware-based tasks;

[0067] A network communication module 452 is used to reach other electronic devices via one or more (wired or wireless) network interfaces 420. Exemplary network interfaces 420 include Bluetooth, Wi-Fi, and Universal Serial Bus (USB).

[0068] a presentation module 453 for enabling presentation of information via one or more output devices 431 (e.g., a display screen, a speaker, etc.) associated with the user interface 430 (e.g., a user interface for operating peripheral devices and displaying content and information);

[0069] The input processing module 454 is configured to detect one or more user inputs or interactions from one of the one or more input devices 432 and to translate the detected inputs or interactions.

[0070] In some embodiments, the image processing device for the virtual scene provided in the embodiments of the present application can be implemented in a software manner. Figure 4 An image processing device 455 of a virtual scene stored in memory 450 is shown. This device can be software in the form of a program or plug-in, and includes the following software modules: a determination module 4551, a channel separation module 4552, a compression module 4553, and a channel merging module 4554. These modules are logical and can be arbitrarily combined or further separated according to the functions they implement. The functions of each module will be described below.

[0071] See also Figure 5 , Figure 5 Schematic diagram of the principle of the virtual scene engine provided by the embodiment of the present application. In the case where the virtual scene is a game virtual scene, the virtual scene engine can be a game engine, such as the Unity3D game engine. Figure 5 As shown, the virtual scene engine includes but is not limited to an editing component (such as an editor for editing / making a virtual scene), an underlying algorithm, a scene management (for managing multiple sub-scenes in a virtual scene), a sound effect (for managing the audio corresponding to the virtual scene), a script engine, a camera component, and a shading component. The image processing method of the virtual scene provided in the embodiment of the present application can be Figure 4The various modules in the image processing device 455 of the virtual scene shown call Figure 5 The implementation of the related components of the virtual scene engine shown is illustrated below with an example.

[0072] For example, the determination module 4551 is used to call the camera component in the virtual scene engine to use the camera component; the channel separation module 4552 is used to call the shading component to perform channel separation processing on the object image to obtain color data of the corresponding color channel and transparency data of the corresponding transparency channel; the compression module 4553 is used to call the shading component to compress the color data to obtain compressed color data and compress the transparency data to obtain compressed transparency data; the channel merging module 4554 is used to call the shading component to perform channel merging processing on the compressed color data and the compressed transparency data to obtain a compressed object image of the object image.

[0073] Of course, the above examples do not constitute a limitation on the embodiments of the present application. The various components included in the virtual scene engine and the calling relationship between the various modules in the virtual scene image processing device 455 and the components in the virtual scene engine can all be adjusted according to the actual application scenario.

[0074] The image processing method of the virtual scene provided by the embodiment of the present application will be described in combination with the exemplary application and implementation of the electronic device provided by the embodiment of the present application.

[0075] See also Figure 6A , Figure 6A This is a flow chart of the image processing method of the virtual scene provided by the embodiment of the present application, which will be combined with Figure 6A The steps shown are explained.

[0076] In step 101 , an object image corresponding to a virtual object in a virtual scene is determined.

[0077] Here, the object image is used to represent part or all of the image of the virtual object, for example, it can be a texture used to represent surface details of the virtual object.

[0078] It is worth noting that the embodiments of the present application do not limit the type of virtual scene; for example, it can be a game virtual scene. There is no limit on the number of virtual objects in the virtual scene; for example, it can be one or more. Furthermore, the relationship between virtual objects and object images can be one-to-one or one-to-many; for example, multiple object images can represent the same virtual object.

[0079] In some embodiments, the above-mentioned determination of the object image corresponding to the virtual object in the virtual scene may be achieved in the following manner: obtaining the object image corresponding to the virtual object through the image path corresponding to the virtual object in the virtual scene.

[0080] Here, an example of determining an object image corresponding to a virtual object is provided. For example, an object image corresponding to a virtual object can be pre-stored in an electronic device, and the correspondence between the virtual object and the image path (i.e., storage path) of the object image can be stored. During image processing, the image path corresponding to the virtual object in the virtual scene can be accessed to obtain the object image corresponding to the virtual object. In this way, the accuracy of the obtained object image can be guaranteed.

[0081] In some embodiments, the above-mentioned determination of the object image corresponding to the virtual object in the virtual scene can be achieved in the following manner: in response to the observation operation on the virtual scene, the observation range corresponding to the observation operation is determined; and the virtual object within the observation range is imaged and processed by the camera component of the virtual scene engine to obtain the object image corresponding to the virtual object.

[0082] Another example of determining an object image corresponding to a virtual object is provided herein. For example, when an observation operation for a virtual scene is received, an observation range corresponding to the observation operation is determined.

[0083] The observation operation can be performed by the user. For example, the user's observation operation can be received through a specific device (such as a keyboard, mouse, voice acquisition device, gesture acquisition device, etc.), and the corresponding observation range can be determined based on the observation operation. Taking the virtual scene of the game as an example, the user can manipulate the virtual character in the virtual scene to play the game. In this case, the manipulation operation of the virtual character (such as moving the mouse) is the observation operation. The electronic device responds to the observation operation and determines the real-time observation range (field of view) of the virtual character from the first-person perspective of the virtual character.

[0084] The observation operation may also be automatically performed by the electronic device according to a pre-set observation strategy, such as: first observe according to observation range A, and then observe according to observation range B after a period of time.

[0085] After determining the observation range, the virtual scene engine's camera component can be called to capture and process images of virtual objects within the observation range, obtaining the corresponding object image. This method supports adjusting the observation range through observation operations, which increases the flexibility of determining the object image and meets the diverse needs of actual application scenarios.

[0086] In step 102, channel separation processing is performed on the object image to obtain color data corresponding to the color channel and transparency data corresponding to the transparency channel.

[0087] For example, the object image obtained in step 101 includes a color channel and a transparency channel. In this case, to improve the image compression effect, the object image is subjected to channel separation processing to obtain color data corresponding to the color channel and transparency data corresponding to the transparency channel. Taking the case where the color channels are RGB channels as an example, the color data may include red data stored in the red channel, green data stored in the green channel, and blue data stored in the blue channel.

[0088] In some embodiments, the above-mentioned channel separation processing of the object image can be achieved in the following manner: when the virtual scene meets the compression conditions, the object image is subjected to channel separation processing; wherein the compression conditions include at least one of the following: the current sub-scene of the virtual scene belongs to the sub-scene to be compressed; wherein the sub-scene to be compressed includes at least part of the sub-scenes in the virtual scene; the number of virtual objects to be compressed in the virtual scene is greater than the number threshold; the current scene parameters of the virtual scene are greater than the scene parameter threshold; wherein the scene parameters include at least one of the interaction parameters of the virtual objects, the number of virtual objects, and the device resource usage parameters.

[0089] In an embodiment of the present application, compression conditions can be set. When the compression conditions are met, image compression is started; when the compression conditions are not met, image compression may not be performed. For example, the object image can be directly rendered to display the object image in the human-computer interaction interface.

[0090] The compression condition may include at least one of the following, which will be described separately.

[0091] 1) The current sub-scene of the virtual scene belongs to the sub-scene to be compressed, where the current sub-scene is, for example, the currently selected sub-scene or the sub-scene currently to be displayed. It is worth noting that the virtual scene includes multiple sub-scenes, and the sub-scene to be compressed includes at least some of the sub-scenes in the virtual scene. Taking a game virtual scene as an example, if there are multiple copies in the game virtual scene, each copy can correspond to a sub-scene; for another example, if there are multiple map areas in the game virtual scene, each map area can correspond to a sub-scene.

[0092] 2) Among the multiple virtual objects currently to be displayed in the virtual scene, the number of virtual objects to be compressed exceeds a threshold. The virtual objects to be compressed indicate that the corresponding object images of the virtual objects require image compression. It is worth noting that in this case, subsequent image compression can be performed for the multiple virtual objects currently to be displayed in the virtual scene, or only for the virtual object currently to be compressed in the virtual scene. The former can further reduce computing resource consumption, while the latter can improve the final display accuracy and display effect.

[0093] 3) The current scene parameter of the virtual scene is greater than the scene parameter threshold. The scene parameter includes at least one of the interaction parameter of the virtual object, the number of virtual objects, and the device resource usage parameter. The larger the scene parameter, the greater the processing pressure. The scene parameter threshold can be set accordingly according to the type of scene parameter. The virtual object here can refer to all virtual objects in general, or to a specific one or several virtual objects, such as a virtual character; the interaction parameter can include at least one of the number and execution frequency of interactive operations, and the interactive operation can include at least one of an attack operation and a collaborative operation; the device resource usage parameter can include at least one of the memory usage rate, the central processing unit (CPU) usage rate, and the graphics processing unit (GPU) usage rate of the electronic device.

[0094] Through the above method, when the compression conditions are met, it is proved that the processing pressure is large, so image compression is turned on, thereby reducing the overhead of computing resources; when the compression conditions are not met, it is proved that the processing pressure is within an acceptable range, so image compression can be omitted, thereby improving the final display accuracy and display effect.

[0095] In some embodiments, between any steps, it also includes: performing at least one of the following processing: in response to a compression configuration operation on at least part of the virtual objects in the virtual scene, determining at least part of the virtual objects as virtual objects to be compressed; based on virtual object parameters corresponding to the multiple virtual objects in the virtual scene, screening multiple virtual objects to obtain virtual objects to be compressed; wherein the virtual object parameters include at least one of volume and complexity.

[0096] In the embodiment of the present application, the virtual object to be compressed may be determined by at least one of the following two methods.

[0097] 1) In response to a compression configuration operation for at least a portion of virtual objects in a virtual scene, the at least a portion of the virtual objects is determined as virtual objects to be compressed. In this way, it is possible to support personnel related to the virtual scene (such as developers) to manually configure the virtual objects to be compressed. For example, some virtual objects that have little impact on the picture effect can be configured as virtual objects to be compressed, thereby reducing the computing resource consumption of the electronic device while ensuring the picture effect; for another example, some virtual objects that require more computing resources to display can be configured as virtual objects to be compressed, thereby significantly reducing the computing resource consumption of the electronic device.

[0098] 2) Obtain virtual object parameters corresponding to multiple virtual objects in the virtual scene (not limited to the virtual object currently to be displayed, for example, it can refer to all virtual objects), and filter the multiple virtual objects according to the virtual object parameters to obtain virtual objects to be compressed, wherein the virtual object parameters include at least one of volume and complexity. The larger the virtual object parameter corresponding to the virtual object, the more difficult it is to display the virtual object and the more computing resources consumed. Therefore, the purpose of the filtering process can be to filter out a batch of virtual objects with the largest virtual object parameters as virtual objects to be compressed. For example, during the filtering process, virtual objects can be selected in order from large to small in terms of virtual object parameters, and the selected virtual objects are used as virtual objects to be compressed until the number of selected virtual objects reaches the screening number threshold, or the ratio between the number of selected virtual objects and the total number of all virtual objects reaches a set ratio. In this way, the virtual objects to be compressed can be automatically determined, reducing labor costs.

[0099] The above two methods can improve the flexibility of determining the virtual objects to be compressed, and at least one of the methods can be selected according to the needs of actual application scenarios.

[0100] In some embodiments, the virtual scene includes multiple sub-scenes, and between any steps, it also includes: performing at least one of the following processing: in response to the compression configuration operation for at least part of the sub-scenes in the virtual scene, determining at least part of the sub-scenes as sub-scenes to be compressed; based on the historical scene parameters corresponding to the multiple sub-scenes, screening the multiple sub-scenes to obtain the sub-scenes to be compressed.

[0101] The embodiment of the present application provides the following two methods to determine the sub-scene to be compressed.

[0102] 1) In response to the compression configuration operation for at least part of the sub-scene in the virtual scene, the at least part of the sub-scene is determined as the sub-scene to be compressed. The relevant personnel of the virtual scene can configure each sub-scene in the virtual scene separately, that is, whether to configure it as a sub-scene to be compressed. For example, a sub-scene (such as a large copy or a large map area) is designed to accommodate a large number of virtual objects, and the processing pressure during display is very large, then the sub-scene can be configured as a sub-scene to be compressed. In this way, the degree of freedom in determining the sub-scene to be compressed can be improved, and relevant personnel can be supported to configure according to actual design requirements.

[0103] 2) Based on the historical scene parameters corresponding to the multiple sub-scenes, the multiple sub-scenes are screened to obtain the sub-scenes to be compressed. For example, for each sub-scene in the virtual scene, the scene parameters within the historical time period are obtained as the historical scene parameters. Then, the sub-scenes corresponding to the historical scene parameters that are greater than the scene parameter threshold can be used as the sub-scenes to be compressed; or, the multiple sub-scenes can be sorted in descending order according to the historical scene parameters, and the sub-scenes that are in the TOP K after sorting can be used as the sub-scenes to be compressed, or the sub-scenes that are in the top L% after sorting can be used as the sub-scenes to be compressed, where K is an integer greater than 0, and L is a number greater than 0 and less than 100. This method refers to the historical experience of displaying virtual scenes and can automatically determine the sub-scenes to be compressed, thereby reducing labor costs.

[0104] The above two methods can be applied either one or in combination to improve flexibility.

[0105] In some embodiments, the above-mentioned channel separation processing of the object image can be achieved in the following manner: storing the object image in an image buffer; and performing channel separation processing on the object image in the image buffer by a shading component of a virtual scene engine.

[0106] The embodiment of the present application can be implemented in combination with a virtual scene engine. First, the object image is stored in an image buffer, and then the channel separation processing is performed on the object image in the image buffer through the shading component of the virtual scene engine.

[0107] It's worth noting that a buffer is a storage space in memory or video memory used to store specific data. For ease of distinction, the buffer dedicated to storing object images is named the image buffer. A shading component, also known as a shader, is an editable program used to shade images and perform 3D graphics calculations. Because shading components are editable, logic related to channel separation processing can be pre-added to them (this logic can be expressed in code), enabling them to perform channel separation processing.

[0108] The above method integrates the channel separation processing capability into the virtual scene engine, thereby improving the simplicity and ease of use of the channel separation processing.

[0109] In step 103, the color data is compressed to obtain compressed color data, and the transparency data is compressed to obtain compressed transparency data.

[0110] After the color data and transparency data are obtained through channel separation, the color data is compressed to obtain compressed color data, and the transparency data is compressed to obtain compressed transparency data. The compression algorithm used in the compression process is not limited, and can be, for example, a PVRTC algorithm.

[0111] Since compression processing will restrict the storage space of data (such as the number of bits), compared with the solution provided by the related technology that performs indiscriminate compression processing on all channels of the image, the embodiment of the present application can expand the storage space of compressed color data by compressing color data and transparency data separately, that is, reducing the information loss of color data during the compression process.

[0112] In some embodiments, the aforementioned compression processing of color data to obtain compressed color data and compression processing of transparency data to obtain compressed transparency data can be achieved by compressing the color data to obtain compressed color data and compressing the transparency data to obtain compressed transparency data via the shading component of the virtual scene engine. Here, compression processing-related logic can be pre-added to the shading component to enable the shading component to perform compression processing. Of course, compression processing is not limited to being implemented via the shading component.

[0113] In step 104 , the compressed color data and the compressed transparency data are subjected to channel merging processing to obtain a compressed object image of the object image.

[0114] After compressing the color data and transparency data separately, the resulting compressed color data and compressed transparency data are channel-merged to obtain a compressed object image of the object image. The compressed object image is the result of image compression of the object image. Compared to the object image, the compressed object image occupies less storage space and consumes fewer computing resources when displayed. At the same time, the image quality is not excessively degraded. In other words, the embodiment of the present application can ensure the quality of the compressed image to a certain extent. The compressed object image and the object image have the same size.

[0115] In some embodiments, the above-mentioned determination of the object image corresponding to the virtual object in the virtual scene can be achieved in the following manner: obtaining the object image corresponding to the virtual object through the image path corresponding to the virtual object in the virtual scene; after step 104, it also includes: updating the format information in the image path according to the compression format information corresponding to the compression processing to obtain a new image path; wherein the new image path is used to store the compressed object image.

[0116] Here, the image path corresponding to the virtual object includes format information of the object image corresponding to the virtual object. The format information is the format of the object image before image compression. For example, the format information includes but is not limited to Tagged GrAphics (TGA) format, Joint Photographic Experts Group (JPEG) format, and Portable Network Graphics (PNG) format.

[0117] While the target image is being compressed, the format information in the image path can be updated based on the compression format information corresponding to the compression process to obtain a new image path for storing the target image. The compression format information depends on the compression algorithm used in the compression process. For example, when the PVRTC algorithm is used, the compression format information is in PVR format. This approach allows for adaptive updating of the image path during image compression, ensuring that the target image can be retrieved based on the new image path for subsequent display.

[0118] It is worth noting that the new image path can be used to replace the original image path, that is, the embodiment of the present application can only store the compressed object image and discard the original object image. In some cases, the new image path and the original image path can also exist at the same time, that is, the embodiment of the present application can store the compressed object image and the original object image at the same time.

[0119] In some embodiments, the aforementioned channel merging of compressed color data and compressed transparency data can be achieved by performing channel merging on the compressed color data and compressed transparency data via a shading component of the virtual scene engine. Here, the relevant logic for channel merging can be pre-added to the shading component to enable the shading component to perform channel merging. Of course, channel merging is not limited to being implemented via the shading component.

[0120] In some embodiments, after step 104 , the method further includes: rendering the compressed object image in the image buffer by using a shading component to display the compressed object image in the human-computer interaction interface.

[0121] For example, the compressed object image in the image buffer can be rendered to the human-computer interaction interface (i.e., screen) through the shading component in the virtual scene engine for display in the human-computer interaction interface. This makes it easier for relevant personnel to view the effect of image compression. Of course, the usefulness of displaying compressed object images is not limited to this.

[0122] In some embodiments, after step 104, it also includes: when the virtual scene engine supports rendering images that comply with the compression format information, the compressed object image is rendered by the virtual scene engine to display the compressed object image in the human-computer interaction interface; between any steps, it also includes: when the virtual scene engine does not support rendering images that comply with the compression format information, the object image is rendered by the virtual scene engine to display the object image in the human-computer interaction interface.

[0123] Here, some virtual scene engines can support rendering images that comply with compression format information, while other virtual scene engines cannot support rendering images that comply with compression format information, for example, they only support rendering images that comply with TGA format, JPEG format or PNG format.

[0124] When a virtual scene engine supports rendering images that conform to compression format information, the virtual scene engine (e.g., a shading component within the virtual scene engine) can render the compressed object image to display it in the human-computer interaction interface. This allows personnel to better understand the effects of image compression and facilitates decisions, such as whether to replace the object image based on the compressed object image or adopt a different compression algorithm.

[0125] When the virtual scene engine does not support rendering images that conform to the compression format information, the virtual scene engine (such as the shading component in the virtual scene engine) renders the object image to display the object image in the human-computer interaction interface. This facilitates relevant personnel to make relevant judgments, such as whether to compress the displayed object image. For example, when the displayed object image is relatively important and has a significant impact on the user experience, it can be chosen not to compress the object image to ensure the best picture quality.

[0126] In some embodiments, after step 104, the method further includes: packaging compressed object images corresponding to multiple virtual objects in the virtual scene to obtain an installation package corresponding to the virtual scene.

[0127] Here, after the compressed object image is obtained through image compression, the compressed object images corresponding to multiple virtual objects (e.g., all virtual objects) in the virtual scene can be packaged to obtain an installation package corresponding to the virtual scene (e.g., a game installation package). Other electronic devices can download and install the installation package, thereby displaying the compressed object images in the installation package, that is, outputting the virtual scene, thereby reducing the workload of the electronic device.

[0128] It is worth noting that the installation package can also simultaneously include object images corresponding to multiple virtual objects in the virtual scene. For an electronic device that downloads and installs the installation package, it can choose to display the object image or compressed object image corresponding to the virtual object based on the device resource usage parameter of the electronic device itself. For example, when the device resource usage parameter is greater than the first parameter threshold, it proves that the processing pressure of the electronic device is large, so in order to reduce the burden, the compressed object image corresponding to the virtual object can be displayed; when the device resource usage parameter is less than or equal to the second parameter threshold, it proves that the processing pressure of the electronic device is small, so in order to improve the picture effect, the object image corresponding to the virtual object can be displayed, wherein the first parameter threshold is greater than the second parameter threshold.

[0129] In some embodiments, after step 103, the method further includes: packaging the compressed color data and the compressed transparency data corresponding to the multiple virtual objects in the virtual scene to obtain an installation package corresponding to the virtual scene.

[0130] Here, another method for generating an installation package is provided. For example, the compressed color data and compressed transparency data corresponding to multiple virtual objects in a virtual scene can be packaged and processed to obtain an installation package corresponding to the virtual scene. In this way, the generation efficiency of the installation package can be improved, and the rapid deployment (installation) of the installation package can be facilitated. Other electronic devices can download and install the installation package, and when it is necessary to output the virtual scene, the compressed color data and compressed transparency data (referring to the compressed color data and compressed transparency data corresponding to the same virtual object) in the installation package are subjected to channel merging processing, and the compressed object image obtained by the channel merging processing is displayed.

[0131] It is worth noting that the installation package may also include color data and transparency data corresponding to multiple virtual objects in the virtual scene. For an electronic device that downloads and installs the installation package, it is possible to select a display object image or a compressed object image based on the device resource usage parameter of the electronic device itself. For example, when the device resource usage parameter is greater than a first parameter threshold, it is proved that the processing pressure of the electronic device is large. Therefore, in order to reduce the burden, the compressed color data and compressed transparency data in the installation package can be channel-merged, and the compressed object image obtained by the channel merging process can be displayed; when the device resource usage parameter is less than or equal to a second parameter threshold, it is proved that the processing pressure of the electronic device is small. Therefore, in order to improve the picture effect, the color data and transparency data in the installation package (referring to the color data and transparency data corresponding to the same virtual object) can be channel-merged, and the object image obtained by the channel merging process can be displayed.

[0132] like Figure 6AAs shown, the embodiment of the present application compresses the color data and the transparency data separately, thereby effectively reducing the information loss during the compression process and ensuring the quality of the obtained compressed object image.

[0133] In some embodiments, see Figure 6B , Figure 6B This is a flow chart of the image processing method for a virtual scene provided by an embodiment of the present application. Figure 6A Step 102 shown can be implemented through steps 201 to 202, which will be described in conjunction with each step.

[0134] In step 201 , a color extraction process is performed on a color channel of an object image to obtain a color image; wherein the color image includes color data of color channels corresponding to a plurality of pixels in the object image.

[0135] Here, the object image may be subjected to color extraction processing for color channels, that is, color data of the color channels corresponding to each pixel in the object image may be extracted to form a color image, wherein the color image and the object image have the same size.

[0136] In step 202 , a transparency extraction process is performed on the object image with respect to the transparency channel to obtain a transparency image; wherein the transparency image includes transparency data of the transparency channels corresponding to a plurality of pixels in the object image.

[0137] Similarly, the transparency channel of the object image can be subjected to a transparency extraction process, that is, the transparency data of each pixel in the object image corresponding to the transparency channel is extracted to form a transparency image, wherein the transparency image has the same size as the object image.

[0138] exist Figure 6B middle, Figure 6A Before step 103 shown, the color image may be size-expanded in step 203 to obtain an expanded color image having a size that meets a set size ratio; wherein the expanded color image includes a first area corresponding to the color image and a second area different from the first area.

[0139] Here, the compression target is an image that meets a set size ratio. The set size ratio depends on the compression algorithm used for the compression process. For example, for the PVRTC algorithm, the size ratio is set to 1:1, that is, the processing target is a square image.

[0140] Generally speaking, during the design phase of an object image, due to considerations such as development costs, the design may not strictly adhere to a set size ratio. Therefore, the color image obtained in step 201 may not conform to the set size ratio. To address this situation, the color image can be size-expanded to obtain an expanded color image whose size conforms to the set size ratio. The goal of the size expansion process can be to minimize the size change; the expanded color image includes a first region corresponding to the color image and a second region distinct from the first region.

[0141] For example, if the size ratio is set to 1:1, and the size of a color image is (height, width), and height = 2*width, then the size expansion process may involve adding a second region of size (height, width) in the width direction of the color image to obtain an expanded color image, and the region occupied by the color image in the expanded color image is the first region. For another example, if the size of a color image is (height, width), and width = 2*height, then the size expansion process may involve adding a second region of size (height, width) in the height direction of the color image to obtain an expanded color image, and the region occupied by the color image in the expanded color image is the first region.

[0142] In step 204 , the transparency image is filled into the second region of the expanded color image.

[0143] Here, the transparency image can be filled into the second area of the expanded color image. In this way, only the expanded color image needs to be compressed, which can minimize the computing resource consumption of the electronic device.

[0144] exist Figure 6B middle, Figure 6A Step 103 shown can be implemented through steps 205 to 206, which will be described in conjunction with each step.

[0145] In step 205 , the color data in the first region of the expanded color image is compressed to obtain compressed color data.

[0146] Here, the first region of the expanded color image corresponds to the color image, and therefore, the color data in the first region is compressed to obtain compressed color data.

[0147] In step 206 , the transparency data in the second region of the expanded color image is compressed to obtain compressed transparency data.

[0148] Here, the second region of the expanded color image corresponds to the transparency image. Therefore, the transparency data in the second region is compressed to obtain compressed transparency data. In this way, the compressed color data and the compressed transparency data can be stored in the same image, which can reduce the computing resources (such as memory) occupied by the electronic device.

[0149] like Figure 6B As shown, the embodiment of the present application aggregates the color image and the transparency image into the same image and performs compression processing, which can minimize the consumption of computing resources of the electronic device.

[0150] In some embodiments, see Figure 6C , Figure 6C This is a flow chart of the image processing method for a virtual scene provided by an embodiment of the present application. Figure 6A The illustrated step 102 can be implemented through steps 301 to 302 , which will be described in conjunction with each step.

[0151] In step 301 , a color extraction process is performed on a color channel of an object image to obtain a color image; wherein the color image includes color data of color channels corresponding to a plurality of pixels in the object image.

[0152] The implementation details of step 301 can be found in the above step 201 and will not be described in detail here.

[0153] In step 302 , a transparency extraction process is performed on the transparency channel of the object image to obtain a transparency image; wherein the transparency image includes transparency data of the transparency channels corresponding to a plurality of pixels in the object image.

[0154] The implementation details of step 302 can be found in the above step 202 and will not be described in detail here.

[0155] exist Figure 6C middle, Figure 6A Before step 103 shown, the color image may be size-expanded in step 303 to obtain an expanded color image having a size that meets a set size ratio.

[0156] When the compression processing targets an image that meets a set size ratio, if the color image does not meet the set size ratio, the color image may be size-expanded to obtain an expanded color image whose size meets the set size ratio.

[0157] In step 304 , the transparency image is size-expanded to obtain an expanded transparency image having a size that meets a set size ratio.

[0158] Similarly, the transparency image may be expanded to obtain an expanded transparency image having a size that meets a set size ratio.

[0159] exist Figure 6C middle, Figure 6A Step 103 shown can be implemented through steps 305 to 306, which will be described in conjunction with each step.

[0160] In step 305, the color data in the expanded color image is compressed to obtain compressed color data.

[0161] Here, the compression process may be performed on the two images respectively. For example, the color data in the expanded color image may be compressed to obtain compressed color data.

[0162] In step 306 , the transparency data in the expanded transparency image is compressed to obtain compressed transparency data.

[0163] Similarly, the transparency data in the expanded transparency image is compressed to obtain compressed transparency data. In this way, the compressed color data and the compressed transparency data are stored in different images respectively.

[0164] like Figure 6C As shown, the embodiment of the present application can reduce the consumption of computing resources of electronic devices to a certain extent by compressing different images.

[0165] Below, we will explain the exemplary application of the embodiment of the present application in actual application scenarios. For ease of understanding, we will take the game virtual scene as an example. For the game virtual scene, the PVRTC algorithm can be used to compress images (such as textures), thereby reducing the size of the final packaged game installation package and reducing memory consumption. However, the PVRTC algorithm has the following disadvantages: 1) It requires that the width and height of the image must be equal (that is, a square image), which is not applicable to Figure 7 The non-square image shown, where Figure 7 The image shown is a whole image; 2) The width and height of the image must be a power of 2; 3) After compressing an image with an alpha channel, the image quality will be greatly reduced, such as Figure 2 shown.

[0166] In view of this, the embodiment of the present application optimizes the image processing process based on the PVRTC algorithm, so as to achieve image compression while improving the quality of the compressed image. Figure 8The flowchart of image processing shown takes the RGBA Compressed PVRTC 4-bits algorithm as an example. Of course, the PVRTC algorithm is not limited to RGBA Compressed PVRTC 4-bits, and can also be RGB Compressed PVRTC 2-bits, RGBA Compressed PVRTC 2-bits, RGB Compressed PVRTC 4-bits, etc.

[0167] 1) Select an image (corresponding to the object image mentioned above). For example, the game developer may select any image in the game virtual scene.

[0168] 2) Strip the Alpha channel. When the selected image includes both RGB channels and Alpha channels, the Alpha channel can be stripped out. This allows for compression processing of the RGB channels and the Alpha channels separately. Here, the Shader in the virtual scene engine (such as the Unity3D engine) can be modified accordingly. For example, in the Shader, MainTex can be set to represent the color data corresponding to the RGB channels in the image, and AlphaTex can be used to represent the transparency data corresponding to the Alpha channel in the image. In the frag stage, the color data can be extracted from MainTex to form a color image, and the transparency data can be extracted from AlphaTex to form a transparency image.

[0169] 3) Size expansion and compression. In many game projects, the width and height of images are not equal. If the width and height are restricted when creating images, it will inevitably lead to increased development costs and cumbersome image production. It may also cause image filling to be undersaturated (for example, the image includes unnecessary information that is simply used to expand the size), further leading to a series of problems such as larger game installation packages and increased memory usage.

[0170] Therefore, in the embodiment of the present application, the requirements of the RGBACompressedPVRTC 4-bits algorithm can be met by size expansion. Since the width and height of the image are usually powers of 2, it is only necessary to consider whether to expand the height or the width during size expansion. Figure 7 Taking the image with a size of 1024*512 (width is 1024, height is 512) as an example, during the size expansion process, the height of the extracted color image can be expanded to 1024 to obtain an expanded color image, such as Figure 9 Similarly, the expanded transparency image can be obtained.

[0171] Figure 7The image shown has a memory footprint of 2 megabytes (MB). After stripping the alpha channel, resizing, and compressing, the resulting compressed image has a total memory footprint of 1 MB. The compressed image includes the image obtained by compressing the expanded color image (which stores compressed color data) and the image obtained by compressing the expanded transparency image (which stores compressed transparency data), each of which occupies 0.5 MB of memory. Thus, the memory footprint of the compressed image is reduced by half compared to the original image.

[0172] On this basis, the embodiment of the present application can be further optimized, that is, the transparency image can be filled into the expanded area of the expanded color image (corresponding to the second area above), and the image obtained after filling is as follows: Figure 10 As shown in the figure, a single image can be compressed, and the memory occupied by the compressed image is only 0.5MB, which is 1 / 4 of the memory occupied by the original image.

[0173] It is worth noting that in the virtual scene of the game, the size of the designed image usually includes three cases: width=height, width=2*height and height=2*width. Therefore, it can effectively support the above-mentioned size expansion processing and filling of transparent images.

[0174] It is worth noting that for an image (or a region in an image) without an alpha channel, such as Figure 11 As shown, when the compression processing is performed using the RGBA Compressed PVRTC 4-bits algorithm, 5 bits of storage space can be used to store the red channel data, 5 bits of storage space can be used to store the green channel data, and 4 bits of storage space can be used to store the blue channel data. Therefore, compared with the solutions provided by related technologies, the embodiments of the present application can reduce the information loss during the compression process and improve the quality of the compressed image. Of course, the above storage methods are only examples, and the storage space (such as the number of bits) of each channel after compression can be adjusted according to the actual application scenario. In addition, for images without RGB channels, 3 bits or other sizes of storage space can be used to store the Alpha channel data.

[0175] After the compression process is completed, the compressed color data and compressed transparency data can be channel-merged to obtain a compressed image (corresponding to the compressed object image above). The compressed image can be used to be packaged into the game installation package, which can effectively reduce the size of the game installation package.

[0176] For ease of understanding, the present application also shows Figure 12 , Figure 12 The left side is the image obtained by compressing the expanded color image. Figure 12 The right side is the image obtained by compressing the expanded transparency image. Figure 12 The "+" sign shown indicates channel merging processing.

[0177] In addition, it also provides Figure 13 The comparative diagram shown in FIG. Figure 13 The image 131 shown is the image selected initially, and the image 132 is the compressed image obtained after compressing the image 131 using the solution provided in the embodiment of the present application. It can be seen that the solution provided in the embodiment of the present application can reduce the loss of image quality while achieving image compression, thereby ensuring a good picture effect.

[0178] The following continues to describe the exemplary structure of the virtual scene image processing device 455 provided in the embodiment of the present application implemented as a software module. In some embodiments, such as Figure 4 As shown, the software modules in the image processing device 455 of the virtual scene stored in the memory 450 may include: a determination module 4551, used to determine the object image corresponding to the virtual object in the virtual scene; a channel separation module 4552, used to perform channel separation processing on the object image to obtain color data of the corresponding color channel and transparency data of the corresponding transparency channel; a compression module 4553, used to compress the color data to obtain compressed color data, and compress the transparency data to obtain compressed transparency data; a channel merging module 4554, used to perform channel merging processing on the compressed color data and the compressed transparency data to obtain a compressed object image of the object image.

[0179] In some embodiments, the channel separation module 4552 is further used to: perform color extraction processing on the object image for the color channel to obtain a color image; wherein the color image includes color data of the color channels corresponding to multiple pixels in the object image; perform transparency extraction processing on the object image for the transparency channel to obtain a transparency image; wherein the transparency image includes transparency data of the transparency channels corresponding to multiple pixels in the object image.

[0180] In some embodiments, the processing target of the compression processing is an image that conforms to a set size ratio; the image processing device 455 of the virtual scene also includes an expansion module, which is used to: perform size expansion processing on the color image to obtain an expanded color image whose size conforms to the set size ratio; wherein the expanded color image includes a first area corresponding to the color image, and a second area different from the first area; fill the transparency image into the second area of the expanded color image; the compression module 4553 is also used to: compress the color data in the first area of the expanded color image to obtain compressed color data; compress the transparency data in the second area of the expanded color image to obtain compressed transparency data.

[0181] In some embodiments, the processing target of the compression processing is an image that meets the set size ratio; the image processing device 455 of the virtual scene also includes an expansion module, which is used to: perform size expansion processing on the color image to obtain an expanded color image whose size meets the set size ratio; perform size expansion processing on the transparency image to obtain an expanded transparency image whose size meets the set size ratio; the compression module 4553 is also used to: perform compression processing on the color data in the expanded color image to obtain compressed color data; perform compression processing on the transparency data in the expanded transparency image to obtain compressed transparency data.

[0182] In some embodiments, the channel separation module 4552 is further used to: perform channel separation processing on the object image when the virtual scene meets the compression conditions; wherein the compression conditions include at least one of the following: the current sub-scene of the virtual scene belongs to the sub-scene to be compressed; wherein the sub-scene to be compressed includes at least part of the sub-scenes in the virtual scene; the number of virtual objects to be compressed in the virtual scene is greater than the number threshold; the current scene parameters of the virtual scene are greater than the scene parameter threshold; wherein the scene parameters include at least one of the interaction parameters of the virtual objects, the number of virtual objects, and the device resource usage parameters.

[0183] In some embodiments, the image processing device 455 of the virtual scene also includes a conditional configuration module for performing at least one of the following processing: in response to a compression configuration operation on at least part of the virtual objects in the virtual scene, determining at least part of the virtual objects as virtual objects to be compressed; screening multiple virtual objects according to virtual object parameters corresponding to the multiple virtual objects in the virtual scene to obtain virtual objects to be compressed; wherein the virtual object parameters include at least one of volume and complexity.

[0184] In some embodiments, the virtual scene includes multiple sub-scenes; the conditional configuration module is further used to perform at least one of the following processing: in response to a compression configuration operation for at least part of the sub-scenes in the virtual scene, determining at least part of the sub-scenes as sub-scenes to be compressed; and screening the multiple sub-scenes according to the historical scene parameters corresponding to the multiple sub-scenes to obtain the sub-scenes to be compressed.

[0185] In some embodiments, the determination module 4551 is further used to: obtain the object image corresponding to the virtual object through the image path corresponding to the virtual object in the virtual scene; the image processing device 455 of the virtual scene also includes a path update module, which is used to update the format information in the image path according to the compression format information corresponding to the compression processing to obtain a new image path; wherein the new image path is used to store the compressed object image.

[0186] In some embodiments, the determination module 4551 is further used to: determine the observation range corresponding to the observation operation in response to the observation operation on the virtual scene; perform image acquisition and processing on the virtual object within the observation range through the camera component of the virtual scene engine to obtain the object image corresponding to the virtual object.

[0187] In some embodiments, the channel separation module 4552 is also used to: store the object image in the image buffer; perform channel separation processing on the object image in the image buffer through the shading component of the virtual scene engine; the image processing device 455 of the virtual scene also includes a rendering module, which is used to render the compressed object image in the image buffer through the shading component to display the compressed object image in the human-computer interaction interface.

[0188] In some embodiments, the compression processing corresponds to the compression format information; the rendering module is also used for: when the virtual scene engine supports rendering images that conform to the compression format information, the compressed object image is rendered by the virtual scene engine to display the compressed object image in the human-computer interaction interface; when the virtual scene engine does not support rendering images that conform to the compression format information, the object image is rendered by the virtual scene engine to display the object image in the human-computer interaction interface.

[0189] In some embodiments, the image processing device 455 of the virtual scene also includes a packaging module for performing any of the following processing: packaging the compressed object images corresponding to multiple virtual objects in the virtual scene to obtain an installation package corresponding to the virtual scene; packaging the compressed color data and compressed transparency data corresponding to multiple virtual objects in the virtual scene to obtain an installation package corresponding to the virtual scene.

[0190] The present invention provides a computer program product or computer program, which includes computer instructions (i.e., executable instructions) stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the virtual scene image processing method described in the present invention.

[0191] An embodiment of the present application provides a computer-readable storage medium having executable instructions stored therein. When the executable instructions are executed by a processor, the processor will execute the image processing method of the virtual scene provided by the embodiment of the present application.

[0192] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface storage, optical disk, or CD-ROM; or various devices including one or any combination of the above memories.

[0193] In some embodiments, executable instructions may be in 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 stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.

[0194] As an example, executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinating files (e.g., files storing one or more modules, subroutines, or code portions).

[0195] As an example, executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed across multiple sites and interconnected by a communication network.

[0196] The above are merely examples of the present application and are not intended to limit the scope of protection of the present application. Any modifications, equivalent replacements, and improvements made within the spirit and scope of the present application are included in the scope of protection of the present application.

Claims

1. A method for processing an image of a virtual scene, characterized in that: The method comprises: determining an object image corresponding to a virtual object in a virtual scene; When the virtual scene satisfies a compression condition, channel separation processing is performed on the object image to obtain color data of a corresponding color channel and transparency data of a corresponding transparency channel, wherein the compression condition includes at least one of the following: The current sub-scene of the virtual scene belongs to a sub-scene to be compressed, and the sub-scene to be compressed includes at least part of the sub-scenes in the virtual scene; the number of virtual objects to be compressed in the virtual scene is greater than a number threshold; the current scene parameter of the virtual scene is greater than a scene parameter threshold, and the scene parameter includes at least one of an interaction parameter of a virtual object, the number of virtual objects, and a device resource usage parameter; compressing the color data to obtain compressed color data, and compressing the transparency data to obtain compressed transparency data; The compressed color data and the compressed transparency data are subjected to channel merging processing to obtain a compressed object image of the object image.

2. The method according to claim 1, characterized in that The performing channel separation processing on the object image to obtain color data corresponding to the color channel and transparency data corresponding to the transparency channel includes: Performing color extraction processing on the object image for the color channel to obtain a color image; wherein the color image includes color data of a plurality of pixels in the object image corresponding to the color channel; The object image is subjected to a transparency extraction process for the transparency channel to obtain a transparency image; wherein the transparency image includes transparency data of a plurality of pixels in the object image corresponding to the transparency channel.

3. The method according to claim 2, characterized in that The compression processing target is an image that meets a set size ratio; before compressing the color data to obtain compressed color data, the method further includes: Performing size expansion processing on the color image to obtain an expanded color image having a size that conforms to the set size ratio; wherein the expanded color image includes a first area corresponding to the color image and a second area different from the first area; Filling the second area of the expanded color image with the transparency image; The compressing the color data to obtain compressed color data and compressing the transparency data to obtain compressed transparency data includes: compressing the color data in the first area of the expanded color image to obtain compressed color data; The transparency data in the second area of the expanded color image is compressed to obtain compressed transparency data.

4. The method according to claim 2, characterized in that The compression processing target is an image that meets a set size ratio; before compressing the color data to obtain compressed color data, the method further includes: Performing size expansion processing on the color image to obtain an expanded color image whose size meets the set size ratio; Performing size expansion processing on the transparency image to obtain an expanded transparency image whose size meets the set size ratio; The compressing the color data to obtain compressed color data and compressing the transparency data to obtain compressed transparency data includes: compressing the color data in the expanded color image to obtain compressed color data; The transparency data in the expanded transparency image is compressed to obtain compressed transparency data.

5. The method according to claim 1, wherein The method further comprises: Perform at least one of the following actions: In response to a compression configuration operation on at least a portion of virtual objects in the virtual scene, determining the at least a portion of virtual objects as virtual objects to be compressed; The plurality of virtual objects in the virtual scene are screened according to virtual object parameters respectively corresponding to the plurality of virtual objects to obtain virtual objects to be compressed; wherein the virtual object parameters include at least one of volume and complexity.

6. The method according to claim 1, characterized in that The virtual scene includes a plurality of sub-scenes; and the method further includes: Perform at least one of the following actions: In response to a compression configuration operation on at least part of the sub-scenes in the virtual scene, determining the at least part of the sub-scenes as sub-scenes to be compressed; The multiple sub-scenes are screened according to the historical scene parameters respectively corresponding to the multiple sub-scenes to obtain the sub-scenes to be compressed.

7. The method according to any one of claims 1 to 4, characterized in that The determining of the object image corresponding to the virtual object in the virtual scene includes: Acquiring an object image corresponding to the virtual object through an image path corresponding to the virtual object in the virtual scene; After performing channel merging processing on the compressed color data and the compressed transparency data to obtain a compressed object image of the object image, the method further includes: updating the format information in the image path according to the compression format information corresponding to the compression process to obtain a new image path; The new image path is used to store the compressed target image.

8. The method according to any one of claims 1 to 4, characterized in that The determining of the object image corresponding to the virtual object in the virtual scene includes: In response to an observation operation on the virtual scene, determining an observation range corresponding to the observation operation; The camera component of the virtual scene engine performs image acquisition processing on the virtual object within the observation range to obtain an object image corresponding to the virtual object.

9. The method according to any one of claims 1 to 4, characterized in that The performing channel separation processing on the object image includes: Storing the object image in an image buffer; Performing channel separation processing on the object image in the image buffer by using a shading component of a virtual scene engine; After performing channel merging processing on the compressed color data and the compressed transparency data to obtain a compressed object image of the object image, the method further includes: The compressed object image in the image buffer is rendered by the shading component to display the compressed object image in a human-computer interaction interface.

10. The method according to any one of claims 1 to 4, characterized in that The compression processing corresponds to the compression format information; the method further includes: When the virtual scene engine supports rendering of images that conform to the compression format information, rendering processing is performed on the compressed object image by the virtual scene engine to display the compressed object image in the human-computer interaction interface; When the virtual scene engine does not support rendering of images that conform to the compression format information, the object image is rendered by the virtual scene engine to display the object image in the human-computer interaction interface.

11. The method according to any one of claims 1 to 4, characterized in that The method further comprises: Perform any of the following: Packaging compressed object images corresponding to a plurality of virtual objects in the virtual scene to obtain an installation package corresponding to the virtual scene; The compressed color data and the compressed transparency data respectively corresponding to the multiple virtual objects in the virtual scene are packaged to obtain an installation package corresponding to the virtual scene.

12. A virtual scene image processing device, characterized in that: The device comprises: A determination module, configured to determine an object image corresponding to a virtual object in a virtual scene; a channel separation module, configured to perform channel separation processing on the object image to obtain color data of the corresponding color channel and transparency data of the corresponding transparency channel when the virtual scene satisfies a compression condition, wherein the compression condition includes at least one of the following: the current sub-scene of the virtual scene belongs to the sub-scene to be compressed, and the sub-scene to be compressed includes at least part of the sub-scenes in the virtual scene; the number of virtual objects to be compressed in the virtual scene is greater than a number threshold; the current scene parameter of the virtual scene is greater than a scene parameter threshold, and the scene parameter includes at least one of an interaction parameter of a virtual object, the number of virtual objects, and a device resource usage parameter; a compression module, configured to compress the color data to obtain compressed color data, and compress the transparency data to obtain compressed transparency data; The channel merging module is used to perform channel merging processing on the compressed color data and the compressed transparency data to obtain a compressed object image of the object image.

13. The device according to claim 12, characterized in that The device comprises: The channel separation module is further configured to perform color extraction processing on the object image for the color channel to obtain a color image; wherein the color image includes color data of the color channels corresponding to multiple pixels in the object image; and perform transparency extraction processing on the object image for the transparency channel to obtain a transparency image; wherein the transparency image includes transparency data of the transparency channels corresponding to multiple pixels in the object image.

14. The device according to claim 12, characterized in that The device comprises: an expansion module configured to expand the size of the color image to obtain an expanded color image having a size that conforms to a set size ratio; wherein the expanded color image includes a first region corresponding to the color image and a second region different from the first region; and fill the second region of the expanded color image with the transparency image; The compression module is further configured to compress the color data in the first region of the expanded color image to obtain compressed color data; and compress the transparency data in the second region of the expanded color image to obtain compressed transparency data.

15. The device according to claim 14, characterized in that The device comprises: The expansion module is further configured to perform size expansion processing on the color image to obtain an expanded color image whose size meets the set size ratio; and to perform size expansion processing on the transparency image to obtain an expanded transparency image whose size meets the set size ratio; The compression module is further used to compress the color data in the expanded color image to obtain compressed color data; and to compress the transparency data in the expanded transparency image to obtain compressed transparency data.

16. An electronic device, characterized in that: include: a memory for storing executable instructions; The processor is configured to implement the image processing method of the virtual scene according to any one of claims 1 to 11 when executing the executable instructions stored in the memory.

17. A computer-readable storage medium, characterized in that Executable instructions are stored, which are used to implement the image processing method of the virtual scene described in any one of claims 1 to 11 when executed by a processor.

18. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the image processing method of the virtual scene according to any one of claims 1 to 11 is implemented.

Citation Information

Patent Citations

  • TFT LCD mura defect detection method based on hybrid self-adaptive level set model and multi-channel fusion

    CN106157310A

  • Image processing apparatus and image processing method

    US20110158525A1

  • Techniques for compressing floating-point format images

    US20190373283A1