CN113313622A - Illumination simulation method and device in virtual scene and electronic equipment - Google Patents

Illumination simulation method and device in virtual scene and electronic equipment Download PDF

Info

Publication number
CN113313622A
CN113313622A CN202110456544.9A CN202110456544A CN113313622A CN 113313622 A CN113313622 A CN 113313622A CN 202110456544 A CN202110456544 A CN 202110456544A CN 113313622 A CN113313622 A CN 113313622A
Authority
CN
China
Prior art keywords
illumination
area
virtual scene
target
preset area
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
CN202110456544.9A
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 Sanqi Mutual Entertainment Technology Co ltd
Original Assignee
Guangzhou Sanqi Mutual Entertainment 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 Sanqi Mutual Entertainment Technology Co ltd filed Critical Guangzhou Sanqi Mutual Entertainment Technology Co ltd
Priority to CN202110456544.9A priority Critical patent/CN113313622A/en
Publication of CN113313622A publication Critical patent/CN113313622A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/04Texture mapping
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/50Lighting effects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2210/00Indexing scheme for image generation or computer graphics
    • G06T2210/61Scene description

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Graphics (AREA)
  • Image Generation (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The application discloses a method and a device for simulating illumination in a virtual scene and electronic equipment, wherein the method comprises the following steps: acquiring illumination parameters of a light source in a preset area in a current virtual scene; according to the illumination direction in the illumination parameters, performing illumination detection on the preset area to obtain a target area in the preset area, wherein the target area is an area in which light is shielded; acquiring a corresponding target material from a material library according to the state information of the virtual object in the target area, wherein the state information is used for indicating that the virtual object is in a light shielding state, and the target material does not contain an illumination algorithm generated aiming at the illumination parameter; and rendering the virtual object according to the target material.

Description

Illumination simulation method and device in virtual scene and electronic equipment
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for simulating illumination in a virtual scene, and an electronic device.
Background
In a virtual scene, a direction light, such as a spotlight, is usually used to simulate the lighting effect, so that the display effect of the virtual scene is more realistic. In the related art, the illumination parameters such as the position of the direction light, the illumination direction of the light, the color of the light and the like are recorded, the illumination formed by the illumination parameters is calculated, and the virtual object is rendered by combining the texture mapping of the virtual object in the virtual scene, so that the effect of the illuminated analog body is achieved.
However, in the virtual scene, there is generally a blocking object for blocking the illumination, and the virtual object is rendered directly by the material formed by the illumination parameters, so that the virtual object whose light is blocked can also show the illuminated effect, which results in poor display effect of the virtual scene on the display picture formed by the god viewing angle, and reduces the experience of the user.
Disclosure of Invention
The present application aims to solve at least one of the technical problems in the prior art, and provides a method and an apparatus for simulating illumination in a virtual scene, and an electronic device, so that a virtual object shielded in the virtual scene realizes an effect of blocking light.
In a first aspect, an embodiment of the present application provides a method for simulating illumination in a virtual scene, including:
acquiring illumination parameters of a light source in a preset area in a current virtual scene;
according to the illumination direction in the illumination parameters, performing illumination detection on the preset area to obtain a target area in the preset area, wherein the target area is an area in which light is shielded;
acquiring a corresponding target material from a material library according to the state information of the virtual object in the target area, wherein the state information is used for indicating that the virtual object is in a light shielding state, and the target material does not contain an illumination algorithm generated aiming at the illumination parameter;
and rendering the virtual object according to the target material.
After the target area which is shaded by light in the preset area is determined through the illumination parameters, the virtual object in the target area is rendered by adopting the target material which does not contain the illumination parameters, so that illumination information is selectively changed in the rendering process, the illumination calculation of the virtual object in the shaded target area is reduced to reduce the calculation amount of a GPU (graphics processing unit), the rendering efficiency is ensured, meanwhile, the effect of light blocking of the shaded virtual object in the current virtual scene can be realized, and the user experience is improved.
In a second aspect, in an embodiment of the present application, there is also provided an illumination simulation apparatus in a virtual scene, including:
the parameter acquisition module is used for acquiring illumination parameters of a light source in a preset area in a virtual scene;
the area acquisition module is used for carrying out illumination detection on the preset area according to the illumination direction in the illumination parameters to acquire a target area in the preset area, wherein the target area is an area in which light is shielded;
a material obtaining module, configured to obtain a target material of the virtual object in the target area, where the target material does not include an illumination algorithm generated for the illumination parameter;
and the object rendering module is used for rendering the virtual object according to the target material.
In a third aspect, an embodiment of the present application provides an electronic device, including: a memory, a processor and a computer program stored on the memory and executable on the processor, the processor when executing the program implementing the method of light simulation in a virtual scene as described in the embodiments above.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium storing computer-executable instructions for causing a computer to perform the method for simulating illumination in a virtual scene according to the foregoing embodiments.
Drawings
The present application is further described with reference to the following figures and examples;
FIG. 1 is a diagram of an application environment of a method for simulating illumination in a virtual scene, according to an embodiment;
fig. 2 is a schematic flowchart of a method for simulating illumination in a virtual scene according to an embodiment;
fig. 3 is a schematic structural diagram of a preset region of a lighting simulation method in a virtual scene according to an embodiment;
fig. 4 is a schematic structural diagram of a preset region of a lighting simulation method in a virtual scene according to another embodiment;
fig. 5 is a schematic flowchart of a method for simulating illumination in a virtual scene according to another embodiment;
fig. 6 is a flowchart illustrating a method for determining a target area according to an embodiment;
FIG. 7 is a flowchart illustrating a method for obtaining a target material according to an embodiment;
FIG. 8 is a block diagram of an illumination simulation apparatus in a virtual scene according to an embodiment;
FIG. 9 is a schematic diagram of an illumination simulation apparatus in a virtual scene according to another embodiment
FIG. 10 is a block diagram showing a configuration of a computer device according to an embodiment.
Detailed Description
Reference will now be made in detail to the present embodiments of the present application, preferred embodiments of which are illustrated in the accompanying drawings, which are for the purpose of visually supplementing the description with figures and detailed description, so as to enable a person skilled in the art to visually and visually understand each and every feature and technical solution of the present application, but not to limit the scope of the present application.
In order to make the solution of the present application easier to understand, the following explains some concepts involved in the present application:
a direction lamp: is a collimated light source used in a game engine to simulate the sun.
Virtual scene: is a virtual scene displayed when an application program runs on a terminal. The virtual scene may be a simulation environment of a real world, a semi-simulation semi-fictional virtual environment, or a pure fictional virtual environment. The virtual scene may be any one of a two-dimensional virtual scene, a 2.5-dimensional virtual scene, or a three-dimensional virtual scene.
Virtual object: the virtual scene may include a plurality of virtual objects, each virtual object has its own shape and volume in the virtual scene and occupies a part of the space in the virtual scene.
Texture mapping: is a bitmap image of a virtual object, the texture map may represent many other aspects of the material surface, such as its reflectivity or roughness, in addition to the basic color (albedo) of the virtual object surface.
A shader: are small scripts that contain mathematical calculations and algorithms to calculate the color rendered by each pixel based on the lighting input and the configuration of the material.
The material is as follows: the set of various visual attributes of the virtual object defines the rendering mode that the object surface should use by including references to the used texture maps, tiling information, color tones, etc., for providing rendering data and lighting algorithms for the program.
Typically, to make a virtual scene closer to a real scene, lighting is simulated in the virtual scene. Simulated illumination is a very important research content in computer graphics, and relates to many fields, such as animation, virtual reality, games, and the like, so that the display effect of a scene is more vivid. For example, in the field of games, a scheme of simulating illumination is generally to simulate a light-emitting object, such as the sun, by using a direction light, then record illumination parameters such as the position of the direction light, the illumination direction of light, the intensity of light, the color of light, and the like, then calculate the illumination formed by the illumination parameters, and render a virtual object by combining materials formed by texture maps of the virtual object in a virtual scene, so that the virtual object achieves the effect of an analog body after being illuminated. However, in the virtual scene, there are usually shelters for shading the illumination, and these shelters may exist at the beginning of loading the virtual scene, or may be added later, or may be fixed, or may be moved. If the virtual object is rendered through the material formed by the illumination parameters, the virtual object with the light shielded can also present the illuminated effect, the real scene cannot be well simulated, and the display effect of the virtual scene on the display picture formed by the view angle of the emperor is poor.
In order to solve the above technical problem, as shown in fig. 1, an application environment diagram to which the technical solution of the embodiment of the present application can be applied is shown. In the application environment, a terminal device 110 and a server 120 may be included. Data is communicated between terminal device 110 and server 120 via a communication link, which may include various connection types, such as a wired communication link or a wireless communication link. The terminal device 110 in fig. 1 may be any number of terminal devices, and specifically may be any one or more of a mobile phone, a tablet computer, a notebook computer, a wearable device, and other terminal devices having a display screen. The server 120 may be implemented by an independent server 120 or a server cluster composed of a plurality of servers 120, and may also be a cloud server providing basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a web service, cloud communication, middleware service, a domain name service, a security service, a CDN, and a big data and artificial intelligence platform. In this embodiment, the terminal device 110 may be used as a front end of a game client running a game, and the server 120 may be used as a background of the game client, so that after the server 120 obtains a data call request sent by a game user in the terminal device 110 through the game client, a long connection may be quickly established with the terminal device 110.
In an embodiment, the terminal device 110 is loaded with a game, the game includes a virtual scene, and during the running of the game, the terminal device 110 acquires character information and operation information of a virtual character from the server 120 according to a user operation or through a communication link, for example, the virtual character is moved to a target direction or a target point, so that the terminal device 110 can determine a current virtual scene according to the character information and the operation information of the virtual character; alternatively, the terminal device 110 may also directly obtain the current game scene from the memory of the terminal device 110 or from the server 120 according to a request or an instruction of the user, such as a selection operation for a game map. The memory or the server executes the operation according to the instruction or the request, which belongs to the prior art, so that the content or the form of the instruction or the request is not particularly limited. After the current virtual scene is obtained, the terminal device obtains the illumination parameters of the light source of the preset area in the current virtual scene from the local memory or the server 120, and after the target area which is shaded by the light in the preset area is determined according to the illumination parameters, the virtual object in the target area is rendered by adopting the target material which does not contain the illumination parameters, so that the illumination information is selectively changed in the rendering process, the illumination calculation of the virtual object in the shaded target area is reduced to reduce the calculation amount of a GPU (graphics processing unit), the rendering efficiency is ensured, meanwhile, the effect of light blocking can be realized on the virtual object which is shaded in the current virtual scene, and the user experience is improved.
As an alternative embodiment, the method may be performed by the terminal device, or by both the server and the terminal device.
The method for simulating illumination in a virtual scene provided by the embodiments of the present application will be described and explained in detail with several specific embodiments.
In one embodiment, as shown in FIG. 2, a method of light simulation in a virtual scene is provided. The embodiment is mainly illustrated by applying the method to computer equipment. The computer device may specifically be the terminal device 110 in fig. 1 described above.
Referring to fig. 2, the illumination simulation method in the virtual scene specifically includes the following steps:
and S11, acquiring the illumination parameters of the light sources in the preset area in the current virtual scene.
The illumination parameters comprise the current illumination intensity, the current illumination color, the current illumination direction and the like of the light source, the preset area is a part of or the whole virtual space divided from the current virtual scene, and the size of the preset area can be set according to actual requirements.
And step S12, performing illumination detection on the preset area according to the illumination direction in the illumination parameters, and acquiring a target area in the preset area, wherein the target area is an area in which light is shielded.
In one embodiment, the illumination direction includes a direction of direct light and indirect light, wherein the direct light is light which is triggered from the light source and directly irradiates the object, and the indirect light is light which is formed after the light is reflected among a plurality of objects and finally enters the camera. The triggering of the illumination detection on the preset area can be triggering the illumination detection on the preset area when the illumination direction in the illumination parameters changes; or when detecting that the moving virtual object exists in the preset area, triggering illumination detection on the preset area; or when the virtual object is detected to be newly added in the preset area, triggering the illumination detection of the preset area.
In an embodiment, as shown in fig. 3 or 4, the preset area may be divided into a plurality of sub-areas according to the illumination direction, each sub-area may be represented by a rectangle with a preset size on the formation map of the current game scene, the illumination direction is simulated in the current virtual scene through the game engine, then illumination detection is performed on the preset area, the sub-area in the preset area where light is blocked is marked according to the result after the illumination detection, and finally the sub-area where each light is blocked forms the target area. If a non-transparent shade, such as a wall, a vehicle, a building, etc., exists at the position of the sub-area in the preset area, the sub-area is marked, such as the sub-area indicated by the letter a in fig. 3 or fig. 4, and finally all the marked sub-areas form a target area. The preset area is divided to form a plurality of sub-areas, so that the sub-areas only need to be traversed in the subsequent process of determining the shielded area, the target area is more conveniently determined, and the calculation amount is reduced. And because the sub-areas are divided according to the illumination direction, a scene similar to illumination projection can be simulated when the target area is rendered subsequently, and the display effect of the game scene is improved.
In one embodiment, the illumination detection mode may be collision detection, that is, the light emitted from the light source is detected by the ray detection function of a physical engine in the game engine, where the physical engine may be PhysX, hawok or bull. When no collision is detected, the fact that no shielding object exists in the sub-area is indicated; when a collision is detected, it indicates that there is a blockage on the sub-region, and the sub-region is marked. It can be known that collision detection is only performed in a preset area, and collision detection is not performed beyond the range of the preset area.
Step S13, acquiring a corresponding target material from the material library according to the state information of the virtual object in the target area, wherein the state information is used for indicating that the virtual object is in a light shielding state, and the target material does not contain the illumination algorithm generated aiming at the illumination parameter.
Since the material library for storing the materials usually includes a plurality of materials, and there may be two or more materials including the same texture map in the plurality of materials, generally, the corresponding target material is obtained from the material library, or any initial material including the texture map of the virtual object in the target area is obtained from the material library, and when the initial material includes the illumination algorithm, the illumination algorithm in the initial material is deleted to generate the target material. The initial material is a material pre-stored in a material library, and an illumination algorithm performed based on an illumination parameter may or may not exist. Illustratively, when the obtained initial material has an illumination algorithm containing illumination parameters, if it is detected that the current virtual scene is loaded on the display screen of the terminal device, modifying the material parameters of the initial material through a preset script of the illumination algorithm, such as an InShadowObject, for rejecting the illumination parameters in the initial material, and rejecting the illumination operation in the initial material. And when the obtained initial material does not have an illumination algorithm based on the illumination parameters, directly taking the initial material as a target material. However, since the initial material may include a shared material shared by a plurality of virtual objects, if the initial material is modified directly, the shared material may be modified, so that all the virtual objects using the shared material in the current virtual scene are affected, and a virtual object that should originally present an illumination effect according to the illumination parameter cannot present a corresponding illumination effect. Therefore, in order to ensure that only the illumination algorithm of the virtual object in the target area is deleted and reduce the influence on other virtual objects, the initial material is copied, then the copied initial material is modified, and the modified initial material is used as the target material of the virtual object in the corresponding target area, so that the target material after the illumination algorithm is deleted only aims at the virtual object in the target area, and other objects in the scene cannot be influenced. However, since each material includes a script, the number of scripts to be copied is increased for the copy of the initial material, and if there are a plurality of shared materials and each shared material needs to be copied, the number of scripts to be copied is too large, which results in an excessive calculation amount for the terminal device. Therefore, the problem of overlarge calculation amount can be avoided by means of deleting the illumination algorithm of the initial material in the local database after the initial material is stored in the local database. At this time, the initial material stored locally only affects the virtual object in the target area, and does not affect other virtual objects. For example, the initial material may be detected, the material information of the shared material part included in the initial material may be stored in the local database, and the shared material part included in the initial material may be converted into unshared material, so that when the subsequent modification of the initial material is ensured, only the virtual object in the target area may be affected, and the amount of data stored in the local database may be reduced. Of course, besides the way of saving the material information including the shared material part to the local database, the complete initial material can be saved to the local database, and the specific saving way can be adjusted according to the actual situation.
However, the shared material is stored locally and is converted into the unshared material, so that when the unshared material is changed in attribute, the terminal device needs to create a new storage space, and the memory is not released until the scene is switched or referenced, which may cause memory leakage. Meanwhile, in consideration of the fact that the illumination state of the virtual object is limited, i.e. illuminated and not illuminated, and there is a corresponding material in each state, in one embodiment, the corresponding target material is obtained from the material library through the state information of the virtual object. As an example of this embodiment, since it is detected that the light in the target area is blocked by the illumination detection, the state of the virtual object in the target area may be correspondingly marked as being in a light-blocked state, that is, not being illuminated. According to the state of the virtual object in the target area, the target material which is the same as the state is matched from the material library, so that no matter the target material does not contain the shared material, adverse effects on other virtual objects in the current virtual scene can not be caused, any modification on the material is not needed, the calculation amount of the terminal equipment can not be increased, and meanwhile, memory leakage can not be caused.
The illumination calculation can include real-time ambient light calculation, emitted light calculation, light shadow calculation and the like through illumination parameters, and because the target area is a shielded area and cannot be irradiated by the light in the global direction generated by the light source, the surface of the virtual object in the target area only presents the basic color of the virtual object without considering the illumination factors, the virtual object in the target area does not need to calculate the direct light information, and only the virtual object outside the target area needs to calculate the direct light information, so that the consumption is reduced.
And step S14, rendering the virtual object according to the target material.
In one embodiment, the corresponding shader is obtained by the target material that does not include the illumination calculation. Because the target material does not contain illumination calculation, when the current virtual scene is rendered, the shader also does not contain illumination calculation on the virtual object in the target area by running the preset script in the target material. The shader which does not contain illumination calculation renders the virtual object, so that the shaded virtual object achieves the effect of light ray blocking, and meanwhile, the running consumption of equipment is reduced.
The method comprises the steps of performing illumination detection on the current virtual scene based on illumination parameters in advance, rendering the virtual objects in the target area by adopting target materials which do not contain the illumination parameters after determining the target area which is shaded by light in the preset area, selectively changing illumination information in the rendering process, reducing the illumination calculation of the virtual objects in the shaded target area so as to reduce the calculation amount of a GPU (graphics processing unit), ensuring the rendering efficiency, realizing the effect of light blocking by the shaded virtual objects in the current virtual scene, and improving the user experience.
Since in the virtual scene, the partial area is without light source, no processing is needed. Therefore, in order to obtain a suitable predetermined area to reduce the computation amount, in an embodiment, as shown in fig. 5, a flow diagram of an illumination simulation method in a virtual scene in another embodiment is shown. Before step S11, the method further includes:
and step S09, acquiring the current position information of the light source in the current virtual scene.
Through the current position information of the light source, the position of the light source can be positioned in the current virtual scene.
And step S10, determining a preset area in the current virtual scene according to the current position information.
In one embodiment, the light source can be preset as a center, and the area within the preset range is a preset area, for example, a circular area formed by taking the light source as a center and having a radius of 10 can be preset as a preset area. It will be appreciated that the predetermined range may be adjusted according to the game requirements. After the light source position is determined, a preset area can be determined in the current virtual scene by taking the light source position as a center according to the preset mode.
In order to make the setting of the range of the preset region more reasonable, and avoid omitting part of the region which should be subjected to illumination processing, or adding part of the region which should not be subjected to illumination processing, in an embodiment, the preset region can be determined in the virtual scene according to the current position information of the light source and the illumination range of the light source, so that the setting accuracy of the preset region is improved. After the position of the light source in the current virtual scene is obtained, the illumination range of the light source can be determined according to the illumination intensity of the light source, so that the boundary of the area is determined according to the illumination range, and the preset area is further determined through the boundary.
Because the size of the virtual object may be inconsistent and the shape of the virtual object may also be irregular, such as a carrier or a tree, when the preset sub-area is used to represent the shielding range of the virtual object, the size of the sub-area may not be completely covered by the virtual object, and the presented shielding range of the illumination may be inconsistent with the actual shielding range of the illumination, which may cause the reduction degree of the game scene to be unrealistic. To further improve the restorability of the game scene, as shown in fig. 6, in an embodiment, the method for determining the target area includes:
and step S21, carrying out illumination detection on the preset area, and acquiring the light and shadow information in the preset area.
In one embodiment, the occlusion area of the occlusion object in the preset area can be determined by simulating the illumination direction in the current virtual scene by the game engine and then performing illumination detection, such as collision detection, on the preset area. After the shielding area is determined, the shielding area is projected according to the illumination direction and the conventional projection principle and is projected to a preset area, so that light and shadow information, namely the projection area of the shielding object, is obtained.
And step S22, acquiring a target area in the preset area according to the light and shadow information.
In an embodiment, after obtaining the light and shadow information, that is, the projection area of the obstruction in the preset area, all the projection areas in the preset area are marked as the target area.
The target area is determined through the light and shadow information in the preset area, so that the actual illumination shielding condition can be restored more truly, and the restoration degree of the game scene is improved.
Considering that when the initial material with the shared material is used for rendering, if the subsequent shared material is modified on other terminal devices, the rendering result of the virtual object in the target area is affected. Therefore, in an embodiment, as shown in fig. 7, the method for obtaining the target material includes:
step S31 is to detect each initial material in the material library corresponding to the texture map of the virtual object.
The specific detection method may determine whether the initial material includes a material file with a shared attribute by detecting an attribute directory of the initial material, or perform detection by using other conventional techniques, which is not limited herein.
Step S32, when it is detected that the shared material exists in each of the initial materials, acquiring a corresponding target material from each of the initial materials according to the state information of the virtual object in the target area.
In an embodiment, when it is detected that all the initial materials including the texture maps of the virtual objects include the material file with the shared attribute, in order to reduce the amount of computation and avoid memory leakage caused by copying or storing the initial materials, the target material is obtained from each initial material according to the state information.
Step S33, when it is detected that at least one of the initial materials does not have a shared material, deleting the illumination algorithm of any initial material not including the shared material, and generating a target material.
In an embodiment, when it is detected that one initial material not including the shared material exists among all the initial materials including the texture maps of the virtual objects, in order to avoid that the modification of other terminal devices causes an influence on the rendering result of the virtual objects in the target area, the change of the rendering result of the virtual objects caused when the material file is modified is reduced by directly deleting the illumination algorithm of the initial material not including the shared material.
In one embodiment, as shown in fig. 8, there is provided an illumination simulation apparatus in a virtual scene, including:
the parameter obtaining module 101 is configured to obtain an illumination parameter of a light source in a preset area in a virtual scene.
The area obtaining module 102 is configured to perform illumination detection on the preset area according to the illumination direction in the illumination parameter, and obtain a target area in the preset area, where the target area is an area where light is blocked.
The material obtaining module 103 is configured to obtain a corresponding target material from a material library according to state information of the virtual object in the target area, where the state information is used to indicate that the virtual object is in a light shielding state, and the target material does not include an illumination algorithm generated for the illumination parameter.
And an object rendering module 104, configured to render the virtual object according to the target material.
In an embodiment, as shown in fig. 9, another illumination simulation apparatus in a virtual scene is provided, which includes, in addition to the structure shown in fig. 7:
and the information obtaining module 099 is configured to obtain current position information of the light source in the current virtual scene.
The area determining module 100 is configured to determine a preset area in the current virtual scene according to the current location information.
In an embodiment, the area determination module 100 is specifically configured to:
and determining a preset area in the virtual scene according to the current position information and the illumination range of the light source.
In one embodiment, the predetermined area includes a plurality of sub-areas. The area obtaining module 102 is specifically configured to: performing illumination detection on a preset area, acquiring each shielded subarea from the preset area, and dividing the subareas into boundaries according to the illumination direction; and forming a target area according to the blocked sub-areas.
In an embodiment, the area obtaining module 102 is specifically configured to:
and according to the illumination direction in the illumination parameters, performing illumination detection on the preset area to acquire the illumination information in the preset area. And acquiring a target area in the preset area according to the light and shadow information.
In an embodiment, the material obtaining module 103 is specifically configured to: and detecting each initial material corresponding to the texture map of the virtual object in the material library, and acquiring a corresponding target material from each initial material according to the state information of the virtual object in the target area when detecting that the shared material exists in each initial material.
In an embodiment, the material obtaining module 103 is further configured to: and when detecting that at least one initial material in the initial materials does not have the shared material, deleting the illumination algorithm of any initial material without the shared material to generate the target material.
In one embodiment, a computer apparatus is provided, as shown in fig. 10, which includes a processor, a memory, a network interface, an input device, and a display screen connected by a system bus. Wherein the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and may also store a computer program that, when executed by the processor, causes the processor to implement a method of light simulation in a virtual scene. The internal memory may also have stored therein a computer program that, when executed by the processor, causes the processor to perform a method of light simulation in a virtual scene. Those skilled in the art will appreciate that the architecture shown in fig. 10 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, the illumination simulation apparatus in the virtual scene provided by the present application can be implemented in the form of a computer program, and the computer program can be run on a computer device as shown in fig. 10. The memory of the computer device may store therein the individual program modules constituting the illumination simulation means in the virtual scene. The program modules constitute computer programs that cause a processor to execute the steps in the illumination simulation method in the virtual scene according to the embodiments of the present application described in the present specification.
In one embodiment, a computer-readable storage medium is provided, which stores computer-executable instructions for causing a computer to perform the steps of the above-described method of illumination simulation in a virtual scene. Here, the steps of the illumination simulation method in the virtual scene may be the steps of the illumination simulation method in the virtual scene in the above-described embodiments.
The foregoing is a preferred embodiment of the present application, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present application, and these modifications and decorations are also regarded as the protection scope of the present application.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.

Claims (10)

1. A method of simulating illumination in a virtual scene, comprising:
acquiring illumination parameters of a light source in a preset area in a current virtual scene;
according to the illumination direction in the illumination parameters, performing illumination detection on the preset area to obtain a target area in the preset area, wherein the target area is an area in which light is shielded;
acquiring a corresponding target material from a material library according to the state information of the virtual object in the target area, wherein the state information is used for indicating that the virtual object is in a light shielding state, and the target material does not contain an illumination algorithm generated aiming at the illumination parameter;
and rendering the virtual object according to the target material.
2. The illumination simulation method in the virtual scene according to claim 1, before obtaining the illumination parameters of the light sources in the preset area in the current virtual scene, further comprising:
acquiring current position information of the light source in a current virtual scene;
and determining the preset area in the current virtual scene according to the current position information.
3. The method of claim 2, wherein the determining the preset region in the virtual scene according to the current position information comprises:
and determining the preset area in the virtual scene according to the current position information and the illumination range of the light source.
4. The method of light simulation in a virtual scene of claim 1, wherein the preset area comprises a plurality of sub-areas;
carrying out illumination detection on the preset area to obtain a target area in the preset area, wherein the method comprises the following steps:
performing illumination detection on the preset area, and acquiring each blocked sub-area from the preset area, wherein the sub-areas are divided according to the illumination direction;
and forming the target area according to the blocked sub-areas.
5. The illumination simulation method in the virtual scene according to claim 1, wherein performing illumination detection on the preset area to obtain a target area in the preset area comprises:
carrying out illumination detection on the preset area to acquire the light and shadow information in the preset area;
and acquiring a target area in the preset area according to the light and shadow information.
6. The illumination simulation method in the virtual scene according to claim 1, before obtaining the corresponding target material from the material library according to the state information of the virtual object in the target area, further comprising:
detecting each initial material corresponding to the texture map of the virtual object in the material library;
the obtaining of the corresponding target material from the material library according to the state information of the virtual object in the target area includes:
and when the shared material exists in each initial material, acquiring a corresponding target material from each initial material according to the state information of the virtual object in the target area.
7. The method of claim 6, further comprising, after detecting each initial material in the material library corresponding to a texture map of the virtual object:
and when detecting that at least one initial material in the initial materials does not have the shared material, deleting the illumination algorithm of any initial material not containing the shared material to generate the target material.
8. An illumination simulation apparatus in a virtual scene, comprising:
the parameter acquisition module is used for acquiring illumination parameters of a light source in a preset area in a virtual scene;
the area acquisition module is used for carrying out illumination detection on the preset area according to the illumination direction in the illumination parameters to acquire a target area in the preset area, wherein the target area is an area in which light is shielded;
a material obtaining module, configured to obtain a target material of the virtual object in the target area, where the target material does not include an illumination algorithm generated for the illumination parameter;
and the object rendering module is used for rendering the virtual object according to the target material.
9. An electronic device, comprising: memory, processor and computer program stored on the memory and executable on the processor, characterized in that the processor, when executing the program, implements a method of light simulation in a virtual scene as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, in which a computer program is stored which is adapted to be loaded and executed by a processor to cause a computer device having said processor to carry out the method of any one of claims 1 to 7.
CN202110456544.9A 2021-04-26 2021-04-26 Illumination simulation method and device in virtual scene and electronic equipment Pending CN113313622A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110456544.9A CN113313622A (en) 2021-04-26 2021-04-26 Illumination simulation method and device in virtual scene and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110456544.9A CN113313622A (en) 2021-04-26 2021-04-26 Illumination simulation method and device in virtual scene and electronic equipment

Publications (1)

Publication Number Publication Date
CN113313622A true CN113313622A (en) 2021-08-27

Family

ID=77371164

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110456544.9A Pending CN113313622A (en) 2021-04-26 2021-04-26 Illumination simulation method and device in virtual scene and electronic equipment

Country Status (1)

Country Link
CN (1) CN113313622A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114385289A (en) * 2021-12-23 2022-04-22 北京字跳网络技术有限公司 Rendering display method and device, computer equipment and storage medium
CN114581576A (en) * 2021-12-13 2022-06-03 北京市建筑设计研究院有限公司 Three-dimensional scene light configuration method and device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108236783A (en) * 2018-01-09 2018-07-03 网易(杭州)网络有限公司 The method, apparatus of illumination simulation, terminal device and storage medium in scene of game
CN108597030A (en) * 2018-04-23 2018-09-28 新华网股份有限公司 Effect of shadow display methods, device and the electronic equipment of augmented reality AR
CN111862295A (en) * 2020-07-17 2020-10-30 完美世界(重庆)互动科技有限公司 Virtual object display method, device, equipment and storage medium
CN112190937A (en) * 2020-10-10 2021-01-08 网易(杭州)网络有限公司 Illumination processing method, device, equipment and storage medium in game

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108236783A (en) * 2018-01-09 2018-07-03 网易(杭州)网络有限公司 The method, apparatus of illumination simulation, terminal device and storage medium in scene of game
CN108597030A (en) * 2018-04-23 2018-09-28 新华网股份有限公司 Effect of shadow display methods, device and the electronic equipment of augmented reality AR
CN111862295A (en) * 2020-07-17 2020-10-30 完美世界(重庆)互动科技有限公司 Virtual object display method, device, equipment and storage medium
CN112190937A (en) * 2020-10-10 2021-01-08 网易(杭州)网络有限公司 Illumination processing method, device, equipment and storage medium in game

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114581576A (en) * 2021-12-13 2022-06-03 北京市建筑设计研究院有限公司 Three-dimensional scene light configuration method and device, electronic equipment and storage medium
CN114385289A (en) * 2021-12-23 2022-04-22 北京字跳网络技术有限公司 Rendering display method and device, computer equipment and storage medium
CN114385289B (en) * 2021-12-23 2024-01-23 北京字跳网络技术有限公司 Rendering display method and device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
EP4242973A1 (en) Image processing method and related apparatus
WO2022116659A1 (en) Volumetric cloud rendering method and apparatus, and program and readable medium
CN111723902A (en) Dynamically estimating lighting parameters for a location in an augmented reality scene using a neural network
US9478065B2 (en) System and method for remote generation of indirect illumination sources in three-dimensional graphics
CN111968215A (en) Volume light rendering method and device, electronic equipment and storage medium
JP2012524327A (en) How to add shadows to objects in computer graphics
CN111400024B (en) Resource calling method and device in rendering process and rendering engine
CN113313622A (en) Illumination simulation method and device in virtual scene and electronic equipment
CN111968214B (en) Volume cloud rendering method and device, electronic equipment and storage medium
CN111127623A (en) Model rendering method and device, storage medium and terminal
US11610364B2 (en) Method, device, and storage medium for applying lighting to a rendered object in a scene
CN112991508A (en) WebGL-based 3D rendering system and method
CN112233220B (en) OpenSceneGraph-based volumetric light generation method, device, equipment and storage medium
CN112884874A (en) Method, apparatus, device and medium for applying decals on virtual model
US10776996B2 (en) Method and apparatus for processing image
CN115984449A (en) Illumination rendering method and device, electronic equipment and storage medium
CN114663632A (en) Method and equipment for displaying virtual object by illumination based on spatial position
CN111260767B (en) Rendering method, rendering device, electronic device and readable storage medium in game
CN115526977B (en) Game picture rendering method and device
JP2007272847A (en) Lighting simulation method and image composition method
CN115970275A (en) Projection processing method and device for virtual object, storage medium and electronic equipment
CN113350786A (en) Skin rendering method and device for virtual character and electronic equipment
CN115239869B (en) Shadow processing method, shadow rendering method and device
WO2024027237A1 (en) Rendering optimization method, and electronic device and computer-readable storage medium
US9741156B2 (en) Material trouble shooter

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