CN112750189A - Illumination coloring method and device, electronic equipment and computer readable storage medium - Google Patents

Illumination coloring method and device, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN112750189A
CN112750189A CN202110076158.7A CN202110076158A CN112750189A CN 112750189 A CN112750189 A CN 112750189A CN 202110076158 A CN202110076158 A CN 202110076158A CN 112750189 A CN112750189 A CN 112750189A
Authority
CN
China
Prior art keywords
preset attribute
illumination
virtual
coloring
attribute value
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202110076158.7A
Other languages
Chinese (zh)
Inventor
张庭亮
陆梦蝶
张婷婷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Huya Technology Co Ltd
Original Assignee
Guangzhou Huya Technology Co Ltd
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 Guangzhou Huya Technology Co Ltd filed Critical Guangzhou Huya Technology Co Ltd
Priority to CN202110076158.7A priority Critical patent/CN112750189A/en
Publication of CN112750189A publication Critical patent/CN112750189A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/02Non-photorealistic rendering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/50Lighting effects

Abstract

The application provides an illumination coloring method, an illumination coloring device, an electronic device and a computer-readable storage medium, wherein the method is executed by a GPU, and the method comprises the following steps: acquiring a preset attribute value of a virtual light source, wherein the virtual light source is used for lighting and coloring a virtual object; transmitting the preset attribute value into a shader; in the process of geometry coloring by using a shader, storing the geometry information of the virtual object and parameters representing the preset attribute values; and performing illumination calculation based on the geometric information and the parameters representing the preset attribute values to determine illumination coloring parameters of the virtual object.

Description

