Methods, devices, and media for rendering a target object in an image
Patent Information
- Application Number
- CN202111383450.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-22
- Publication Date
- 2026-10-16
- Estimated Expiration
- 2041-11-22
AI Technical Summary
静态介质材质如果形成体积云,需要大量、复杂的光照模拟计算,因而所需的硬件开销很大,尤其是针对运行在移动设备上的手游而言,由于移动设备的计算资源有限,是不可能实现的上述大量、复杂的光照模拟计算
Smart Images

Figure CN116152406B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this disclosure generally relate to image processing, and more specifically to a method, computing device, and computer storage medium for rendering a target object in an image. Background Technology
[0002] Traditional methods for rendering target objects in images, such as in games and movies (e.g., but not limited to real-time volumetric clouds), primarily involve applying static medium materials to a sky sphere mesh. Forming volumetric clouds with static medium materials requires extensive and complex lighting simulation calculations, resulting in significant hardware overhead, especially for mobile games running on mobile devices where limited computing resources make such calculations impossible. Even when using ray-stepping and approximation algorithms to simulate cloud rendering in mobile games, the high number of sampling steps still requires substantial computation. It should be understood that implementing real-time volumetric cloud rendering on mobile devices differs from that on console PCs. If rendering target objects (e.g., but not limited to real-time volumetric clouds) in mobile games consumes excessive computing power, it can easily lead to lag on mobile devices. In addition, for distant target objects (such as, but not limited to, distant clouds), when the angle between the ray tracing direction and the horizontal direction is small, many step samplings are required to penetrate the target object. Therefore, traditional methods for simulating cloud rendering based on ray stepping and approximation algorithms cannot collect data of distant target objects within a limited number of step samplings.
[0003] In summary, the shortcomings of traditional methods for rendering target objects in images are: difficulty in quickly rendering real-time target objects on computing devices with limited computing power, and inability to collect data on distant target objects within a limited number of step samplings. Summary of the Invention
[0004] To address the aforementioned issues, this disclosure provides a method, computing device, and computer storage medium for rendering target objects in an image. This method enables the rapid rendering of real-time target objects on computing devices with limited computing power, and allows the acquisition of data on distant target objects within a limited number of step samplings.
[0005] According to a first aspect of this disclosure, a method for rendering a target object in an image is provided, comprising: generating a bounding box for enclosing the target object in a current frame image; generating one or more sampling surfaces within the bounding box to obtain coordinate information of the sampling surfaces; adjusting at least one of the maximum position information and minimum position information of the bounding box in a predetermined direction based on the obtained coordinate information of the sampling surfaces; and determining the intersection point of the ray tracing direction and the sampling surfaces based at least on the adjusted position information of the bounding box, so as to render the target object in the current frame image with the intersection point as the starting point for step sampling.
[0006] According to a second aspect of this disclosure, a computing device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; the memory storing instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method of the first aspect of this disclosure.
[0007] In a third aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause a computer to perform the method of the first aspect of this disclosure.
[0008] In some embodiments, the method for rendering a target object in an image further includes: determining whether a current step sampling based on a predetermined step size has been completed; in response to determining that the current step sampling based on the predetermined step size has been completed, increasing the predetermined step size at predetermined intervals; and performing the next step sampling based on the increased predetermined step size.
[0009] In some embodiments, the method for rendering a target object in an image further includes: determining whether the rendered target object has a tangent plane; and adjusting the position of the sampling surface in response to determining that the rendered target object has a tangent plane.
[0010] In some embodiments, rendering a target object in the current frame image with the intersection point as the starting point of step sampling includes: confirming whether the current step sampling location is located at or beyond the sampling surface; and in response to confirming that the current step sampling location is located at or beyond the sampling surface, rendering the target object in the current frame image based on the acquisition data of the current step sampling and the acquisition data of each step sampling on the ray tracing path from the intersection point to the current test point of the current step sampling.
[0011] In some embodiments, generating one or more sampling surfaces within a bounding box includes: sampling noise data for each pixel of an image region within the bounding box, wherein the target object is a real-time volumetric cloud; determining whether the density of the sampled pixels is greater than a predetermined density threshold; in response to determining that the density of the sampled pixels is greater than the predetermined density threshold, determining that the sampled pixels are sampling points of the target object; determining the maximum and / or minimum coordinate information of the sampling points of the target object in a predetermined direction based on the coordinate information of the sampling points of the target object; and generating one or more sampling surfaces based on the maximum and / or minimum coordinate information in the predetermined direction, wherein the sampling surfaces are located inside the bounding box.
[0012] In some embodiments, the method for rendering a target object in an image further includes: creating a first array; sampling the density of multiple sampling points within the target object range for the current frame image in a multi-frame image, wherein all multi-frame images include the target object; comparing the density of each of the multiple sampling points with a predetermined density threshold to write the position information of sampling points greater than the predetermined density threshold into the first array; comparing the position information of the sampling points written into the first array to determine the maximum and minimum position information in a predetermined direction; and determining a sampling container corresponding to the current frame image based on the maximum and minimum position information, wherein each sampling container includes multiple sampling surfaces.
[0013] In some embodiments, the method for rendering a target object in an image further includes: creating a second array; determining multiple sampling containers corresponding to the multiple frames of images respectively; determining the sampling container with the largest coverage area based on the coordinate information of the sampling containers, so as to write the coordinate information of the sampling container with the largest coverage area into the second array; and using the determined sampling container with the largest coverage area for rendering the target object of the multiple frames of images.
[0014] In some embodiments, the target object is: a sea of clouds from a top-down perspective, clouds from a bottom-up perspective, and multiple frames of images are images from a game running on a mobile terminal.
[0015] In some embodiments, the method for rendering a target object in an image further includes: determining whether the density of test points sampled in a predetermined number of consecutive steps is less than or equal to a predetermined density threshold; in response to determining that the density of test points sampled in a predetermined number of consecutive steps is less than or equal to the predetermined density threshold, performing step sampling with a first set value as the step size; determining whether the density of the current test point sampled with the first set value as the step size is greater than the predetermined density threshold; and in response to determining that the density of the current test point sampled with the first set value as the step size is greater than the predetermined density threshold, performing step sampling with a second set value as the step size, wherein the second set value is less than the first set value.
[0016] In some embodiments, the method for rendering a target object in an image further includes: taking the intersection of the ray tracing direction and the sampling surface as the starting point of the step sampling, determining the number of step samplings and the step sampling distance corresponding to the current step sampling; determining whether the current step sampling meets a predetermined step sampling termination condition, the predetermined step sampling termination condition including at least one of the following: the number of step samplings corresponding to the current step sampling is greater than or equal to a predetermined step sampling number threshold; the step sampling distance corresponding to the current step sampling is greater than or equal to a predetermined step sampling distance threshold; the current step sampling of the test point reaches outside the adjusted bounding box; and stopping the step sampling of the test point in response to determining that the current step sampling meets the predetermined step sampling termination condition.
[0017] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0018] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. In the drawings, the same or similar reference numerals denote the same or similar elements.
[0019] Figure 1 A schematic diagram of a system for implementing a method for rendering a target object in an image, according to an embodiment of the present disclosure, is shown.
[0020] Figure 2 A flowchart of a method for rendering a target object in an image according to an embodiment of the present disclosure is shown.
[0021] Figure 3 A schematic diagram of a method for rendering a target object in an image according to an embodiment of the present disclosure is shown.
[0022] Figure 4 A flowchart is shown of a method for rendering a target object for a multi-frame image according to an embodiment of the present disclosure.
[0023] Figure 5 A schematic diagram of a method for rendering a target object for a multi-frame image according to an embodiment of the present disclosure is shown.
[0024] Figure 6 A flowchart of a method for determining a predetermined step size according to an embodiment of the present disclosure is shown.
[0025] Figure 7 A block diagram of an electronic device according to an embodiment of the present disclosure is shown. Detailed Implementation
[0026] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0027] The term "comprising" and its variations as used herein signify open inclusion, i.e., "including but not limited to". Unless otherwise stated, the term "or" means "and / or". The term "based on" means "at least partially based on". The terms "one example embodiment" and "one embodiment" mean "at least one example embodiment". The term "another embodiment" means "at least one additional embodiment". The terms "first", "second", etc., may refer to different or the same objects. Other explicit and implicit definitions may also be included below.
[0028] As mentioned above, the shortcomings of traditional methods for rendering target objects in images are: difficulty in quickly rendering real-time target objects on computing devices with limited computing power, and inability to collect data on distant target objects within a limited number of step samplings.
[0029] To at least partially address one or more of the aforementioned problems and other potential issues, exemplary embodiments of this disclosure propose a scheme for rendering target objects in an image. In this scheme, one or more sampling surfaces are generated within a bounding box that determines the target object in the current frame image, and the maximum and / or minimum position information of the bounding box in a predetermined direction is adjusted based on the coordinate information of the acquired sampling surfaces. This disclosure allows the sampling surfaces and / or the adjusted bounding box to be closer to the target object. Furthermore, by determining the intersection of the ray tracing direction and the sampling surface based at least on the adjusted bounding box position information, and using this intersection as the starting point for step sampling of the test point to render the target object in the current frame image, this disclosure allows the test point to be step sampled along the ray tracing direction starting from the intersection of the ray tracing direction and the sampling surface (which is closer to the target object). This significantly reduces the number of test point step samples, making it more likely to sample the complete target object (e.g., including distant target objects) within a limited number of step samples. Therefore, this disclosure enables real-time rendering of target objects on computing devices with limited computing power, and the acquisition of data for distant target objects within a limited number of step samples. Moreover, this disclosure can significantly improve the visible distance of the target object.
[0030] Figure 1A schematic diagram of a system 100 for implementing a method for rendering a target object in an image, according to an embodiment of the present disclosure, is shown. Figure 1 As shown, system 100 includes: one or more computing devices 110 ( Figure 1 (Only a computing device is shown as an example only.) Server 130. Server 130 can interact with computing device 110 via network 140.
[0031] Regarding server 130, it is used, for example, to provide background services for applications (such as, but not limited to, mobile games) running on computing device 110. Functions include, for example, login, payment, maintaining client connections on computing device 110, and forwarding messages.
[0032] Regarding the computing device 110, which is, for example but not limited to, a mobile device such as a mobile phone, one or more applications (e.g., games) can run on the computing device 110. The computing device 110 may have one or more processing units. The computing device 110 can, for example, render a target object in an image. Specifically, the computing device 110 can generate a bounding box for surrounding the target object in the current frame image; generate one or more sampling surfaces within the bounding box to obtain the coordinate information of the sampling surfaces; and perform step sampling of the test point for each pixel in the image region within the bounding box with a predetermined step size. The computing device 110 can also adjust at least one of the maximum and minimum position information of the bounding box in a predetermined direction based on the obtained coordinate information of the sampling surfaces, and determine the intersection point of the ray tracing direction and the sampling surfaces based at least on the position information of the adjusted bounding box, so as to render the target object in the current frame image with the intersection point as the starting point for step sampling. In some embodiments, the computing device 110 includes, for example, a bounding box generation unit 112, a sampling surface generation unit 114, a bounding box adjustment unit 116, and a target object rendering unit 118.
[0033] Regarding the bounding box generation unit 112, it is used to generate a bounding box for surrounding the target object in the current frame image.
[0034] Regarding the sampling surface generation unit 114, it is used to generate one or more sampling surfaces within the bounding box in order to obtain the coordinate information of the sampling surfaces.
[0035] Regarding the bounding box adjustment unit 116, it is used to adjust at least one of the maximum position information and minimum position information of the bounding box in a predetermined direction based on the coordinate information of the acquired sampling surface.
[0036] Regarding the target object rendering unit 118, it is used to determine the intersection point of the ray tracing direction and the sampling surface based at least on the position information of the adjusted bounding box, so as to render the target object in the current frame image with the intersection point as the starting point for step sampling.
[0037] Figure 2 A flowchart of a method 200 for rendering a target object in an image according to an embodiment of the present disclosure is shown. Figure 3 A schematic diagram of a method for rendering a target object in an image according to an embodiment of the present disclosure is shown. Method 200 may be performed by, for example... Figure 1 The computing device 110 shown can be used for execution, and can also be used in Figure 7 The method is performed at the illustrated electronic device 700. It should be understood that method 200 may also include additional boxes not shown and / or the boxes shown may be omitted, and the scope of this disclosure is not limited in this respect.
[0038] In step 202, computing device 110 generates a bounding box for surrounding the target object in the current frame image.
[0039] For example, Figure 3 The diagram schematically illustrates the bounding box 320 of the target object 310 (e.g., but not limited to, a sea of clouds from a top-down view or clouds from a bottom-up view). This bounding box 320 is, for example, an OBB (Oriented bounding box) type. By employing an OBB bounding box, this disclosure can more closely approximate the target object.
[0040] Regarding the target object 310, it is, for example, a real-time volumetric cloud. The target object is, for example, a three-dimensional volumetric cloud constructed based on one or more three-dimensional noise texture maps and density-height functions. Regarding the three-dimensional noise texture map, it includes, for example, at least one or more of the following: a low-frequency perlin-worly noise map and a high-frequency Worley noise map. Perlin noise is suitable for producing the hazy and fluffy shape of stratus clouds, but it cannot describe the smoothness and motion of volumetric clouds. Worley noise has better fractal smoothness characteristics. Low-frequency perlin-worly noise has a more realistic effect, closely resembling natural clouds.
[0041] Regarding the density height function, it is used to offset or scale the noise signal. Specifically, for example, computing device 110 constructs the basic shape of a volumetric cloud based on a three-dimensional noise texture map; then, it generates a density height function based on weather texture and cloud type attribute information; subsequently, it generates a volumetric cloud as the target object based on the basic shape of the volumetric cloud and the density height function.
[0042] It should be understood that other existing methods can also be used to construct the target object, such as volumetric clouds.
[0043] Regarding the bounding box 320, it is the optimal bounding space of the discrete point set of the target object 310. For example... Figure 3 As shown, the bounding box 320 is, for example, the smallest cuboid that contains the target object 310 and is arbitrary in direction relative to the coordinate axes. Bounding box determination algorithms also include, for example, axis-aligned bounding boxes (AABB), bounding spheres, and fixed-direction convex hulls (FDH), etc.
[0044] Regarding the current frame image, which is, for example but not limited to, one frame in a multi-frame image of a game running on a mobile terminal, the target object 310 in the multi-frame image is represented as a volumetric cloud that changes in real time.
[0045] In step 204, the computing device 110 generates one or more sampling surfaces within the bounding box in order to obtain the coordinate information of the sampling surfaces.
[0046] The method for generating sampling surfaces includes, for example, the following steps: a computing device 110 samples noise data for each pixel in an image region within a bounding box, the target object being a real-time volumetric cloud; determines whether the density of the sampled pixels is greater than a predetermined density threshold; in response to determining that the density of the sampled pixels is greater than the predetermined density threshold, determines the sampled pixels as sampling points of the target object; based on the coordinate information of the sampling points of the target object, determines the maximum and / or minimum coordinate information of the sampling points of the target object in a predetermined direction; and based on the maximum and / or minimum coordinate information in the predetermined direction, generates one or more sampling surfaces located inside the bounding box.
[0047] For example, such as Figure 3 As shown, the target object is a sea of clouds from a top-down perspective. If the computing device 110 determines that the density of the sampled pixels within the bounding box 320 is greater than a predetermined density threshold (the predetermined density threshold is, for example, "0", or may be any other value other than "0"), then the sampled pixels are determined to be sampling points of a volumetric cloud; if the density of the sampled pixels is determined to be less than or equal to the predetermined density threshold, then the sampled pixels are determined to be sampling points of a non-volumetric cloud. Then, the computing device 110 compares the coordinate information of all sampling points determined to be volumetric clouds in order to determine the highest position (e.g., the position indicated by marker 312) and / or the lowest position of the volumetric cloud sampling points in a predetermined direction (e.g., the height direction representing the Z-axis); then, the computing device 110 generates a sampling surface 330 based on the coordinate information of the highest position (e.g., the position indicated by marker 312). Figure 3A cross-sectional view of the bounding box 320, the target object 310, and the sampling surface 330 is schematically shown. It should be understood that in some embodiments, the computing device 110 may also generate another sampling surface based on the coordinate information of the lowest position of the volumetric cloud.
[0048] In step 206, the computing device 110 adjusts at least one of the maximum and minimum position information of the bounding box in a predetermined direction based on the coordinate information of the acquired sampling surface.
[0049] For example, such as Figure 3 As shown, the target object is a sea of clouds from a top-down perspective. The computing device 110 generates a sampling surface 330 based on the coordinate information of the highest position, i.e., the position indicated by marker 312. The computing device 110 adjusts the highest position information of the bounding box 320 based on the coordinate information of the position indicated by marker 312.
[0050] In step 208, the computing device 110 determines the intersection of the ray tracing direction and the sampling surface, based at least on the adjusted bounding box position information, so as to render the target object in the current frame image with the intersection as the starting point for step sampling.
[0051] For example, computing device 110 identifies the intersection point 354 of the ray tracing direction (e.g., the direction exemplified by marker 340) with the sampling surface so that the intersection point 354 is used as the starting point for step sampling.
[0052] Regarding the method for stopping the step sampling of test points, it includes, for example, the computing device 110 using the intersection of the ray tracing direction and the sampling surface as the starting point of the step sampling, determining the number of step samplings and the step sampling distance corresponding to the current step sampling; determining whether the current step sampling meets a predetermined step sampling termination condition; and if the computing device 110 determines that the current step sampling meets the predetermined step sampling termination condition, stopping the step sampling of the test point. The predetermined step sampling termination condition includes at least one of the following: the number of step samplings corresponding to the current step sampling is greater than or equal to a predetermined step sampling number threshold; the step sampling distance corresponding to the current step sampling is greater than or equal to a predetermined step sampling distance threshold; or the current step sampling of the test point reaches outside the adjusted bounding box.
[0053] The method for rendering a target object in the current frame image with the intersection point as the starting point of the step sampling includes, for example, the computing device 110 confirming whether the current step sampling location is located at or beyond the sampling surface; and if the computing device 110 confirms that the current step sampling location is located at or beyond the sampling surface, rendering the target object in the current frame image based on the acquisition data of the current step sampling and the acquisition data of each step sampling on the ray tracing path from the intersection point to the current test point of the current step sampling.
[0054] For example, computing device 110 causes the test point to be sampled in steps along the direction of ray tracing (e.g., the direction exemplified by marker 340) with a predetermined step size, starting from intersection 354.
[0055] The following describes the method for rendering the target object in the current frame image, using formulas (1) to (3).
[0056]
[0057]
[0058]
[0059] In formula (1) above, SL(x) represents the intensity of the scattered light. P(g,θ) i The '(g,θ)' represents the proportional distribution of light intensity scattered in all directions when scattering occurs at the step sampling point of the test. 'V(i,x)' represents whether light intensity can be received at the step sampling point. 'L(i,x)' represents the light intensity of the light source at the step sampling point. 'lights' represents all light sources. 'P(g,θ)' represents the light intensity of the light source at the step sampling point. i V(i,x)L(i,x) represents the light intensity of the current light source after scattering at the step sampling point towards the camera. T(a,x) represents the attenuation ratio of light propagating from a to x in the air. This attenuation ratio follows Beer's Law. The attenuation ratio T(a,x) has an exponential relationship with the propagation distance of the light. T(a,b) represents the attenuation ratio of light propagating from a to b in the air. δ scat (x) and δ abs (x) represents two attenuation coefficients, where δ scat (x) represents the scattering coefficient at x at the step sampling point.
[0060] In addition, L i (b)T(a,b) represents the direct light intensity at the current step sampling point b, which is equal to the original light intensity L at the current step sampling point b in the ray tracing direction. i (b) Multiply by the corresponding attenuation ratio T(a,b). represents the scattered incident light intensity at the current step sampling point b, which is equal to the integral of the scattered light intensities at each step sampling point along the ray tracing path from a to b. b represents the current step sampling point. a represents the intersection of the ray tracing direction and the sampling surface, i.e., the starting point of the step sampling. x represents a step sampling point along the ray tracing path from a to b.
[0061] The direct visual light intensity at the current step sampling point b (e.g., the step sampling point indicated by mark 356) is associated, for example, with noise data of the image acquired at the current step sampling point b (e.g., with noise data of the image acquired at the step sampling point indicated by mark 356).
[0062] The intensity of the scattered incident light at the current step sampling point b is, for example, associated with the integral (or accumulated value) of the noise data of the image acquired at each step sampling along the ray tracing path from the intersection of the ray tracing direction and the sampling surface to the current step sampling point b. For example, the intensity of the scattered incident light at the current step sampling point b is associated with the accumulated value of the noise data of the image acquired at each step sampling along the ray tracing path from the step sampling point indicated by intersection 354 to the step sampling point indicated by mark 356.
[0063] In this scheme, one or more sampling surfaces are generated within the bounding box that encloses the target object in the current frame image, and the maximum and / or minimum position information of the bounding box in a predetermined direction is adjusted based on the coordinate information of the acquired sampling surfaces. This disclosure allows the sampling surfaces and / or the adjusted bounding boxes to be closer to the target object. Furthermore, by determining the intersection point of the ray tracing direction and the sampling surfaces based at least on the position information of the adjusted bounding boxes, and using this intersection point as the starting point for step sampling of the test point to render the target object in the current frame image, this disclosure allows the test point to be step sampled along the ray tracing direction starting from the intersection point of the ray tracing direction and the sampling surface (which is closer to the target object). This significantly reduces the number of step samplings at the test point, making it more likely to sample the complete target object (e.g., including distant target objects) within a limited number of step samplings. Therefore, this disclosure enables real-time rendering of target objects on computing devices with limited computing power, and the acquisition of data from distant target objects within a limited number of step samplings. Moreover, this disclosure can significantly improve the visible distance of the target object.
[0064] In some embodiments, method 200 further includes: computing device 110 determining whether current step sampling based on a predetermined step size has been completed; if it is determined that current step sampling based on a predetermined step size has been completed, increasing the predetermined step size at predetermined intervals; and performing the next step sampling based on the increased predetermined step size. By employing the above means, this disclosure allows the step size of the next step sampling to be greater than the step size of the current step sampling, thereby enabling higher sampling accuracy for nearby target objects and lower sampling accuracy for distant target objects. Consequently, this disclosure can further reduce the computational load required for rendering real-time target objects without affecting the rendering visual effect.
[0065] In some embodiments, method 200 further includes: computing device 110 determining whether a tangent plane exists in the rendered target object; and if it is determined that a tangent plane exists in the rendered target object, adjusting the position of the sampling plane. By employing the above methods, this disclosure enables further optimization of the sampling plane position, better balancing the rendering effect of the real-time target object with the required computational load.
[0066] Figure 4 A flowchart illustrating a method 400 for rendering a target object across multiple frames of images according to an embodiment of the present disclosure is shown. Method 400 may be performed by, for example... Figure 1 The computing device 110 shown can be used for execution, and can also be used in Figure 7 The method is performed at the illustrated electronic device 700. It should be understood that method 400 may also include additional boxes not shown and / or the boxes shown may be omitted, and the scope of this disclosure is not limited in this respect.
[0067] In step 402, computing device 110 creates a first array. For example, computing device 110 creates a first array `positions` to record position information.
[0068] In step 404, the computing device 110 samples the density of multiple sampling points within the target object range for the current frame image in the multi-frame images, all of which include the target object.
[0069] For example, computing device 110 samples the density of multiple sampling points (e.g., each sampling point within a volumetric cloud, i.e., 512*512*512 pixels) within the target object range in the current frame image 502 of a multi-frame image (e.g., consecutive or intermittent animation image frames in a mobile game). The method for sampling each sampling point within the volumetric cloud range includes, for example, sampling the volumetric cloud density based on predetermined parameters and a texture. In the current frame image 502, the bounding box of the target object range is indicated, for example, by reference numeral 514.
[0070] In step 406, the computing device 110 compares the density of each of the plurality of sampling points with a predetermined density threshold, so as to write the position information of the sampling points that are greater than the predetermined density threshold into a first array. For example, if the computing device 110 determines that the cloud density of a sampling point is greater than the set predetermined density threshold, then the position information of that sampling point is written into the first array positions.
[0071] In step 408, the computing device 110 compares the position information of the sampling points written in the first array to determine the maximum and minimum position information in a predetermined direction.
[0072] For example, computing device 110 counts all written position information in the first array `positions`, and finds the maximum and minimum position information. Figure 5 As shown, for the current frame image 502, the maximum position information (e.g., the position information indicated by marker 504) and the minimum point position information (e.g., the position information indicated by marker 506) in the Z-axis direction, the maximum position information (e.g., the position information indicated by marker 510) and the minimum point position information (e.g., the position information indicated by marker 508) in the X-axis direction, and the maximum position information and the minimum point position information in the Y-axis direction are found.
[0073] In step 410, the computing device 110 determines the sampling container corresponding to the current frame image based on the maximum and minimum position information, and each sampling container includes multiple sampling surfaces. For example, the computing device 110 determines the first sampling container 512 corresponding to the current frame image 502 based on the maximum and minimum position information in the X, Y, and Z axis directions. Figure 5 As shown, the first sampling container 512 of the current frame image 502 is closer to the target object than the bounding box 514 of the target object in the previous frame image 502.
[0074] In step 412, computing device 110 creates a second array. For example, computing device 110 creates a second array aabbs to store the determined sampling containers.
[0075] In step 414, computing device 110 determines a plurality of sampling containers corresponding to the multiple frames of images respectively. For example, computing device 110 determines a second sampling container 524 corresponding to the second frame image 522 based on a method similar to steps 406 to 410, and so on, computing device 110 determines the Nth sampling container 534 corresponding to the Nth frame image 532.
[0076] In step 416, the computing device 110 determines the sampling container with the largest coverage area based on the coordinate information of the sampling containers, so as to write the coordinate information of the sampling container with the largest coverage area into the second array. For example, the computing device 110 compares the coverage areas of the first sampling container 512, the second sampling container 524 to the Nth sampling container 534. For example, after comparison, it is determined that the first sampling container 512 has the largest coverage area, so the first sampling container 512 is written into the second array aabbs.
[0077] In step 418, the computing device 110 uses the sampling container with the largest determined coverage area for rendering the target objects in the multi-frame images. For example, the computing device 110 uses the first sampling container 512 as a shared sampling container for the target objects in the current frame image 502 to the Nth frame image 532, so as to use it for rendering the target objects in the current frame image 502 to the Nth frame image 532.
[0078] By adopting the above scheme, this disclosure can determine a common optimal sampling container for multiple frames of images, and thus can quickly render real-time target objects in multiple frames of images running on mobile devices.
[0079] In some embodiments, method 200 further includes method 600 for determining a predetermined step size. Figure 6 A flowchart of a method 600 for determining a predetermined step size according to an embodiment of the present disclosure is shown. Method 600 may be derived from, for example... Figure 1 The computing device 110 shown can be used for execution, and can also be used in Figure 7 The method is performed at the illustrated electronic device 700. It should be understood that method 600 may also include additional boxes not shown and / or the boxes shown may be omitted, and the scope of this disclosure is not limited in this respect.
[0080] In step 602, the computing device 110 determines whether the density collected by the test points in a predetermined number of consecutive step samplings is less than or equal to a predetermined density threshold. If the computing device 110 determines that the density of the sampling points in a predetermined number of consecutive step samplings is not less than or equal to the predetermined density threshold, it proceeds to step 608.
[0081] In step 604, if the computing device 110 determines that the density of test points in a predetermined number of consecutive step samplings is less than or equal to a predetermined density threshold, step sampling is performed with a first set value as the step size.
[0082] In step 606, the computing device 110 determines whether the density collected at the current test point, which is sampled in steps with a first set value, is greater than a predetermined density threshold. If the computing device 110 determines that the density of the sampling point based on the first set value step is less than or equal to the predetermined density threshold, it proceeds to step 604.
[0083] In step 608, if the computing device 110 determines that the density collected at the current test point with a step size of a first set value is greater than a predetermined density threshold, then the sampling is performed with a step size of a second set value, where the second set value is less than the first set value.
[0084] By employing the above methods, this disclosure can perform light step sampling with a larger step size in image regions without target objects (e.g., volumetric clouds), and perform light step sampling with a smaller step size in image regions where the density of target objects (e.g., volumetric clouds) is detected. This disclosure can further reduce unnecessary light step sampling times, thereby improving rendering speed and saving computing power. Moreover, it can simultaneously take into account the sampling accuracy of target objects (e.g., volumetric clouds) and ensure rendering effects.
[0085] Figure 7A schematic block diagram of an example electronic device 700 that can be used to implement embodiments of the present disclosure is shown. For example, such as Figure 1 The computing device 110 shown can be implemented by an electronic device 700. As shown, the electronic device 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to computer program instructions stored in read-only memory (ROM) 702 or loaded from storage unit 708 into random access memory (RAM) 703. The random access memory 703 may also store various programs and data required for the operation of the electronic device 700. The CPU 701, ROM 702, and RAM 703 are interconnected via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0086] Multiple components in electronic device 700 are connected to input / output interface 705, including: input unit 706, such as keyboard, mouse, microphone, etc.; output unit 707, such as various types of monitors, speakers, etc.; storage unit 708, such as disk, optical disk, etc.; and communication unit 709, such as network card, modem, wireless transceiver, etc. Communication unit 709 allows device 700 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0087] The various processes and procedures described above, such as methods 200, 400, and 600, can be executed by the central processing unit 701. For example, in some embodiments, methods 200 and 500 can be implemented as computer software programs tangibly contained in a machine-readable medium, such as storage unit 708. In some embodiments, part or all of the computer program can be loaded and / or installed on device 700 via read-only memory 702 and / or communication unit 709. When the computer program is loaded into random access memory 703 and executed by the central processing unit 701, one or more actions of methods 200, 400, and 600 described above can be performed.
[0088] This disclosure relates to methods, apparatus, systems, electronic devices, computer-readable storage media, and / or computer program products. A computer program product may include computer-readable program instructions for performing various aspects of this disclosure.
[0089] Computer-readable storage media can be tangible devices capable of holding and storing instructions for use by an instruction execution device. Computer-readable storage media can be, for example—but not limited to—electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination thereof. The computer-readable storage media used herein are not to be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.
[0090] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge computing devices. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to computer-readable storage media within the respective computing / processing device.
[0091] Computer program instructions used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing the status information of the computer-readable program instructions to implement various aspects of this disclosure.
[0092] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.
[0093] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processing unit of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0094] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.
[0095] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction, which contains one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0096] The various embodiments of this disclosure have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or technical improvements to the embodiments in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. A method for rendering a target object in an image, comprising: Generate a bounding box to surround the target object in the current frame image; Generating one or more sampling surfaces within a bounding box to obtain coordinate information of the sampling surfaces includes: sampling noise data for each pixel in an image region within the bounding box, wherein the target object is a real-time volumetric cloud; determining whether the density of the sampled pixels is greater than a predetermined density threshold; in response to determining that the density of the sampled pixels is greater than the predetermined density threshold, determining that the sampled pixels are sampling points of the target object; determining the maximum and / or minimum coordinate information of the sampling points of the target object in a predetermined direction based on the coordinate information of the sampling points of the target object; and generating one or more sampling surfaces located inside the bounding box based on the maximum and / or minimum coordinate information in the predetermined direction. Based on the acquired coordinate information of the sampling surface, adjust at least one of the maximum and minimum position information of the bounding box in a predetermined direction; and Based at least on the position information of the adjusted bounding box, the intersection of the ray tracing direction and the sampling surface is determined so that the intersection can be used as the starting point for step sampling to render the target object in the current frame image.
2. The method according to claim 1, further comprising: Determine whether the current step sampling based on the predetermined step size has been completed; In response to determining that the current step sampling based on a predetermined step size has been completed, the predetermined step size is increased at predetermined intervals; as well as The next step sampling is performed based on the increased predetermined step size.
3. The method according to claim 1, further comprising: Determine if the rendered target object has a tangent plane; as well as In response to the determination that a tangent plane exists on the rendered target object, the position of the sampling plane is adjusted.
4. The method of claim 1, wherein rendering the target object in the current frame image using the intersection point as the starting point for step sampling comprises: Confirm whether the current step sampling position is located at or beyond the sampling surface; as well as In response to confirming that the current step sample location is located at or beyond the sampling surface, the target object in the current frame image is rendered based on the acquisition data of the current step sample and the acquisition data of each step sample on the ray tracing path from the intersection point to the current step sample.
5. The method according to claim 1, further comprising: Create the first array; For the current frame image in a multi-frame image, the density of multiple sampling points within the target object range is sampled, and the multi-frame image includes the target object; The density of each of the multiple sampling points is compared with a predetermined density threshold so that the location information of the sampling points that are greater than the predetermined density threshold are written into the first array; The position information of the sampling points written in the first array is compared in order to determine the maximum and minimum position information in the predetermined direction; as well as Based on the maximum and minimum position information, the sampling container corresponding to the current frame image is determined, and each sampling container includes multiple sampling surfaces.
6. The method according to claim 5, further comprising: Create a second array; Determine the multiple sampling containers corresponding to the multiple frames of images; Based on the coordinate information of the sampling container, the sampling container with the largest coverage area is determined so that the coordinate information of the sampling container with the largest coverage area is written into the second array; as well as The sampling container with the largest determined coverage area is used for rendering the target object of the multi-frame image.
7. The method according to claim 5, wherein the target object is: a sea of clouds from a top-down perspective, clouds from a bottom-up perspective, and the multi-frame images are images running in a game on a mobile terminal.
8. The method according to claim 1, further comprising: Determine whether the density collected at the test points for a predetermined number of consecutive step samplings is less than or equal to a predetermined density threshold. In response to the fact that the density of test points for a predetermined number of consecutive step samplings is less than or equal to a predetermined density threshold, step sampling is performed with a first set value as the step size; Determine whether the density collected at the current test point, with the first set value as the step size, is greater than a predetermined density threshold; and In response to determining that the density collected at the current test point, which is sampled with the first set value as the step size, is greater than a predetermined density threshold, sampling is performed with the second set value as the step size, wherein the second set value is less than the first set value.
9. The method according to claim 1, further comprising: The intersection of the ray tracing direction and the sampling surface is used as the starting point for step sampling, and the number of step samplings and the step sampling distance corresponding to the current step sampling are determined. Determine whether the current step sampling meets the predetermined step sampling termination condition, which includes at least one of the following: The number of steps corresponding to the current step sampling is greater than or equal to the predetermined step sampling number threshold; The current step sampling distance is greater than or equal to the predetermined step sampling distance threshold; The current step sampling of the test point reaches outside the adjusted bounding box; and In response to determining that the current step sampling meets the predetermined step sampling termination condition, the step sampling of the test point is stopped.
10. A computing device, comprising: At least one processor; as well as A memory that is communicatively connected to the at least one processor; The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-9.
11. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to perform the method of any one of claims 1-9.
Citation Information
Patent Citations
Light tracking optimization method facing 3D scenes
CN108090947A
Scene rendering method and device, electronic equipment and storage medium
CN113674389A