A rendering method, apparatus, device, and storage medium

By dividing particles in the particle system into multiple levels and determining the critical screen ratio based on index thresholds, the problem of abrupt special effects during LOD switching is solved, achieving smoothness and cost-effectiveness in special effects rendering.

CN115131485BActive Publication Date: 2026-03-13ZHUHAI KINGSOFT ONLINE GAME TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-29
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

In existing technologies, manually setting the threshold for LOD switching distance and the number of particles results in abrupt changes in special effects during LOD switching, and also incurs high manual costs.

Method used

Based on the specified indicators of each particle in the particle system, the particles are divided into multiple levels, and the critical screen ratio of each level is determined based on the preset indicator threshold. The target level is determined by the critical screen ratio and the target screen ratio for rendering, thus realizing LOD classification.

Benefits of technology

It reduces the complexity of special effects rendering, improves the smoothness of special effects when switching LODs, and reduces labor costs. Special effects when switching between different LODs can be achieved by adjusting component parameters.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115131485B_ABST
    Figure CN115131485B_ABST
Patent Text Reader

Abstract

This invention provides a rendering method, apparatus, device, and storage medium, relating to the field of computer technology. The specific implementation scheme is as follows: Obtain a particle system to be rendered; divide each particle in the particle system into multiple levels according to a specified index of each particle; wherein the specified index of particles under each level is within the same preset index range; determine the critical screen ratio corresponding to each level based on a preset index threshold; the critical screen ratio corresponding to each level is a screen ratio threshold value characterizing whether particles of that level are displayed; for each level, determine whether that level is the target level to be rendered based on the critical screen ratio corresponding to that level and the target screen ratio corresponding to the particle system; if so, render the particles under the target level. It can be seen that this scheme can improve the smoothness of special effects changes during LOD switching.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a rendering method, apparatus, device, and storage medium. Background Technology

[0002] In game development, developers often add dazzling special effects to game scenes to enhance their realism. However, adding too many effects can strain rendering. To reduce this, effects need to be displayed in tiers, known as Levels of Detail (LOD). The purpose of LOD grading is to reduce the complexity of rendering effects when they are far from the viewpoint.

[0003] In related technologies, LOD (Level of Detail) grading is achieved by configuring a threshold for the LOD switching distance—that is, a threshold for the distance between the viewpoint and the effect—and controlling the number of particles in the particle system under different thresholds, thereby displaying different effects. For example, in a client-side game scene, an explosion effect might have a particle system composed of particles rendered as flames, sparks, and smoke, with LOD switching distance thresholds set to 10 meters and 20 meters respectively. When the distance between the viewpoint and the effect is less than 10 meters, all particles in the effect's particle system are rendered; when the distance is greater than 10 meters but less than 20 meters, only flame particles are rendered, thus achieving graded display and reducing rendering pressure. However, the method of manually setting the LOD switching distance threshold and the number of particles in the particle system under different thresholds to achieve graded effect display in related technologies can lead to abrupt changes in the effect during LOD switching.

[0004] Therefore, there is an urgent need for a rendering method that can improve the smoothness of special effects changes during LOD switching. Summary of the Invention

[0005] The purpose of this invention is to provide a rendering method, apparatus, device, and storage medium to improve the smoothness of special effects changes during LOD switching. The specific technical solution is as follows:

[0006] In a first aspect, embodiments of the present invention provide a rendering method, the method comprising:

[0007] Obtain the particle system to be rendered;

[0008] Based on the specified index of each particle in the particle system, each particle in the particle system is divided into multiple levels; wherein, the specified index is an index characterizing the display effect when the screen is displayed, and the specified index of the particles under each level is within the same preset index range.

[0009] Based on preset index thresholds, the critical screen ratio corresponding to each level is determined; wherein, the index threshold is a critical index value characterizing whether particles are displayed; and the critical screen ratio corresponding to each level is a critical screen ratio value characterizing whether particles of that level are displayed.

[0010] For each level, based on the critical screen ratio corresponding to that level and the target screen ratio corresponding to the particle system, it is determined whether that level is the target level to be rendered.

[0011] If so, render the particles at the target level.

[0012] Optionally, determining the critical screen ratio corresponding to each level based on a preset index threshold includes:

[0013] For each level, a specified index is determined for a specified particle within that level; wherein, the specified particle is the particle with the largest specified index in that level.

[0014] The scaling factor used when scaling the specified index of the specified particle to the index threshold is used as the critical screen ratio corresponding to that level.

[0015] Optionally, determining whether a level is a target level to be rendered, based on the critical screen-to-body ratio corresponding to that level and the target screen-to-body ratio corresponding to the particle system, for each level, includes:

[0016] For each level, if the target screen ratio corresponding to the particle system is greater than the critical screen ratio corresponding to that level, then that level is determined as the target level to be rendered.

[0017] Optionally, rendering particles at the target level includes:

[0018] Based on the critical screen ratio corresponding to each level, multiple screen ratio intervals are determined; each screen ratio interval is an interval that represents particles of different levels that are not completely the same.