Illumination coloring method and device, electronic equipment and computer readable storage medium
Technical Field
The present disclosure relates to the field of image processing technologies, and in particular, to an illumination rendering method and apparatus, an electronic device, and a computer-readable storage medium.
Background
The illusion Engine (UE) is a general game development Engine. In application scenes such as game development, animation production, real-time live broadcast and the like based on a ghost engine, a developer often needs to realize a specific illumination coloring effect on a specific virtual object. In the related art, a specific lighting coloring effect is applied to a specific virtual object by controlling a light channel carried by a ghost engine.
However, in the existing version of the illusion engine, there are only three light channels, and virtual objects in games, animations, live broadcasts and other projects developed by developers have various lighting styles and require various lighting coloring effects. Therefore, since the number of light channels in the illusion engine responsible for lighting is too small, it is often not possible to create the respective required lighting shading effect for virtual objects larger than the number of light channels.
Disclosure of Invention
To overcome the problems in the related art, the present application provides an illumination coloring method, apparatus, electronic device and computer-readable storage medium.
According to a first aspect of embodiments herein, there is provided a method of illumination shading, the method being performed by a GPU, the method comprising: acquiring a preset attribute value of a virtual light source, wherein the virtual light source is used for lighting and coloring a virtual object; transmitting the preset attribute value into a shader; in the process of geometry coloring by using a shader, storing the geometry information of the virtual object and parameters representing the preset attribute values; and performing illumination calculation based on the geometric information and the parameters representing the preset attribute values to determine illumination coloring parameters of the virtual object.
According to a second aspect of embodiments of the present application, there is provided an illumination coloration apparatus, the apparatus comprising: the attribute value acquisition module is used for acquiring preset attribute values of all virtual light sources, and the virtual light sources are used for lighting and coloring the virtual object; the attribute value transmission module is used for transmitting the preset attribute value into a shader; the storage module is used for storing the geometric information of the virtual object and the parameter representing the preset attribute value in the process of performing geometric coloring by using the shader; and the parameter determining module is used for carrying out illumination calculation based on the geometric information and the parameter representing the preset attribute value, and determining the illumination coloring parameter of the virtual object.
According to a third aspect of embodiments herein, there is provided an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method of the first aspect of the present application when executing the program.
According to a fourth aspect of embodiments herein, there is provided a computer readable storage medium storing a computer program which, when executed by a processor, implements the method of the first aspect herein.
The technical scheme provided by the embodiment of the application can have the following beneficial effects:
in the method of the embodiment of the application, different from the method of directly adopting the lighting channel of the phantom engine to perform illumination coloring on the virtual object in the related technology, the method firstly obtains the preset attribute value of the virtual light source for performing illumination coloring on the virtual object, then stores the parameter representing the preset attribute value in the geometric coloring process, and in the illumination calculation stage, not only utilizes the geometric information obtained in the geometric process, but also enables the parameter representing the preset attribute value to participate in the illumination calculation, so that the illumination coloring parameter generated by the virtual light source for the virtual object can be obtained. Therefore, the method can solve the problem that the number of the built-in light channels of the illusion engine is insufficient in the related technology, and meets the requirements on the illumination coloring effect of various virtual objects.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the specification.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present specification and together with the description, serve to explain the principles of the specification.
Fig. 1 is a diagram illustrating a partial view interface for a fantasy engine according to an exemplary embodiment of the present application.
FIG. 2A is a schematic illustration of the illumination coloring effect of the same light channel for two different beads according to an exemplary embodiment of the present application.
FIG. 2B is a schematic illustration of the illumination coloring effect of the present application for different light channels on two different beads according to an exemplary embodiment.
Fig. 3 is a flow chart illustrating a method of illumination shading according to an exemplary embodiment of the present application.
FIG. 4 is a diagram illustrating a view window of a component in a virtual engine according to an illustrative embodiment of the present application.
Fig. 5 is a schematic diagram illustrating storage of geometric information and parameters characterizing attribute values of virtual light sources in a geometric rendering process according to an exemplary embodiment of the present application.
Fig. 6 is a block diagram of an illumination shading device shown in the present application according to an exemplary embodiment.
FIG. 7 is a block diagram illustrating an electronic device according to an exemplary embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present specification. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the specification, as detailed in the appended claims.
The terminology used in the description herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the description. As used in this specification and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used herein to describe various information, these information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, the first information may also be referred to as second information, and similarly, the second information may also be referred to as first information, without departing from the scope of the present specification. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
The illusion engine is a universal Game development engine developed by an Epic Game company, can be used in the fields of animation, games, live broadcast, augmented reality and the like, and provides a large amount of required core technologies, data generation tools and basic support for developers. By using the illusion engine, the designer can develop data resources as much as possible with only a small amount of assistance of a program developer, and the process is completed in a complete visualization environment, so that the actual operation is very convenient.
In application scenarios where a developer performs game development, animation production, live broadcast in real time, and the like based on a ghost engine, there is often a need to implement specific illumination coloring for a specific virtual object: the light layering effect is realized in the illusion engine, and the specific light is only effective on partial models and objects, and the whole illumination effect is not influenced.
However, in the ghost engine, there is no concept of layering. In the illusion engine, the need to implement a particular lighting rendering for a particular virtual object is achieved through a Light Channel (Light Channel). The light channel is a technology for performing distinguishing illumination coloring (or referred to as "lighting") on different virtual objects in the same scene. As shown in fig. 1, 101 is a schematic view of a partial view interface of the illusion engine. Both the lighting in the ghost engine and the lighting (Light) options of the model have a setting of one Light channel 102(Light Channels)102, under which there are a limited number of Light Channels, for example three for the ghost engine 4. When the specific illumination coloring is realized on a plurality of specific virtual objects, the specific illumination coloring is realized by adopting a mode of setting a light channel.
By way of example in fig. 2A and 2B, two different beads 201 and 202 are illustrated for illumination coloring. A spotlight 203 is placed in a scene without light. When the light paths of the spotlight 203 and the small balls 201 and 202 are set to "Channel 0" as shown in fig. 1, the small balls 201 and 202 are illuminated and a projection can be formed on the floor. On the other hand, when the light path of the ball 201 is maintained at Channel 0 and the light paths of the spotlight 203 and the ball 202 are set at Channel 1, the light path of the spotlight 203 is not the same as that of the ball 201, so that the ball 201 is not affected by the light from the spotlight 203 and cannot form a projection on the floor, while the light path of the spotlight 203 is the same as that of the ball 202, so that the light from the spotlight 203 is affected on the ball 202 and a light projection spotlight can be formed on the floor.
In the illusion engine, the specific lighting rendering is implemented for a specific virtual object, namely, by setting a lighting channel for the specific virtual object. However, in the existing version of the illusion engine (UE 4), there are only three light channels. However, in an actual development scene, in some cases, the number of virtual objects in the virtual scene is large, the virtual objects require multiple illumination coloring effects, and the number of lighting channels in the illusion engine, which are responsible for lighting, is limited, and it is often impossible to create the illumination effects required by the virtual objects larger than the number of lighting channels.
In order to overcome the defects in the related art, embodiments of the present application provide a method for lighting and coloring a virtual object, where the method is used to perform lighting and coloring on a specific virtual object in a virtual scene. The illumination rendering method may be executed by a GPU of the illusion engine, and of course, it should be understood by those skilled in the art that the illumination rendering method may also be executed by other GPUs of a development engine similar to the illusion engine and having only a limited number of light channels, which is not specifically limited in the present application. The illusion engine or other development engine may be installed on a computer, may also be installed on a server, and may also be installed on a terminal device with corresponding computing capability, which is not limited in this application.
As shown in fig. 3, a flowchart of a method for lighting shading provided in an embodiment of the present application is provided, where the method includes:
step S301, acquiring a preset attribute value of a virtual light source, wherein the virtual light source is used for lighting and coloring a virtual object;
step S302, transmitting the preset attribute value into a shader;
step S303, storing the geometric information of the virtual object and the parameters representing the preset attribute values in the process of performing geometric coloring by using the shader;
step S304, based on the geometric information stored in the designated buffer area and the parameter representing the preset attribute value, performing illumination calculation to determine the illumination coloring parameter of the virtual object.
The virtual object may be an object in a virtual scene, a role in a virtual scene, or the like, which is not limited in the present application.
When a developer creates components of a Virtual object using the ghost engine, each component is self-contained with a "Virtual light" item. As shown in fig. 4, a view window 401 of a component in the Virtual engine is shown, and an item of "Virtual light" carried by the component is shown as 402. For any component, its corresponding virtual light source 402 has a number of attributes, including: intensity (Intensity), illumination Color (Light Color), illumination Direction (Light Direction), highlight Color (Specular Color), shade Color (Shadow Color), Light Source Angle (Source Angle), minimum Roughness (Min Roughness), maximum Roughness (Max Roughness), and the like. And the attribute values corresponding to the attributes are edited in advance by personnel editing scenes such as art designing and the like based on aesthetic design.
Therefore, different from the related art that a lighting channel of a ghost engine is adopted to perform specific illumination coloring on a specific virtual object, in the method provided in the embodiment of the present application, for each specific virtual object, in the design stage, from the aesthetic point of view, the embodiment of the present application uses an attribute value determined for a virtual light source corresponding to each virtual object by an art designer, and by obtaining the attribute value, the attribute value is stored in the geometric coloring process, and in the illumination calculation stage, the attribute value and the geometric information participate in illumination calculation, so that the illumination coloring parameter is determined for the specific virtual object. Therefore, the problem that the lighting channel of the existing version of the unreal engine is limited can be bypassed, and the customized coloring scheme for the specific virtual object is realized, namely, the lighting scheme designed in advance by the art designer is presented in the unreal engine.
When a developer develops virtual scenes and virtual objects in the fields of animation, games, live broadcast and the like by using the illusion engine, the virtual light sources corresponding to the virtual objects can be created and set simultaneously by creating the model components corresponding to the virtual objects. The attribute values of the virtual light sources are determined in advance by the art adjustment, as described above. In addition, the attribute value of the virtual light source is stored in a cache region of the CPU in the illusion engine. Therefore, when the method described in the present application is used to perform illumination rendering on a virtual object, in some embodiments, in step S301, the attribute value preset by the virtual light source is obtained, which may be implemented by: and extracting the attribute value of the virtual light source corresponding to the component based on the parameter corresponding to the component of the virtual object.
Since the relevant parameters (including the attribute values of the virtual light sources) are stored in the CPU when the virtual engine is used to create the components of the virtual object, when the GPU is used to execute step S301 in the method of the present application to obtain the preset attribute values of the virtual light sources, the attribute values of the virtual light sources corresponding to the components can be extracted from the storage area by accessing the storage area of the parameters corresponding to the components of the virtual object, thereby obtaining the preset attribute values of the virtual light sources.
Of course, it should be understood by those skilled in the art that the preset attribute value of the virtual light source may also be stored in advance in a dedicated storage medium or a storage area of a third-party device by an artist in a stage based on aesthetic design, and when the method provided by the embodiment of the present application is used to perform illumination rendering on a virtual object, step S301 obtains the preset attribute value of the virtual light source, or may be that a GPU of a ghost engine directly accesses the storage area of the dedicated storage medium or the third-party device that can communicate with the GPU of the ghost engine, so as to obtain the attribute value of the virtual light source corresponding to the virtual object. When a plurality of virtual objects exist, the virtual objects may be associated with the storage data of the storage area of the dedicated storage medium or the third-party device by adding a mapping table to the illusion engine in advance. The present application does not limit the specific implementation manner of obtaining the preset attribute value of the virtual light source in step S301.
In the technology of performing illumination rendering on a virtual scene, there are two rendering processes: forward Rendering (Forward Rendering) or Forward Shading (Forward Shading) and delayed Shading. The forward coloring or forward coloring method is to transmit all the light source information of one virtual object in the virtual scene to the shader for storage before rendering the virtual object, so that the coloring effect of the object under illumination can be obtained when the illumination coloring calculation is performed on the object. If there are multiple objects in the scene, the above procedure is performed for each object until all objects are rendered. And the delayed coloring is to render all objects in the scene once, store the related data (including position, normal vector, texture, etc.) in a cache, and then calculate again by using the data and the light source information to obtain the final effect.
The delayed coloring mainly comprises two stages: a geometric rendering (Base Pass) stage and a Lighting calculation (Lighting Pass) stage. In the geometric rendering stage, a virtual scene is rendered once, various geometric information of each virtual object in the virtual scene is acquired and stored in a series of textures called G-buffers (G-buffers), and the geometric information includes a Position Vector (Position Vector), a Color Vector (Color Vector), a Normal Vector (Normal Vector) and/or a Specular Value (Specular Value). In the illumination processing stage, the texture data in the G buffer is used, and the result of the virtual scene after illumination is calculated by combining the light source information. The illumination calculation process is the same as that in the forward rendering method, except that the input variables required for the illumination calculation are obtained from the corresponding G-buffers in the delayed shading technique, rather than from the shaders in the forward rendering process. In the embodiment of the application, the illumination rendering process mainly applies a delayed coloring technology.
Therefore, after the preset attribute values of the virtual light sources are obtained, step S302 may be executed to transmit the preset attribute values to the shaders for the vertex shaders and the pixel shaders to access, and further to perform associated storage with various geometric information of each virtual object in the virtual scene obtained in the geometric rendering stage.
In order to compress the storage space and reduce the storage pressure on the buffer, in some embodiments, the step S302 of passing the preset attribute value into the shader may include: and building the preset attribute values into an array, and transmitting the array into a shader through a Uniform cache.
The Uniform cache is a bridge for sharing data between shaders and application programs, is a common cache on the GPU, and can store a large amount of matrix and vector data and the like which need to be transmitted to the shaders. Therefore, the default attribute values of the virtual light sources obtained in step S301 may be stored in the Uniform cache in an array manner by means of the Uniform cache, and then different default attribute values of the virtual light sources are transmitted to corresponding shaders through the Uniform cache.
The preset attribute values are set into an array, and the method can be realized by the following code forms:
VirtualLightUniformBuffer.LightColors[UinformBufferIndex]=VirtualLight.GetColoredLightBrightness();
VirtualLightUniformBuffer.LightDirections[UinformBufferIndex]=VirtualLight.LightDirection;
VirtualLightUniformBuffer.SpecularColors[UinformBufferIndex]=VirtualLight.GetSpecularColor();
VirtualLightUniformBuffer.LightSourceAngles[UinformBufferIndex]=VirtualLight.LightSourceAngle;
......
for convenience of presentation, the code embodiment only gives the array construction of the attribute values such as the illumination color (LightColors), the illumination direction (LightDirections), the highlight color (specularcors), the light source angle (lightsource angle), and the like, and the array construction of other attribute values is similar to the code embodiment. Of course, the attribute values of the virtual light source are established in an array manner, and other specific code forms may also be adopted, which is not limited in this application.
All virtual light sources corresponding to the virtual scene are built into an array and stored in a Unifrom cache, then the array is transmitted into a shader, so that the attribute values of the virtual light sources stored in a CPU can be transmitted into a GPU, and the GPU can utilize the attribute values of the virtual light sources in rendering calculation to determine the illumination and coloring parameters of the virtual objects.
Of course, it should be understood by those skilled in the art that, in addition to creating an array from the preset attribute values through a Uniform cache, the array may be introduced into the shader through other caches, and the preset attribute values may be introduced into the shader in other forms. The other cache may be a common cache between the GPU and the CPU, so as to store the data stored in the CPU in the GPU, and the other cache may be in a form of "attribute identifier + attribute value", or in other transmission form agreed in advance, which is not limited in this application.
As described above, in the delayed rendering technique, during the process of geometry rendering, a scene is rendered once, and various combination information of virtual objects is obtained and stored in a series of textures called G buffer. In the related art, since the lighting channel of the illusion engine is used for performing the specific lighting coloring on the specific virtual object, in the process of geometric coloring, the related art stores the geometric information of the virtual object, but does not store the parameter representing the preset attribute value in the embodiment of the application.
In the embodiment of the application, a conventional thought of the related art is thrown away, and in the process of performing geometric rendering by using a shader, not only the geometric information of the virtual object is stored, but also the parameter representing the preset attribute value is stored. As shown in fig. 5, a schematic diagram (501) is given for storing not only the geometric information of the virtual object (including the position vector, color vector, normal vector and/or mirror value at each pixel position) but also the attribute value of the virtual light source in the geometric rendering process. In the subsequent illumination calculation stage, the parameters representing the preset attribute values and the geometric information are used for illumination calculation together, so that specific illumination coloring parameters (502) for the virtual object can be obtained.
In some embodiments, in step S303, the parameter characterizing the preset attribute value may be the preset attribute value itself, and the attribute value may be in an array form as described in the above embodiments, or in other forms. Of course, in order to reduce the buffer space, the parameter representing the preset attribute value may also be a virtual light source index, and the virtual light source index may be a simple number, such as 0,1,2,3, and the like, and may also be in other forms, as long as the virtual light source index uniquely corresponds to the preset attribute value.
Therefore, when the parameter representing the preset attribute value of the virtual luminaire is the virtual luminaire index, in step S303, the geometric rendering stage stores the geometric information of the virtual object and the virtual luminaire index in the cache of the GPU. In step S304, when performing illumination calculation based on the geometric information and the parameter representing the preset attribute value, first obtaining a virtual light source index from a cache region of the GPU; then, reading the preset attribute values transmitted to the shader in the step S302 according to the index, where the attribute values may be stored in an array form or in other forms; finally, the attribute value of the virtual light source is read, and the geometric information of the current pixel stored in the geometric coloring process is utilized to perform illumination calculation, so that the illumination coloring parameters of the virtual object can be determined, wherein the illumination coloring parameters not only comprise the color parameters of the virtual object, but also comprise the coloring parameters of the virtual object under specific illumination coloring, namely the specific virtual object finally presented in the virtual scene, not only comprises the color information of the virtual object, but also comprises the illumination parameters designed for the virtual object by the designer from the aesthetic point of view.
It can be seen from the above embodiments that, unlike the method in the related art in which the lighting channel of the illusion engine is directly used for illumination coloring of the virtual object, the method in the embodiment of the present application first obtains the preset attribute value of the virtual light source for illumination coloring of the virtual object, then stores the parameter representing the preset attribute value in the geometric coloring process, and in the illumination calculation stage, not only utilizes the geometric information obtained in the geometric process, but also enables the parameter representing the preset attribute value to participate in the illumination calculation, so that the illumination coloring parameter generated by the virtual light source for the virtual object can be obtained. Therefore, the method can solve the problem that the number of the built-in light channels of the illusion engine is insufficient in the related technology, and meets the requirements on the illumination coloring effect of various virtual objects.
In some embodiments, storing the parameter representing the preset attribute value specifically includes: and compressing the parameters representing the preset attribute values by adopting a specified encoding technology, and storing the compression result into a geometric data buffer area.
In the geometric rendering stage, the uncompressed parameters representing the preset attribute values are usually in the RGB888 format, that is, the data are stored in 8 bits in the R channel, the G channel and the B channel, respectively. In the geometric rendering stage, when the parameters representing the preset attribute values are stored, since the space of the buffer area of the GPU is limited, in order to reduce the storage pressure of the buffer area of the GPU, a special encoding technique may be adopted to compress the parameters representing the preset attribute values, and then the compression result is stored in the geometric data buffer area.
In some embodiments, the specified encoding technique is used to compress parameters characterizing preset attribute values in RGB888 format to RG88 format, i.e., data stored in eight bits in R, G, and B channels, respectively, into the upper eight bits and the lower eight bits of the original B channel, which are stored in R and G channels, respectively, to save buffer space in the GPU.
Of course, those skilled in the art should understand that the specified encoding technique may also be other encoding techniques, for example, parameters for compressing the RGB888 format characterizing the preset attribute values to the BG88 format or the RB88 format, etc., which is not limited in this application.
Of course, it should also be understood by those skilled in the art that, correspondingly, when the parameter characterizing the preset attribute value is stored in the encoding format, in step S304 of the method according to the embodiment of the present application, when performing the illumination calculation based on the stored geometric information and the parameter characterizing the preset attribute value, it is necessary to decode the parameter characterizing the preset attribute value first, and then perform the illumination calculation based on the decoded parameter characterizing the preset attribute value in combination with the combination information.
The illumination calculation described in this application can be implemented Based on the illumination calculation Function of the illusion engine, for example, Based on a Bidirectional Reflection Distribution Function (BRDF) of physical Rendering (PBR), soft shadow simulation of a capsule shape, and the like, and related contents may refer to related technologies, which are not described herein.
It can be seen from the above embodiments of the present application that, unlike the related art, a method of directly adopting a light channel of a phantom engine to perform illumination coloring on a virtual object, the present application first obtains a preset attribute value of a virtual light source for performing illumination coloring on the virtual object, then stores a parameter representing the preset attribute value in a geometric coloring process, and in an illumination calculation stage, not only utilizes geometric information obtained in the geometric process, but also enables the parameter representing the preset attribute value to participate in illumination calculation, thereby obtaining an illumination coloring parameter generated by the virtual light source for the virtual object. When the parameters representing the preset attribute values are compressed and stored, the method can solve the problem that the number of the built-in light channels of the illusion engine is insufficient in the related technology, meet the requirements on illumination coloring effects of various virtual objects, relieve the storage pressure of the GPU and save the storage space.
Corresponding to the embodiment of the method, the application also provides an illumination coloring device. As shown in fig. 6, which is a block diagram of an illumination shading device according to an exemplary embodiment shown in the present application, the illumination shading device 600 includes:
an attribute value obtaining module 601, configured to obtain preset attribute values of all virtual light sources, where the virtual light sources are used to perform illumination coloring on a virtual object;
an attribute value transmission module 602, configured to transmit the preset attribute value into a shader;
a storage module 603, configured to store the geometric information of the virtual object and the parameter representing the preset attribute value in the process of performing geometric rendering by using the shader;
a parameter determining module 604, configured to perform illumination calculation based on the geometric information and a parameter representing the preset attribute value, and determine an illumination coloring parameter of the virtual object.
The specific implementation of the illumination coloring of the virtual object by applying the apparatus according to the foregoing embodiment of the present application may refer to the foregoing method embodiment, which is not described in detail herein.
In some embodiments, the apparatus may further include an encoding module and a decoding module. The encoding module is used for compressing the parameters representing the preset attribute values by adopting a specified encoding technology and storing the compression result to the storage module; and the parameter determining module is used for acquiring a compressed parameter representing the preset attribute value from the storage module, decompressing the parameter representing the preset attribute value, and sending a decompression result to the parameter determining module for illumination calculation. Similarly, the detailed content of this embodiment may refer to the method embodiments described above, which are not described herein again.
By utilizing the device provided by the embodiment of the application, the preset attribute value of the virtual light source for lighting and coloring the virtual object can be obtained firstly, then the parameter representing the preset attribute value is stored in the geometric coloring process, and in the lighting calculation stage, the geometric information obtained in the geometric process is utilized, and the parameter representing the preset attribute value participates in lighting calculation, so that the lighting and coloring parameter produced by the virtual light source for the virtual object can be obtained. Therefore, the device can solve the problem that the number of the lamplight channels built in the illusion engine is insufficient in the related technology, and meets the requirements on the illumination coloring effect of various virtual objects.
Corresponding to the foregoing method embodiment, the present application further provides an electronic device, and fig. 7 is a schematic structural diagram of an exemplary electronic device provided in the present application.
As shown in fig. 7, the electronic device 700 provided in this embodiment includes: a processor 701, a memory 704 and a computer program stored on the memory 704 and executable on the processor 701, which when executed by the processor implements the method hereinbefore described. The number of the processors 701 in the electronic device may be one or more, and in fig. 7, taking one processor 701 as an example, the processor may include a GPU702 and a CPU 703. The processor 701 and the memory 704 in the electronic device may be connected by a communication bus or other means, and fig. 5 illustrates an example of a connection by a communication bus 705.
The processor 701 of the electronic device in this embodiment is integrated with the illumination coloring apparatus provided in the above embodiment. In addition, the memory 704 in the electronic device serves as a computer-readable storage medium, and may be used to store one or more programs, which may be software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the illumination rendering method in the embodiment of the present application. The processor 701 executes various functional applications of the device and data processing by executing software programs, instructions and modules stored in the memory 704, that is, implements the illumination coloring method in the above-described method embodiment.
The memory 704 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of the device, and the like. Further, the memory 704 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the memory 704 may further include memory located remotely from the processor 704, which may be connected to devices via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The processor 701 executes a program stored in the memory 704 to execute various functional applications and data processing, thereby implementing the illumination rendering method provided by the embodiment of the present application.
Furthermore, the present application also provides a computer-readable storage medium, which stores a computer program, which when executed by a processor implements any of the methods described above.
The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CDROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The signal medium of the computer readable storage medium may comprise a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing. Computer program code for carrying out operations for aspects of the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The device can execute the methods provided by all the embodiments of the application, and has corresponding functional modules and beneficial effects for executing the methods. For details of the technology not described in detail in this embodiment, reference may be made to the methods provided in all the foregoing embodiments of the present application.
Other embodiments of the present application will be readily apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the specification being indicated by the following claims.
It will be understood that the present description is not limited to the precise arrangements described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present description is limited only by the appended claims.
The above description is only a preferred embodiment of the present disclosure, and should not be taken as limiting the present disclosure, and any modifications, equivalents, improvements, etc. made within the spirit and principle of the present disclosure should be included in the scope of the present disclosure.

