A method, device and computer-readable storage medium for rendering

By introducing distance offset values ​​into game rendering technology, calculating the final distance of transparent objects and adjusting the rendering order, the special effect rendering requirements and transparent object sorting problems in the game are solved, and the consistency and correctness of the rendering effect are achieved.

CN112669372BActive Publication Date: 2025-01-10BEIJING PIXEL SOFTWARE TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011522458.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-21
Publication Date
2025-01-10
Estimated Expiration
2040-12-21

AI Technical Summary

Technical Problem

Existing game rendering technologies are difficult to meet the rendering needs of certain special effects, especially in the sorting of transparent objects and special effects, resulting in differences in rendering effects at different angles.

Method used

By introducing distance offset value, calculate the final distance value of transparent object to observer as the sum of the distance value from the special effect to the observer and the distance offset value from the object to the special effect, and adjust the distance offset value according to the rendering order requirements to ensure transparency Objects are rendered in order of demand within the special effects.

Benefits of technology

It realizes the consistency and correctness of rendering effects at any angle, meets the rendering order requirements of objects within the special effects, and maintains the correctness of sorting distance from other objects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112669372B_ABST
    Figure CN112669372B_ABST
Patent Text Reader

Abstract

The embodiments of the present application provide a method, device and computer-readable storage medium for rendering, the method comprising obtaining a plurality of objects to be rendered, wherein the plurality of objects include at least two objects in a special effect; determining the distance values ​​from the plurality of objects to the observer, wherein the distance value from each of the at least two objects to the observer is the sum of the distance offset value from each object to the special effect and the distance value from the special effect to the observer; and rendering the plurality of objects in descending order of the plurality of distance values ​​corresponding to the plurality of objects. The method of the embodiments of the present application superimposes the distance offset value of each transparent object on the distance from the special effect to the observer, and finally obtains the final sorting distance of each transparent object in the special effect, so that each transparent object can be rendered in the required order under any observer's angle while maintaining the distance sorting with other objects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing, and in particular to a method, device and computer-readable storage medium for rendering. Background Art

[0002] In today's games, a large number of transparent objects and special effects are introduced to show a good rendering effect and artistic expression. When introducing transparent objects and special effects, a rendering sorting problem is introduced. When dealing with the rendering of transparent mixed objects, a sorting error can cause a big difference in the rendering effect.

[0003] In existing games, distance sorting is generally used to solve the transparency sorting problem. Specifically, the distance of existing transparent objects and objects in special effects from the camera is first calculated, and then sorted in descending order according to the distance. Objects that are far away are drawn first, and then nearby transparent objects are drawn. In this way, transparent objects and objects in special effects can be mixed in the correct drawing order to achieve the correct effect.

[0004] The above fixed rendering method can render conventional effects normally, but it is difficult to meet the rendering requirements of certain special effects. Therefore, how to meet the rendering requirements of special effects becomes an urgent problem to be solved. Summary of the invention

[0005] The purpose of the embodiments of the present application is to provide a method, device and computer-readable storage medium for rendering, which can meet the rendering requirements of certain special effects.

[0006] In a first aspect, an embodiment of the present application provides a method for rendering, comprising: obtaining multiple objects to be rendered, wherein the multiple objects include at least two objects within a special effect; determining distance values ​​from the multiple objects to an observer, wherein the distance value from each of the at least two objects to the observer is the sum of a distance offset value between each object and the special effect and a distance value from the special effect to the observer; rendering the multiple objects in order from large to small according to the multiple distance values ​​corresponding to the multiple objects.

[0007] In the above implementation process, a distance offset value is introduced in the distance sorting of each transparent object in the special effect, and the distance from the special effect to the observer is used as the basic distance from all transparent objects in the special effect to the observer. On this basis, the distance offset values ​​of each transparent object are superimposed to obtain the final distance value from each transparent object in the special effect to the observer, and multiple transparent objects are rendered according to the final distance value. In this way, the transparent objects in the special effect can be rendered in the required rendering order at any angle while maintaining the distance sorting with other objects.

[0008] In combination with the first aspect, in one embodiment, the method also includes: obtaining the rendering sort order requirements of the at least two objects; determining the distance offset value between each of the at least two objects and the special effect based on the rendering sort order requirements of the at least two objects, wherein the distance offset value of the object with an earlier rendering sort order among the at least two objects is greater than the distance offset value of the object with a later rendering sort order.