[0019] For each target level, if the target screen ratio is within a specified screen ratio range with the critical screen ratio corresponding to the target level as the lower limit, the number of target particles to be rendered for that target level is determined based on the length of the range corresponding to the specified screen ratio range; if the target screen ratio is outside a specified screen ratio range with the critical screen ratio corresponding to the target level as the lower limit, the total number of particles under that target level is determined as the number of target particles to be rendered for that target level.

[0020] Render the particles at each target level according to the number of target particles to be rendered as determined for each target level.

[0021] Optionally, determining the number of target particles to be rendered at the target level based on the interval length corresponding to the specified screen ratio interval includes:

[0022] Calculate the difference between the target screen ratio and the lower limit of the specified screen ratio range;

[0023] The ratio of the difference to the length of the interval corresponding to the specified screen ratio interval is used as the proportion of particles to be rendered at the target level.

[0024] The product of the proportion of particles to be rendered at the target level and the total number of particles at that target level is determined as the target number of particles to be rendered at that target level.

[0025] Secondly, embodiments of the present invention provide a rendering apparatus, the apparatus comprising:

[0026] The acquisition module is used to acquire the particle system to be rendered;

[0027] The partitioning module is used to divide each particle in the particle system into multiple levels according to the specified index of each particle in the particle system; wherein, the specified index is an index that characterizes the display effect when the screen is displayed, and the specified index of the particles in each level is within the same preset index range.

[0028] The first determining module is used to determine the critical screen ratio corresponding to each level based on a preset index threshold; wherein, the index threshold is a critical index value characterizing whether particles are displayed; and the critical screen ratio corresponding to each level is a screen ratio critical value characterizing whether particles of that level are displayed.

[0029] The second determining module is used to determine whether a level is a target level to be rendered, based on the critical screen ratio corresponding to that level and the target screen ratio corresponding to the particle system for each level.

[0030] The rendering module is used to render particles at the target level if necessary.

[0031] Optionally, the first determining module includes:

[0032] The first determining submodule is used to determine, for each level, a specified index of a specified particle among the particles at that level; wherein, the specified particle is the particle with the largest specified index at that level.

[0033] The second determining submodule is used to scale the specified index of the specified particle to the index threshold using the scaling factor as the critical screen ratio corresponding to that level; it is also used to determine that level as the target level to be rendered if the target screen ratio of the particle system is greater than the critical screen ratio corresponding to that level for each level.

[0034] Optionally, the rendering module includes:

[0035] The interval determination submodule is used to determine multiple screen ratio intervals based on the critical screen ratio corresponding to each level; where each screen ratio interval is an interval representing particles of different levels that are not completely the same.

[0036] The particle count determination submodule is used to determine the target particle count to be rendered for each target level if the target screen ratio is within a specified screen ratio range with the critical screen ratio corresponding to the target level as the lower limit of the range; if the target screen ratio is outside the specified screen ratio range with the critical screen ratio corresponding to the target level as the lower limit of the range, the total number of particles under the target level is determined as the target particle count to be rendered for the target level.

[0037] The rendering submodule is used to render particles at each target level according to the number of target particles to be rendered determined for each target level.

[0038] Optionally, the particle count determination submodule determines the target particle count to be rendered at the target level based on the interval length corresponding to the specified screen ratio interval, including:

[0039] Calculate the difference between the target screen ratio and the lower limit of the specified screen ratio range;

[0040] The ratio of the difference to the length of the interval corresponding to the specified screen ratio interval is used as the proportion of particles to be rendered at the target level.

[0041] The product of the proportion of particles to be rendered at the target level and the total number of particles at the target level is determined as the target number of particles to be rendered at the target level.

[0042] Thirdly, embodiments of the present invention provide an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;

[0043] Memory, used to store computer programs;

[0044] When a processor executes a program stored in memory, it implements the steps of any of the rendering methods described above.

[0045] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of any of the rendering methods described above.

[0046] Beneficial effects of the embodiments of the present invention:

[0047] The solution provided in this invention involves acquiring a particle system to be rendered, dividing each particle in the system into multiple levels based on a specified index of each particle, determining the critical screen ratio corresponding to each level based on a preset index threshold, and determining whether each level is the target level to be rendered based on the critical screen ratio and the target screen ratio of the particle system. If so, the particles at the target level are rendered. Since the preset index threshold is a critical index value representing whether particles are displayed, the critical screen ratio corresponding to each level is determined through this threshold. When the target screen ratio of the particle system is less than the critical screen ratio of a certain level, the particles at that level are not rendered, i.e., not displayed. This achieves LOD (Level of Detail) grading by utilizing the critical screen ratios corresponding to different levels. Furthermore, since the particles in the particle system of other levels besides the target level are particles with smaller specified indices, rendering only the particles at the target level and not rendering the particles of other levels reduces the complexity of special effects rendering and has less impact on the user's viewing experience, improving the smoothness of special effects changes during LOD switching. Furthermore, by creating a component based on this rendering method, players can easily see the effects of different LOD transitions in real time within the game by simply adjusting the component parameters, i.e., the preset threshold values. Compared to manually creating LOD transition effects, this component is low-cost, produces superior results, and is easy to use; simply add the component to the effect.

[0048] Of course, implementing any product or method of the present invention does not necessarily require achieving all of the advantages described above at the same time. Attached Figure Description

[0049] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other embodiments can be obtained based on these drawings.

[0050] Figure 1 A flowchart of a rendering method provided in an embodiment of the present invention;

[0051] Figure 2 This is another flowchart of the rendering method provided in an embodiment of the present invention;

[0052] Figure 3 This is another flowchart of the rendering method provided in the embodiments of the present invention;

[0053] Figure 4This is a schematic diagram of the rendering apparatus provided in an embodiment of the present invention;

[0054] Figure 5 A block diagram of an electronic device for implementing the rendering method provided in the embodiments of the present invention. Detailed Implementation

[0055] 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. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art based on this application are within the scope of protection of the present invention.

[0056] In the field of game development, to enrich game content and enhance visual effects, developers often add various dazzling special effects to game scenes. However, adding too many effects can put a strain on rendering, potentially causing lag during gameplay and negatively impacting the gaming experience.

[0057] To reduce rendering pressure, effects can be graded based on Level of Distance (LOD). When an effect is far from the viewpoint, the complexity of rendering the effect is reduced, thus lowering rendering pressure. Related technologies achieve LOD grading by configuring a threshold for the LOD switching distance—that is, a threshold for the distance between the viewpoint and the effect—and controlling the number of particles in the particle system at different thresholds, thereby displaying different effects. However, the current method of manually setting the LOD switching distance threshold and the number of particles in the particle system at different thresholds to achieve graded effect display is too labor-intensive, and the changes in effect during LOD switching are abrupt.

[0058] Based on the above, in order to improve the smoothness of special effects changes during LOD switching, embodiments of the present invention provide a rendering method, apparatus, device, and storage medium.

[0059] Below, we will first introduce a rendering method provided by an embodiment of the present invention.

[0060] The rendering method provided in this disclosure can be applied to electronic devices. In specific applications, the electronic device can be a server or a terminal device, both of which are reasonable. In practical applications, the terminal device can be a smartphone, tablet computer, desktop computer, etc.

[0061] Specifically, the execution entity of this rendering method can be a rendering device. For example, when the rendering method is applied to a terminal device, the rendering device can be functional software running on the terminal device, such as special effects rendering software; of course, the rendering device can also be a plugin in an existing client, such as a special effects rendering plugin in game software. For example, when the rendering method is applied to a server, the rendering device can be a computer program running on the server, which can be used to implement special effects rendering.

[0062] The rendering method provided in this embodiment of the invention may include the following steps:

[0063] Obtain the particle system to be rendered;

[0064] Based on the specified index of each particle in the particle system, each particle in the particle system is divided into multiple levels; wherein, the specified index is an index characterizing the display effect when the screen is displayed, and the specified index of the particles under each level is within the same preset index range.

[0065] Based on preset index thresholds, the critical screen ratio corresponding to each level is determined; wherein, the index threshold is a critical index value characterizing whether particles are displayed; and the critical screen ratio corresponding to each level is a critical screen ratio value characterizing whether particles of that level are displayed.

[0066] For each level, based on the critical screen ratio corresponding to that level and the target screen ratio corresponding to the particle system, it is determined whether that level is the target level to be rendered.

[0067] If so, render the particles at the target level.

[0068] The solution provided in this invention involves acquiring a particle system to be rendered, dividing each particle in the system into multiple levels based on a specified index of each particle, determining the critical screen ratio corresponding to each level based on a preset index threshold, and determining whether each level is the target level to be rendered based on the critical screen ratio and the target screen ratio of the particle system. If so, the particles at the target level are rendered. Since the preset index threshold is a critical index value representing whether particles are displayed, the critical screen ratio corresponding to each level is determined through this threshold. When the target screen ratio of the particle system is less than the critical screen ratio of a certain level, the particles at that level are not rendered, i.e., not displayed. This achieves LOD (Level of Detail) grading by utilizing the critical screen ratios corresponding to different levels. Furthermore, since the particles in the particle system of other levels besides the target level are particles with smaller specified indices, rendering only the particles at the target level and not rendering the particles of other levels reduces the complexity of special effects rendering and has less impact on the user's viewing experience, improving the smoothness of special effects changes during LOD switching. Furthermore, by creating a component based on this rendering method, players can easily see the effects of different LOD transitions in real time within the game by simply adjusting the component parameters, i.e., the preset threshold values. Compared to manually creating LOD transition effects, this component is low-cost, produces superior results, and is easy to use; simply add the component to the effect.

[0069] The rendering method provided by the embodiments of the present invention will now be described in conjunction with the accompanying drawings.

[0070] like Figure 1 As shown, the rendering method provided in this embodiment of the invention may include steps S101-S105:

[0071] S101, Obtain the particle system to be rendered;

[0072] In this embodiment, the particle system is a collection of all particles to be rendered on the client interface. After rendering, the particle system will display special effects on the client. It is understandable that, to achieve LOD (Level of Detail) grading for the special effects, the particle system to be rendered can be obtained first, and the particles within the system can be processed to achieve LOD grading during rendering. The particle system is composed of particles that simulate real-world effects such as water, fire, fog, and gas. Its principle is to combine countless individual particles to present a fixed shape, and then use controllers and scripts to control the movement of the entire system or individual particles to simulate realistic effects.

[0073] S102, according to the specified index of each particle in the particle system, the particles in the particle system are divided into multiple levels; wherein, the specified index is an index that characterizes the display effect when the screen is displayed, and the specified index of the particles in each level is within the same preset index range.

[0074] In this embodiment, the designated index for each particle in the particle system is an index characterizing the display effect when displayed on a screen. For example, this designated index could be the number of pixels occupied by the particle when the particle system is displayed on an electronic device at 100% screen-to-body ratio, the particle size, or the display area of ​​the particle on the electronic device, etc. For example, using the number of pixels occupied by the particle as the designated index, if the particle system is displayed at 100% screen-to-body ratio on a mobile phone screen with a resolution of 1920*1080, and particle A in the particle system occupies 200 pixels, then the designated index for particle A is 200.

[0075] It is understandable that, since the display effects of individual particles in a particle system differ when displayed on a screen, these particles can be divided into multiple levels according to specified indicators. When dividing the particles in the particle system into multiple levels, a preset indicator range can be used to group particles within the same preset indicator range into the same level. For example, if the preset indicator range for level A is (50, 100), the preset indicator range for level B is (100, 200), and the preset indicator range for level C is (200, 500), and for instance, if the specified indicator distribution of each particle in the particle system is (70, 80, 120, 145, 300, 400), then particles with specified indicators of 70 and 80 are classified as level A, particles with specified indicators of 120 and 145 are classified as level B, and particles with specified indicators of 300 and 400 are classified as level C. It should be noted that in this embodiment, "multiple levels" refers to two or more levels. Furthermore, the preset index range for each level can be set by relevant technical personnel according to their needs, and the comparison of the embodiments of the present invention is not limited.

[0076] S103, based on a preset index threshold, determine the critical screen ratio corresponding to each level; wherein, the index threshold is a critical index value characterizing whether particles are displayed; the critical screen ratio corresponding to each level is a screen ratio critical value characterizing whether particles of that level are displayed.

[0077] In this embodiment, when the particle system is rendered as a special effect on the terminal device, the ratio of the screen area occupied by the special effect to the screen area of ​​the entire terminal device is the screen ratio corresponding to the particle system. To achieve Level of Detail (LOD) grading, a critical screen ratio corresponding to each level of the particle system can be determined, that is, the critical screen ratio value at which particles of each level are displayed. When the screen ratio corresponding to the particle system is less than the critical screen ratio corresponding to a certain level, particles of that level are not rendered, i.e., not displayed. Thus, LOD grading is achieved by utilizing the critical screen ratios corresponding to different levels.

[0078] It should be noted that the preset threshold value is a critical value representing whether particles are displayed. In practical applications, to alleviate the abrupt switching effect during LOD transitions, this threshold value can be set to a small value that has little impact on the viewing effects. This way, when particles smaller than the threshold value are not displayed, the impact on the user's viewing experience is minimal. Specifically, this threshold value can be set by relevant technical personnel based on experience and the actual terminal screen specifications, and this embodiment of the invention does not limit this.

[0079] Understandably, there are multiple ways to determine the critical screen-to-body ratio for each level based on preset indicator thresholds. For example, in one implementation, the mode of each specified indicator under each level can be used as the specified indicator for that level. The scaling factor used to scale the specified indicator to the preset indicator threshold is then calculated and used as the critical screen-to-body ratio for that level. For instance, if the mode of the specified indicator for each particle in level A of the particle system is 500, and the preset indicator threshold is 50, then the scaling factor for scaling the specified indicator to the indicator threshold for level A is 10%, and this 10% is the critical screen-to-body ratio for level A.

[0080] S104. For each level, based on the critical screen ratio corresponding to that level and the target screen ratio corresponding to that particle system, determine whether that level is the target level to be rendered.

[0081] In this embodiment, when the particle system to be rendered in step S101 is rendered as a special effect on the terminal device, the ratio of the screen area occupied by the special effect to the screen area of ​​the entire terminal device is the target screen ratio corresponding to the particle system. It can be understood that since each level corresponds to a critical screen ratio, which represents the threshold value for whether particles at that level are displayed, when the target screen ratio corresponding to the particle system is less than the critical screen ratio corresponding to a certain level, the particles at that level are not displayed. Therefore, based on the critical screen ratio corresponding to that level and the target screen ratio corresponding to the particle system, the target level to be rendered can be determined.

[0082] Optionally, in one implementation, for each level, determining whether the level is the target level to be rendered, based on the critical screen-to-body ratio corresponding to that level and the target screen-to-body ratio corresponding to the particle system, may include:

[0083] For each level, if the target screen ratio of the particle system is greater than the critical screen ratio of that level, then that level is determined as the target level to be rendered.

[0084] Understandably, since each level has a critical screen-to-body ratio, when the target screen-to-body ratio of the particle system is less than the critical screen-to-body ratio of a certain level, the particles at that level will not be rendered. Therefore, by comparing the target screen-to-body ratio of the particle system with the critical screen-to-body ratio of each level, the level with the critical screen-to-body ratio less than the target screen-to-body ratio is the target level to be rendered. For example, if the critical screen-to-body ratio of level A is 50%, level B is 20%, level C is 10%, and the target screen-to-body ratio is 35%, then by comparing the target screen-to-body ratio with the critical screen-to-body ratio of each level, the target level can be determined to be level B or level C.

[0085] S105, if so, render particles at that target level.

[0086] In this embodiment, particles of the target level are rendered. The rendering method can be to render all particles under the target level, or to select different numbers of particles under the target level for rendering according to different target screen ratios, and so on.

[0087] Understandably, when rendering a particle system, the target screen-to-body ratio is compared with the critical screen-to-body ratio for each level within the particle system. Particles at the determined target level are rendered, while other particles are not. This allows for Level of Detail (LOD) grading by utilizing the critical screen-to-body ratios for each level. Furthermore, since the critical screen-to-body ratio for each level is the scaling factor used to scale the specified metric to a preset threshold, the critical screen-to-body ratio for levels with larger specified metric values ​​is smaller than that for levels with smaller specified metric values. Therefore, for the same particle system to be rendered, the target level is the level with the larger specified metric value, while particles at other levels within the system are those with smaller specified metric values. During LOD transitions, omitting the rendering of LOD particles at other levels reduces the complexity of special effects rendering and has minimal impact on the user's viewing experience, resolving the issue of abrupt LOD transitions.

[0088] The solution provided in this invention involves acquiring a particle system to be rendered, dividing each particle in the system into multiple levels based on a specified index of each particle, determining the critical screen ratio corresponding to each level based on a preset index threshold, and determining whether each level is the target level to be rendered based on the critical screen ratio and the target screen ratio of the particle system. If so, the particles at the target level are rendered. Since the preset index threshold is a critical index value representing whether particles are displayed, the critical screen ratio corresponding to each level is determined through this threshold. When the target screen ratio of the particle system is less than the critical screen ratio of a certain level, the particles at that level are not rendered, i.e., not displayed. This achieves LOD (Level of Detail) grading by utilizing the critical screen ratios corresponding to different levels. Furthermore, since the particles in the particle system of other levels besides the target level are particles with smaller specified indices, rendering only the particles at the target level and not rendering the particles of other levels reduces the complexity of special effects rendering and has less impact on the user's viewing experience, improving the smoothness of special effects changes during LOD switching. Furthermore, by creating a component based on this rendering method, players can easily see the effects of different LOD transitions in real time within the game by simply adjusting the component parameters, i.e., the preset threshold values. Compared to manually creating LOD transition effects, this component is low-cost, produces superior results, and is easy to use; simply add the component to the effect.

[0089] Alternatively, in another embodiment of the invention, such as Figure 2 As shown, in step S103 above, determining the critical screen ratio corresponding to each level based on a preset index threshold may include steps S1031-S1032:

[0090] S1031, For each level, determine the specified index of a specified particle among the particles in that level; wherein, the specified particle is the particle with the largest specified index in that level.

[0091] In this embodiment, the method for determining the specified particle with the largest specified index at each level can be to first obtain the distribution of the specified index of all particles at that level, and then determine the specified particle at that level and the specified index of the specified particle from the distribution of the specified index at each level.

[0092] S1032, Based on the specified index of the specified particle, determine the critical screen ratio corresponding to the specified level by using the scaling factor when scaling to the threshold of the index.

[0093] In this embodiment, by identifying the specified particle with the largest specified metric at each level, and using the scaling factor applied when scaling to the specified metric threshold based on that specified particle's specified metric, the critical screen-to-body ratio corresponding to that level is determined. It is understood that for particles at the same level, when the specified particle with the largest metric is scaled to the metric threshold, all particles at that level are no larger than the metric threshold, and none of the particles at that level need to be rendered. Therefore, the critical screen-to-body ratio corresponding to that level can be determined based on the scaling factor applied when scaling to the specified metric threshold based on that specified particle's specified metric. Furthermore, this embodiment allows for a simple and quick determination of the critical screen-to-body ratio for each level.

[0094] For example, the scaling factor used to scale a specified particle's specified metric to a threshold value can be used as the critical screen-to-body ratio for that level. For instance, if the specified metric for a specified particle in level A is 100 and the threshold value is 50, then the critical screen-to-body ratio for level A can be determined to be 50%. Furthermore, it should be noted that since electronic device screens are often non-square rectangles, while particles are typically square in shape when displayed, to ensure the accuracy of the determined critical screen-to-body ratio, the ratio of the specified particle's side length to the side length of the electronic device's window interface can be defined as the screen-to-body ratio. Then, the square root of the scaling factor used to scale the specified particle's specified metric to that threshold value can be used as the critical screen-to-body ratio for that level. For example, if the dimensions of a mobile game window are 800*600, and the dimensions of a specific particle at level A on that game window are also 600*600, since both the height of the game window and the height of the specified particle are 600, if the ratio of the height of the specified particle to the height of the game window is used as the screen ratio, then the screen ratio of the specified particle is 100%. When the dimensions of the game window are scaled down to 800*300 with a scaling factor of 50%, the specified particle, to maintain its square shape, will have its dimensions scaled down to 300*300 with a scaling factor of 25%. Therefore, when calculating the critical screen ratio, the square root of the scaling factor used when scaling the specified particle's dimensions to the threshold can be used as the critical screen ratio for that level. It should be noted that the definition of screen ratio and the calculation method of critical screen ratio are not limited in this embodiment of the invention.

[0095] As can be seen, this solution allows for a simple and quick determination of the critical screen ratio for each level.

[0096] Alternatively, in another embodiment of the invention, such as Figure 3 As shown, rendering particles at the target level in step S105 above may include steps S1051-S1053:

[0097] S1051, based on the critical screen ratio corresponding to each level, determine multiple screen ratio intervals; wherein, each screen ratio interval is an interval representing the display of particles of different levels.

[0098] In this embodiment, since the critical screen-to-body ratio corresponding to each level is the critical value representing whether particles of that level are displayed, the screen-to-body ratio range for displaying particles of different levels can be determined based on the critical screen-to-body ratio of each level. For example, if the critical screen-to-body ratio corresponding to level A is 50%, the critical screen-to-body ratio corresponding to level B is 20%, and the critical screen-to-body ratio corresponding to level C is 10%, then the screen-to-body ratio ranges that can be determined are: A range (50%-100%), if the target screen-to-body ratio is within the A range, the displayed particle levels are A, B, and C; B range (20%-50%), if the target screen-to-body ratio is within the B range, the displayed particle levels are B and C; C range (10%-20%), if the target screen-to-body ratio is within the C range, the displayed particle level is C; D range (0-10%), if the target screen-to-body ratio is within the D range, particles of levels A, B, and C are not displayed.

[0099] S1052, for each target level, if the target screen ratio is within a specified screen ratio range with the critical screen ratio corresponding to the target level as the lower limit of the range, the number of target particles to be rendered for the target level is determined based on the length of the range corresponding to the specified screen ratio range; if the target screen ratio is outside a specified screen ratio range with the critical screen ratio corresponding to the target level as the lower limit of the range, the total number of particles under the target level is determined as the number of target particles to be rendered for the target level.

[0100] For example, if the critical screen ratio for grade A is 50%, for grade B it is 20%, and for grade C it is 10%, and the target screen ratio is 35%, then the target grades are grade B and grade C. For grade B, since the target screen ratio falls within the specified screen ratio range whose lower limit is its corresponding critical screen ratio (i.e., within the B range (20%-50%)), the number of target particles to be rendered for grade B is determined based on the length of this specified screen ratio range. For grade C, since the target screen ratio falls outside the specified screen ratio range whose lower limit is its corresponding critical screen ratio (i.e., outside the C range (10%, 20%)), the total number of particles under grade C is determined as the number of target particles to be rendered for grade C.

[0101] It is understandable that for each screen-to-body ratio range determined above, the number of particle levels displayed within each range will not be exactly the same. When the target screen-to-body ratio switches from a larger range to an adjacent smaller range, one level of particles will be hidden. For example, in the example above, when the target screen-to-body ratio switches from range B to range C, level B particles will be hidden. That is, when the target screen-to-body ratio is in range B, all level B particles are rendered, but when switching to range C, all level B particles are hidden. Therefore, to further improve the smoothness of the effect changes during LOD switching, in this embodiment, if the target screen-to-body ratio is located within a specified screen-to-body ratio range with the critical screen-to-body ratio corresponding to the target level as the lower limit of the range, the number of target particles to be rendered for the target level is determined based on the range length corresponding to the specified screen-to-body ratio range.

[0102] Optionally, in one implementation, determining the number of target particles to be rendered at the target level based on the interval length corresponding to the specified screen ratio interval may include steps A1-A3:

[0103] A1, calculate the difference between the target screen ratio and the lower limit of the specified screen ratio range;

[0104] In this implementation, the difference between the target screen ratio and the lower limit of the specified screen ratio range is calculated to obtain the difference value.

[0105] A2, the ratio of this difference to the length of the interval corresponding to the specified screen ratio interval is used as the proportion of particles to be rendered at this target level;

[0106] For example, if the target screen ratio is 35%, the target level is either B or C. For level B, since the target screen ratio is within the specified screen ratio range that is the lower limit of its corresponding critical screen ratio, that is, within the B range (20%-50%), the difference is calculated to be 15%, and the range length is 30%. Therefore, the proportion of particles to be rendered in level B is 50%.

[0107] A3 determines the target particle count to be rendered at that target level by multiplying the proportion of particles to be rendered at that target level by the total number of particles at that target level.

[0108] It is understandable that after determining the proportion of particles to be rendered at the target level through step A2, the product of the proportion of particles to be rendered at the target level and the total number of particles at the target level is the target number of particles to be rendered at the target level.

[0109] S1053, render the particles at each target level according to the number of target particles to be rendered determined for each target level.

[0110] Understandably, by rendering particles at each target level according to the number of target particles to be rendered determined for each target level, the number of target particles to be rendered will be different for different target screen ratios, making the switching effect smoother when switching LOD.

[0111] As can be seen, this solution can further improve the smoothness of special effects changes during LOD switching.

[0112] To better understand the content of the embodiments of the present invention, a specific example is described below.

[0113] In related technologies, achieving graded display of special effects by setting a threshold for LOD switching distance and the number of particles in the particle system at different thresholds can lead to abrupt changes in special effects during LOD switching. Furthermore, manually configuring the LOD switching distance for each effect is required, resulting in high labor costs. This example develops a special effects LOD plugin to reduce manual workload while improving the smoothness of special effects changes during LOD switching. The LOD plugin used in this example performs the following steps at runtime:

[0114] Step 1: Configure the pixel threshold for LOD switching (corresponding to the preset index threshold mentioned above).

[0115] Step 2: Obtain the particle system from the special effects.

[0116] Step 3: Based on the size of the particles in the particle system (corresponding to the specified index above), classify each particle into three levels: large, medium, and small.

[0117] Step 4: Based on the pixel threshold configured in Step 1, calculate the screen ratio during LOD switching for each level (corresponding to the critical screen ratio mentioned above).

[0118] Step 5: Based on the target screen ratio corresponding to the particle system and the screen ratio when switching LODs for each level, determine the target level to be rendered and the number of particles to be rendered for each target level.

[0119] The following example illustrates the execution process of this LOD plugin:

[0120] (1) Set the pixel threshold for LOD switching to 50.

[0121] (2) Obtain the particle system in the special effects.

[0122] (3) Obtain the particle size distribution of the particle system as (500, 450, 250, 200, 100, 80), and divide these particle systems into 3 levels: particles with a particle size distribution of (500, 450) are classified as large particles; particles with a particle size distribution of (250, 200) are classified as medium particles; and particles with a particle size distribution of (100, 80) are classified as small particles.

[0123] (4) Using the number of pixels occupied by the largest particle in each level (corresponding to the specified particle above), the scaling factor used when scaling the number of pixels occupied by the largest particle to the pixel threshold is used as the screen ratio during LOD switching for that level. For large particle levels, the screen ratio during LOD switching is 10%; for medium particle levels, the screen ratio during LOD switching is 20%; and for large particle levels, the screen ratio during LOD switching is 50%.

[0124] (5) Based on the screen ratio when switching LODs for each level, if the target screen ratio corresponding to the current particle system is 35%, then the number of particles to be rendered under the small particle level is 0, the number of particles to be rendered under the medium particle level is 50% of the total number of particles of that level in the particle system, and the number of particles to be rendered under the large particle level is the total number of particles of that level in the particle system.

[0125] As can be seen, this solution can automatically adjust special effects details based on different screen ratios, greatly reducing manual workload. Furthermore, it improves the smoothness of special effects transitions during LOD switching.

[0126] Corresponding to the embodiments of the above methods, embodiments of the present invention also provide a rendering apparatus, such as... Figure 4 As shown, the device includes:

[0127] Acquisition module 410 is used to acquire the particle system to be rendered;

[0128] The division module 420 is used to divide each particle in the particle system into multiple levels according to the specified index of each particle in the particle system; wherein, the specified index is an index that characterizes the display effect when the screen is displayed, and the specified index of the particles in each level is within the same preset index range.

[0129] The first determining module 430 is used to determine the critical screen ratio corresponding to each level based on a preset index threshold; wherein, the index threshold is a critical index value characterizing whether particles are displayed; and the critical screen ratio corresponding to each level is a screen ratio critical value characterizing whether particles of that level are displayed.

[0130] The second determining module 440 is used to determine whether a level is a target level to be rendered, based on the critical screen ratio corresponding to that level and the target screen ratio corresponding to the particle system for each level.

[0131] Rendering module 450 is used to render particles at the target level if necessary.

[0132] Optionally, the first determining module includes:

[0133] The first determining submodule is used to determine, for each level, a specified index of a specified particle among the particles at that level; wherein, the specified particle is the particle with the largest specified index at that level.

[0134] The second determining submodule is used to scale the specified index of the specified particle to the index threshold using the scaling factor as the critical screen ratio corresponding to that level; it is also used to determine that level as the target level to be rendered if the target screen ratio of the particle system is greater than the critical screen ratio corresponding to that level for each level.

[0135] Optionally, the rendering module includes:

[0136] The interval determination submodule is used to determine multiple screen ratio intervals based on the critical screen ratio corresponding to each level; where each screen ratio interval is an interval representing particles of different levels that are not completely the same.

[0137] The particle count determination submodule is used to determine the target particle count to be rendered for each target level if the target screen ratio is within a specified screen ratio range with the critical screen ratio corresponding to the target level as the lower limit of the range; if the target screen ratio is outside the specified screen ratio range with the critical screen ratio corresponding to the target level as the lower limit of the range, the total number of particles under the target level is determined as the target particle count to be rendered for the target level.

[0138] The rendering submodule is used to render particles at each target level according to the number of target particles to be rendered determined for each target level.

[0139] Optionally, the particle count determination submodule determines the target particle count to be rendered at the target level based on the interval length corresponding to the specified screen ratio interval, including:

[0140] Calculate the difference between the target screen ratio and the lower limit of the specified screen ratio range;

[0141] The ratio of the difference to the length of the interval corresponding to the specified screen ratio interval is used as the proportion of particles to be rendered at the target level.

[0142] The product of the proportion of particles to be rendered at the target level and the total number of particles at the target level is determined as the target number of particles to be rendered at the target level.

[0143] This invention also provides an electronic device, such as... Figure 5 As shown, it includes a processor 501, a communication interface 502, a memory 503, and a communication bus 504, wherein the processor 501, the communication interface 502, and the memory 503 communicate with each other through the communication bus 504.

[0144] Memory 503 is used to store computer programs;

[0145] When the processor 501 executes the program stored in the memory 503, it implements the steps of any of the rendering methods described in the above embodiments.

[0146] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not indicate that there is only one bus or one type of bus.

[0147] The communication interface is used for communication between the aforementioned electronic devices and other devices.

[0148] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0149] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0150] In another embodiment of the present invention, a computer-readable storage medium is also provided, which stores a computer program, wherein the computer program, when executed by a processor, performs the steps of any of the rendering methods described in the above embodiments.

[0151] In another embodiment of the present invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the rendering methods described above.

[0152] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).

[0153] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0154] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the apparatus embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0155] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.

Claims

1. A rendering method, characterized by, The method comprises: acquiring a particle system to be rendered; dividing each particle in the particle system into a plurality of levels according to a specified index of each particle in the particle system, wherein the specified index is an index representing a display effect when a picture is displayed, and the specified index of the particles in each level is within a same preset index range; for each level, determining a specified particle in the particles in the level, wherein the specified particle is a particle with the maximum specified index in the level, and determining a critical screen ratio corresponding to the level based on a scaling coefficient used when the specified index of the specified particle is scaled to an index threshold value, wherein the index threshold value is a critical index value representing whether the particle is displayed, and the critical screen ratio corresponding to each level is a screen ratio critical value representing whether the particles in the level are displayed; for each level, if a target screen ratio corresponding to the particle system is greater than the critical screen ratio corresponding to the level, determining the level as a target level to be rendered; rendering the particles in the target level.

2. The method of claim 1, wherein, The rendering of the particles in the target level comprises: determining a plurality of screen ratio intervals based on the critical screen ratios corresponding to the levels, wherein each screen ratio interval is an interval representing the particles of different levels that are not completely displayed; for each target level, if the target screen ratio is located in a specified screen ratio interval with the critical screen ratio corresponding to the target level as a lower limit value, determining a target particle number to be rendered in the target level based on an interval length corresponding to the specified screen ratio interval, and if the target screen ratio is located outside the specified screen ratio interval with the critical screen ratio corresponding to the target level as a lower limit value, determining a total number of particles in the target level as the target particle number to be rendered in the target level; rendering the particles in the target level according to the target particle number to be rendered in each target level.

3. The method of claim 2, wherein, The determination of the target particle number to be rendered in the target level based on the interval length corresponding to the specified screen ratio interval comprises: calculating a difference between the target screen ratio and a lower limit value of the specified screen ratio interval; taking a ratio of the difference to the interval length corresponding to the specified screen ratio interval as a proportion of the particles to be rendered in the target level; and determining a product of the proportion of the particles to be rendered in the target level and a total number of the particles in the target level as the target particle number to be rendered in the target level.

4. A rendering device, characterized in that The device comprises: an acquisition module configured to acquire a particle system to be rendered; a division module configured to divide each particle in the particle system into a plurality of levels according to a specified index of each particle in the particle system, wherein the specified index is an index representing a display effect when a picture is displayed, and the specified index of the particles in each level is within a same preset index range; The first determining module is configured to determine, for each level, a specified indicator of a specified particle in the particles at the level, wherein the specified particle is a particle with the maximum specified indicator at the level, and determine a critical screen ratio corresponding to the level based on the specified indicator of the specified particle and a scaling coefficient used when scaling to an indicator threshold value; wherein the indicator threshold value is a critical indicator value representing whether the particle is displayed or not, and the critical screen ratio corresponding to each level is a screen ratio critical value representing whether the particle at the level is displayed or not. The second determining module is configured to determine, for each level, the level as a target level to be rendered if the target screen ratio corresponding to the particle system is greater than the critical screen ratio corresponding to the level. The rendering module is configured to render the particles at the target level.

5. The apparatus of claim 4, wherein, The rendering module includes: The interval determining submodule is configured to determine a plurality of screen ratio intervals based on the critical screen ratios corresponding to the levels; wherein each screen ratio interval represents the particles of different levels that are displayed incompletely. The particle number determining submodule is configured to determine, for each target level, a target particle number to be rendered at the target level based on an interval length corresponding to a specified screen ratio interval if the target screen ratio is located in the specified screen ratio interval with the critical screen ratio corresponding to the target level as a lower limit value of the interval, and determine a total number of the particles at the target level as the target particle number to be rendered at the target level if the target screen ratio is located outside the specified screen ratio interval with the critical screen ratio corresponding to the target level as the lower limit value of the interval. The rendering submodule is configured to render the particles at each target level according to the target particle number to be rendered at the target level determined for the target level.

6. An electronic device, comprising: The device includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus. The memory is configured to store a computer program. The processor is configured to execute the program stored in the memory to implement the method steps in any one of claims 1-3.

7. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the method steps in any one of claims 1-3.

Citation Information

Patent Citations

  • Building information model scene rendering method and device and computer equipment

    CN112632679A