A rendering method for controlling illumination according to region

By obtaining the game time and character position in real time in the game program and adjusting the control parameters of the light and environment using the configuration table, the problem of insufficient lighting changes in the existing technology is solved, and a more dynamic and immersive game lighting effect is achieved.

CN118557963BActive Publication Date: 2025-04-22GUANGZHOU AIYOU INFORMATION TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410639395.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-22
Publication Date
2025-04-22
Estimated Expiration
2044-05-22

AI Technical Summary

Technical Problem

The prior art cannot dynamically change the lights and environment in real time according to time, and cannot change the calculation results of the lights and environment according to the location of the virtual character, resulting in a low degree of richness of the light changes.

Method used

By obtaining the current game time and character position in each frame in the game program, using the corresponding configuration table to obtain the control parameters of the lights and environment, and modifying the lights and objects in the game environment in real time based on these parameters.

Benefits of technology

It realizes dynamic adjustment of lights and environments based on time and character position, thereby significantly improving the richness of light changes and providing a more realistic and immersive gaming experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118557963B_ABST
    Figure CN118557963B_ABST
Patent Text Reader

Abstract

The present invention provides a rendering method for controlling illumination according to a region, which belongs to the field of game development technology; it comprises the following steps: after the game program is started, the player controls the character to enter a virtual scene, in which the program obtains the current game time in each frame, and calculates the day and night time of the current frame through the change of the game time; S2, in the virtual scene, the program obtains the position of the current game character in each frame, and uses two methods for obtaining corresponding configuration tables according to the position, and obtains the configuration table corresponding to the current position in multiple configuration tables. The present invention can not only control the lighting and environment to change dynamically and in real time according to the time, but also change the calculation results of the lighting and environment according to the position of the virtual character.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of game development, and in particular to a rendering method for controlling illumination according to a region. Background Art

[0002] In a 3D game scene environment, in order to enhance the player's sense of immersion in the process of controlling a virtual character to play the game, the light and shadow similar to that in the real world can be simulated in the game scene. The environment and lighting change with the day and night time. This kind of day and night change function can provide a more realistic gaming experience.

[0003] In the prior art, the day and night changes of game scenes often control the lighting results of the rendering in the scene to change continuously according to the passage of time, thereby presenting different lighting effects corresponding to different time points. However, the prior art cannot control the lighting and environment to change dynamically and in real time according to time, and will not change the calculation results of the lighting and environment according to the position of the virtual character. The richness of lighting changes is low. Therefore, the present application provides a rendering method for controlling lighting according to the area to meet the needs. Summary of the invention

[0004] The technical problem to be solved by the present invention is to provide a rendering method for controlling illumination according to regions to solve the problem of low richness of existing illumination changes.

[0005] In order to solve the above technical problems, the present invention provides the following technical solutions:

[0006] A rendering method for controlling illumination according to a region comprises the following steps:

[0007] S1, after the game program is started, the player controls the character to enter the virtual scene. In the virtual scene, the program obtains the current game time in each frame, and calculates the day and night time of the current frame through the change of the game time;

[0008] S2, in the virtual scene, the program obtains the position of the current game character in each frame, and uses two methods to obtain the corresponding configuration table according to the position, and obtains the configuration table corresponding to the current position in multiple configuration tables;

[0009] S3, using the day and night time of the current frame to obtain multiple control parameters of lighting and environment from the current configuration table;

[0010] S4, each frame uses the control parameters of the light and environment to modify the light and the specified environment objects in the current game environment;

[0011] S5, the game program renders the final virtual scene image to the screen for display.

[0012] In a possible implementation, the first method of obtaining the corresponding configuration table in S2 includes the following steps:

[0013] S211, recording the current position of the game character, which is based on the world space coordinate system of the virtual scene;

[0014] S212, traversing all the light control cubes in the virtual scene, obtaining the transformation matrix of their world space, transforming the position of the current game character into the local space of the light control cube through the transformation matrix of their world space, and obtaining the local coordinate position of the game character;

[0015] S213, based on the maximum and minimum boundary ranges of the six faces of the cube, compare whether the local coordinate position of the game character is within the boundary range of the cube. If it is within a certain cube, then return the configuration table data corresponding to the cube for subsequent calculations.

[0016] In a possible implementation, the second method of obtaining the corresponding configuration table in S2 includes the following steps:

[0017] S221, when making a virtual scene, the production staff divides the scene into multiple areas in advance, and these areas are stored in the form of a quadtree;

[0018] S222, during the running of the game, recording the position of the current game character, which is based on the world space coordinate system of the virtual scene;

[0019] S223, obtaining the area data in the form of a quadtree stored in the current virtual scene, first obtaining the area corresponding to the first child node of the root node of the quadtree, and obtaining the result of whether the character is located in the area by comparing whether the current position of the character is within the maximum and minimum ranges of the area;

[0020] S224, if the character is not in the area, then determine whether it is in the area corresponding to other child nodes of the parent node. If the character is in the area corresponding to a certain node, then obtain the child node of this node and determine whether it is in the area corresponding to a certain child node. Repeat the above process until a certain node no longer has child nodes, then return the configuration table data of the area corresponding to the current node for subsequent calculations.

[0021] In one possible implementation, the multiple control parameters of the lighting and environment in S3 include main light color, character light color, ambient light color, ambient light occlusion intensity, fog concentration, fog color, fog display distance, fog height attenuation, volume fog switch, volume fog color, volume fog distribution index and volume fog display distance.

[0022] In a possible implementation, modifying the light and the specified environment object in S4 includes the following steps:

[0023] S41, obtaining a directional light source in a virtual scene, and modifying its light color to be the main light color;

[0024] S42, obtaining the character light in the virtual scene, and modifying its light color to the character light color;

[0025] S43, obtaining the skylight in the virtual scene, modifying its light color to the ambient light color, and modifying its ambient light shielding intensity to the ambient light shielding intensity in the control parameter;

[0026] S44, obtaining the fog component in the virtual scene, modifying its concentration, color, display distance and height attenuation respectively, and modifying the switch, color, distribution index and display distance of its volume fog at the same time.

[0027] Compared with the prior art, the present invention has at least the following beneficial effects:

[0028] First, the current game time is obtained in the virtual scene, and the day and night time of the current frame is calculated through the changes in the game time. Then, the corresponding configuration table data is obtained according to the position of the virtual character through two methods, and then multiple control parameters of the light and environment are obtained from the current configuration table. Then, the control parameters are used to modify the light and specified environmental objects, and finally the virtual scene is rendered. This design can not only control the dynamic and real-time changes of the light and environment according to the time, but also change the calculation results of the light and environment according to the position of the virtual character, effectively improving the richness of lighting changes. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] The accompanying drawings, which are incorporated herein and constitute a part of the specification, illustrate embodiments of the present disclosure and, together with the description, further serve to explain the principles of the present disclosure and to enable those skilled in the relevant art to make and use the present disclosure.

[0030] Figure 1 This is a flow chart of the first method in S2 of the present invention;

[0031] Figure 2 This is a flow chart of the second method in S2 of the present invention.

[0032] As shown in the figure, in order to clearly implement the structure of the embodiment of the present invention, specific structures and devices are marked in the figure, but this is only for illustrative purposes and is not intended to limit the present invention to the specific structure, device and environment. According to specific needs, ordinary technicians in this field can adjust or modify these devices and environments, and the adjustments or modifications made are still included in the scope of the attached claims. DETAILED DESCRIPTION

[0033] The following is a detailed description of a rendering method for controlling illumination according to a region provided by the present invention in conjunction with the accompanying drawings and specific embodiments. At the same time, it is explained here that in order to make the embodiments more detailed, the following embodiments are the best and preferred embodiments, and those skilled in the art may also adopt other alternative methods to implement some known technologies; and the accompanying drawings are only for a more specific description of the embodiments, and are not intended to specifically limit the present invention.

[0034] It should be noted that the references to "one embodiment", "embodiment", "exemplary embodiments", "some embodiments" and the like in the specification indicate that the embodiments described may include specific features, structures or characteristics, but not every embodiment may include the specific features, structures or characteristics. In addition, when a specific feature, structure or characteristic is described in conjunction with an embodiment, it should be within the knowledge of a person skilled in the art to implement such feature, structure or characteristic in conjunction with other embodiments (whether or not explicitly described).

[0035] In general, a term can be understood, at least in part, from its use in context. For example, depending, at least in part, on the context, the term "one or more" as used herein can be used to describe any feature, structure, or characteristic in the singular sense, or can be used to describe a combination of features, structures, or characteristics in the plural sense. Additionally, the term "based on" can be understood as not necessarily intended to convey an exclusive set of factors, but rather can be alternative, depending, at least in part, on the context, allowing for the presence of other factors that are not necessarily explicitly described.

[0036] It will be understood that the meaning of “on,” “over,” and “above” in this disclosure should be interpreted in the broadest manner, so that “on” means not only “directly on” something, but also includes the meaning of being “on” something with intervening features or layers therebetween, and “on” or “over” means not only “on” or “above” something, but also includes the meaning of being “on” or “above” something with no intervening features or layers therebetween.

[0037] Additionally, spatially relative terms such as "under," "beneath," "lower," "above," "upper," and the like may be used herein for descriptive convenience to describe the relationship of one element or feature to another element or features, as shown in the accompanying drawings. Spatially relative terms are intended to encompass different orientations of the device in use or operation in addition to the orientation depicted in the accompanying drawings. The device may be oriented in other ways, and the spatially relative descriptors used herein may be similarly interpreted accordingly.

[0038] Example 1

[0039] like Figure 1 As shown, a rendering method for controlling illumination according to a region includes the following steps:

[0040] S1, after the game program is started, the player controls the character to enter the virtual scene. In the virtual scene, the program obtains the current game time in each frame, and calculates the day and night time of the current frame through the change of the game time;

[0041] S2, in the virtual scene, the program obtains the position of the current game character in each frame, and uses the first method of obtaining the corresponding configuration table according to the position to obtain the configuration table corresponding to the current position in multiple configuration tables. The first method includes the following steps:

[0042] S211, recording the current position of the game character, which is based on the world space coordinate system of the virtual scene;

[0043] S212, traversing all the light control cubes in the virtual scene, obtaining the transformation matrix of their world space, transforming the position of the current game character into the local space of the light control cube through the transformation matrix of their world space, and obtaining the local coordinate position of the game character;

[0044] S213, comparing the local coordinate position of the game character to see if it is within the boundary range of the cube based on the maximum and minimum boundary ranges of the six faces of the cube. If it is within a certain cube, then returning the configuration table data corresponding to the cube for subsequent calculations;

[0045] S3, using the day and night time of the current frame, obtains multiple control parameters of the lighting and environment from the current configuration table, wherein the control parameters include the main light color, the character light color, the ambient light color, the ambient light occlusion intensity, the fog concentration, the fog color, the fog display distance, the fog height attenuation, the volume fog switch, the volume fog color, the volume fog distribution index, and the volume fog display distance;

[0046] S4, each frame uses the control parameters of the light and environment to modify the light and the specified environment objects in the current game environment. Modifying the light and the specified environment objects includes the following steps:

[0047] S41, obtaining a directional light source in a virtual scene, and modifying its light color to be the main light color;

[0048] S42, obtaining the character light in the virtual scene, and modifying its light color to the character light color;

[0049] S43, obtaining the skylight in the virtual scene, modifying its light color to the ambient light color, and modifying its ambient light shielding intensity to the ambient light shielding intensity in the control parameter;

[0050] S44, obtaining fog components in the virtual scene, modifying their concentration, color, display distance and height attenuation respectively, and modifying the switch, color, distribution index and display distance of its volume fog;

[0051] S5, the game program renders the final virtual scene image to the screen for display.

[0052] Example 2

[0053] like Figure 2 As shown, a rendering method for controlling illumination according to a region includes the following steps:

[0054] S1, after the game program is started, the player controls the character to enter the virtual scene. In the virtual scene, the program obtains the current game time in each frame, and calculates the day and night time of the current frame through the change of the game time;

[0055] S2, in the virtual scene, the program obtains the position of the current game character in each frame, and uses the second method of obtaining the corresponding configuration table according to the position to obtain the configuration table corresponding to the current position in multiple configuration tables. The second method includes the following steps:

[0056] S221, when making a virtual scene, the production staff divides the scene into multiple areas in advance, and these areas are stored in the form of a quadtree;

[0057] S222, during the running of the game, recording the position of the current game character, which is based on the world space coordinate system of the virtual scene;

[0058] S223, obtaining the area data in the form of a quadtree stored in the current virtual scene, first obtaining the area corresponding to the first child node of the root node of the quadtree, and obtaining the result of whether the character is located in the area by comparing whether the current position of the character is within the maximum and minimum ranges of the area;

[0059] S224, if the character is not in the area, then determine whether it is in the area corresponding to other child nodes of the parent node. If the character is in the area corresponding to a certain node, then obtain the child node of this node and determine whether it is in the area corresponding to a certain child node. Repeat the above process until a certain node no longer has a child node, then return the configuration table data of the area corresponding to the current node for subsequent calculation;

[0060] S3, using the day and night time of the current frame, obtains multiple control parameters of the lighting and environment from the current configuration table, wherein the control parameters include the main light color, the character light color, the ambient light color, the ambient light occlusion intensity, the fog concentration, the fog color, the fog display distance, the fog height attenuation, the volume fog switch, the volume fog color, the volume fog distribution index, and the volume fog display distance;

[0061] S4, each frame uses the control parameters of the light and environment to modify the light and the specified environment objects in the current game environment. Modifying the light and the specified environment objects includes the following steps:

[0062] S41, obtaining a directional light source in a virtual scene, and modifying its light color to be the main light color;

[0063] S42, obtaining the character light in the virtual scene, and modifying its light color to the character light color;

[0064] S43, obtaining the skylight in the virtual scene, modifying its light color to the ambient light color, and modifying its ambient light shielding intensity to the ambient light shielding intensity in the control parameter;

[0065] S44, obtaining fog components in the virtual scene, modifying their concentration, color, display distance and height attenuation respectively, and modifying the switch, color, distribution index and display distance of its volume fog;

[0066] S5, the game program renders the final virtual scene image to the screen for display.

[0067] The technical solution provided by the present invention can not only control the lighting and environment to change dynamically and in real time according to time, but also change the calculation results of the lighting and environment according to the position of the virtual character, thereby effectively improving the richness of lighting changes.

[0068] The present invention covers any substitution, modification, equivalent method and scheme made on the essence and scope of the present invention. In order to make the public have a thorough understanding of the present invention, specific details are described in detail in the following preferred embodiments of the present invention, but those skilled in the art can fully understand the present invention without the description of these details. In addition, in order to avoid unnecessary confusion about the essence of the present invention, well-known methods, processes, procedures, components and circuits are not described in detail.

[0069] A person skilled in the art will appreciate that all or part of the steps in the above-mentioned embodiment method can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc.

[0070] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A rendering method for controlling illumination according to a region, characterized in that: The following steps are involved: S1, after the game program is started, the player controls the character to enter the virtual scene. In the virtual scene, the program obtains the current game time in each frame, and calculates the day and night time of the current frame through the change of the game time; S2, in the virtual scene, the program obtains the position of the current game character in each frame, and uses two methods to obtain the corresponding configuration table according to the position, and obtains the configuration table corresponding to the current position in multiple configuration tables; The first method of obtaining the corresponding configuration table includes the following steps: S211, recording the current position of the game character, which is based on the world space coordinate system of the virtual scene; S212, traversing all the light control cubes in the virtual scene, obtaining the transformation matrix of their world space, transforming the position of the current game character into the local space of the light control cube through the transformation matrix of their world space, and obtaining the local coordinate position of the game character; S213, based on the maximum and minimum boundary ranges of the six faces of the cube, compare whether the local coordinate position of the game character is within the boundary range of the cube. If it is within a certain cube, then return the configuration table data corresponding to the cube for subsequent calculations. S3, using the day and night time of the current frame, obtaining multiple control parameters of the lighting and environment from the current configuration table; the multiple control parameters of the lighting and environment include main light color, character light color, ambient light color, ambient light occlusion intensity, fog concentration, fog color, fog display distance, fog height attenuation, volume fog switch, volume fog color, volume fog distribution index and volume fog display distance; S4, using the control parameters of the light and environment in each frame to modify the light and the specified environment objects in the current game environment; the modification of the light and the specified environment objects includes the following steps: S41, obtaining a directional light source in a virtual scene, and modifying its light color to be the main light color; S42, obtaining the character light in the virtual scene, and modifying its light color to the character light color; S43, obtaining the skylight in the virtual scene, modifying its light color to the ambient light color, and modifying its ambient light shielding intensity to the ambient light shielding intensity in the control parameter; S44, obtaining fog components in the virtual scene, modifying their concentration, color, display distance and height attenuation respectively, and modifying the switch, color, distribution index and display distance of its volume fog; S5, the game program renders the final virtual scene image to the screen for display.

2. The rendering method for controlling illumination according to a region according to claim 1, characterized in that: The second method of obtaining the corresponding configuration table in S2 comprises the following steps: S221, when making a virtual scene, the production staff divides the scene into multiple areas in advance, and these areas are stored in the form of a quadtree; S222, during the running of the game, recording the position of the current game character, which is based on the world space coordinate system of the virtual scene; S223, obtaining the area data in the form of a quadtree stored in the current virtual scene, first obtaining the area corresponding to the first child node of the root node of the quadtree, and obtaining the result of whether the character is located in the area by comparing whether the current position of the character is within the maximum and minimum ranges of the area; S224, if the character is not in the area, then determine whether it is in the area corresponding to other child nodes of the parent node. If the character is in the area corresponding to a certain node, then obtain the child node of this node and determine whether it is in the area corresponding to a certain child node. Repeat the above process until a certain node no longer has child nodes, then return the configuration table data of the area corresponding to the current node for subsequent calculations.

Citation Information

Patent Citations

  • Weather system generation method and device, and equipment

    CN112037292A

  • Ambient light shielding processing method, device and equipment

    CN114832375A