[0009] In the above implementation process, the distance offset value of the object in the front rendering sorting order is set to be greater than the distance offset value of the object in the back rendering sorting order, so that each transparent object can be rendered according to the required rendering order.

[0010] In combination with the first aspect, in another embodiment, the distance offset value between each object and the special effect refers to the distance value from each object to the center of the special effect, and the distance value from the special effect to the observer refers to the distance value from the center of the special effect to the observer.

[0011] In the above implementation process, a distance offset value is introduced into the distance sorting of transparent objects in each special effect, thereby introducing a gap in the rendering sorting of each transparent object in the special effect, so that each transparent object in the special effect is rendered in the required order.

[0012] In combination with the first aspect, in another embodiment, the at least two objects are transparent objects.

[0013] In the above implementation process, each object in the special effect is a transparent object, so each object in the special effect is rendered in order.

[0014] In a second aspect, an embodiment of the present application provides a device for rendering, comprising: an information acquisition unit, used to acquire multiple objects to be rendered, wherein the multiple objects include at least two objects within a special effect; the information acquisition unit is also used to determine the distance values ​​from the multiple objects to an observer, wherein the distance value from each of the at least two objects to the observer is the sum of the distance offset value between each object and the special effect and the distance value from the special effect to the observer; a processing unit, used to render the multiple objects in order from large to small according to the multiple distance values ​​corresponding to the multiple objects.

[0015] In combination with the second aspect, in one embodiment, the information acquisition unit is also used to: obtain the rendering sort order requirements of the at least two objects; determine the distance offset value between each of the at least two objects and the special effect based on the rendering sort order requirements of the at least two objects, wherein the distance offset value of the object with an earlier rendering sort order among the at least two objects is greater than the distance offset value of the object with a later rendering sort order.

[0016] In combination with the second aspect, in another embodiment, the distance offset value between each object and the special effect refers to the distance value from each object to the center of the special effect, and the distance value from the special effect to the observer refers to the distance value from the center of the special effect to the observer.

[0017] In combination with the second aspect, in another embodiment, the at least two objects are transparent objects.

[0018] In a third aspect, an embodiment of the present application provides a device for rendering, comprising: a processor, a memory and a bus, wherein the processor is connected to the memory via the bus, and the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the steps in the method provided in the first aspect are executed.

[0019] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a server, the steps in the method provided in the first aspect are implemented.

[0020] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the embodiments of the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0022] Figure 1 A flowchart of a method for rendering provided in an embodiment of the present application;

[0023] Figure 2 A structural block diagram of a device for rendering is provided for an embodiment of the present application;

[0024] Figure 3 A schematic diagram of a device structure for rendering provided in an embodiment of the present application. DETAILED DESCRIPTION

[0025] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0026] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0027] In existing games, distance sorting is generally used to solve the transparency sorting problem. Specifically, the distance of existing transparent objects and objects in special effects from the camera is first calculated, and then sorted in descending order according to the distance. Objects that are far away are drawn first, and then nearby transparent objects are drawn. In this way, transparent objects and objects in special effects can be mixed in the correct drawing order to achieve the correct effect.

[0028] The above fixed rendering method can render regular effects normally, but it is difficult to meet the rendering requirements of some special effects.

[0029] For example, within the same special effect, no matter from which angle, object A is rendered before object B, and the distance order between other objects is satisfied. It is required that object A in the special effect must be drawn before object B at any time. When object A is farther from the camera than object B at a certain viewing angle, the correct rendering effect can be obtained; when the camera is in the opposite position, object B must be farther from the camera than object A, and an incorrect rendering effect will be obtained.

[0030] In view of the above problems, an embodiment of the present application provides a method for rendering, which can satisfy the requirement that within the same special effect, object A is rendered before object B no matter from which angle, and can also satisfy the distance sorting between other objects.

[0031] Combine the following Figure 1 Describe the method for rendering in the embodiment of the present application, combined with Figure 2 and Figure 3 The present invention describes a device for rendering according to an embodiment of the present application.

[0032] Please refer to Figure 1 , Figure 1 A flowchart of a method for rendering provided in an embodiment of the present application, which can be applied to Figure 2 The device 200 for rendering shown in FIG. Figure 1 The methods shown include:

[0033] 110. Obtain a plurality of objects to be rendered, wherein the plurality of objects include at least two objects in a special effect.

[0034] At least two objects are transparent objects.

[0035] It should be noted that, in the embodiment of the present application, the special effect can be considered as a box, and multiple transparent objects are wrapped in the special effect. These transparent objects are called transparent objects in the special effect.