Claims (10)

1. A method for illumination shading, the method being performed by a GPU, the method comprising:
acquiring a preset attribute value of a virtual light source, wherein the virtual light source is used for lighting and coloring a virtual object;
transmitting the preset attribute value into a shader;
in the process of geometry coloring by using a shader, storing the geometry information of the virtual object and parameters representing the preset attribute values;
and performing illumination calculation based on the geometric information and the parameters representing the preset attribute values to determine illumination coloring parameters of the virtual object.
2. The method according to claim 1, wherein the obtaining of the preset attribute value of the virtual light source is implemented by:
and extracting the attribute value of the virtual light source corresponding to the virtual object based on the parameter corresponding to the virtual object.
3. The method of claim 1, wherein passing the preset attribute values into a shader comprises:
building the preset attribute values into an array;
the array is passed into the shader through the Uniform cache.
4. The method according to claim 1, wherein the parameter characterizing the preset attribute value is a virtual illuminant index, and the virtual illuminant index uniquely corresponds to the preset attribute value.
5. The method according to claim 1, wherein storing parameters characterizing the preset attribute values comprises:
compressing the parameters representing the preset attribute values by adopting a specified encoding technology;
and storing the compression result to a geometric data buffer.
6. The method of claim 5, wherein the specified encoding technique is used to compress parameters characterizing the preset attribute values in RGB888 format to RG88 format.
7. An illumination coloring apparatus, said apparatus comprising:
the attribute value acquisition module is used for acquiring preset attribute values of all virtual light sources, and the virtual light sources are used for lighting and coloring the virtual object;
the attribute value transmission module is used for transmitting the preset attribute value into a shader;
the storage module is used for storing the geometric information of the virtual object and the parameter representing the preset attribute value in the process of performing geometric coloring by using the shader;
and the parameter determining module is used for carrying out illumination calculation based on the geometric information and the parameter representing the preset attribute value, and determining the illumination coloring parameter of the virtual object.
8. The apparatus of claim 7, further comprising:
the coding module is used for compressing the parameters representing the preset attribute values by adopting a specified coding technology and storing the compression result to the storage module;
and the decoding module is used for acquiring the compressed parameters representing the preset attribute values from the storage module, decompressing the parameters representing the preset attribute values, and then sending the decompressed results to the parameter determination module for illumination calculation.
9. An electronic device, characterized in that the electronic device comprises a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method of any of claims 1 to 6 when executing the program.
10. A computer-readable storage medium, characterized in that the storage medium stores a computer program which, when executed by a processor, implements the method of any of the preceding claims 1 to 6.
CN202110076158.7A 2021-01-20 2021-01-20 Illumination coloring method and device, electronic equipment and computer readable storage medium Pending CN112750189A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110076158.7A CN112750189A (en) 2021-01-20 2021-01-20 Illumination coloring method and device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110076158.7A CN112750189A (en) 2021-01-20 2021-01-20 Illumination coloring method and device, electronic equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN112750189A true CN112750189A (en) 2021-05-04

