A point light source culling method and system
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-21
- Publication Date
- 2026-08-11
AI Technical Summary
均会在很大程度上影响CPU或GPU(Graphics ProcessingUnit,图形处理器)的性能,从而影响游戏运行的流畅性
Smart Images

Figure CN116188653B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of game scene rendering technology, and more specifically, to a method and system for point light source culling. Background Technology
[0002] In game scene rendering, the illumination of multiple light sources plays a very important role in the aesthetics and realism of the scene's visual effects.
[0003] When performing lighting calculations, not all point light sources in the point light source list can affect all areas of the screen space. Therefore, it is necessary to remove those point light sources that do not affect fragments to reduce the computational burden on the computer.
[0004] However, existing technical solutions either calculate the point light sources affecting each object on the CPU (Central Processing Unit) to reduce the number of point light sources in the pixel shading stage, or divide the camera's spatial frustum into blocks and calculate and store the list of point light sources affecting it. Both of these methods significantly impact the performance of the CPU or GPU (Graphics Processing Unit), thus affecting the smoothness of game operation. Summary of the Invention
[0005] The present invention aims to, for example, provide a point light source rejection method and system that can at least partially solve the above-mentioned technical problems.
[0006] The embodiments of the present invention can be implemented as follows:
[0007] In a first aspect, embodiments of the present invention provide a point light source removal method, applied to a point light source removal system, the point light source removal system including a central processing unit and a graphics processing unit, the central processing unit being communicatively connected to the graphics processing unit; the method includes:
[0008] The central processing unit divides the screen to be rendered into multiple screen regions according to a preset resolution, and generates multiple mask images with the preset resolution, each of the mask images corresponding to one of the screen regions.
[0009] The central processing unit calculates the coverage area of each point light source in the point light source list on the screen to be rendered, and stores the calculation results in the mask image corresponding to each screen area;
[0010] When calculating lighting, the graphics processor determines the target screen area where the fragment is located based on the fragment's screen coordinates.
[0011] The graphics processor obtains the calculation results stored on the mask image corresponding to the target screen area, and determines the effective point light source based on the calculation results.
[0012] Optionally, the coverage area of each point light source in the calculated point light source list on the screen to be rendered includes:
[0013] The central processing unit, based on perspective projection, calculates the horizontal and vertical ranges of each point light source projected onto the screen to be rendered according to the camera parameters.
[0014] The central processing unit uses the area formed by the horizontal interval and the vertical interval as the coverage area.
[0015] Optionally, each of the mask images includes a preset number of bits, the number of bits being the same as the number of point light sources in the point light source list, and each point light source corresponding to one bit; storing the calculation result in the mask image corresponding to each of the screen regions includes:
[0016] The central processing unit obtains the point light sources projected onto the coverage area from the list of point light sources and uses them as target point light sources;
[0017] The central processing unit marks the bit corresponding to the target point light source according to the target point light source;
[0018] The central processing unit stores the marked bits as the calculation result in the mask image corresponding to each screen area.
[0019] Optionally, the screen coordinates include a vertical coordinate and a horizontal coordinate, and determining the target screen area where the fragment is located based on the fragment's screen coordinates includes:
[0020] The graphics processor obtains the vertical and horizontal coordinates of the fragment respectively;
[0021] The graphics processor determines the screen coordinates to be rendered in the screen to be rendered, which correspond to the screen coordinates, based on the vertical coordinate and the horizontal coordinate.
[0022] The graphics processor determines the target screen region where the fragment is located from multiple screen regions based on the screen coordinates to be rendered.
[0023] Optionally, determining the effective point light source based on the calculation result includes:
[0024] The graphics processor acquires the mask image corresponding to the screen area where the fragment is located;
[0025] The graphics processor determines the target point light source corresponding to the fragment based on the marked bits stored on the mask image;
[0026] The graphics processor uses the target point light source as the effective point light source.
[0027] Optionally, the preset resolution is 64×32.
[0028] Optionally, the number of bits can be any one of 8 bits, 16 bits, and 32 bits.
[0029] Secondly, embodiments of the present invention provide a point light source culling method, applied to a central processing unit in a point light source culling system, wherein the point light source culling system further includes a graphics processing unit (GPU), and the central processing unit is communicatively connected to the GPU; the point light source culling method includes:
[0030] The screen to be rendered is divided into multiple screen areas according to the preset resolution;
[0031] Generate multiple mask images with a preset resolution, each mask image corresponding to a screen region;
[0032] Calculate the coverage area of each point light source in the point light source list on the screen to be rendered;
[0033] The calculation results are stored in the mask image corresponding to each screen region.
[0034] Thirdly, embodiments of the present invention provide a point light source culling method, applied to a graphics processor in a point light source culling system, wherein the point light source culling system further includes a central processing unit (CPU), and the CPU is communicatively connected to the graphics processor; the point light source culling method includes:
[0035] When calculating illumination, the target screen area where the fragment is located is determined based on the fragment's screen coordinates;
[0036] Based on the mask image corresponding to the target screen area, obtain the calculation results stored on the mask image;
[0037] The effective point light source is determined based on the calculation results.
[0038] Fourthly, embodiments of the present invention provide a point light source culling system, the point light source culling system including a central processing unit and a graphics processing unit, the central processing unit being communicatively connected to the graphics processing unit;
[0039] The central processing unit is used to divide the screen to be rendered into multiple screen regions according to a preset resolution, and generate multiple mask images with a resolution of the preset resolution, each of the mask images corresponding to one of the screen regions; calculate the coverage area of each point light source in the point light source list on the screen to be rendered, and store the calculation results in the mask image corresponding to each of the screen regions;
[0040] The graphics processor is configured to, when calculating illumination, determine the target screen area where the fragment is located based on the screen coordinates of the fragment; obtain the calculation results stored on the mask image corresponding to the target screen area; and determine the effective point light source based on the calculation results.
[0041] The beneficial effects of the embodiments of the present invention include, for example:
[0042] The central processing unit (CPU) divides the screen to be rendered into multiple screen regions and generates a mask image for each region. It then calculates the coverage area of each point light source in the point light source list on the screen to be rendered, storing the results in the mask image corresponding to each screen region. When the graphics processing unit (GPU) calculates lighting, it uses the screen coordinates of fragments to index the calculation results stored in the mask image corresponding to the current screen region, directly using the coverage area of the point light sources on the screen to be rendered from the calculation results. This eliminates the need to calculate point light sources that do not affect the current screen region, improving the GPU's processing efficiency and thus enhancing the smoothness of the game. Attached Figure Description
[0043] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0044] Figure 1 This is an architecture diagram of a point light source rejection system provided in an embodiment of the present invention;
[0045] Figure 2 A flowchart illustrating the steps of a point light source removal method provided in an embodiment of the present invention;
[0046] Figure 3 A schematic diagram of a calculated coverage area provided in an embodiment of the present invention;
[0047] Figure 4 This is a schematic diagram illustrating the calculation of the coverage area under a special condition, as provided in an embodiment of the present invention.
[0048] Figure 5 A flowchart illustrating the steps of a point light source culling method applied to a central processing unit, as provided in an embodiment of the present invention;
[0049] Figure 6 This is a flowchart illustrating the steps of a point light source culling method applied to a graphics processor, as provided in an embodiment of the present invention.
[0050] Icons: 10 - Point light source culling system; 11 - Central processing unit; 12 - Graphics processor. Detailed Implementation
[0051] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0052] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0053] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0054] Furthermore, the terms "first" and "second" are used only to distinguish descriptions and should not be interpreted as indicating or implying relative importance.
[0055] It should be noted that, where there is no conflict, the features in the embodiments of the present invention can be combined with each other.
[0056] In existing technologies, the following two methods are generally used to eliminate point light sources.
[0057] 1. Standard forward multi-point light source shading calculation scheme: This scheme typically involves comparing whether a fragment is within the range of the light source during the pixel shading stage, and then eliminating point light sources that do not affect the fragment.
[0058] The above solution requires distance determination between each point light source and fragment. Since point light sources are generally scattered throughout the scene, this results in a large amount of distance determination calculation during the pixel shading stage. Calculating the point light sources affecting each object on the CPU side reduces the number of point light sources in the pixel shading stage, but this incurs additional CPU computational overhead.
[0059] 2. Advanced Point Light Source Block Removal Scheme: In camera space, the camera frustum is divided into blocks along the X, Y, and Z axes. The GPU's general computing function is used to calculate and store the point light sources affected by each block. The block in which the fragment is located is calculated based on its position in camera space, and a list of point light sources affecting the fragment is obtained. This can efficiently remove point light sources that do not affect the fragment at all.
[0060] Advanced point light source block culling scheme: Divide the camera spatial frustum into blocks and calculate and store the list of point light sources affecting it. This requires a large amount of GPU memory to store the list of point light sources for each block and GPU performance.
[0061] Based on the above, this specification provides a point light source rejection method and system, which can effectively alleviate the above-mentioned technical problems.
[0062] Please refer to Figure 1 The present invention provides a point light source rejection system 10, which includes a central processing unit 11 and a graphics processor 12, and the central processing unit 11 and the graphics processor 12 are communicatively connected.
[0063] When rendering game scenes, the central processing unit 11 first performs the initial processing steps, and then the graphics processing unit 12 performs scene rendering, lighting calculations, and other processing.
[0064] Correspondingly, embodiments of this specification provide a point light source culling method, applied to a point light source culling system. The point light source culling system includes a central processing unit (CPU) and a graphics processing unit (GPU), with the CPU and GPU communicatively connected. The method includes, for example: Figure 2 The following steps are shown:
[0065] Step S110: The central processing unit divides the screen to be rendered into multiple screen regions according to a preset resolution, and generates multiple mask images with the preset resolution, each of the mask images corresponding to one of the screen regions.
[0066] Step S120: The central processing unit calculates the coverage area of each point light source in the point light source list on the screen to be rendered, and stores the calculation results in the mask image corresponding to each screen area.
[0067] Step S130: When calculating lighting, the graphics processor determines the target screen area where the fragment is located based on the screen coordinates of the fragment.
[0068] Step S140: The graphics processor obtains the calculation results stored on the mask image corresponding to the target screen area, and determines the effective point light source based on the calculation results.
[0069] In step S110, the central processing unit divides the screen to be rendered into multiple screen regions according to a preset resolution and generates multiple mask images with the preset resolution, each of the mask images corresponding to one of the screen regions.
[0070] The screen to be rendered can be the actual screen projected in the game; the preset resolution can be the resolution set by the developers according to actual needs and different terminal devices. Since the screen to be rendered is generally large in size, when the central processing unit processes it, it can be divided into multiple screen areas according to the preset resolution, and then a mask image with the same resolution as the screen area can be generated for each screen area. The mask image can be an image in unsigned integer format.
[0071] Optionally, the preset resolution is 64×32. The point light source culling method provided in this embodiment of the invention is mainly applied to the forward point light source shading calculation on mobile platforms (such as Android and Apple operating system platforms), where there are a large number of unnecessary judgments regarding light sources and fragments. Therefore, a preset resolution of 64×32 is preferred.
[0072] After completing step S110, step S120 is executed, whereby the central processing unit calculates the coverage area of each point light source in the point light source list on the screen to be rendered, and stores the calculation results in the mask image corresponding to each screen area.
[0073] Point light sources are a type of light source in a game scene. A point light source list refers to a list of point light sources in a game scene that participate in lighting calculations. The coverage area can be the area covered by the light emitted by a point light source projected onto the screen to be rendered. After the screen to be rendered is divided and a mask image is generated for each screen area, the central processing unit calculates the coverage area for each point light source in the point light source list.
[0074] As an optional embodiment, the shape of the point light source can be represented by a triangle approximating a sphere, and the coverage area of the triangles that make up the sphere projected onto the screen to be rendered can be calculated, thereby accurately calculating the coverage area of each point light source on the screen to be rendered.
[0075] After calculating the coverage area of each point light source, the central processing unit stores the data (calculation results) of the coverage area of each point light source on each screen area into the mask image corresponding to each screen area for later use.
[0076] Optionally, the coverage area of each point light source in the calculated point light source list on the screen to be rendered includes:
[0077] The central processing unit, based on perspective projection, calculates the horizontal and vertical ranges of each point light source projected onto the screen to be rendered, according to the camera parameters.
[0078] The central processing unit uses the area formed by the horizontal interval and the vertical interval as the coverage area.
[0079] As an alternative implementation, a less computationally expensive method can be chosen, namely, directly calculating the rough rectangular coverage area of the sphere projected onto the screen to calculate the coverage area.
[0080] Solving in camera space simplifies the process of finding the tangent point between the viewpoint and the circle in world space to finding the tangent point between the origin and the circle, thus improving computational efficiency. For example... Figure 3 As shown, the cross-section of the point light source in the XZ and YZ planes of camera space is a circle with the radius of the point light source. In the YZ plane, as long as the center of the circle is not located on a horizontal line, the line segments KB and JB in the diagram will be unequal after projection onto the screen. By analogy to 3D space, if the center of the point light source does not coincide with the view frustum, the distances from the center of the circle to the highest point on the X and Y axes will be unequal after projection, leading to the conclusion that its shape is elliptical. To calculate the coverage area of the point light source on the screen to be rendered after projection, it is necessary to solve for the upper and lower intervals of the cross-sectional circle of the point light source projected onto the screen on the X and Y axes, respectively, in the YZ and XZ planes. Taking the YZ plane as an example: After solving for the tangent points P and O of the MI tangent and the MN tangent to the circle, the tangent points P and O can be projected onto the screen to obtain points K and Q. The closed area formed by points K and Q is the vertical interval on the Y-axis, which is the coverage area of the light source on the Y-axis. Similarly, the horizontal interval on the X-axis after projection on the XZ plane can be obtained. Then, the area formed by the horizontal interval and the vertical interval is taken as the coverage area.
[0081] Additionally, it should be noted that, in cases such as Figure 4 In the cases shown, if the origin is located inside or on the circle, the quadratic equation has no solution or only a unique solution. In this case, it is only necessary to solve for the intersection of the circle on the screen to be rendered. The vertical interval on the Y-axis can be obtained based on whether the circle is located in the upper or lower half of the Y-axis. Similarly, the horizontal interval on the X-axis after projection onto the XZ plane can be obtained, thus obtaining the coverage area.
[0082] Optionally, each of the mask images includes a preset number of bits, the number of bits being the same as the number of point light sources in the point light source list, and each point light source corresponding to one bit; storing the calculation result in the mask image corresponding to each of the screen regions includes:
[0083] The central processing unit obtains the point light sources projected onto the coverage area from the list of point light sources and uses them as target point light sources.
[0084] The central processing unit marks the bit corresponding to the target point light source based on the target point light source.
[0085] The central processing unit stores the marked bits as the calculation result in the mask image corresponding to each screen area.
[0086] The mask image contains a preset number of bits. The number of bits determines the capacity of the list of point light sources participating in the lighting calculation. For example, if the number of bits is 8, the capacity of the point light source list is 8, meaning the list includes 8 point light sources. After calculating each coverage area, the central processing unit (CPU) reverse-engineers the point light sources in each screen area that can be projected onto the coverage area, and marks them as target point light sources.
[0087] After obtaining the target point light source, the corresponding bits in the mask image are marked according to the target point light source's position in the point light source list. For example, if the number of bits in the bit (00000000) and the capacity of the point light source list is 8, and the first and eighth point light sources in the list are the target point light sources, then the first and eighth bits of the bit (0000001) are set to 1. The marked bits are then stored as the calculation result in the corresponding mask image.
[0088] Optionally, the number of bits can be any one of 8 bits, 16 bits, and 32 bits. Since the image format only supports 8-bit, 16-bit, and 32-bit unsigned integer formats, the number of bits can be any one of 8 bits, 16 bits, and 32 bits. Correspondingly, the maximum capacity of the light source list is 8, 16, or 32.
[0089] The pixel shading stage is a programmable stage of the graphics pipeline for fragments, determining the final display color of the fragments. A fragment is a set of information about pixels in 3D space, calculated by the graphics pipeline through triangular rasterization and projected onto the screen. During the pixel shading stage, when the graphics processor performs lighting calculations, step S130 is executed to determine the target screen area where the fragment is located based on its screen coordinates.
[0090] The coordinates on the screen to be rendered are different for each element. After dividing the screen area, the coordinates before the division can still be used. After the graphics processor obtains the screen coordinates of the fragment, since there is only one coordinate corresponding to each screen area, the screen area where the fragment is located, i.e., the target screen area, can be determined.
[0091] Optionally, the screen coordinates include a vertical coordinate and a horizontal coordinate, and determining the target screen area where the fragment is located based on the fragment's screen coordinates includes:
[0092] The graphics processor obtains the vertical and horizontal coordinates of the fragment, respectively.
[0093] The graphics processor determines the screen coordinates to be rendered in the screen to be rendered, corresponding to the screen coordinates, based on the vertical coordinate and the horizontal coordinate.
[0094] The graphics processor determines the target screen region where the fragment is located from multiple screen regions based on the screen coordinates to be rendered.
[0095] As an optional real-time method, the graphics processor can first obtain the horizontal and vertical coordinates of the fragment, then find the coordinates on the screen to be rendered that are the same as the horizontal and vertical coordinates of the fragment, and then determine which screen area the coordinates found on the screen to be rendered are located in, thus determining that the screen area is the target screen area.
[0096] After determining the target screen area, step S140 is executed, in which the graphics processor obtains the calculation results stored on the mask image corresponding to the target screen area, and determines the effective point light source based on the calculation results.
[0097] After determining the target screen area, the graphics processor determines the mask image corresponding to the target screen area, extracts the calculation results stored on the mask image, and then uses the point light sources that affect the screen area (i.e. point light sources that can be projected onto the covered area of the screen to be rendered) in the calculation results as valid point light sources.
[0098] Optionally, determining the effective point light source based on the calculation result includes:
[0099] The graphics processor acquires the mask image corresponding to the screen area where the fragment is located.
[0100] The graphics processor determines the target point light source corresponding to the fragment based on the marked bits stored on the mask image.
[0101] The graphics processor uses the target point light source as the effective point light source.
[0102] As an optional implementation, the graphics processor can first obtain the marked bits stored in the mask image corresponding to the screen area corresponding to the fragment, and then determine the target point light source (i.e., the point light source that affects the screen) corresponding to the fragment by the bit offset of the valid bits. For example, the position of the bit in the bit string, such as the bit 00010000000000000000000000000000000 in a 32-bit string being the 29th bit, then the bit offset is 29, meaning the 29th point light source in the point light source list is the target point light source. This target point light source is then used as a valid point light source so that the graphics processor can proceed to the next step. This avoids performing lighting calculations on point light sources that do not affect the fragment.
[0103] Based on the same inventive concept, such as Figure 5 As shown in the figure, an embodiment of the present invention provides a point light source culling method, applied to a central processing unit in a point light source culling system. The point light source culling system further includes a graphics processing unit (GPU), and the central processing unit is communicatively connected to the GPU. The point light source culling method includes the following steps:
[0104] Step S210: Divide the screen to be rendered into multiple screen areas according to the preset resolution.
[0105] Step S220: Generate multiple mask images with a resolution of the preset resolution, each of the mask images corresponding to a screen region.
[0106] Step S230: Calculate the coverage area of each point light source in the point light source list on the screen to be rendered.
[0107] Step S240: Store the calculation results in the mask image corresponding to each screen region.
[0108] The specific description of each step in the point light source rejection method for the central processing unit applied to the point light source rejection system provided in this specification has been described in detail in the embodiments of the point light source rejection method for the point light source rejection system provided in this specification, and will not be elaborated here.
[0109] Based on the same inventive concept, embodiments of this invention provide a point light source culling method applied to a graphics processor in a point light source culling system. The point light source culling system further includes a central processing unit (CPU), which is communicatively connected to the graphics processor. The point light source culling method includes, as follows: Figure 6 The following steps are shown:
[0110] Step S310: When calculating illumination, determine the target screen area where the fragment is located based on the screen coordinates of the fragment.
[0111] Step S320: Obtain the calculation results stored on the mask image based on the mask image corresponding to the target screen area.
[0112] Step S330: Determine the effective point light source based on the calculation results.
[0113] The specific description of each step in the point light source culling method for the graphics processor applied to the point light source culling system provided in this specification has been described in detail in the embodiments of the point light source culling method applied to the point light source culling system provided in this specification, and will not be elaborated here.
[0114] Based on the same inventive concept, such as Figure 1 As shown in the figure, the embodiment of the present invention provides a point light source rejection system 10, which includes a central processing unit 11 and a graphics processor 12, and the central processing unit 11 and the graphics processor 12 are communicatively connected.
[0115] The central processing unit 11 is used to divide the screen to be rendered into multiple screen regions according to a preset resolution, and generate multiple mask images with a resolution of the preset resolution, each of the mask images corresponding to one of the screen regions; calculate the coverage area of each point light source in the point light source list on the screen to be rendered, and store the calculation result in the mask image corresponding to each of the screen regions;
[0116] The graphics processor 12 is configured to, when calculating illumination, determine the target screen area where the fragment is located based on the screen coordinates of the fragment; obtain the calculation results stored on the mask image corresponding to the target screen area; and determine the effective point light source based on the calculation results.
[0117] The specific application of each unit in the point light source rejection system 10 described above has been described in detail in the embodiments of the point light source rejection method provided in this specification, and will not be elaborated here.
[0118] The present invention has at least the following beneficial effects:
[0119] The central processing unit (CPU) divides the screen to be rendered into multiple screen regions and generates a mask image for each region. It then calculates the coverage area of each point light source in the point light source list on the screen to be rendered, storing the results in the mask image corresponding to each screen region. When the graphics processing unit (GPU) calculates lighting, it uses the screen coordinates of fragments to index the calculation results stored in the mask image corresponding to the current screen region, directly using the coverage area of the point light sources on the screen to be rendered from the calculation results. This eliminates the need to calculate point light sources that do not affect the current screen region, improving the GPU's processing efficiency and thus enhancing the smoothness of the game.
[0120] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative; for example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of the invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0121] In addition, the functional modules in the various embodiments of the present invention can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0122] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0123] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for eliminating point light sources, characterized in that, An application is made in a point light source culling system, the point light source culling system comprising a central processing unit (CPU) and a graphics processing unit (GPU), the CPU and the GPU being communicatively connected; the method includes: The central processing unit divides the screen to be rendered into multiple screen regions according to a preset resolution and generates multiple mask images with the preset resolution. Each mask image corresponds to one of the screen regions. Each mask image includes a preset number of bits, the number of bits being the same as the number of point light sources in the point light source list, and each point light source corresponds to one bit. The central processing unit (CPU) calculates the coverage area of each point light source in the point light source list on the screen to be rendered, and stores the calculation result in the mask image corresponding to each screen area. This includes: the CPU acquiring point light sources projected onto the coverage area from the point light source list as target point light sources; the CPU marking the bits corresponding to the target point light sources; and the CPU storing the marked bits as the calculation result in the mask image corresponding to each screen area. Specifically, the CPU calculates the horizontal and vertical intervals projected onto the screen to be rendered by each point light source based on perspective projection and camera parameters. The CPU uses the area formed by the horizontal and vertical intervals as the coverage area. When calculating lighting, the graphics processor determines the target screen area where the fragment is located based on the fragment's screen coordinates. The graphics processor obtains the calculation results stored on the mask image corresponding to the target screen area, and determines the effective point light source based on the calculation results.
2. The point light source elimination method as described in claim 1, characterized in that, The screen coordinates include a vertical coordinate and a horizontal coordinate. Determining the target screen area where the fragment is located based on the fragment's screen coordinates includes: The graphics processor obtains the vertical and horizontal coordinates of the fragment respectively; The graphics processor determines the screen coordinates to be rendered in the screen to be rendered, which correspond to the screen coordinates, based on the vertical coordinate and the horizontal coordinate. The graphics processor determines the target screen region where the fragment is located from multiple screen regions based on the screen coordinates to be rendered.
3. The point light source elimination method as described in claim 1, characterized in that, The step of determining the effective point light source based on the calculation result includes: The graphics processor acquires the mask image corresponding to the screen area where the fragment is located; The graphics processor determines the target point light source corresponding to the fragment based on the marked bits stored on the mask image; The graphics processor uses the target point light source as the effective point light source.
4. The point light source elimination method as described in claim 1, characterized in that, The preset resolution is 64×32.
5. The point light source elimination method as described in claim 2, characterized in that, The number of bits can be any of 8 bits, 16 bits, or 32 bits.
6. A method for eliminating point light sources, characterized in that, A central processing unit (CPU) is used in a point light source culling system, the point light source culling system further including a graphics processing unit (GPU), the CPU being communicatively connected to the GPU; the point light source culling method includes: The screen to be rendered is divided into multiple screen areas according to the preset resolution; Multiple mask images with a preset resolution are generated, and each mask image corresponds to a screen region; wherein each mask image includes a preset number of bits, the number of bits being the same as the number of point light sources in the point light source list, and each point light source corresponds to one bit; Calculating the coverage area of each point light source in the point light source list on the screen to be rendered includes: based on perspective projection, calculating the horizontal and vertical intervals of each point light source projected onto the screen to be rendered according to camera parameters; and taking the area formed by the horizontal and vertical intervals as the coverage area. Storing the calculation results in the mask image corresponding to each screen region includes: obtaining point light sources projected onto the coverage area from the point light source list as target point light sources; marking the bits corresponding to the target point light sources according to the target point light sources; and storing the marked bits as the calculation results in the mask image corresponding to each screen region.
7. A method for eliminating point light sources, characterized in that, The graphics processor used in the point light source culling system as described in claim 1, wherein the point light source culling system further includes a central processing unit (CPU), the CPU being communicatively connected to the graphics processor; the point light source culling method includes: When calculating illumination, the target screen area where the fragment is located is determined based on the fragment's screen coordinates; Based on the mask image corresponding to the target screen area, obtain the calculation results stored on the mask image; The effective point light source is determined based on the calculation results.
8. A point light source rejection system, characterized in that, The point light source elimination system includes a central processing unit and a graphics processing unit, and the central processing unit and the graphics processing unit are communicatively connected. The central processing unit (CPU) is configured to divide the screen to be rendered into multiple screen regions according to a preset resolution, and generate multiple mask images with the preset resolution, each mask image corresponding to one screen region; wherein each mask image includes a preset number of bits, the number of bits being the same as the number of point light sources in the point light source list, and each point light source corresponding to one bit; calculate the coverage area of each point light source in the point light source list on the screen to be rendered, and store the calculation result in the mask image corresponding to each screen region, including: the CPU obtaining point light sources in the point light source list that are projected onto the coverage area as target point light sources; the CPU marking the bits corresponding to the target point light sources according to the target point light sources; the CPU storing the marked bits as the calculation result in the mask image corresponding to each screen region; wherein the CPU calculates the horizontal and vertical intervals projected onto the screen to be rendered by each point light source based on perspective projection and according to camera parameters; the CPU uses the area formed by the horizontal and vertical intervals as the coverage area. The graphics processor is configured to, when calculating illumination, determine the target screen area where the fragment is located based on the screen coordinates of the fragment; obtain the calculation results stored on the mask image corresponding to the target screen area; and determine the effective point light source based on the calculation results.
Citation Information
Patent Citations
Virtual light source processing method and device, medium and electronic equipment
CN111260766A
Volume light generation method and device based on OpenSceneGraph, equipment and storage medium
CN112233220A