[0036] It should be noted that in the embodiment of the present application, the multiple objects to be rendered may refer to only the multiple objects within the special effect, or may refer to the general term for the multiple objects within the special effect and the multiple objects outside the special effect, but the embodiment of the present application is not limited to this.

[0037] It should be noted that in the embodiment of the present application, the multiple objects to be rendered can be transparent objects, semi-transparent objects, opaque objects, a combination of transparent objects and semi-transparent objects, or a combination of transparent objects and opaque objects, but the embodiment of the present application is not limited to this.

[0038] It should be noted that in the embodiment of the present application, the special effect includes at least two objects, and at least two objects in the special effect can be transparent objects, or a combination of a transparent object and a translucent object, or a combination of a transparent object and an opaque object, but the embodiment of the present application is not limited to this.

[0039] As an embodiment, a plurality of objects to be rendered are obtained, wherein the plurality of objects to be rendered include at least two objects in a special effect. The plurality of objects to be rendered here refers to the collective term for the plurality of objects in the special effect and the plurality of objects outside the special effect, and the plurality of objects in the special effect and the plurality of objects outside the special effect are all transparent objects.

[0040] For easy distinction, the two transparent objects to be rendered are represented by A and B respectively, the special effect is represented by E, and the two transparent objects in the special effect are represented by C and D respectively.

[0041] It should be noted that only two transparent objects A and B are selected as an embodiment here. In the embodiment of the present application, there can be three transparent objects or four transparent objects, but the present application is not limited to this. Only two transparent objects C and D in the special effect are selected here. In the embodiment of the present application, there can be three transparent objects or four transparent objects in the special effect, but the present application is not limited to this.

[0042] 120. Determine distance values ​​from each of the multiple objects to the observer, wherein the distance value from each of the at least two objects to the observer is the sum of a distance offset value from each object to the special effect and a distance value from the special effect to the observer.

[0043] Get the rendering sorting order requirements of at least two objects;

[0044] The distance offset value between each of the at least two objects and the special effect is determined according to the rendering sorting order requirements of the at least two objects, wherein the distance offset value of the object with an earlier rendering sorting order among the at least two objects is greater than the distance offset value of the object with a later rendering sorting order.

[0045] The distance offset value between each object and the special effect refers to the distance value from each object to the center of the special effect, and the distance value from the special effect to the observer refers to the distance value from the center of the special effect to the observer.

[0046] It should be noted that, in the embodiments of the present application, the distance offset value between each object and the special effect may also refer to the distance value from each object to the edge of the special effect, and the distance value from the special effect to the observer refers to the distance value from the edge of the special effect to the observer; the distance offset value between each object and the special effect may also refer to the distance value from each object to a designated point of the special effect, and the distance value from the special effect to the observer refers to the distance value from the designated point of the special effect to the observer, but the present application is not limited to this.

[0047] As an embodiment, the distance values ​​from the above-mentioned multiple objects to the observer are determined, wherein the distance value from each of at least two objects in the special effect to the observer is the sum of the distance offset value from each object to the special effect and the distance value from the special effect to the observer.

[0048] It should be noted that the above-mentioned observer may be a camera, or other photographing devices or observation devices, and the embodiments of the present application are not limited thereto.

[0049] As an embodiment, the observer here is a camera (the perspective here is the first perspective), and the distance values ​​of the above-mentioned multiple objects to the camera are determined, wherein the distance values ​​of transparent objects A and B to the camera are 10m and 30m respectively, the distance value of special effect E to the camera is 15m, and the distance values ​​of the two transparent objects C and D in the special effect to the camera are 16m and 14m respectively.

[0050] Now there is a special display requirement. Object C must be rendered before object D no matter from which angle it is viewed, and the distance sorting between it and other objects must be met.

[0051] According to the existing rendering method, the distances of existing transparent objects and transparent objects in special effects from the camera are calculated, and they are sorted in descending order according to the distances. Objects far away are drawn first, and then transparent objects near are drawn. In this way, transparent objects and transparent objects in special effects can be mixed in the correct drawing order to produce the correct effect.

[0052] According to the above rules, when the camera is in the first perspective, the rendering order of the above transparent objects is: B, C, D, A, at this time, object C can be rendered before object D.

[0053] However, when the camera observes the objects in the opposite direction (the perspective here is the second perspective), the distances of A, B, C, D, and E become 30m, 10m, 14m, 16m, and 15m. The drawing order according to the above distances is A, D, C, and B. The rendering order that does not meet the requirements is A, C, D, and B, that is, object C is not rendered before object D.

[0054] In order to make the rendering order of object C be drawn before object D at any camera angle, and to satisfy the distance order between other objects, the distance values ​​of objects C and D to the observer are the sum of the distance offset value of each object and the distance value of the special effect to the observer.

[0055] That is, the distance value from object C to the observer is the distance value from effect E to the observer plus the distance offset value of object C;

[0056] The distance value from object D to the observer is the distance value from effect E to the observer plus the distance offset value of object D.

[0057] Assuming the distance offset values ​​of the transparent objects, the distance offset value of the object at the front of the rendering sorting order is greater than the distance offset value of the object at the back of the rendering sorting order.

[0058] In the above implementation process, a distance offset value is introduced into the distance sorting of transparent objects in each special effect, thereby introducing a gap in the rendering sorting of each transparent object in the special effect, so that each transparent object in the special effect is rendered in the required order.

[0059] It should be noted that the distance offset of objects C and D does not exceed the range of special effect E that wraps C and D.

[0060] As an embodiment, it is assumed that the distance offset value of object C is 1 m, and the distance offset value of object D is 0 m, but the embodiment of the present application is not limited thereto.

[0061] At this time, the distance from object C to the observer is 15m+1m=16m, and the distance from object D to the observer is 15m+0m=15m.

[0062] Furthermore, when the camera is in the first perspective, the distances from A, B, C, and D to the camera are 10m, 30m, 16m, and 15m respectively; when the camera is in the first perspective, the distances from A, B, C, and D to the camera are 30m, 10m, 16m, and 15m respectively.

[0063] In the above implementation process, the distance offset value of the object in the front rendering sorting order is set to be greater than the distance offset value of the object in the back rendering sorting order, so that each transparent object can be rendered according to the required rendering order.

[0064] 130 , rendering the multiple objects in a descending order of the multiple distance values ​​corresponding to the multiple objects.

[0065] According to the existing rendering method, the distance values ​​from each transparent object to the camera are sorted from large to small, and each transparent object is rendered to obtain the required rendering effect.

[0066] Sort the above transparent objects from large to small. When the camera is in the first perspective, the rendering order of the transparent objects is B, C, D, A, so that object C is rendered before object D and the distance order with A and B is met.

[0067] When the camera is at the second viewing angle, the rendering order of each transparent object is A, C, D, B, which satisfies that object C is rendered before object D and can satisfy the distance sorting with A and B.

[0068] In the above implementation process, the special effect is used as a black box, and all objects inside the special effect use the distance from the special effect to the camera as the basic value of the distance from the object to the camera. Then, the respective distance offset values ​​are superimposed on this basis as the final sorting distance, and transparent objects are sorted and rendered according to the final sorting distance, thereby achieving the rendering sorting problem that object C is drawn before object D at any camera angle while maintaining the distance sorting with other objects, further achieving better rendering effects.

[0069] Combination of the above Figure 1 The method for rendering in the embodiment of the present application is described below. Figure 2 and Figure 3 The present invention describes a device for rendering according to an embodiment of the present application.

[0070] Please refer to Figure 2 , Figure 2 This is a structural block diagram of a device for rendering according to an embodiment of the present application. Figure 2 The device 200 provided for rendering is Figure 1 The method corresponds to, including being able to achieve Figure 1 Each functional module of the method.

[0071] In one embodiment, Figure 2 The provided device 200 for rendering includes:

[0072] Information acquisition unit 210 and processing unit 220;

[0073] An information acquisition unit, used to acquire a plurality of objects to be rendered, wherein the plurality of objects include at least two objects in the special effect;

[0074] The at least two objects mentioned above are transparent objects.

[0075] The information acquisition unit is further used to determine the distance values ​​from the multiple objects to the observer, wherein the distance value from each of at least two objects to the observer is the sum of the distance offset value from each object to the special effect and the distance value from the special effect to the observer;

[0076] The information acquisition unit is also used to:

[0077] Get the rendering sorting order requirements of at least two objects;

[0078] The distance offset value between each of the at least two objects and the special effect is determined according to the rendering sorting order requirements of the at least two objects, wherein the distance offset value of the object with an earlier rendering sorting order among the at least two objects is greater than the distance offset value of the object with a later rendering sorting order.

[0079] The distance offset value between each object and the special effect refers to the distance value from each object to the center of the special effect, and the distance value from the special effect to the observer refers to the distance value from the center of the special effect to the observer.

[0080] The processing unit is used to render the multiple objects in a descending order of the multiple distance values ​​corresponding to the multiple objects.

[0081] It should be noted that Figure 2 The provided rendering device 200 can realize Figure 1 The method embodiment involves various processes of rendering. The operations and / or functions of various modules in the rendering device 200 are respectively to achieve Figure 1 For details, please refer to the description in the above method embodiment. To avoid repetition, detailed description is appropriately omitted here.

[0082] Please refer to Figure 3 , Figure 3 A schematic diagram of a device structure for rendering provided in an embodiment of the present application, such as Figure 3The device 300 for rendering shown may include: at least one processor 310, which may be a CPU (Central Processing Unit), a GPU (Graphics Processing Unit), or a CPU and a GPU, but the embodiments of the present application are not limited thereto, at least one communication interface 320, at least one memory 330, and at least one communication bus 340. Among them, the communication bus 340 is used to realize direct connection and communication between these components. Among them, the communication interface 320 of the device in the embodiment of the present application is used to communicate signaling or data with other node devices. The memory 330 may be a high-speed RAM (random access memory) memory, or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 330 may optionally be at least one storage device located away from the aforementioned processor. The memory 330 stores computer-readable instructions. When the computer-readable instructions are executed by the processor 310, the device for rendering executes. Figure 1 The method process is shown.

[0083] The present invention provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a server, Figure 1 The method process shown.

[0084] In the several embodiments provided in this application, it should be understood that the disclosed systems and methods can also be implemented in other ways. The system embodiments described above are only illustrative. For example, the division of the system devices is only a logical function division. There may be other division methods in actual implementation. For example, multiple devices or components can be combined or integrated into another system, or some features can be ignored or not executed.

[0085] In addition, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0086] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for rendering, characterized in that include: Acquire a plurality of objects to be rendered, wherein the plurality of objects include at least two objects in the special effect; each of the at least two objects is a transparent object, a combination of a transparent object and a semi-transparent object, or a combination of a transparent object and an opaque object; Obtaining rendering sorting order requirements of the at least two objects; Determining a distance offset value between each of the at least two objects and the special effect according to a rendering sorting order requirement of the at least two objects, wherein the distance offset value of the object with a preceding rendering sorting order among the at least two objects is greater than the distance offset value of the object with a following rendering sorting order; Determine the distance values ​​from the multiple objects to the observer respectively, wherein the distance value from each of the at least two objects to the observer is the sum of the distance offset value from each object to the special effect and the distance value from the special effect to the observer; The multiple objects are rendered in a descending order of the multiple distance values ​​corresponding to the multiple objects.

2. The method according to claim 1, characterized in that The distance offset value between each object and the special effect refers to the distance value from each object to the center of the special effect, and the distance value from the special effect to the observer refers to the distance value from the center of the special effect to the observer.

3. A device for rendering, characterized in that include: An information acquisition unit, configured to acquire a plurality of objects to be rendered, wherein the plurality of objects include at least two objects in a special effect; each of the at least two objects is a transparent object, a combination of a transparent object and a semi-transparent object, or a combination of a transparent object and an opaque object; The information acquisition unit is further used to determine the distance values ​​from the multiple objects to the observer, wherein the distance value from each of the at least two objects to the observer is the sum of the distance offset value from each object to the special effect and the distance value from the special effect to the observer; A processing unit, configured to render the multiple objects in a descending order of the multiple distance values ​​corresponding to the multiple objects; The information acquisition unit is also used to: Get the rendering sorting order requirements of at least two objects; The distance offset value between each of the at least two objects and the special effect is determined according to the rendering sorting order requirements of the at least two objects, wherein the distance offset value of the object with an earlier rendering sorting order among the at least two objects is greater than the distance offset value of the object with a later rendering sorting order.

4. The device according to claim 3, characterized in that The distance offset value between each object and the special effect refers to the distance value from each object to the center of the special effect, and the distance value from the special effect to the observer refers to the distance value from the center of the special effect to the observer.

5. A device for rendering, characterized in that include: A processor, a memory and a bus, wherein the processor is connected to the memory via the bus, and the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, they are used to implement the method according to any one of claims 1 to 2.

6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a server, implements the method as claimed in any one of claims 1 to 2.

Citation Information

Patent Citations

  • Method and apparatus for visualization of geo-located media contents in 3D rendering applications

    CN106133795A

  • Rendering control method and device and readable storage medium

    CN107952241A