Family

ID=75652598

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110076158.7A Pending CN112750189A (en) 2021-01-20 2021-01-20 Illumination coloring method and device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN112750189A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113313811A (en) * 2021-06-29 2021-08-27 完美世界(北京)软件科技发展有限公司 Illumination processing method and device, electronic equipment and storage medium
CN113398594A (en) * 2021-05-07 2021-09-17 深圳市灼华互娱科技有限公司 Character model light creating method, device, equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113398594A (en) * 2021-05-07 2021-09-17 深圳市灼华互娱科技有限公司 Character model light creating method, device, equipment and storage medium
CN113313811A (en) * 2021-06-29 2021-08-27 完美世界(北京)软件科技发展有限公司 Illumination processing method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
WO2022116759A1 (en) Image rendering method and apparatus, and computer device and storage medium
CN111033570B (en) Rendering images from computer graphics using two rendering computing devices
US10755473B2 (en) Graphics processing system
CN111340928B (en) Ray tracing-combined real-time hybrid rendering method and device for Web end and computer equipment
US9928637B1 (en) Managing rendering targets for graphics processing units
US9330475B2 (en) Color buffer and depth buffer compression
US20100060652A1 (en) Graphics rendering system
CN112750189A (en) Illumination coloring method and device, electronic equipment and computer readable storage medium
CN110124318B (en) Method and device for making virtual vegetation, electronic equipment and storage medium
JP5731566B2 (en) Information processing apparatus, control method, and recording medium
TW201624278A (en) Apparatus and method for efficient graphics processing in a virtual execution environment
US11069119B1 (en) Methods and systems for constructing a shader
TW201702992A (en) Edge-based coverage mask compression
EP3210109A1 (en) Devices and methods for generating elementary geometries
JP6470766B2 (en) Method and apparatus for updating a shader program based on a current state
US8379024B2 (en) Modular shader architecture and method for computerized image rendering
CN113648652B (en) Object rendering method and device, storage medium and electronic equipment
US20210183129A1 (en) Graphics processing
Sabbadin et al. High Dynamic Range Point Clouds for Real‐Time Relighting
CN116206006A (en) Card style direct illumination effect rendering method based on UE rendering engine
US9626791B2 (en) Method for representing a participating media in a scene and corresponding device
US10062140B2 (en) Graphics processing systems
CN115205440A (en) Image rendering method and device
Schwandt et al. Differential G-Buffer rendering for mediated reality applications
Martinez Adapting architectural models for visualization using virtual reality headsets

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination