WO2021155688A1 - 图片处理方法、装置、存储介质及电子设备 - Google Patents

图片处理方法、装置、存储介质及电子设备 Download PDF

Info

Publication number
WO2021155688A1
WO2021155688A1 PCT/CN2020/126344 CN2020126344W WO2021155688A1 WO 2021155688 A1 WO2021155688 A1 WO 2021155688A1 CN 2020126344 W CN2020126344 W CN 2020126344W WO 2021155688 A1 WO2021155688 A1 WO 2021155688A1
Authority
WO
WIPO (PCT)
Prior art keywords
picture
data
component
target mask
light
Prior art date
Application number
PCT/CN2020/126344
Other languages
English (en)
French (fr)
Inventor
刘琦
翟光洲
麦元协
Original Assignee
腾讯科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Priority to EP20917554.6A priority Critical patent/EP4002289A4/en
Priority to JP2022523027A priority patent/JP7301453B2/ja
Priority to KR1020227008760A priority patent/KR102617789B1/ko
Publication of WO2021155688A1 publication Critical patent/WO2021155688A1/zh
Priority to US17/588,536 priority patent/US11983900B2/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/50Lighting effects
    • G06T15/503Blending, e.g. for anti-aliasing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/50Lighting effects
    • G06T15/506Illumination models
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/50Lighting effects
    • G06T15/80Shading
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T19/00Manipulating 3D models or images for computer graphics
    • G06T19/20Editing of 3D images, e.g. changing shapes or colours, aligning objects or positioning parts
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/80Camera processing pipelines; Components thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10141Special mode during image acquisition
    • G06T2207/10152Varying illumination
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2219/00Indexing scheme for manipulating 3D models or images for computer graphics
    • G06T2219/20Indexing scheme for editing of 3D models
    • G06T2219/2012Colour editing, changing, or manipulating; Use of colour codes

Definitions

  • This application relates to the field of image processing, and in particular to an image processing method, device, storage medium, and electronic equipment.
  • the usual way is to use the 3D model to represent the objects in the picture.
  • the embodiments of the present application provide an image processing method, device, storage medium, and electronic device, which can avoid the jam of the mobile terminal device caused by the increase of power consumption of the mobile terminal device for image rendering.
  • An embodiment of the present application provides an image processing method, including:
  • the g component of the target mask picture stores first light change data
  • the b component of the target mask picture stores second light change data
  • the first light change data indicates that the first light change data is being rendered.
  • the change data of the light on the left side of the first picture used in the picture, and the second light change data is the change data of the light on the right side of the first picture used when the first picture is rendered;
  • An embodiment of the application provides an image processing device, including:
  • the first obtaining unit is configured to obtain the first picture to be rendered
  • the second acquiring unit is configured to acquire a target mask picture corresponding to the first picture
  • the g component of the target mask picture stores first light change data
  • the b component of the target mask picture stores second light change data
  • the first light change data indicates that the first light change data is being rendered.
  • the change data of the light on the left side of the first picture used in the picture, and the second light change data is the change data of the light on the right side of the first picture used when the first picture is rendered;
  • the rendering unit is configured to render the first picture using the target mask picture to obtain a second picture.
  • the embodiment of the present application provides a computer-readable storage medium in which a computer program is stored, and the above-mentioned image processing method is executed when the computer program is running.
  • the embodiment of the present application provides an electronic device including a memory, a processor, and a computer program stored in the memory and capable of running on the processor.
  • the processor is configured to execute the above-mentioned picture when the computer program is run. Approach.
  • the purpose of rendering the picture is achieved through the light change data stored in the target mask of the picture, thereby avoiding the use of 3D models, and realizing light projection by laying out real-time light sources or baking scenes in the scene, thereby avoiding adding mobile terminals to the picture rendering The stall of the mobile terminal device caused by the power consumption of the device.
  • FIG. 1 is a schematic diagram of an application environment of a picture processing method provided by an embodiment of the present application
  • Fig. 2 is a flowchart of a picture processing method provided by an embodiment of the present application.
  • FIG. 3 is a flowchart of using a custom shader for the first picture to complete rendering according to an embodiment of the present application
  • FIG. 4 is an engineering flowchart of GPU one-time rendering provided by an embodiment of the present application.
  • FIG. 5 is a comparison diagram of rendering results of the first image provided by an embodiment of the present application.
  • FIG. 6 is a first picture provided by an embodiment of the present application and a mask diagram corresponding to the first picture;
  • FIG. 7 is a schematic structural diagram of a picture processing apparatus provided by an embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of an electronic device of a picture processing method provided by an embodiment of the present application.
  • the embodiment of the present application provides a picture processing method, which can be but not limited to be applied to a picture processing system in a hardware environment as shown in FIG. 1, wherein the picture processing system may include but is not limited to a terminal device 102.
  • the terminal device 102 is configured to display the first picture to be rendered and the second picture obtained by rendering the first picture.
  • the terminal device 102 may include, but is not limited to: a display 108, a processor 106, and a memory 104.
  • the display 108 is configured to obtain a human-computer interaction instruction through a human-computer interaction interface, and is also configured to present a first picture to be rendered;
  • the processor 106 is configured to respond to the human-computer interaction instruction and use the target mask picture corresponding to the first picture to compare the first picture The picture is rendered.
  • the memory 104 is configured to store the first picture to be rendered and the attribute information of the target mask picture corresponding to the first picture.
  • the server 112 may include, but is not limited to: a database 114 and a processing engine 116.
  • the processing engine 116 is configured to call a target mask picture corresponding to the first picture stored in the database 114, and use the target mask picture to render the first picture , To obtain the second picture, to achieve the purpose of rendering the picture through the light change data stored in the target mask picture of the picture, thereby avoiding the use of 3D models, and realizing light projection through the layout of real-time light sources or baking scenes in the scene. It avoids the freezing of the mobile terminal device caused by the increase of the power consumption of the mobile terminal device for the image rendering.
  • the display 108 in the terminal device 102 is configured to display the first picture to be rendered (as shown in FIG. 1 in the game screen in the shooting game, the target virtual character is sniping the target object in the distance).
  • the terminal device 102 obtains the first picture to be rendered, and sends the first picture to the server 112 via the network 110;
  • S104 the server 112 obtains the target mask picture corresponding to the first picture, where ,
  • the g component of the target mask picture stores the first light change data
  • the b component of the target mask picture stores the second light change data.
  • the second light change data is the light change data on the right side of the first picture used when rendering the first picture;
  • S106 Use the target mask picture to render the first picture to obtain the second Picture;
  • S108 The server 112 returns the second picture obtained above to the terminal device 102 via the network 110.
  • the terminal device 102 obtains the first picture to be rendered; obtains the target mask picture corresponding to the first picture, wherein the g component of the target mask picture stores the first light change data, and the target mask picture
  • the b component of stores the second light change data
  • the first light change data is the light change data on the left side of the first picture used when rendering the first picture
  • the second light change data is used when rendering the first picture
  • the light change data located on the right side of the first picture use the target mask picture to render the first picture to obtain the second picture, which achieves the realization of the picture through the light change data stored in the target mask picture of the picture
  • the purpose of rendering is to avoid the use of 3D models and realize light projection by laying out real-time light sources or baking scenes in the scene, thereby avoiding the freezing of mobile terminal devices caused by increasing the power consumption of the mobile terminal device for image rendering.
  • the above-mentioned image processing method can be, but not limited to, applied to the server 112, and is also used to assist the application client to render the first image using the mask image corresponding to the first image.
  • the above-mentioned application client can be but not limited to running in the terminal device 102
  • the terminal device 102 can be, but not limited to, a mobile phone, a tablet computer, a notebook computer, a PC, and other terminal devices that support the running of the application client.
  • the foregoing server 112 and the terminal device 102 may, but are not limited to, implement data interaction through a network, and the foregoing network may include, but is not limited to, a wireless network or a wired network.
  • the wireless network includes: Bluetooth, WIFI and other networks that realize wireless communication.
  • the aforementioned wired network may include, but is not limited to: wide area network, metropolitan area network, and local area network.
  • the aforementioned server 112 may include, but is not limited to, any hardware device that can perform computing, such as an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or the provision of cloud services, cloud databases, Cloud servers for basic cloud computing services such as cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, and big data and artificial intelligence platforms.
  • the foregoing image processing method includes:
  • Step 202 Obtain a first picture to be rendered.
  • Step 204 Obtain a target mask picture corresponding to the first picture, where the g component of the target mask picture stores the first light change data, the b component of the target mask picture stores the second light change data, and the first light
  • the change data is the light change data on the left side of the first picture used when the first picture is rendered
  • the second light change data is the light change data on the right side of the first picture used when the first picture is rendered.
  • Step 206 Render the first picture using the target mask picture to obtain the second picture.
  • the first picture to be rendered may include, but is not limited to: a picture containing a character object, and a picture containing a static object.
  • a character to use a 2D real-life picture
  • the position of the screen light is fixed
  • the artist outputs a light mask image (that is, a target mask) according to the light direction.
  • the mask image is an opaque image
  • the r, g, and b components of the r, g, and b data correspond to different data. Due to the need to independently control the color changes on both sides of the character, the g component of the mask map stores the light change data on the left, and the b component stores the light change data on the right.
  • Step 2 Load the shader to the graphics processing unit (GPU, Graphics Processing Unit);
  • Step 3 Call the Update function
  • Step 4 Determine whether the lighting parameters have changed; if yes, go to step 5, otherwise go to step 6;
  • Step 5 Modify the light input parameters of the fragment shader
  • Step 6 Submit UI vertex data (including mask texture, first image texture) to the GPU, and set the rendering state (shader, start mixing)
  • Step 7 Submit rendering commands to the GPU
  • Step 8 judge whether the rendering is finished; if yes, go to step 9, otherwise go to step 3;
  • the CPU will call the Update function once every frame.
  • the Update function judge whether the lighting parameters of the screen have changed. If there are changes, modify the left and right light color input parameters of the shader. Every frame will submit all the rendering data, and the custom shader will be submitted to the GPU.
  • the GPU is responsible for rendering the data submitted by the CPU.
  • the engineering flow chart of GPU one rendering is shown in Figure 4.
  • Step 1 GPU one-time rendering processing starts
  • Step 2 GPU rendering pipeline
  • Step 3 Fragment shader processing: use the first picture and the mask map corresponding to the first picture, mix the light color, and return the fragment color value;
  • Step 4 GPU rendering pipeline
  • Step 5 Fix the display cache data
  • Step 6 the end.
  • the GPU when the GPU renders the player's picture, it will call the custom shader code.
  • the fragment function of the shader the player image and mask image are sampled.
  • the left and right light colors have been passed to the shader variable as parameters, and the rgba data value of the fragment can be obtained by mixing and superimposing the light color and the image sampling data.
  • the first picture to be rendered by acquiring the first picture to be rendered; acquiring the target mask picture corresponding to the first picture, wherein the g component of the target mask picture stores the first light change data, and the value of the target mask picture
  • the b component stores the second light change data.
  • the first light change data is the light change data on the left side of the first picture used when rendering the first picture
  • the second light change data is the light change data used when rendering the first picture.
  • the light change data located on the right side of the first picture use the target mask picture to render the first picture to obtain the second picture, which achieves the rendering of the picture through the light change data stored in the target mask picture of the picture
  • the purpose of this is to avoid the use of 3D models and realize light projection by laying out real-time light sources or baking scenes in the scene, thereby avoiding the increase in power consumption of the mobile terminal device for image rendering and causing the mobile terminal device to freeze.
  • rendering the first picture using the target mask picture to obtain the second picture includes:
  • the first picture is rendered using the r component, g component, and b component of the target mask picture to obtain the second picture.
  • the picture is a picture obtained by compressing the third picture
  • the third picture is a picture with transparency
  • the alpha value is used to indicate the transparency of the third picture.
  • the compression algorithm for pictures in this application uses etc compression. etc compression does not support pictures with transparency.
  • the alpha value of the picture needs to be saved to another picture.
  • the alpha value of the original character picture is saved to the r component of the mask picture.
  • the first picture and the mask map corresponding to the first picture that is, the left picture is the first picture
  • the right picture is the mask picture corresponding to the first picture.
  • the mask image generally presents color 1, which is the r component representing the alpha value.
  • the data on the left is the r+g component, showing color 2.
  • the data on the right is the r+b component data, showing color 3.
  • the third picture is The alpha value of the picture is stored in the r component of the target mask picture.
  • rendering the first picture using the target mask picture to obtain the second picture includes:
  • the first light change amount data and the second light change amount data are superimposed with the original data in the first picture to obtain a second picture.
  • the method further includes:
  • the data after the first light change and the data after the second light change are overlaid on the data to be rendered in the first picture to obtain the second picture.
  • rendering the first picture using the target mask picture to obtain the second picture includes:
  • the original data of the first picture and the g component and b component in the target mask picture corresponding to the first picture are superimposed to obtain the second picture.
  • the third picture is determined The picture is the first picture to be rendered.
  • the embodiment of the present application also provides a picture processing device for implementing the above picture processing method. As shown in FIG. 7, the device includes: a first acquiring unit 71, a second acquiring unit 73, and a rendering unit 75.
  • the first obtaining unit 71 is configured to obtain the first picture to be rendered.
  • the second acquiring unit 73 is configured to acquire a target mask picture corresponding to the first picture, wherein the g component of the target mask picture stores the first light change data, and the b component of the target mask picture stores the second light change Data, the first light change data is the light change data on the left side of the first picture used when rendering the first picture, and the second light change data is the light on the right side of the first picture used when rendering the first picture The change data.
  • the rendering unit 75 is configured to render the first picture using the target mask picture to obtain the second picture.
  • the rendering unit 75 includes:
  • the rendering module is configured to render the first picture using the r component, g component, and b component of the target mask picture when the r component of the target mask picture stores the alpha value of the third picture to obtain the second picture ,
  • the first picture is a picture obtained by compressing the third picture
  • the third picture is a picture with transparency
  • the alpha value is used to indicate the transparency of the third picture.
  • the first obtaining unit 71 obtains the first picture to be rendered; the second obtaining unit 73 obtains the target mask picture corresponding to the first picture, wherein the g component of the target mask picture stores the first picture.
  • Light change data The b component of the target mask picture stores the second light change data.
  • the first light change data is the light change data on the left side of the first picture used when rendering the first picture, and the second light change data It is the change data of the light on the right side of the first picture used when rendering the first picture; the rendering unit 75 uses the target mask picture to render the first picture to obtain the second picture.
  • the above-mentioned device further includes:
  • the storage module is configured to, before using the target mask picture to render the first picture, when the first picture is a picture obtained by compressing the third picture, and the third picture is a picture with transparency, the third picture
  • the alpha value is stored in the r component of the target mask picture.
  • the aforementioned rendering unit 75 includes:
  • the collection module is configured to collect the original data in the first picture
  • An acquiring module configured to acquire the first light variation data stored in the g component of the target mask picture, and the second light variation data stored in the b component of the target mask picture;
  • the superimposing module is configured to superimpose the first light change amount data and the second light change amount data with the original data in the first picture to obtain a second picture.
  • the above-mentioned device further includes:
  • the third obtaining unit is configured to obtain the first light changed data stored in the g component of the target mask picture after obtaining the raw data to be rendered in the first picture, and the second light stored in the b component of the target mask picture The changed data;
  • the processing unit is configured to overwrite the data to be rendered in the first picture with the data after the first light change and the data after the second light change to obtain the second picture.
  • the above device further includes:
  • the superimposing module is configured to superimpose the original data of the first picture and the g component and b component in the target mask picture corresponding to the first picture by calling the target function to obtain the second picture.
  • the embodiment of the present application also provides an electronic device for implementing the foregoing image processing method.
  • the electronic device includes a memory 802 and a processor 804.
  • the memory 802 stores a computer program
  • the processor 804 It is configured to execute the steps in any one of the above-mentioned method embodiments through a computer program.
  • the above-mentioned electronic device may be located in at least one network device among a plurality of network devices in a computer network.
  • the above-mentioned processor may be configured to execute the following steps through a computer program:
  • S3 Render the first picture using the target mask picture to obtain the second picture.
  • FIG. 8 is only for illustration, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a palmtop computer, and a mobile Internet device. Terminal devices such as Mobile Internet Devices (MID) and PAD can also be various types of servers.
  • FIG. 8 does not limit the structure of the above-mentioned electronic device.
  • the electronic device may also include more or fewer components (such as a network interface, etc.) than shown in FIG. 8, or have a configuration different from that shown in FIG. 8.
  • the memory 802 may be configured to store software programs and modules, such as program instructions/modules corresponding to the image processing method and apparatus in the embodiments of the present application.
  • the processor 804 executes the software programs and modules stored in the memory 802 by running Various functional applications and data processing, that is, to achieve the above-mentioned image processing method.
  • the memory 802 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory.
  • the memory 802 may further include a memory remotely provided with respect to the processor 804, and these remote memories may be connected to the terminal through a network.
  • the memory 802 may be, but is not limited to, configured to store information such as the first picture to be rendered, the target mask picture corresponding to the first picture, and the second picture.
  • the foregoing memory 802 may, but is not limited to, include the first obtaining unit 71, the second obtaining unit 73, and the rendering unit 75 in the foregoing image processing apparatus.
  • it may also include, but is not limited to, other module units in the above-mentioned picture processing apparatus, which will not be repeated in this example.
  • the aforementioned transmission device 806 is configured to receive or send data via a network.
  • the aforementioned network examples may include wired networks and wireless networks.
  • the transmission device 806 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network.
  • the transmission device 806 is a radio frequency (RF) module, which is configured to communicate with the Internet in a wireless manner.
  • RF radio frequency
  • the aforementioned electronic device further includes: a display 808 configured to display the aforementioned first picture to be rendered and a second picture; and a connection bus 810 configured to connect each module component in the aforementioned electronic device.
  • the embodiment of the present application provides a computer-readable storage medium in which a computer program is stored, and the computer program is configured to execute the image processing method provided in the embodiment of the present application when the computer program is run.
  • the aforementioned computer-readable storage medium may be configured to store a computer program configured to perform the following steps:
  • S3 Render the first picture using the target mask picture to obtain the second picture.
  • the storage medium may include: flash disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk, etc.
  • the integrated unit in the foregoing embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in the foregoing computer-readable storage medium.
  • the technical solution of the present application essentially or the part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium.
  • a number of instructions are included to enable one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the disclosed client can be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division.
  • there may be other division methods for example, multiple units or components may be combined or may be Integrate into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, units or modules, and may be in electrical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.

Abstract

本申请公开了一种图片处理方法、装置、存储介质及电子设备。其中,方法包括:通过获取待渲染的第一图片;获取与第一图片对应的目标掩膜图片,其中,目标掩膜图片的g分量存储了第一灯光变化数据,目标掩膜图片的b分量存储了第二灯光变化数据,第一灯光变化数据为在渲染第一图片时采用的位于第一图片左侧的灯光的变化数据,第二灯光变化数据为在渲染第一图片时采用的位于第一图片右侧的灯光的变化数据;使用目标掩膜图片对第一图片进行渲染,得到第二图片。

Description

图片处理方法、装置、存储介质及电子设备
相关申请的交叉引用
本申请基于申请号为202010082717.0、申请日为2020年02月07日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。
技术领域
本申请涉及图片处理领域,尤其涉及一种图片处理方法、装置、存储介质及电子设备。
背景技术
相关技术中,在投射在图片上的灯光发生变化的情况下,为了使图片中的对象(如人)更好的呈现灯光效果,通常所采用的方式是对图片中的对象采用3D模型来表征,通过图片所在场景布局实时光源或烘焙场景实现灯光投影,而采用这种方式,实时光源会消耗性能,在移动终端设备上会增加功耗,进而会给性能低的移动终端设备的运行造成卡顿现象。
发明内容
本申请实施例提供了一种图片处理方法、装置、存储介质及电子设备,能够避免对图片渲染增加移动终端设备的功耗而导致的移动终端设备的卡顿。
本申请实施例的提供一种图片处理方法,包括:
获取待渲染的第一图片;
获取与所述第一图片对应的目标掩膜图片;
其中,所述目标掩膜图片的g分量存储了第一灯光变化数据,所述目标掩膜图片的b分量存储了第二灯光变化数据,所述第一灯光变化数据为在渲染所述第一图片时采用的位于所述第一图片左侧的灯光的变化数据,所述第二灯光变化数据为在渲染所述第一图片时采用的位于所述第一图片右侧的灯光的变化数据;
使用所述目标掩膜图片对所述第一图片进行渲染,得到第二图片。
本申请实施例提供一种图片处理装置,包括:
第一获取单元,配置为获取待渲染的第一图片;
第二获取单元,配置为获取与所述第一图片对应的目标掩膜图片;
其中,所述目标掩膜图片的g分量存储了第一灯光变化数据,所述目标掩膜图片的b分量存储了第二灯光变化数据,所述第一灯光变化数据为在渲染所述第一图片时采用的位于所述第一图片左侧的灯光的变化数据,所述第二灯光变化数据为在渲染所述第一图片时采用的位于所述第一图片右侧的灯光的变化数据;
渲染单元,配置为使用所述目标掩膜图片对所述第一图片进行渲染,得到第二图片。
本申请实施例提供一种计算机可读存储介质,该存储介质中存储有计算机程序,所述计算机程序运行时执行上述图片处理方法。
本申请实施例提供了一种电子设备,包括存储器、处理器及存储在存 储器上并可在处理器上运行的计算机程序,所述处理器被设置为运行所述计算机程序时,执行上述的图片处理方法。
应用本申请实施例提供的图片处理方法、装置、存储介质及电子设备,至少具有以下有益技术效果:
通过图片的目标掩膜图片所存储的灯光的变化数据实现对图片的渲染的目的,从而避免采用3D模型,通过场景中布局实时光源或烘焙场景实现灯光投影,进而避免了对图片渲染增加移动终端设备的功耗而导致的移动终端设备的卡顿。
附图说明
此处所说明的附图用来提供对本申请的进一步理解,构成本申请的一部分,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:
图1是本申请实施例提供的图片处理方法的应用环境的示意图;
图2是本申请实施例提供的图片处理方法的流程图;
图3是本申请实施例提供的对第一图片使用自定义着色器来完成渲染的流程图;
图4是本申请实施例提供的GPU一次渲染的工程流程图;
图5是本申请实施例提供的第一图片渲染结果的对比图;
图6是本申请实施例提供的第一图片以及第一图片对应的mask图;
图7是本申请实施例提供的图片处理装置的结构示意图;
图8是本申请实施例提供的图片处理方法的电子设备的结构示意图。
具体实施方式
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分的实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本申请保护的范围。
需要说明的是,本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本申请的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。
本申请实施例提供了一种图片处理方法,该图片处理方法可以但不限于应用于如图1所示的硬件环境中的图片处理系统中,其中,该图片处理系统可以包括但不限于终端设备102、网络110及服务器112。其中,终端设备102配置为显示待渲染的第一图片,以及渲染第一图片得到的第二图片。
其中,终端设备102中可以包括但不限于:显示器108、处理器106及存储器104。显示器108配置为通过人机交互接口获取人机交互指令,还配置为呈现待渲染的第一图片;处理器106配置为响应人机交互指令, 使用第一图片对应的目标掩膜图片对第一图片进行渲染。存储器104配置为存储待渲染的第一图片、第一图片对应的目标掩膜图片的属性信息。
其中,服务器112可以包括但不限于:数据库114及处理引擎116,处理引擎116配置为调用数据库114中存储的第一图片对应的目标掩膜图片,使用该目标掩膜图片对第一图片进行渲染,得到第二图片,达到了通过图片的目标掩膜图片所存储的灯光的变化数据实现对图片的渲染的目的,从而避免采用3D模型,通过场景中布局实时光源或烘焙场景实现灯光投影,进而避免了对图片渲染增加移动终端设备的功耗而导致的移动终端设备的卡顿。
具体过程如以下步骤:在终端设备102中的显示器108配置为显示待渲染的第一图片(如图1所示射击游戏中的游戏画面,目标虚拟角色正在狙击远处的目标对象)。如步骤S102-S108,S102:终端设备102获取待渲染的第一图片,并将该第一图片通过网络110发送至服务器112;S104:服务器112获取与第一图片对应的目标掩膜图片,其中,目标掩膜图片的g分量存储了第一灯光变化数据,目标掩膜图片的b分量存储了第二灯光变化数据,第一灯光变化数据为在渲染第一图片时采用的位于第一图片左侧的灯光的变化数据,第二灯光变化数据为在渲染第一图片时采用的位于第一图片右侧的灯光的变化数据;S106:使用目标掩膜图片对第一图片进行渲染,得到第二图片;S108:服务器112将上述得到的第二图片通过网络110返回至终端设备102。
在一些实施例中,终端设备102获取待渲染的第一图片;获取与第一图片对应的目标掩膜图片,其中,目标掩膜图片的g分量存储了第一灯光 变化数据,目标掩膜图片的b分量存储了第二灯光变化数据,第一灯光变化数据为在渲染第一图片时采用的位于第一图片左侧的灯光的变化数据,第二灯光变化数据为在渲染第一图片时采用的位于第一图片右侧的灯光的变化数据;使用目标掩膜图片对第一图片进行渲染,得到第二图片,达到了通过图片的目标掩膜图片所存储的灯光的变化数据实现对图片的渲染的目的,从而避免采用3D模型,通过场景中布局实时光源或烘焙场景实现灯光投影,进而避免了对图片渲染增加移动终端设备的功耗而导致的移动终端设备的卡顿。
在一些实施例中,上述图片处理方法可以但不限于应用于服务器112中,还用于协助应用客户端使用第一图片对应的掩膜图片对该第一图片进行渲染处理。其中,上述应用客户端可以但不限于运行在终端设备102中,该终端设备102可以但不限于为手机、平板电脑、笔记本电脑、PC机等支持运行应用客户端的终端设备。上述服务器112和终端设备102可以但不限于通过网络实现数据交互,上述网络可以包括但不限于无线网络或有线网络。其中,该无线网络包括:蓝牙、WIFI及其他实现无线通信的网络。上述有线网络可以包括但不限于:广域网、城域网、局域网。上述服务器112可以包括但不限于任何可以进行计算的硬件设备,如可以是独立的物理服务器,也可以是多个物理服务器构成的服务器集群或者分布式系统,还可以是提供云服务、云数据库、云计算、云函数、云存储、网络服务、云通信、中间件服务、域名服务、安全服务、以及大数据和人工智能平台等基础云计算服务的云服务器。
在一些实施例中,如图2所示,上述图片处理方法包括:
步骤202,获取待渲染的第一图片。
步骤204,获取与第一图片对应的目标掩膜图片,其中,目标掩膜图片的g分量存储了第一灯光变化数据,目标掩膜图片的b分量存储了第二灯光变化数据,第一灯光变化数据为在渲染第一图片时采用的位于第一图片左侧的灯光的变化数据,第二灯光变化数据为在渲染第一图片时采用的位于第一图片右侧的灯光的变化数据。
步骤206,使用目标掩膜图片对第一图片进行渲染,得到第二图片。
在一些实施例中,待渲染的第一图片可包括但不限于:包含人物对象的图片,包含静态物品的图片。
在实际应用中,选择人物使用2D真人图片,屏幕灯光位置是固定的,由美术人员根据灯光方向输出灯光mask图(即目标掩图)。mask图为不透明图片,其r,g,b数据的r,g,b分量对应了不同的数据。由于需要独立控制人物两侧的颜色变化,mask图的g分量存储左侧的灯光变化数据,b分量存储右侧的灯光变化数据。
对第一图片使用自定义着色器来完成渲染,程序工作流程图如图3所述。
步骤1,开始;
即开始第一图片的渲染工作。
步骤2,加载着色器到图像处理器(GPU,Graphics Processing Unit);
步骤3,调用Update函数;
步骤4,判断灯光参数是否有变化;如果是,则执行步骤5,否则执行步骤6;
步骤5,修改片元着色器灯光输入参数;
步骤6,向GPU提交UI顶点数据(包括mask纹理,第一图片纹理),设置渲染状态(着色器,开始混合)
步骤7,向GPU提交渲染命令;
步骤8,判断渲染是否结束;如果是,则执行步骤9,否则执行步骤3;
步骤9,结束。
其中,对第一图片启动渲染后,CPU每一帧会调用一次Update函数。在Update函数中判断屏幕的灯光参数是否有改变,若有改变则修改着色器的左右灯光颜色输入参数。每一帧会提交所有的渲染数据,自定义的着色器会提交到GPU中。
GPU负责渲染CPU提交的数据。GPU一次渲染的工程流程图如图4所示。
步骤1,GPU一次渲染处理开始;
步骤2,GPU渲染流水线;
步骤3,片元着色器处理:采用第一图片和第一图片对应的mask图,混合灯光颜色,返回片元颜色值;
步骤4,GPU渲染流水线;
步骤5,修好显示缓存数据;
步骤6,结束。
其中,GPU渲染选手图片时,会调用自定义的着色器代码。在着色器的片元函数中,对选手图像和mask图进行采样。左右灯光颜色已作为参数传递到着色器变量中,混合叠加灯光颜色和图片采样数据即可得到片元 的rgba数据值。
应用本申请上述实施例,通过获取待渲染的第一图片;获取与第一图片对应的目标掩膜图片,其中,目标掩膜图片的g分量存储了第一灯光变化数据,目标掩膜图片的b分量存储了第二灯光变化数据,第一灯光变化数据为在渲染第一图片时采用的位于第一图片左侧的灯光的变化数据,第二灯光变化数据为在渲染第一图片时采用的位于第一图片右侧的灯光的变化数据;使用目标掩膜图片对第一图片进行渲染,得到第二图片,达到了通过图片的目标掩膜图片所存储的灯光的变化数据实现对图片的渲染的目的,从而避免采用3D模型,通过场景中布局实时光源或烘焙场景实现灯光投影,进而避免对图片渲染增加移动终端设备的功耗而导致移动终端设备的卡顿。
在实际应用中,使用2D图片可以达到高清效果,人物衣服褶皱的光影可以实现得很细腻,同时保证游戏的性能。将alpha数据和灯光数据合并到了mask图,不会额外增加游戏的图片数量。采用本申请提供的技术方案可以实现如图5所示的效果图。
屏幕灯光变化,人物身体左右两侧会按照环境灯光的变化出现不同颜色的灯光投影。左图为未实现效果的截图,右图为采用本申请的技术方案实现效果的截图。右图人物两侧的脸庞,肩膀和手臂会出现细致的灯光投影效果。
在一些实施例中,使用目标掩膜图片对第一图片进行渲染,得到第二图片,包括:
在目标掩膜图片的r分量存储了第三图片的alpha值的情况下,使用 目标掩模图片的r分量、g分量和b分量对第一图片进行渲染,得到第二图片,其中,第一图片是将第三图片压缩得到的图片、且第三图片为具有透明度的图片,alpha值用于表示第三图片的透明度。
为了支持android性能低的手机且减少游戏内存,本申请中对图片的压缩算法采用了etc压缩。etc压缩不支持有透明度的图片,现有技术中,图片的alpha值需保存到另外的图片。在本申请中为减少图片数量,减少磁盘空间,将原人物图片的alpha值保存到了mask图的r分量。如图6所示,第一图片以及第一图片对应的mask图,即左侧图是第一图片,右侧图是第一图片对应的mask图。其中,mask图大体呈现颜色1,为代表alpha值的r分量。左侧数据为r+g分量,呈现颜色2。右侧数据为r+b分量数据,呈现颜色3。
在一些实施例中,在使用目标掩膜图片对第一图片进行渲染之前,在第一图片是将第三图片压缩得到的图片、且第三图片为具有透明度的图片的情况下,将第三图片的alpha值存储到目标掩膜图片的r分量。
在一些实施例中,使用目标掩膜图片对第一图片进行渲染,得到第二图片,包括:
采集第一图片中的原始数据;
获取目标掩膜图片的g分量存储的第一灯光变化量数据,以及目标掩膜图片的b分量存储的第二灯光变化量数据;
将第一灯光变化量数据和第二灯光变化量数据与第一图片中的原始数据进行叠加,得到第二图片。
在一些实施例中,获取第一图片中的待渲染的原始数据之后,还包括:
获取目标掩膜图片的g分量存储的第一灯光变化后的数据,以及目标掩膜图片的b分量存储的第二灯光变化后的数据;
将第一灯光变化后的数据和第二灯光变化后的数据覆盖第一图片中待渲染的数据,得到第二图片。
在一些实施例中,使用目标掩膜图片对第一图片进行渲染,得到第二图片,包括:
通过调用目标函数将第一图片的原始数据与第一图片对应的目标掩膜图片中的g分量和b分量进行叠加,得到第二图片。
在一些实施例中,获取待渲染的第一图片之前,还可通过判断函数检测到第三图片对应的目标掩膜图片的g分量、b分量所对应的数据发生变化的情况下,确定第三图片为待渲染的第一图片。
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本申请所必须的。
本申请实施例还提供了一种用于实施上述图片处理方法的图片处理装置。如图7所示,该装置包括:第一获取单元71、第二获取单元73以及渲染单元75。
第一获取单元71,配置为获取待渲染的第一图片。
第二获取单元73,配置为获取与第一图片对应的目标掩膜图片,其中,目标掩膜图片的g分量存储了第一灯光变化数据,目标掩膜图片的b分量 存储了第二灯光变化数据,第一灯光变化数据为在渲染第一图片时采用的位于第一图片左侧的灯光的变化数据,第二灯光变化数据为在渲染第一图片时采用的位于第一图片右侧的灯光的变化数据。
渲染单元75,配置为使用目标掩膜图片对第一图片进行渲染,得到第二图片。
在一些实施例中,渲染单元75,包括:
渲染模块,配置为在目标掩膜图片的r分量存储了第三图片的alpha值的情况下,使用目标掩模图片的r分量、g分量和b分量对第一图片进行渲染,得到第二图片,其中,第一图片是将第三图片压缩得到的图片、且第三图片为具有透明度的图片,alpha值用于表示第三图片的透明度。
应用本申请上述实施例,第一获取单元71获取待渲染的第一图片;第二获取单元73获取与第一图片对应的目标掩膜图片,其中,目标掩膜图片的g分量存储了第一灯光变化数据,目标掩膜图片的b分量存储了第二灯光变化数据,第一灯光变化数据为在渲染第一图片时采用的位于第一图片左侧的灯光的变化数据,第二灯光变化数据为在渲染第一图片时采用的位于第一图片右侧的灯光的变化数据;渲染单元75使用目标掩膜图片对第一图片进行渲染,得到第二图片。达到了通过图片的目标掩膜图片所存储的灯光的变化数据实现对图片的渲染的目的,从而避免采用3D模型,通过场景中布局实时光源或烘焙场景实现灯光投影,进而避免对图片渲染增加移动终端设备的功耗而导致的移动终端设备的卡顿。
在一些实施例中,上述装置还包括:
存储模块,配置为在使用目标掩膜图片对第一图片进行渲染之前,在 第一图片是将第三图片压缩得到的图片、且第三图片为具有透明度的图片的情况下,将第三图片的alpha值存储到目标掩膜图片的r分量。
在一些实施例中,上述渲染单元75,包括:
采集模块,配置为采集第一图片中的原始数据;
获取模块,配置为获取目标掩膜图片的g分量存储的第一灯光变化量数据,以及目标掩膜图片的b分量存储的第二灯光变化量数据;
叠加模块,配置为将第一灯光变化量数据和第二灯光变化量数据与第一图片中的原始数据进行叠加,得到第二图片。
在一些实施例中,上述装置还包括:
第三获取单元,配置为获取第一图片中的待渲染的原始数据之后,获取目标掩膜图片的g分量存储的第一灯光变化后的数据,目标掩膜图片的b分量存储的第二灯光变化后的数据;
处理单元,配置为将第一灯光变化后的数据和第二灯光变化后的数据覆盖第一图片中待渲染的数据,得到第二图片。
在一些实施例中,上述装置还包括,包括:
叠加模块,配置为通过调用目标函数将第一图片的原始数据与第一图片对应的目标掩膜图片中的g分量和b分量进行叠加,得到第二图片。
本申请实施例还提供了一种用于实施上述图片处理方法的电子设备,如图8所示,该电子设备包括存储器802和处理器804,该存储器802中存储有计算机程序,该处理器804被设置为通过计算机程序执行上述任一项方法实施例中的步骤。
在一些实施例中,上述电子设备可以位于计算机网络的多个网络设备 中的至少一个网络设备。
在一些实施例中,上述处理器可以被设置为通过计算机程序执行以下步骤:
S1,获取待渲染的第一图片;
S2,获取与第一图片对应的目标掩膜图片,其中,目标掩膜图片的g分量存储了第一灯光变化数据,目标掩膜图片的b分量存储了第二灯光变化数据,第一灯光变化数据为在渲染第一图片时采用的位于第一图片左侧的灯光的变化数据,第二灯光变化数据为在渲染第一图片时采用的位于第一图片右侧的灯光的变化数据;
S3,使用目标掩膜图片对第一图片进行渲染,得到第二图片。
在一些实施例中,本领域普通技术人员可以理解,图8所示的结构仅为示意,电子设备也可以是智能手机(如Android手机、iOS手机等)、平板电脑、掌上电脑以及移动互联网设备(Mobile Internet Devices,MID)、PAD等终端设备,还可以为各种类型的服务器。图8其并不对上述电子设备的结构造成限定。例如,电子设备还可包括比图8中所示更多或者更少的组件(如网络接口等),或者具有与图8所示不同的配置。
其中,存储器802可配置为存储软件程序以及模块,如本申请实施例中的图片处理方法和装置对应的程序指令/模块,处理器804通过运行存储在存储器802内的软件程序以及模块,从而执行各种功能应用以及数据处理,即实现上述的图片处理方法。存储器802可包括高速随机存储器,还可以包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器802可进一步包括相对于 处理器804远程设置的存储器,这些远程存储器可以通过网络连接至终端。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。其中,存储器802可以但不限于配置为存储待渲染的第一图片,第一图片对应的目标掩膜图片以及第二图片等信息。作为一种示例,如图8所示,上述存储器802中可以但不限于包括上述图片处理装置中的第一获取单元71、第二获取单元73以及渲染单元75。此外,还可以包括但不限于上述图片处理装置中的其他模块单元,本示例中不再赘述。
在一些实施例中,上述的传输装置806配置为经由一个网络接收或者发送数据。上述的网络实例可包括有线网络及无线网络。在一个实例中,传输装置806包括一个网络适配器(Network Interface Controller,NIC),其可通过网线与其他网络设备与路由器相连从而可与互联网或局域网进行通讯。在一个实例中,传输装置806为射频(Radio Frequency,RF)模块,其配置为通过无线方式与互联网进行通讯。
此外,上述电子设备还包括:显示器808,配置为显示上述待渲染的第一图片,以及第二图片;连接总线810,配置为连接上述电子设备中的各个模块部件。
本申请实施例提供了一种计算机可读存储介质,该计算机可读存储介质中存储有计算机程序,该计算机程序被设置为运行时执行本申请实施例提供的图片处理方法。
在一些实施例中,上述计算机可读的存储介质可以被设置为存储配置为执行以下步骤的计算机程序:
S1,获取待渲染的第一图片;
S2,获取与第一图片对应的目标掩膜图片,其中,目标掩膜图片的g分量存储了第一灯光变化数据,目标掩膜图片的b分量存储了第二灯光变化数据,第一灯光变化数据为在渲染第一图片时采用的位于第一图片左侧的灯光的变化数据,第二灯光变化数据为在渲染第一图片时采用的位于第一图片右侧的灯光的变化数据;
S3,使用目标掩膜图片对第一图片进行渲染,得到第二图片。
在一些实施例中,本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令终端设备相关的硬件来完成,该程序可以存储于计算机可读存储介质中,存储介质可以包括:闪存盘、只读存储器(ROM,Read-Only Memory)、随机存取器(RAM,Random Access Memory)、磁盘或光盘等。
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。
上述实施例中的集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在上述计算机可读取的存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在存储介质中,包括若干指令用以使得一台或多台计算机设备(可为个人计算机、服务器或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。
在本申请的上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。
在本申请所提供的几个实施例中,应该理解到,所揭露的客户端,可通过其它的方式实现。其中,以上所描述的装置实施例仅仅是示意性的,例如所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,单元或模块的间接耦合或通信连接,可以是电性或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
以上所述仅是本申请的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本申请的保护范围。

Claims (15)

  1. 一种图片处理方法,所述方法由电子设备执行,所述方法包括:
    获取待渲染的第一图片;
    获取与所述第一图片对应的目标掩膜图片;
    其中,所述目标掩膜图片的g分量存储了第一灯光变化数据,所述目标掩膜图片的b分量存储了第二灯光变化数据,所述第一灯光变化数据为在渲染所述第一图片时采用的位于所述第一图片左侧的灯光的变化数据,所述第二灯光变化数据为在渲染所述第一图片时采用的位于所述第一图片右侧的灯光的变化数据;
    使用所述目标掩膜图片对所述第一图片进行渲染,得到第二图片。
  2. 根据权利要求1所述的方法,其中,所述使用所述目标掩膜图片对所述第一图片进行渲染,得到第二图片,包括:
    在所述目标掩膜图片的r分量存储了第三图片的alpha值的情况下,使用所述目标掩模图片的r分量、g分量和b分量对所述第一图片进行渲染,得到所述第二图片;
    其中,所述第一图片是将所述第三图片压缩得到的图片、且所述第三图片为具有透明度的图片,所述alpha值用于表示所述第三图片的透明度。
  3. 根据权利要求2所述的方法,其中,所述使用所述目标掩膜图片对所述第一图片进行渲染之前,所述方法还包括:
    在所述第一图片是将所述第三图片压缩得到的图片、且所述第三图片为具有透明度的图片的情况下,将所述第三图片的alpha值存储到所述目标掩膜图片的r分量。
  4. 根据权利要求1至3中任一项所述的方法,其中,所述使用所述目标掩膜图片对所述第一图片进行渲染,得到第二图片,包括:
    采集所述第一图片中的原始数据;
    获取所述目标掩膜图片的g分量存储的第一灯光变化量数据,以及所述目标掩膜图片的b分量存储的第二灯光变化量数据;
    将所述第一灯光变化量数据和所述第二灯光变化量数据与所述第一图片中的原始数据进行叠加,得到所述第二图片。
  5. 根据权利要求4中所述的方法,其中,所述获取所述第一图片中的待渲染的原始数据之后,所述方法还包括:
    获取所述目标掩膜图片的g分量存储的第一灯光变化后的数据,所述目标掩膜图片的b分量存储的第二灯光变化后的数据;
    将所述第一灯光变化后的数据和所述第二灯光变化后的数据覆盖所述第一图片中待渲染的数据,得到所述第二图片。
  6. 根据权利要求1中所述的方法,其中,所述使用所述目标掩膜图片对所述第一图片进行渲染,得到第二图片,包括:
    通过调用目标函数将所述第一图片的原始数据与所述第一图片对应的目标掩膜图片中的g分量和b分量进行叠加,得到所述第二图片。
  7. 根据权利要求1中所述的方法,其中,所述获取待渲染的第一图片之前,所述方法还包括:
    通过判断函数检测到第三图片对应的目标掩膜图片的g分量、b分量所对应的数据发生变化的情况下,确定所述第三图片为所述待渲染的第一图片。
  8. 一种图片处理装置,包括:
    第一获取单元,配置为获取待渲染的第一图片;
    第二获取单元,配置为获取与所述第一图片对应的目标掩膜图片;
    其中,所述目标掩膜图片的g分量存储了第一灯光变化数据,所述目标掩膜图片的b分量存储了第二灯光变化数据,所述第一灯光变化数据为在渲染所述第一图片时采用的位于所述第一图片左侧的灯光的变化数据,所述第二灯光变化数据为在渲染所述第一图片时采用的位于所述第一图片右侧的灯光的变化数据;
    渲染单元,配置为使用所述目标掩膜图片对所述第一图片进行渲染,得到第二图片。
  9. 根据权利要求8所述的装置,其中,所述渲染单元,包括:
    渲染模块,配置为在所述目标掩膜图片的r分量存储了第三图片的alpha值的情况下,使用所述目标掩模图片的r分量、g分量和b分量对所述第一图片进行渲染,得到所述第二图片,其中,所述第一图片是将所述第三图片压缩得到的图片、且所述第三图片为具有透明度的图片,所述alpha值配置为表示所述第三图片的透明度。
  10. 根据权利要求9所述的装置,其中,所述装置还包括:
    存储模块,配置为在使用所述目标掩膜图片对所述第一图片进行渲染之前,在所述第一图片是将所述第三图片压缩得到的图片、且所述第三图片为具有透明度的图片的情况下,将所述第三图片的alpha值存储到所述目标掩膜图片的r分量。
  11. 根据权利要求9至10中任一项所述的装置,其中,所述渲染单元,包括:
    采集模块,配置为采集所述第一图片中的原始数据;
    获取模块,配置为获取所述目标掩膜图片的g分量存储的第一灯光变化量数据,以及所述目标掩膜图片的b分量存储的第二灯光变化量数据;
    叠加模块,配置为将所述第一灯光变化量数据和所述第二灯光变化量数据与所述第一图片中的原始数据进行叠加,得到所述第二图片。
  12. 根据权利要求11中所述的装置,其中,所述装置包括:
    第三获取单元,配置为获取所述第一图片中的待渲染的原始数据之后,获取所述目标掩膜图片的g分量存储的第一灯光变化后的数据,所述目标掩膜图片的b分量存储的第二灯光变化后的数据;
    处理单元,配置为将所述第一灯光变化后的数据和所述第二灯光变化后的数据覆盖所述第一图片中待渲染的数据,得到所述第二图片。
  13. 根据权利要求8中所述的装置,其中,所述渲染单元,包括:
    叠加模块,配置为通过调用目标函数将所述第一图片的原始数据与所述第一图片对应的目标掩膜图片中的g分量和b分量进行叠加,得到所述第二图片。
  14. 一种计算机可读存储介质,所述存储介质包括存储的程序,所述程序运行时,执行所述权利要求1至7任一项所述的图片处理方法。
  15. 一种电子设备,包括存储器和处理器,其中,所述存储器中存储有计算机程序,所述处理器被设置为运行所述计算机程序时,执行所述权利要求1至7任一项所述的图片处理方法。
PCT/CN2020/126344 2020-02-07 2020-11-04 图片处理方法、装置、存储介质及电子设备 WO2021155688A1 (zh)

Priority Applications (4)

Application Number Priority Date Filing Date Title
EP20917554.6A EP4002289A4 (en) 2020-02-07 2020-11-04 METHOD AND DEVICE FOR IMAGE PROCESSING, INFORMATION CARRYING AND ELECTRONIC APPARATUS
JP2022523027A JP7301453B2 (ja) 2020-02-07 2020-11-04 画像処理方法、画像処理装置、コンピュータプログラム、及び電子機器
KR1020227008760A KR102617789B1 (ko) 2020-02-07 2020-11-04 픽처 처리 방법 및 디바이스, 저장 매체 그리고 전자 장치
US17/588,536 US11983900B2 (en) 2020-02-07 2022-01-31 Image processing method and apparatus, storage medium, and electronic device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010082717.0 2020-02-07
CN202010082717.0A CN111260768B (zh) 2020-02-07 2020-02-07 图片处理方法和装置、存储介质及电子装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/588,536 Continuation US11983900B2 (en) 2020-02-07 2022-01-31 Image processing method and apparatus, storage medium, and electronic device

Publications (1)

Publication Number Publication Date
WO2021155688A1 true WO2021155688A1 (zh) 2021-08-12

Family

ID=70954883

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/126344 WO2021155688A1 (zh) 2020-02-07 2020-11-04 图片处理方法、装置、存储介质及电子设备

Country Status (5)

Country Link
EP (1) EP4002289A4 (zh)
JP (1) JP7301453B2 (zh)
KR (1) KR102617789B1 (zh)
CN (1) CN111260768B (zh)
WO (1) WO2021155688A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111260768B (zh) * 2020-02-07 2022-04-26 腾讯科技(深圳)有限公司 图片处理方法和装置、存储介质及电子装置

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1258837A1 (en) * 2001-05-14 2002-11-20 Thomson Licensing S.A. Method to generate mutual photometric effects
US7583264B2 (en) * 2005-08-31 2009-09-01 Sega Corporation Apparatus and program for image generation
CN104392479A (zh) * 2014-10-24 2015-03-04 无锡梵天信息技术股份有限公司 一种利用灯光索引号对像素进行光照着色的方法
CN108520551A (zh) * 2018-03-30 2018-09-11 苏州蜗牛数字科技股份有限公司 实现光贴图动态光照的方法、存储介质及计算设备
CN109887066A (zh) * 2019-02-25 2019-06-14 网易(杭州)网络有限公司 光照效果处理方法及装置、电子设备、存储介质
CN111260768A (zh) * 2020-02-07 2020-06-09 腾讯科技(深圳)有限公司 图片处理方法和装置、存储介质及电子装置

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6016150A (en) * 1995-08-04 2000-01-18 Microsoft Corporation Sprite compositor and method for performing lighting and shading operations using a compositor to combine factored image layers
JP3777288B2 (ja) 2000-05-10 2006-05-24 株式会社ナムコ ゲームシステム及び情報記憶媒体
US20070070082A1 (en) * 2005-09-27 2007-03-29 Ati Technologies, Inc. Sample-level screen-door transparency using programmable transparency sample masks
US20130265306A1 (en) * 2012-04-06 2013-10-10 Penguin Digital, Inc. Real-Time 2D/3D Object Image Composition System and Method
JP5904281B2 (ja) * 2012-08-10 2016-04-13 株式会社ニコン 画像処理方法、画像処理装置、撮像装置および画像処理プログラム
CN104134230B (zh) * 2014-01-22 2015-10-28 腾讯科技(深圳)有限公司 一种图像处理方法、装置及计算机设备
JP6727816B2 (ja) 2016-01-19 2020-07-22 キヤノン株式会社 画像処理装置、撮像装置、画像処理方法、画像処理プログラムおよび記憶媒体
CN108492339B (zh) * 2018-03-28 2021-06-01 腾讯科技(深圳)有限公司 获取资源压缩包的方法、装置、电子设备及存储介质
CN110473280B (zh) * 2018-05-09 2024-02-23 网易(杭州)网络有限公司 多光源画面渲染方法、装置、存储介质、处理器和终端

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1258837A1 (en) * 2001-05-14 2002-11-20 Thomson Licensing S.A. Method to generate mutual photometric effects
US7583264B2 (en) * 2005-08-31 2009-09-01 Sega Corporation Apparatus and program for image generation
CN104392479A (zh) * 2014-10-24 2015-03-04 无锡梵天信息技术股份有限公司 一种利用灯光索引号对像素进行光照着色的方法
CN108520551A (zh) * 2018-03-30 2018-09-11 苏州蜗牛数字科技股份有限公司 实现光贴图动态光照的方法、存储介质及计算设备
CN109887066A (zh) * 2019-02-25 2019-06-14 网易(杭州)网络有限公司 光照效果处理方法及装置、电子设备、存储介质
CN111260768A (zh) * 2020-02-07 2020-06-09 腾讯科技(深圳)有限公司 图片处理方法和装置、存储介质及电子装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP4002289A4 *

Also Published As

Publication number Publication date
US20220164991A1 (en) 2022-05-26
JP7301453B2 (ja) 2023-07-03
KR20220046665A (ko) 2022-04-14
EP4002289A1 (en) 2022-05-25
EP4002289A4 (en) 2022-11-30
JP2022553251A (ja) 2022-12-22
CN111260768A (zh) 2020-06-09
CN111260768B (zh) 2022-04-26
KR102617789B1 (ko) 2023-12-22

Similar Documents

Publication Publication Date Title
WO2021129044A1 (zh) 对象渲染方法和装置、存储介质及电子装置
CN112215934A (zh) 游戏模型的渲染方法、装置、存储介质及电子装置
CN112316433B (zh) 游戏画面渲染方法、装置、服务器和存储介质
US20240096007A1 (en) Rendering Method, Device, and System
CN111583378B (zh) 一种虚拟资产处理的方法及装置、电子设备、存储介质
CN114119818A (zh) 场景模型的渲染方法、装置及设备
CN111583379B (zh) 虚拟模型的渲染方法、装置、存储介质与电子设备
US10237563B2 (en) System and method for controlling video encoding using content information
CN116091672A (zh) 图像渲染方法、计算机设备及其介质
WO2021155688A1 (zh) 图片处理方法、装置、存储介质及电子设备
JP7160495B2 (ja) 画像前処理方法、装置、電子機器及び記憶媒体
US20230343021A1 (en) Visible element determination method and apparatus, storage medium, and electronic device
WO2023202254A1 (zh) 图像渲染方法、装置、电子设备、计算机可读存储介质及计算机程序产品
CN116758201A (zh) 三维场景的渲染处理方法、设备、系统及计算机存储介质
CN114428573B (zh) 特效图像处理方法、装置、电子设备及存储介质
EP4231243A1 (en) Data storage management method, object rendering method, and device
US11983900B2 (en) Image processing method and apparatus, storage medium, and electronic device
CN113313796B (zh) 场景生成方法、装置、计算机设备和存储介质
WO2022033162A1 (zh) 一种模型加载方法以及相关装置
CN111462007B (zh) 图像处理方法、装置、设备及计算机存储介质
CN114119831A (zh) 积雪模型的渲染方法、装置、电子设备及可读介质
CN113192173A (zh) 三维场景的图像处理方法、装置及电子设备
WO2023197729A1 (zh) 对象渲染方法、装置、电子设备及存储介质
WO2022135050A1 (zh) 渲染方法、设备以及系统
WO2023216771A1 (zh) 虚拟天气交互方法、装置、电子设备、计算机可读存储介质及计算机程序产品

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20917554

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2020917554

Country of ref document: EP

Effective date: 20220218

ENP Entry into the national phase

Ref document number: 20227008760

Country of ref document: KR

Kind code of ref document: A

ENP Entry into the national phase

Ref document number: 2022523027

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE