Cloud layer rendering method and electronic device
By dynamically adjusting the light step size using a pyramid structure and Perlin/Worley noise map, the problem of high computational resource consumption and insufficient realism in cloud image rendering in existing technologies is solved, achieving realistic cloud images and animations.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-13
- Publication Date
- 2026-04-10
AI Technical Summary
Existing technologies consume significant computational resources when rendering cloud images, and the resulting cloud images are not realistic enough, especially in terms of cloud thickness, shape, and lighting variations.
By employing a pyramid-structured cloud noise map and dynamically adjusting the light step size, combined with Perlin and Worley noise maps, a continuous and three-dimensional cloud image is generated. By adjusting the light step size and pixel value processing, computational resource consumption is reduced and the realism of light and shadow is improved.
It generates realistic cloud images while reducing computational resource consumption during the rendering process, thus improving the realism of cloud animation effects.
Smart Images

Figure CN120411331B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, and particularly relates to a cloud layer rendering method and an electronic device. BACKGROUND
[0002] At present, there are some scenes of displaying cloud layer images or displaying cloud layer dynamic effects by using cloud layer images in weather application programs (APPs) and game APPs provided by electronic devices. The cloud layer dynamic effect refers to a dynamic change process of a cloud layer. The prior art proposes a method of rendering a cloud layer image by using a Raymarch algorithm.
[0003] However, although the prior art can render a relatively realistic cloud layer image by using the Raymarch algorithm, a large amount of real-time calculation is required in the rendering process, which leads to a large consumption of computing resources in the electronic device. SUMMARY
[0004] The embodiments of the present application provide a cloud layer rendering method and an electronic device, which can generate a relatively realistic cloud layer image and reduce the consumption of computing resources in the rendering process of the cloud layer image.
[0005] To achieve the above object, the embodiments of the present application adopt the following technical solutions:
[0006] In a first aspect, a cloud layer rendering method is provided, which comprises the following steps: first, receiving and responding to a rendering operation, and obtaining a first cloud layer noise image; second, establishing a first pyramid structure corresponding to the first cloud layer noise image, the first pyramid structure comprising a plurality of second cloud layer noise images, and the pixel point sizes of the plurality of second cloud layer noise images being different; third, controlling a first light ray step, and in the process of the first light ray step, adjusting a step length of the first light ray based on the first pyramid structure, and processing an initial pixel value of a first pixel point in the first cloud layer noise image to obtain a target pixel value of the first pixel point; and fourth, generating a first cloud layer image based on the target pixel values of a plurality of first pixel points in the first cloud layer noise image.
[0007] In the method, the first light ray is directed from the first pixel point to a first preset light source position.
[0008] It can be understood that the first pyramid structure includes a plurality of second cloud layer noise maps with different pixel point sizes, and the electronic device can dynamically adjust the step length of the first light based on the plurality of different pixel point sizes included in the first pyramid structure. For example, the electronic device can reduce the step length when the first light steps in a thicker cloud layer simulated by the first cloud layer noise map, and the electronic device can increase the step length when the first light steps in a sparser cloud layer simulated by the first cloud layer noise map. When the electronic device controls the first light to step according to the reduced step length, the influence of the cloud layer passed through during the process of the preset light source irradiating the first pixel point on the light and shadow on the first pixel point can be more comprehensively considered. Thus, a more accurate target pixel value of the first pixel point can be obtained, and the more accurate target pixel value of the first pixel point can represent a more realistic light and shadow on the first pixel point. The plurality of more accurate target pixel values of the first pixel point can more accurately simulate the light and shadow changes of cloud layers with different thicknesses. Therefore, the cloud layer image obtained by using the plurality of more accurate target pixel values of the first pixel point is also more realistic.
[0009] Secondly, when the electronic device controls the first light to step according to the increased step length, the stepping speed of the first light can be increased, so that the calculation amount in the stepping process of the first light can be reduced, and the consumption of computing resources in the rendering process of the cloud layer image can be reduced. As can be seen from the above, by using the present solution, a more realistic cloud layer image can be generated, and the consumption of computing resources in the rendering process of the cloud layer image can be reduced.
[0010] In combination with the first aspect, in a possible implementation manner, the above control of the first light to step and, in the process of the first light stepping, the adjustment of the step length of the first light based on the first pyramid structure, and the processing of the initial pixel value of the first pixel in the first cloud layer noise map to obtain the target pixel value of the first pixel include: determining an initial step length corresponding to the first light based on the first pyramid structure; determining that the first light steps to a first stepping point according to the initial step length; adjusting the initial step length based on the first pyramid structure and the first stepping point to obtain an adjusted step length, and updating the initial pixel value of the first pixel to obtain an updated pixel value; determining that the first light steps to a second stepping point according to the adjusted step length, and continuing to adjust the adjusted step length and update the updated pixel value; and until the first light steps end, determining that the target pixel value of the first pixel is the updated pixel value.
[0011] This embodiment describes an implementation manner of the electronic device adjusting the step length and updating the pixel value in the process of the first light stepping.
[0012] With reference to the first aspect, in a possible implementation form of the first aspect, the adjusting the initial step length based on the first pyramid structure and the first step point, and updating the initial pixel value of the first pixel point to obtain the updated pixel value comprises: in a case that the first step point is occluded to the first light, reducing the initial step length based on the first pyramid structure to obtain the adjusted step length, and attenuating the initial pixel value of the first pixel point to obtain the updated pixel value; in a case that the first step point is not occluded to the first light, enlarging the initial step length based on the first pyramid structure to obtain the adjusted step length, and determining the updated pixel value as the initial pixel value of the first pixel point.
[0013] It can be understood that, in a case that the first step point is occluded to the first light, it indicates that the cloud layer at the first step point in the first cloud layer noise map is thicker, and the electronic device can reduce the initial step length. The electronic device controls the first light to step at the reduced step length, so as to further determine whether there is thicker cloud layer around the first step point to occlude the first light. In this way, the influence of the cloud layer passed in the process in which the preset light source irradiates to the first pixel point on the light and shadow on the first pixel point can be more comprehensively considered, and the electronic device attenuates the pixel value (for example, the initial pixel value of the first pixel point) when the cloud layer at each step point (for example, the first step point) occludes the first light, so that a more accurate target pixel value of the first pixel point can be obtained, and the more accurate target pixel value of the first pixel point can represent a more real light and shadow on the first pixel point. A plurality of more accurate target pixel values of the first pixel point can more accurately simulate the light and shadow change of cloud layers with different thicknesses, and therefore, the cloud layer image obtained by using the plurality of more accurate target pixel values of the first pixel point is more real.
[0014] Secondly, in a case that the first step point is not occluded to the first light, it indicates that the cloud layer at the first step point in the first cloud layer noise map is thinner, and the electronic device can enlarge the initial step length to step at the enlarged step length, so as to improve the step speed of the first light. Therefore, the calculation amount of the first light step process can be reduced, and the consumption of the calculation resource in the rendering process of the cloud layer image can be reduced.
[0015] With reference to the first aspect, in a possible implementation form of the first aspect, the plurality of second cloud layer noise maps in the first pyramid structure are located at different levels, and the higher the level of the second cloud layer noise map in the plurality of second cloud layer noise maps, the smaller or larger the resolution of the second cloud layer noise map; the initial step length is equal to the size of a pixel point in the second cloud layer noise map at an initial level, and the second cloud layer noise map at the initial level is the second cloud layer noise map with the largest resolution in the plurality of second cloud layer noise maps.
[0016] The step length is adjusted based on the first pyramid structure, and the adjusting includes: determining an updated level based on the initial level, wherein the updated level is adjacent to the initial level, and a resolution of a second cloud layer noise image at the updated level is greater than a resolution of the second cloud layer noise image at the initial level; and determining that the adjusted step length is equal to a size of a pixel in the second cloud layer noise image at the updated level.
[0017] It can be understood that the resolution of the second cloud layer noise image at the updated level becomes larger, and the size of the pixel in the second cloud layer noise image at the updated level becomes smaller. The electronic device determines that the adjusted step length is equal to the size of the pixel in the second cloud layer noise image at the updated level, and thus the adjusted step length becomes smaller. Further, the electronic device controls the first light to step according to the adjusted step length, that is, the step length of the first light is reduced. Reducing the step length of the first light can more comprehensively consider the influence of the cloud layer passed by the preset light source on the light and shadow on the first pixel point in the process of the preset light source irradiating to the first pixel point. Thus, a more accurate target pixel value of the first pixel point can be obtained.
[0018] It should be noted that if the electronic device determines that there is no other second cloud layer noise image with a resolution greater than the resolution of the second cloud layer noise image at the initial level in the first pyramid structure, it can be determined that the updated level is still the initial level.
[0019] With reference to the first aspect, in another possible implementation, the step length is adjusted based on the first pyramid structure, and the adjusting includes: determining an updated level based on the initial level, wherein the updated level is adjacent to the initial level, and a resolution of a second cloud layer noise image at the updated level is less than a resolution of the second cloud layer noise image at the initial level; and determining that the adjusted step length is equal to a size of a pixel in the second cloud layer noise image at the updated level.
[0020] It can be understood that the resolution of the second cloud layer noise image at the updated level becomes smaller, and the size of the pixel in the second cloud layer noise image at the updated level becomes larger. The electronic device determines that the adjusted step length is equal to the size of the pixel in the second cloud layer noise image at the updated level, and thus the adjusted step length becomes larger. Further, the electronic device controls the first light to step according to the adjusted step length, that is, the step length of the first light is increased. Increasing the step length of the first light can increase the step speed of the first light, and thus the calculation amount in the step process of the first light can be reduced, and the consumption of the calculation resource in the rendering process of the cloud layer image can be reduced.
[0021] With reference to the first aspect, in a possible implementation form of the first aspect, the method further includes: determining whether a pixel value of the first step point is greater than the initial pixel value of the first pixel point, wherein the pixel value of the first step point being greater than the initial pixel value of the first pixel point indicates that the first step point blocks the first light ray, and the pixel value of the first step point being less than or equal to the initial pixel value of the first pixel point indicates that the first step point does not block the first light ray.
[0022] This embodiment describes one implementation form of how the electronic device determines whether the first step point blocks the first light ray.
[0023] With reference to the first aspect, in a possible implementation form of the first aspect, the method further includes: in a case where the first pixel point satisfies a preset sampling condition, controlling the first light ray step based on the first pyramid structure, and processing the initial pixel value of the first pixel point in the process of the first light ray step to obtain a target pixel value of the first pixel point, wherein the preset sampling condition includes that the initial pixel value of the first pixel point is out of a preset value range, and the preset value range includes a pixel value corresponding to black.
[0024] It can be understood that, in a case where the initial pixel value of the first pixel point is out of the pixel value corresponding to black, the first pixel point is a pixel point in the cloud layer simulated by the first cloud noise map. Therefore, the electronic device can consider the influence of the cloud layer passed through by the preset light source in the process of irradiating to the first pixel point on the light and shadow on the first pixel point, process the initial pixel value of the first pixel point, to obtain a more accurate target pixel value of the first pixel point, and the more accurate target pixel value of the first pixel point can represent a more real light and shadow on the first pixel point.
[0025] With reference to the first aspect, in a possible implementation form of the first aspect, the method further includes: in a case where the first light ray steps to an i th step point and a pixel value of the i th step point belongs to a preset value range, determining that the step of the first light ray ends, wherein the pixel value of the i th step point belonging to the preset value range indicates that the first light ray penetrates out of the cloud layer, the preset value range includes a pixel value corresponding to black, and i is a positive integer greater than 1.
[0026] This embodiment describes one implementation form of how the electronic device determines that the step of the first light ray ends.
[0027] With reference to the first aspect, in a possible implementation form of the first aspect, the method further includes: seamlessly splicing a plurality of first noise maps to obtain the first cloud noise map, wherein the plurality of first noise maps include Perlin noise maps and Worley noise maps.
[0028] It can be understood that the Perlin noise map has continuity, and thus the electronic device can simulate the continuity of the cloud layer by using the Perlin noise map. The Worley noise map has a lattice feature, and thus the electronic device can simulate the stereoscopic effect of the cloud layer by using the Worley noise map. In summary, the first cloud layer noise map generated by the electronic device by using the Perlin noise map and the Worley noise map can simulate a continuous and stereoscopic cloud layer, that is, the first cloud layer noise map can simulate a cloud layer with a strong sense of reality.
[0029] With reference to the first aspect, in another possible implementation, the method further includes: offsetting the plurality of first noise maps in the first cloud layer noise map to obtain a third cloud layer noise map; establishing a second pyramid structure corresponding to the third cloud layer noise map; controlling a second ray marching based on the second pyramid structure, and processing an initial pixel value of a second pixel point in the third cloud layer noise map to obtain a target pixel value of the second pixel point in a process of the second ray marching, wherein the second ray is directed from the second pixel point to a second preset light source position; generating a second cloud layer image based on the target pixel values of the plurality of second pixel points in the third cloud layer noise map; and displaying the first cloud layer image and the second cloud layer image in sequence.
[0030] It can be understood that, since there are no gaps between the plurality of first noise maps in the first cloud layer noise map, the edges of the cloud layer simulated by the third cloud layer noise map obtained by offsetting the plurality of first noise maps are all smooth and gentle. Further, the cloud layer in the second cloud layer image generated by using the third cloud layer noise map does not have the problem of edge disconnection, and conforms to the shape of a real cloud layer. In addition, the electronic device offsets the plurality of first noise maps in the first cloud layer noise map to obtain the third cloud layer noise map, which reduces the workload of generating a new cloud layer noise map compared to re-splicing a plurality of new noise maps to obtain a new cloud layer noise map.
[0031] In addition, the first preset light source position and the second preset light source position can both be set according to possible positions of a preset light source, and the first preset light source position used by the first cloud layer noise map and the second preset light source position used by the third cloud layer noise map can be different. In this way, the plurality of cloud layer images (including the first cloud layer image and the second cloud layer image) obtained by the electronic device by performing cloud layer rendering on a plurality of different cloud layer noise maps (including the first cloud layer noise map and the third cloud layer noise map) can represent the light and shadow changes of the cloud layer under different positions of the preset light source, and playing the plurality of cloud layer images can reflect the dynamic change process (i.e., cloud layer dynamic effect) of a real cloud layer.
[0032] With reference to the first aspect, in a possible implementation form of the first aspect, the method further includes: obtaining a mask image, the mask image comprising a pattern of a preset shape. The first cloud layer noise image is obtained based on the preset shape, and the first cloud layer noise image is used to simulate a cloud layer of the preset shape, and the first cloud layer image comprises a cloud layer of the preset shape.
[0033] It can be understood that the electronic device can further obtain a mask image comprising a pattern of a preset shape, and then obtain a first cloud layer noise image used to simulate a cloud layer of the preset shape based on the preset shape. Thus, the cloud layer image obtained by using the first cloud layer noise image can comprise a cloud layer of the preset shape.
[0034] In a second aspect, an electronic device is provided, which comprises a processor, a memory and a communication interface. The memory and the communication interface are coupled to the processor. The memory is configured to store computer program code, and the computer program code comprises computer instructions. When the processor executes the computer instructions, the electronic device performs the method according to any one of the first aspect.
[0035] In a third aspect, a computer readable storage medium is provided, which stores computer instructions. When the computer instructions are run on an electronic device, the electronic device performs the method according to any one of the first aspect.
[0036] In a fourth aspect, a computer program product is provided, which comprises computer instructions. When the computer instructions are run on an electronic device, the electronic device performs the method according to any one of the first aspect.
[0037] In a fifth aspect, an apparatus (for example, the apparatus can be a chip system) is provided, which comprises a processor configured to support an electronic device to implement the cloud layer rendering method according to the first aspect. In a possible design, the apparatus further comprises a memory configured to store program instructions and data necessary for the electronic device. When the apparatus is a chip system, the apparatus can be composed of a chip or can comprise a chip and other discrete devices.
[0038] The technical effects brought by any one of the second aspect to the fifth aspect can refer to the technical effects brought by different design forms of the first aspect, and will not be described herein. BRIEF DESCRIPTION OF DRAWINGS
[0039] Figure 1 (a) to (b) in FIG. 1 are schematic diagrams of a cloud layer dynamic effect provided by the prior art using a photographed cloud layer image;
[0040] Figure 2 FIG. 2 is a structural schematic diagram of an electronic device provided by an embodiment of the present application;
[0041] Figure 3 A system architecture schematic diagram of an electronic device provided by an embodiment of the present application;
[0042] Figure 4 A flowchart of a cloud layer rendering method provided by an embodiment of the present application Figure 1 ;
[0043] Figure 5 An interface schematic diagram of an electronic device displaying a cloud layer dynamic effect provided by an embodiment of the present application;
[0044] Figure 6 Schematic diagrams of a Perlin noise map provided by an embodiment of the present application;
[0045] Figure 7 Schematic diagrams of a Worley noise map provided by an embodiment of the present application;
[0046] Figure 8 A schematic diagram of a first cloud layer noise map provided by an embodiment of the present application;
[0047] Figure 8 A schematic diagram of a first pyramid structure corresponding to the first cloud layer noise map provided by an embodiment of the present application;
[0048] Figure 9 A grid schematic diagram of a plurality of second cloud layer noise maps provided by an embodiment of the present application;
[0049] Figure 10 A step-by-step process schematic diagram of a first light ray provided by an embodiment of the present application;
[0050] Figure 10 A change schematic diagram of a cloud layer thickness provided by an embodiment of the present application;
[0051] Figure 11 Schematic diagrams of a plurality of cloud layer images provided by an embodiment of the present application;
[0052] Figure 12 A schematic diagram of a possible position of the sun provided by an embodiment of the present application;
[0053] Figure 13 A flowchart of a cloud layer rendering method provided by an embodiment of the present application Figure 1 ;
[0054] Figure 14 Schematic diagrams of rendering a cloud layer in a preset shape provided by an embodiment of the present application;
[0055] Figure 15 A flowchart of a cloud layer rendering method provided for an embodiment of the present application Figure 3 ;
[0056] Figure 16 A structural diagram of a chip system provided for an embodiment of the present application. DETAILED DESCRIPTION
[0057] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present application.
[0058] The terms "first", "second" are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined with "first", "second" can explicitly or implicitly include one or more of the features. In the description of the present application, unless otherwise specified, the meaning of "a plurality of" is two or more.
[0059] At present, the prior art proposes that an electronic device can render and generate a plurality of different cloud layer images by using a Raymarch algorithm. The process of rendering and generating a cloud layer image by the electronic device using the Raymarch algorithm can include: emitting a light ray from a camera to each pixel on a screen, gradually stepping along the direction of the light ray at a certain step size, and calculating the density of the cloud layer; at each step point, accumulating the transparency and color, calculating the absorption and scattering effect of the light ray when traveling inside the cloud layer, and simulating the attenuation of the light ray when passing through the cloud layer; when passing out of the cloud layer or reaching the maximum number of steps, terminating the stepping, and mixing the cloud layer color with the background color to obtain the final pixel color; and generating a cloud layer image by using the pixel colors of a plurality of pixels. Further, the electronic device plays the plurality of cloud layer images to realize the display of cloud layer dynamic effects.
[0060] In existing technologies, electronic devices can use a fixed step size or dynamically determine the step size based on signed distance fields (SDFs). If the fixed step size is set too large, the number of attenuation events as light passes through the clouds decreases, resulting in inaccurate final pixel colors. If the fixed step size is set too small, the stepping speed is too slow; furthermore, if the stepping stops before reaching the maximum number of steps, the light may not have yet exited the clouds, leading to inaccurate final pixel colors. Alternatively, if the stepping stops when the light exits the clouds, the total number of steps is too large, resulting in excessive computation. Therefore, existing electronic devices using a fixed step size suffer from either inaccurate final pixel colors or excessive computation. Inaccurate final pixel colors further lead to unrealistic cloud lighting in cloud images containing multiple pixel colors, resulting in unrealistic cloud images. Multiple unrealistic cloud images also result in unrealistic cloud animation effects.
[0061] Secondly, while existing technologies can solve the problem of inaccurate final pixel colors by dynamically determining the step size based on SDFs, the process of dynamically determining the step size based on SDFs is complex and computationally intensive, resulting in significant consumption of computing resources.
[0062] In addition, existing technologies have proposed using captured cloud images to display cloud animation effects on electronic devices. However, the cloud animation effects displayed using captured cloud images only change in position; the thickness, shape, and lighting of the clouds remain unchanged, making the cloud animation effects unrealistic.
[0063] For example, refer to Figure 1 Images (a) and (b) in the diagrams are schematic representations of a method for displaying cloud motion effects using captured cloud images, provided by existing technology. Figure 1 As shown in (a) and (b), the position of the clouds in the two cloud images changes, but the thickness, shape, and lighting of the clouds remain unchanged. When the electronic device plays these two cloud images continuously, it can only show that the clouds are moving, but the thickness, shape, and lighting of the clouds do not change. This is different from the actual changes in the clouds. Therefore, it can be concluded that the cloud motion effect shown by playing these two cloud images continuously is not realistic.
[0064] To address the aforementioned issues, this application provides a cloud rendering method. After acquiring a first cloud noise map, the electronic device establishes a first pyramid structure corresponding to the first cloud noise map. Since the pixel sizes of the multiple second cloud noise maps included in the first pyramid structure are different, the electronic device can dynamically adjust the step size of the first ray based on these different pixel sizes. For example, when the first ray steps through a thicker cloud layer simulated by the first cloud noise map, the electronic device can reduce the step size; when it steps through a sparser cloud layer simulated by the first cloud noise map, the electronic device can increase the step size. By controlling the first ray to step according to the reduced step size, the electronic device can more comprehensively consider the influence of the clouds traversed by the preset light source on the light and shadow on the first pixel. This results in a more accurate target pixel value for the first pixel, which can represent a more realistic light and shadow on the first pixel. Multiple more accurate target pixel values for the first pixel can more accurately simulate the light and shadow changes of clouds of different thicknesses; therefore, the cloud image obtained using multiple more accurate target pixel values for the first pixel is more realistic.
[0065] Secondly, by controlling the first ray to move according to the amplified step size, the electronic device can increase the stepping speed of the first ray, thereby reducing the computational load during the stepping process and thus lowering the computational resource consumption of the cloud image rendering process. In summary, this solution can generate more realistic cloud images while reducing the computational resource consumption of the cloud image rendering process.
[0066] This application provides a cloud rendering method that can be applied to electronic devices, such as tablet computers, personal computers (PCs), laptops, mobile phones, in-vehicle devices, or wearable devices (e.g., smart bracelets). This application does not limit the specific type of electronic device.
[0067] Take mobile phones as an example of electronic devices. Figure 2 A schematic diagram of the structure of the electronic device provided in this application is shown.
[0068] like Figure 2As shown, the mobile phone can include a processor 210, an external memory interface 220, an internal memory 221, a universal serial bus (USB) interface 230, a charging management module 240, a power management module 241, a battery 242, an antenna 1, an antenna 2, a mobile communication module 250, a wireless communication module 260, an audio module 270, a speaker 270A, a receiver 270B, a microphone 270C, a headset interface 270D, a sensor module 280, a key 290, a motor 291, an indicator 292, a camera [1-N] 293, a display screen [1-N] 294, and a subscriber identification module (SIM) card interface 295, etc. The sensor module 280 can include a pressure sensor, a gyroscope sensor, a barometric pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc.
[0069] The processor 210 can be configured to perform various functions or steps of the mobile phone in the above method embodiments.
[0070] The display screen 240 is configured to display an interface, etc. The display screen 240 includes a display panel. The display panel can be a liquid crystal display (LCD), a light-emitting diode (LED), an organic light-emitting diode (OLED), etc.
[0071] In the embodiments of the present application, the display screen 240 can be referred to as a touch screen if the display screen 240 integrates a touch sensor. The touch sensor can also be referred to as a "touch panel". That is, the display screen 240 can include a display panel and a touch panel. The touch sensor 231 is configured to detect a touch operation acting on or near the touch sensor 231. After the touch sensor detects the touch operation (e.g., the user operation described above), the kernel layer of the mobile phone can be triggered to drive periodically scan the touch parameters generated by the touch operation. Then, the kernel layer of the mobile phone can pass the touch parameters to the relevant modules of the upper layer, so that the relevant modules can determine the touch event corresponding to the touch parameters. In the embodiments of the present application, the display screen 240 is taken as an example of a display screen (i.e., a touch screen) integrated with a touch sensor, and the method provided by the present application is described.
[0072] It is understood that the structure illustrated in this embodiment does not constitute a specific limitation on the mobile phone. In other embodiments, the mobile phone may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0073] The software system of the aforementioned mobile phone can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment uses a layered architecture. Taking a system as an example, the structure of a mobile phone's software system is illustrated. A layered architecture divides the software into several layers, each with a clear role and function. Layers communicate with each other through interfaces. In some embodiments, such as... Figure 3 As shown, The system is divided into four layers, from top to bottom: the application layer, the application framework layer (or framework layer), the Android runtime and system libraries, and the kernel layer. The layers communicate with each other through software interfaces.
[0074] The application layer can include a series of apps. These apps can be divided into system apps pre-installed on the phone and third-party apps downloaded by the user. For example, ... Figure 3 As shown, system apps can include weather apps, etc.
[0075] The framework layer provides the application programming interface (API) and programming framework for the application layer (APP). The application framework layer includes some predefined functions. For example, ... Figure 3 As shown, the framework layer can include a view system, a package manager, a content provider, a resource manager, an input system, etc.
[0076] The view system is used to build the display interface of the APP. The activity manager is used to manage the life cycle of each APP. The APP usually runs in the form of activity in the operating system. The activity manager can schedule the activity process of the APP to manage the life cycle of each APP. The content provider is used to store and obtain data, and make the data accessible to the APP. The data can include videos, images, audios, dialed and received calls, browsing history and bookmarks, phonebook, etc. The resource manager provides various resources for the APP, such as localized strings, icons, pictures, layout files, video files, etc. The input system is used to listen to the input module (such as the touch screen driver) of the mobile phone, and convert the parameters input by the input module into usable events and deliver them to the relevant modules (such as the upper-layer APP) of the upper layer.
[0077] The Android runtime includes a core library and a virtual machine. The Android runtime is responsible for the scheduling and management of the Android system. The core library contains two parts: one part is the function function that the java language needs to call, and the other part is the core library of Android.
[0078] The application layer and the framework layer run in the virtual machine. The virtual machine executes the java files of the application layer and the framework layer into binary files. The virtual machine is used to perform the management of the object life cycle, the stack management, the thread management, the security and exception management, and the garbage collection, etc.
[0079] The system library can include multiple functional modules. For example, as shown in Figure 3 The surface manager is used to manage the display subsystem, and provides the fusion of the two-dimensional (2D) layer and the three-dimensional (3D) layer for multiple APPs. The media library supports multiple commonly used audio, video format playback and recording, and static image files, etc.
[0080] The kernel layer is the layer between hardware and software. The kernel layer at least includes a touch screen driver, a display driver, a graphics processor driver, a sensor driver, etc., and the embodiments of the present application do not make any limitation thereto.
[0081] In the embodiments of the present application, the system library can also include a graphics engine. The graphics engine can be used for drawing, for example, rendering 2D graphics or 3D graphics. For example, when any one of the weather APP and the game APP needs to display a cloud image, the graphics engine can be called to render and generate the cloud image. After any one of the APPs receives the cloud image returned by the graphics engine, the cloud image can be displayed on the display screen 240 through the display driver.
[0082] Based on the hardware architecture and the software architecture, the cloud layer rendering method provided by the embodiments of the present application is introduced below taking a mobile phone as an example.
[0083] Referring to Figure 4 Fig. 1 is a flowchart of a cloud layer rendering method provided by an embodiment of the present application. As shown in Figure 4 the specific process can include S401-S413.
[0084] S401, the mobile phone receives and responds to a rendering operation to obtain a first cloud layer noise map.
[0085] The mobile phone can obtain the first cloud layer noise map in response to the rendering operation, and the first cloud layer noise map can be used to generate a cloud layer image. Optionally, the first cloud layer noise map can be referred to as a first texture.
[0086] In some embodiments, the rendering operation can be used to trigger a cloud layer image, or the rendering operation can be used to trigger a cloud layer dynamic effect. If the rendering operation is used to trigger a cloud layer image, the mobile phone can generate a cloud layer image based on the first cloud layer noise map in response to the rendering operation; wherein the process of generating a cloud layer image based on the first cloud layer noise map by the mobile phone can include S403-S412. If the rendering operation is used to trigger a cloud layer dynamic effect, the mobile phone can generate multiple cloud layer images based on the first cloud layer noise map in response to the rendering operation, and the cloud layer dynamic effect can be displayed by playing the multiple cloud layer images; wherein the process of generating multiple cloud layer images based on the first cloud layer noise map by the mobile phone can include S402-S412.
[0087] Exemplarily, as shown in (a) of Figure 5 , the mobile phone displays a desktop interface 510, and the desktop interface 510 includes an icon 511 of a weather APP. Then, the mobile phone can receive a user's click operation on the icon 511 of the weather APP. The click operation on the icon 511 of the weather APP belongs to the rendering operation and is used to trigger a cloud layer dynamic effect. The mobile phone can execute S402-S413 to obtain multiple cloud layer images in response to the click operation on the icon 511 of the weather APP; and then play the multiple cloud layer images in a main interface 520 of the weather APP to display the cloud layer dynamic effect in the main interface 520.
[0088] In some embodiments, the electronic device can seamlessly splice multiple first noise maps to obtain the first cloud layer noise map. Optionally, the multiple first noise maps can include multiple Perlin noise maps and multiple Worley noise maps. The parameters of the multiple Perlin noise maps can be different, and the parameters of the multiple Worley noise maps can also be different.
[0089] For example, multiple Perlin noise maps may include a Perlin noise map at a first frequency and a Perlin noise map at a second frequency. The first frequency is greater than the second frequency. Optionally, the Perlin noise map at the first frequency may be referred to as a high-frequency Perlin noise map, and the Perlin noise map at the second frequency may be referred to as a low-frequency Perlin noise map.
[0090] For example, multiple Worley noise maps include a Worley noise map at a third frequency and a Perlin noise map at a fourth frequency. The third frequency is greater than the fourth frequency. Optionally, the Worley noise map at the third frequency can be referred to as a high-frequency Worley noise map, and the Worley noise map at the fourth frequency can be referred to as a low-frequency Worley noise map.
[0091] It is understandable that, such as Figure 6 As shown in (a), the Perlin noise map is continuous, therefore a mobile phone can use the Perlin noise map to simulate the continuity of clouds. Figure 7 As shown in (a), the Worley noise map has lattice characteristics, therefore, the mobile phone can use the Worley noise map to simulate the three-dimensionality of clouds. In summary, the first cloud noise map generated by the mobile phone using the Perlin noise map and the Worley noise map can simulate continuous, three-dimensional clouds; that is, the first cloud noise map can simulate clouds with a relatively high degree of realism. The first cloud noise map can also simulate clouds of different thicknesses and shapes. Optionally, the cloud noise map (including the first cloud noise map and the second cloud noise map) can also be called a cloud thickness map.
[0092] Secondly, compared to Figure 6 The low-frequency Perlin noise plot shown in (b) is shown in the figure. Figure 6 The high-frequency Perlin noise map shown in (a) indicates denser clouds. For example, as... Figure 6 As shown in (c), the mobile phone seamlessly stitches together the same high-frequency Perlin noise maps to obtain a stitched high-frequency Perlin noise map; as... Figure 6 As shown in (d), the mobile phone seamlessly stitches together the same low-frequency Perlin noise map to obtain a stitched low-frequency Perlin noise map. It can be seen that the stitched high-frequency Perlin noise map is denser than the stitched low-frequency Perlin noise map.
[0093] Similarly, compared to Figure 7 The low-frequency Worley noise plot shown in (b) is shown in the image. Figure 7 The high-frequency Worley noise map shown in (a) indicates denser clouds. For example, as...Figure 7 As shown in (c) of FIG. 13, the mobile phone seamlessly splices the same high-frequency Worley noise map to obtain a spliced high-frequency Worley noise map. As shown in (d) of FIG. 13, the mobile phone seamlessly splices the same low-frequency Worley noise map to obtain a spliced low-frequency Worley noise map. It can be seen that the spliced high-frequency Worley noise map is denser than the spliced low-frequency Worley noise map. Figure 7
[0094] In summary, the mobile phone can generate the first cloud layer noise map by using the Perlin noise maps of different frequencies and the Worley noise maps of different frequencies, and the first cloud layer noise map can represent cloud layers of different densities. The cloud layer image including cloud layers of different densities can be generated by using the first cloud layer noise map.
[0095] It should be noted that, Figure 6 (c) and (d) of FIG. 13 are illustrative of seamless splicing by taking a Perlin noise map as an example, and Figure 7 (c) and (d) of FIG. 13 are also illustrative of seamless splicing by taking a Worley noise map as an example, and both are not used to limit the actual seamless splicing process. The electronic device seamlessly splices multiple different Perlin noise maps and multiple different Worley noise maps in the actual cloud layer rendering process.
[0096] Optionally, the multiple first noise maps can include a first other noise map having continuity and a second other noise map having a lattice feature. The first other noise map is different from the Perlin noise map, and the second other noise map is different from the Worley noise map.
[0097] In some embodiments, the size of the first cloud layer noise map can be a preset size or determined based on the size of a target display area. The target display area is used to display the cloud layer image. For example, taking the size of the first cloud layer noise map as an example which is determined based on the size of the target display area, the mobile phone can further acquire the size of the target display area in response to the rendering operation. Then, the mobile phone can seamlessly splice the multiple first noise maps based on the size of the target display area to obtain the first cloud layer noise map, and the size ratio of the first cloud layer noise map can be equal to the size ratio of the target display area.
[0098] In some embodiments, since the densities of cloud layers of different weathers are different, and the densities of cloud layers of different time periods are also different. Therefore, the mobile phone can further acquire a preset weather and a preset time period, and then acquire the first cloud layer noise map corresponding to the preset weather and the preset time period. The first cloud layer noise map corresponding to the preset weather and the preset time period can represent the density of the real cloud layer under the preset weather and the preset time period.
[0099] The mobile phone obtaining the first cloud layer noise map corresponding to the preset weather and the preset time period can include: the mobile phone first obtaining a plurality of Perlin noise maps and a plurality of Worley noise maps according to the preset weather and the preset time period; and then seamlessly splicing the plurality of Perlin noise maps and the plurality of Worley noise maps to obtain the first cloud layer noise map.
[0100] Exemplarily, as shown in (a) of FIG. 8, the mobile phone obtains the first cloud layer noise map 810, the first cloud layer noise map 810 simulates different density of cloud layers, and there is no gap between a plurality of first noise maps in the first cloud layer noise map 810. Figure 8
[0101] S402, the mobile phone establishes a first pyramid structure corresponding to the first cloud layer noise map.
[0102] The mobile phone can obtain a first pyramid structure including a plurality of levels based on the first cloud layer noise map. The first pyramid structure can include a plurality of second cloud layer noise maps at different levels, and the resolution of the second cloud layer noise map at a higher level in the first pyramid structure is smaller or larger.
[0103] It should be noted that in the following embodiments, the resolution of the second cloud layer noise map at a higher level in the first pyramid structure is smaller as an example.
[0104] In some embodiments, the mobile phone can generate a plurality of second cloud layer noise maps based on the first cloud layer noise map. Then, the plurality of second cloud layer noise maps are used to form the first pyramid structure. The resolution of each two adjacent second cloud layer noise maps at different levels can be equal to a first multiple. For example, taking the first multiple equal to 2 as an example, the resolution of the second cloud layer noise map at the first level is 2 times the resolution of the second cloud layer noise map at the second level, the resolution of the second cloud layer noise map at the second level is 2 times the resolution of the second cloud layer noise map at the third level, and so on.
[0105] Optionally, the pixel value of each pixel point at the jth level can be equal to the minimum value of the pixel values of a plurality of associated pixel points at the (j-1)th level, wherein the plurality of associated pixel points at the (j-1)th level correspond to each pixel point at the jth level, and j is a positive integer greater than 1. Each pixel point at the jth level is a pixel point in the second cloud layer noise map at the jth level. The plurality of associated pixel points at the (j-1)th level are pixel points in the second cloud layer noise map at the (j-1)th level.
[0106] Optionally, the resolution of the second cloud layer noise map of the first layer can be equal to the resolution of the first cloud layer noise map, or the resolution of the second cloud layer noise map of the first layer can be smaller than the resolution of the first cloud layer noise map. Wherein, if the resolution of the second cloud layer noise map of the first layer is equal to the resolution of the first cloud layer noise map, the second cloud layer noise map of the first layer is the first cloud layer noise map.
[0107] Exemplarily, as shown in (b) of FIG. 8, the mobile phone can obtain a first pyramid structure 820 corresponding to the first cloud layer noise map 810. The first pyramid structure 820 includes: a second cloud layer noise map 821 of a first layer, a second cloud layer noise map 822 of a second layer, a second cloud layer noise map 823 of a third layer, and a second cloud layer noise map 824 of a fourth layer. The higher the level in the first pyramid structure 820, the smaller the resolution of the second cloud layer noise map. Figure 8 For example, taking the first multiple equal to 2 as an example, the resolution of the second cloud layer noise map 821 of the first layer can be 512*512, the resolution of the second cloud layer noise map 822 of the second layer can be 256*256, the resolution of the second cloud layer noise map 823 of the third layer can be 128*128, and the resolution of the second cloud layer noise map 824 of the fourth layer can be 64*64.
[0108] It can be understood that if the resolution of the second cloud layer noise map of the higher level in the plurality of second cloud layer noise maps is smaller, the size of the pixel point in the second cloud layer noise map of the higher level is smaller. The multiple between the size of the pixel point in every two adjacent second cloud layer noise maps can be equal to the second multiple.
[0109] For example, as shown in the grid diagram of the plurality of second cloud layer noise maps in FIG. 9, the resolution of the second cloud layer noise map of the first layer in the plurality of second cloud layer noise maps can be 8*8, the resolution of the second cloud layer noise map of the second layer can be 4*4, and the resolution of the second cloud layer noise map of the third layer can be 2*2. The size of one pixel point in the second cloud layer noise map of the second layer is equal to the size of 4 pixel points in the second cloud layer noise map of the first layer, and the size of one pixel point in the second cloud layer noise map of the third layer is equal to the size of 16 pixel points in the second cloud layer noise map of the first layer. Secondly, the pixel value of one pixel point in the second cloud layer noise map of the second layer can be equal to the minimum value of the pixel values of 4 pixel points in the second cloud layer noise map of the first layer, and the pixel value of one pixel point in the second cloud layer noise map of the third layer is equal to the minimum value of the pixel values of 4 pixel points in the second cloud layer noise map of the second layer.
[0110] Figure 9 It needs to be noted that the resolution of the plurality of second cloud layer noise maps actually used by the mobile phone can all be greater than the resolution of the first cloud layer noise map.
[0111] It needs to be noted that the resolution of the plurality of second cloud layer noise maps actually used by the mobile phone can all be greater than the resolution of the first cloud layer noise map. Figure 9 Resolution of the second cloud layer noise map shown.
[0112] In the embodiment of the present application, the pixel value of a pixel point in the cloud layer noise map can refer to the color value of each pixel point, which can be represented by a color model (for example, an RGBA model). The RGBA model includes the numerical value of the red (R) channel, the numerical value of the green (G) channel, the numerical value of the blue (B) channel, and the numerical value of the alpha (A) channel.
[0113] S403, the mobile phone determines a first sampling point meeting a preset sampling condition from the first cloud layer noise map.
[0114] Optionally, the pixel point in the first cloud layer noise map can be referred to as a first pixel point. The mobile phone can determine whether each first pixel point in the first cloud layer noise map meets the preset sampling condition. If the first pixel point meets the preset sampling condition, the first pixel point can be determined as the first sampling point. If the first pixel point does not meet the preset sampling condition, the first pixel point can be determined as not the first sampling point. Further, the mobile phone can determine a plurality of first sampling points, and perform S404-S410 for each first sampling point to determine the target pixel value of each first sampling point.
[0115] The preset sampling condition can include that the initial pixel value of the first pixel point is out of a preset numerical range. The preset numerical range can include the pixel value corresponding to black. The initial pixel value of the first pixel point can refer to the pixel value of the first pixel point in the first cloud layer noise map.
[0116] It can be understood that the pixel points in the cloud layer represented by the first cloud layer noise map all meet the preset sampling condition, that is, the pixel points in the cloud layer represented by the first cloud layer noise map are all first sampling points.
[0117] It should be noted that the following embodiments take one first sampling point as an example to introduce the process of determining the target pixel value of each first sampling point by the mobile phone.
[0118] S404, the mobile phone determines an initial step length corresponding to a first light ray based on the first pyramid structure, wherein the first light ray is directed from the first sampling point to a first preset light source position.
[0119] The mobile phone can control the stepping of the first ray based on the first pyramid structure, and process the initial pixel value of the first pixel during the stepping process to obtain the target pixel value of the first pixel. Specifically, controlling the stepping of the first ray based on the first pyramid structure can include: firstly determining the initial step size corresponding to the first ray based on the first pyramid structure, so that the first ray initially steps according to the initial step size; then adjusting the initial step size so that the first ray continues to step according to the adjusted step size, until the stepping of the first ray ends. Optionally, the step size can be referred to as the stepping distance.
[0120] In some embodiments, the initial step size can be equal to the size of a pixel in the second cloud noise map at the initial level, where the second cloud noise map at the initial level is the one with the highest resolution among the multiple second cloud noise maps. If the resolution of the second cloud noise map decreases with higher levels in the first pyramid structure, then the second cloud noise map at the initial level can refer to the second cloud noise map of the first layer, for example, the second cloud noise map 821 of the first layer.
[0121] Optionally, if the second cloud noise map at the initial level has the highest resolution among multiple second cloud noise maps, the phone can set the resolution of the second cloud noise map at the initial level to be lower than a preset resolution, thus making the resolution of the second cloud noise map at the initial level smaller. A smaller resolution in the second cloud noise map at the initial level results in a larger pixel size and a larger initial step size. The first ray starting its step with a larger initial step size can reduce the number of steps required for the first ray to penetrate the cloud.
[0122] In some embodiments, the first preset light source position may be set according to the possible locations where the preset light source may appear; wherein, the preset light source may be the sun.
[0123] For example, with Figure 10 Using the cloud image shown in (a) as an example, the stepping process of the first ray will be explained. Figure 10 As shown in (a), if a pixel 1001 in the cloud image meets the preset sampling conditions, the mobile phone can determine that pixel 1001 is the first sampling point. Then, the mobile phone can determine the first ray corresponding to the first sampling point, the first ray pointing from pixel 1001 to a first preset light source position 1010. The first preset light source position 1010 is a possible location where the sun may appear.
[0124] It should be noted that during the cloud rendering process, the first ray steps on the first cloud noise map. Figure 10(a) is only used to illustrate the stepping process of the first light ray, and cannot represent the actual stepping process of the first light ray on the first cloud layer noise map in the actual execution. Secondly, the pixel point shown in (a) cannot represent the actual first sampling point. Figure 10 (a) cannot represent the actual first sampling point.
[0125] S405, the mobile phone determines that the first light ray steps to a first stepping point according to an initial step length.
[0126] After the direction of the first light ray (i.e., from the first sampling point to the first preset light source position) is determined, the mobile phone determines that the first light ray steps to a first stepping point according to an initial step length from the first sampling point. Then, the mobile phone can adjust the step length at the first stepping point to continue stepping according to the adjusted step length, and can also update the initial pixel value of the first sampling point at the first stepping point. The first stepping point is a pixel point in the first cloud layer noise map.
[0127] S406, the mobile phone judges whether the first stepping point blocks the first light ray.
[0128] After the mobile phone determines the first stepping point, the pixel value of the first stepping point can be obtained. The pixel value of the first stepping point refers to the pixel value of the first stepping point in the first cloud layer noise map. The mobile phone can judge whether the first stepping point blocks the first light ray based on the pixel value of the first stepping point. If the first stepping point blocks the first light ray, the mobile phone can perform S407-S408 to realize step length reduction and pixel value attenuation. If the first stepping point does not block the first light ray, the mobile phone can perform S410 to realize step length enlargement and pixel value keeping unchanged.
[0129] In some embodiments, the mobile phone can judge whether the pixel value of the first stepping point is greater than the initial pixel value of the first sampling point. Wherein, the pixel value of the first stepping point being greater than the initial pixel value of the first sampling point indicates that the first stepping point blocks the first light ray. The pixel value of the first stepping point being less than or equal to the initial pixel value of the first sampling point indicates that the first stepping point does not block the first light ray. For example, taking the first sampling point as Figure 10 For example, taking the pixel point 1001 shown in (a) as an example, the mobile phone can judge whether the pixel value of the first stepping point 1002 is greater than the initial pixel value of the first sampling point.
[0130] S407, the mobile phone reduces the initial step length based on the first pyramid structure to obtain an adjusted step length.
[0131] If the phone blocks the first light source at the first step point, it indicates that the cloud layer at that point in the first cloud noise map is relatively thick. Therefore, the phone can reduce the initial step size. The phone then controls the first light source to move according to the reduced step size, thereby further determining whether there are still thick clouds blocking the first light source near the first step point. For example, with... Figure 10 The cloud image shown in (a) illustrates the different thicknesses of clouds. Figure 10 As shown in (b) of the image, the cloud thickness varies along the same horizontal line in the cloud image. Therefore, it can be concluded that the cloud thickness represented by the multiple step points reached by the first ray in the first cloud noise map can also be different. Furthermore, whether the multiple step points reached by the first ray block the first ray also varies.
[0132] In some embodiments, the mobile phone can determine an updated layer based on an initial layer, wherein the updated layer is adjacent to the initial layer, and the resolution of the second cloud noise map at the updated layer is greater than the resolution of the second cloud noise map at the initial layer. Then, the mobile phone can determine that the adjusted step size is equal to the size of a pixel in the second cloud noise map at the updated layer. Wherein, as the resolution of the second cloud noise map at the updated layer increases, the size of a pixel in the second cloud noise map at the updated layer decreases, and the adjusted step size also decreases.
[0133] It should be noted that if the phone determines that there is no other second cloud noise map in the first pyramid structure with a resolution greater than that of the second cloud noise map located at the initial level, then it can determine whether the updated level is still the initial level.
[0134] For example, the second cloud noise map located at the initial level could be Figure 8 If the mobile phone can determine that there is no other second cloud noise map in the first pyramid structure with a resolution greater than that of the second cloud noise map of the first layer, then the mobile phone can determine that the updated layer is still the first layer.
[0135] S408: The mobile phone attenuates the initial pixel value of the first sampling point to obtain the updated pixel value.
[0136] The first sampling point is the first pixel in the first cloud noise map that meets the preset sampling conditions. Therefore, the initial pixel value of the first sampling point is the pixel value of the first sampling point in the first cloud noise map. Since the first sampling point blocks the first light, the phone needs to attenuate the initial pixel value of the first sampling point to obtain the updated pixel value.
[0137] Further, after obtaining the adjusted step length and the updated pixel value, the mobile phone can continue to perform S405-S409 based on the adjusted step length and the updated pixel value until the step of the first light ray ends. For example, the process of the mobile phone performing S405-S409 based on the adjusted step length and the updated pixel value is introduced by taking the second step point as an example. The mobile phone first determines that the first light ray steps to the second step point according to the adjusted step length. Then, it is determined whether the second step point is occluded to the first light ray. If the second step point is occluded to the first light ray, the adjusted step length is reduced based on the first pyramid structure to obtain an adjusted step length, and the updated pixel value of the first sampling point is also attenuated to obtain an updated pixel value. If the second step point is not occluded to the first light ray, the adjusted step length is enlarged based on the first pyramid structure to obtain an adjusted step length, and it is determined that the updated pixel value remains unchanged.
[0138] In some embodiments, the mobile phone can attenuate the initial pixel value of the first sampling point by a preset ratio to obtain an updated pixel value. For example, the preset ratio can be 10%, or 20%, etc. Taking the preset ratio of 10% as an example, the mobile phone can attenuate the initial pixel value of the first sampling point by 10% to obtain an updated pixel value, and the updated pixel value is 90% of the initial pixel value of the first sampling point.
[0139] S409, the mobile phone enlarges the initial step length based on the first pyramid structure to obtain an adjusted step length, and determines that the updated pixel value is the initial pixel value of the first sampling point.
[0140] In the case that the first step point is not occluded to the first light ray, it means that the cloud layer at the first step point in the first cloud noise map is thin. Therefore, the mobile phone can enlarge the initial step length. The mobile phone controls the first light ray to step according to the enlarged step length, so that the first light ray can further step to a position far away from the first step point to determine whether the position far away from the first step point is occluded to the first light ray. In the case that the first step point is not occluded to the first light ray, the mobile phone can also determine that the updated pixel value is the initial pixel value of the first sampling point, i.e., the initial pixel value of the first sampling point remains unchanged.
[0141] Further, after obtaining the adjusted step length and the updated pixel value, the mobile phone can continue to perform S405-S409 based on the adjusted step length and the updated pixel value until the step of the first light ray ends.
[0142] In some embodiments, the mobile phone can determine an updated level based on the initial level, wherein the updated level is adjacent to the initial level, and a resolution of the second cloud layer noise map at the updated level is smaller than a resolution of the second cloud layer noise map at the initial level. Then, the mobile phone can determine that the adjusted step length is equal to a size of one pixel point in the second cloud layer noise map at the updated level. Wherein, the resolution of the second cloud layer noise map at the updated level is smaller, the size of one pixel point in the second cloud layer noise map at the updated level is larger, and the adjusted step length is also larger.
[0143] For example, the second cloud layer noise map at the initial level can be the second cloud layer noise map 821 of the first layer shown in (b) of FIG. 8. Figure 8 The mobile phone can determine that the resolution of the second cloud layer noise map at the second layer in the first pyramid structure is greater than the resolution of the second cloud layer noise map at the first layer, i.e., determine that the updated level is the second layer, and the second cloud layer noise map at the updated level is the second cloud layer noise map 822 at the second layer.
[0144] For example, the first sampling point is the pixel point 1001 shown in (a) of FIG. 10. Figure 10 For example, the first sampling point is the pixel point 1001 shown in (a) of FIG. 10. Figure 10 As shown in (a) of FIG. 10, the mobile phone determines that the first light ray corresponding to the first sampling point (i.e., the pixel point 1001) steps to the first step point 1002 according to the initial step length. The mobile phone can reduce the initial step length to obtain the adjusted step length in the case that the first light ray is blocked at the first step point 1002, and then control the first light ray to step to the second step point 1003 according to the adjusted step length. Then, the first light ray steps to the third step point 1004 and the fourth step point 1005 in turn.
[0145] S410, the mobile phone determines that the target pixel value of the first sampling point is the updated pixel value when the first light ray penetrates out of the cloud layer.
[0146] The mobile phone can determine the target pixel value of the first sampling point when the first light ray steps to the i-th step point and the pixel value of the i-th step point belongs to a preset numerical range. Wherein, the pixel value of the i-th step point belonging to the preset numerical range can represent that the first light ray penetrates out of the cloud layer, and the preset numerical range includes the pixel value corresponding to black. i is a positive integer greater than 1.
[0147] In some embodiments, the mobile phone can determine that the first light ray steps to the i-th step point and the pixel value of the i-th step point belongs to a preset numerical range. Wherein, the pixel value of the i-th step point belonging to the preset numerical range can represent that the first light ray penetrates out of the cloud layer, and the preset numerical range includes the pixel value corresponding to black. i is a positive integer greater than 1.
[0148] Exemplarily, the first sampling point is Figure 10 Exemplarily, as shown in (a) of FIG. 10, the step-by-step process of the first light ray is described. After the first light ray steps to the fourth step point 1005, the updated step length and the updated pixel value can be obtained. Then, the first light ray steps to the fifth step point 1006 according to the updated step length. If the pixel value of the fifth step point 1006 belongs to the preset value range, the phone can determine that the step of the first light ray ends, or in other words, that the first light ray penetrates through the cloud layer. At this time, the phone can determine that the target pixel value of the first sampling point is the updated pixel value obtained after the first light ray steps to the fourth step point 1005.
[0149] It should be noted that, since the first light ray steps in the 2D first cloud noise map, the step-by-step process of the first light ray described in the above embodiment can be referred to as a step-by-step process using the 2D Raymarch algorithm. Compared with the first light ray stepping in the three-dimensional space, the calculation amount of the first light ray stepping in the 2D first cloud noise map is smaller, thereby reducing the consumption of computing resources in the rendering process of the cloud image.
[0150] S411, the phone generates a cloud image corresponding to the first cloud noise map based on the target pixel values of the plurality of first sampling points in the first cloud noise map.
[0151] The phone can determine the plurality of first sampling points from all the pixel points included in the first cloud noise map, and execute the above S404-S410 on each of the plurality of first sampling points to obtain the target pixel value of each of the plurality of first sampling points. After obtaining the target pixel values of the plurality of first sampling points, the phone can generate a cloud image corresponding to the first cloud noise map based on the target pixel values of the plurality of first sampling points in the first cloud noise map.
[0152] It should be noted that the cloud image corresponding to the first cloud noise map is equivalent to the first cloud image in the summary.
[0153] In some embodiments, the phone can update the initial pixel values of the plurality of first sampling points in the first cloud noise map using the target pixel values of the plurality of first sampling points, and can also update the initial pixel values of the pixel points other than the plurality of first sampling points in the first cloud noise map to the preset pixel value to obtain the cloud image corresponding to the first cloud noise map.
[0154] The preset pixel value can be a pixel value corresponding to a preset color, for example, a pixel value corresponding to blue.
[0155] Exemplarily, as shown in (a) of FIG. 11, the phone obtains the cloud image 1101 corresponding to the first cloud noise map. Figure 11 Exemplarily, as shown in (a) of FIG. 11, the phone obtains the cloud image 1101 corresponding to the first cloud noise map.
[0156] It should be noted that the background color outside the cloud layer in the cloud layer image 1101 can be blue, Figure 11 (a) in FIG. 11 is not shown.
[0157] It can be understood that the mobile phone dynamically updates the step length of the first light ray based on the first pyramid structure. When the first light ray is blocked at a step point, the step length can be reduced. Further judgment can be made on whether there is thicker cloud layer to block the first light ray near the step point according to the reduced step length. In this way, the influence of the cloud layer passed by the preset light source on the light and shadow on the first pixel point during the process of the preset light source irradiating the first sampling point can be more comprehensively considered. Therefore, a more accurate target pixel value of the first pixel point can be obtained. The more accurate target pixel value of the first pixel point can represent a more real light and shadow on the first pixel point. A plurality of more accurate target pixel values of the first pixel point can more accurately simulate the light and shadow changes of cloud layers of different thicknesses. Therefore, the cloud layer image obtained by using a plurality of more accurate target pixel values of the first pixel point is more real.
[0158] Secondly, the mobile phone dynamically updates the step length of the first light ray based on the first pyramid structure. When the first light ray is not blocked at a step point, the step length can be increased. The step-in speed of the first light ray can be improved according to the increased step length. Therefore, the calculation amount of the light ray step-in process can be reduced, and the calculation amount of generating the cloud layer image is also reduced.
[0159] In some embodiments, if the rendering operation is used to trigger the cloud layer image, the mobile phone can end the cloud layer rendering process after obtaining the cloud layer image corresponding to the first cloud layer noise image. If the rendering operation is used to trigger the cloud layer dynamic effect, the mobile phone can continue to perform S412-S413 to generate and sequentially display a plurality of cloud layer images. The mobile phone displays the cloud layer dynamic effect by sequentially displaying the plurality of cloud layer images.
[0160] It should be noted that the following embodiments are described by taking the rendering operation as an example to trigger the cloud layer dynamic effect.
[0161] S412, the mobile phone offsets a plurality of first noise images included in the first cloud layer noise image to obtain at least one offset cloud layer noise image.
[0162] The mobile phone needs to render a plurality of cloud layer noise images corresponding to a plurality of cloud layer noise images by using a plurality of cloud layer noise images, and then display the cloud layer dynamic effect by sequentially displaying a plurality of cloud layer images. After obtaining the first cloud layer noise image, the mobile phone can offset the plurality of first noise images in the first cloud layer noise image to generate a new cloud layer noise image (i.e., an offset cloud layer noise image) because there is no gap between the plurality of first noise images included in the first cloud layer noise image. The plurality of cloud layer noise images can include the first cloud layer noise image and the offset cloud layer noise image. Alternatively, the offset cloud layer noise image can be referred to as an offset texture.
[0163] It should be noted that the offset cloud noise map is equivalent to the third cloud noise map in the above summary.
[0164] In some embodiments, since the first cloud noise map is composed of a plurality of first noise maps, the mobile phone can offset the plurality of first noise maps in the first cloud noise map according to a preset direction and a preset offset number to obtain an offset cloud noise map. For example, the preset direction can be above, below, left or right. The preset offset number can be equal to any one positive number such as 1, 2 or 3, and the preset offset number refers to the number of noise maps, etc.
[0165] Exemplarily, taking the preset direction as left and the preset offset number as 2 as an example, the mobile phone can offset the plurality of first noise maps in the first cloud noise map as a whole to the left by two first noise maps to obtain an offset cloud noise map. Among them, the two leftmost first noise maps in the first cloud noise map are moved to the rightmost in the offset cloud noise map.
[0166] In some embodiments, the mobile phone offsets the first cloud noise map to obtain an offset cloud noise map, and can continue to offset the offset cloud noise map to generate a next offset cloud noise map. Thus, the mobile phone can obtain a plurality of different offset cloud noise maps.
[0167] It can be understood that since there is no gap between the plurality of first noise maps in the first cloud noise map, the edge of the cloud layer simulated by the offset cloud noise map obtained by the mobile phone offsetting the plurality of first noise maps is smooth. Further, the cloud layer in the cloud image generated by using the offset cloud noise map does not have the problem of edge disconnection, which conforms to the shape of the real cloud layer. Secondly, compared with re-splicing a plurality of new noise maps to obtain a new cloud noise map, the mobile phone offsets the plurality of first noise maps in the first cloud noise map to obtain an offset cloud noise map, which reduces the workload of generating a plurality of cloud noise maps.
[0168] In the embodiments of the present application, after the mobile phone obtains each offset cloud noise map, the mobile phone can execute a cloud rendering process on the offset cloud noise map to obtain a cloud image corresponding to the offset cloud noise map.
[0169] It should be noted that the mobile phone executes the cloud rendering process on the offset cloud noise map, which can refer to the cloud rendering process executed on the first cloud noise map described in S402-S411 above.
[0170] For example, the mobile phone performs cloud rendering on the offset cloud noise map, which can include: establishing a second pyramid structure corresponding to the offset cloud noise map; controlling a second light ray step based on the second pyramid structure, and processing an initial pixel value of a second pixel in the third cloud noise map to obtain a target pixel value of the second pixel in the process of the second light ray step, wherein the second light ray is from the second pixel to a second preset light source position; generating a cloud image corresponding to the offset cloud noise map based on the target pixel values of a plurality of second pixels in the offset cloud noise map.
[0171] It should be noted that the details of the second pyramid structure can refer to the above introduction of the first pyramid structure in S402; the details of controlling the second light ray step based on the second pyramid structure, and processing the initial pixel value of the second pixel in the third cloud noise map to obtain the target pixel value of the second pixel in the process of the second light ray step can refer to the above introduction of the first light ray step in S403-S410; the details of generating the cloud image corresponding to the offset cloud noise map based on the target pixel values of a plurality of second pixels in the offset cloud noise map can refer to the above introduction of generating the cloud image corresponding to the first cloud noise map based on the target pixel values of a plurality of first sampling points in S411, which will not be repeated here.
[0172] In some embodiments, the preset light source positions adopted by the mobile phone for a plurality of different cloud noise maps can be different, for example, the first preset light source position adopted by the first cloud noise map is different from the second preset light source position adopted by an offset cloud noise map, that is, the first preset light source position and the second preset light source position can be different positions where the preset light source can appear. In this way, a plurality of cloud images obtained by the mobile phone performing cloud rendering on a plurality of different cloud noise maps can represent the light and shadow changes of the cloud under different positions of the preset light source.
[0173] For example, the preset light source is the sun, as shown in Figure 12 The points on the curve 1201 can be positions where the sun can appear, so the first preset light source position and the second light source position can be two different points on the curve 1201.
[0174] For example, the preset light source is the sun, as shown in Figure 11As shown in (a) to (c), the mobile phone can obtain multiple cloud images with the sun in different positions. These multiple cloud images may include cloud image 1101 corresponding to a first cloud noise map, cloud image 1102 corresponding to an offset cloud noise map, and cloud image 1103 corresponding to another offset cloud noise map. It can be seen that the sun is in different positions in the multiple cloud images, therefore, the light and shadow of the clouds in the multiple cloud images are different. By playing these multiple cloud images, the mobile phone can display the changes in the light and shadow of the clouds caused by the change in the sun's position.
[0175] It should be noted that cloud images 1101, 1102, and 1103 are in color. The background color outside the clouds in cloud image 1102 can be blue, and the background color outside the clouds in cloud image 1103 can also be blue. Figure 11 (a) through (c) are not shown.
[0176] S413. After the mobile phone generates multiple cloud images, it displays the multiple cloud images in sequence. The multiple cloud images include: the cloud image corresponding to the first cloud noise map, and the cloud image corresponding to the offset cloud noise map.
[0177] After the phone generates multiple cloud images, it can display them sequentially. The phone then loops through these cloud images within the target display area.
[0178] It should be noted that the cloud image corresponding to the offset cloud noise map is equivalent to the second cloud image in the invention.
[0179] For example, such as Figure 5 As shown in (b), the main interface 520 of the weather app may include a target display area 521, in which the phone can display multiple cloud images.
[0180] It should be noted that, Figure 5 (b) shows a schematic diagram of a cloud image displayed on a mobile phone.
[0181] Understandably, the mobile phone uses multiple cloud noise maps (including a first cloud noise map and at least one offset cloud noise map) to simulate changes in cloud shape and thickness. Playing multiple cloud images rendered from these noise maps on the phone can display these changes in cloud shape and thickness, thus showcasing the dynamic process of cloud change (i.e., cloud animation). Secondly, based on the above analysis, each cloud image obtained by the phone is relatively realistic; therefore, playing multiple cloud images can reflect the real dynamic process of cloud change.
[0182] In some embodiments, the phone can also obtain a preset shape input by the user, and then generate a cloud layer image including a cloud layer of the preset shape. As shown in Figure 13 The cloud layer rendering method provided by the embodiments of the present application can also include S1301, and S401 in the method can include S1302.
[0183] S1301, the phone obtains a mask image including a preset shape pattern.
[0184] The phone can receive a mask image input by the user before receiving a rendering operation. Some contents in the mask image are invisible, and the mask image can be divided into a visible region and an invisible region. The preset shape pattern belongs to the visible region.
[0185] S1302, the phone obtains a first cloud layer noise map based on the preset shape, wherein the first cloud layer noise map is used to simulate a cloud layer of the preset shape, and a cloud layer image corresponding to the first cloud layer noise map includes a cloud layer of the preset shape.
[0186] After receiving the mask image, the phone can receive and respond to a rendering operation to obtain a first cloud layer noise map used to simulate a cloud layer of the preset shape. Then, the phone can perform cloud layer rendering on the first cloud layer noise map to obtain a cloud layer image corresponding to the first cloud layer noise map, and the cloud layer image includes a cloud layer of the preset shape.
[0187] Further, after obtaining the first cloud layer noise map used to simulate a cloud layer of the preset shape, the phone can perform offset on a plurality of first noise maps included in the first cloud layer noise map to obtain an offset cloud layer noise map, and the offset cloud layer noise map can also be used to simulate a cloud layer of the offset cloud layer noise map. Then, after obtaining a cloud layer image corresponding to the first cloud layer noise map and a cloud layer image corresponding to the offset cloud layer noise map, playing the cloud layer image corresponding to the first cloud layer noise map and the cloud layer image corresponding to the offset cloud layer noise map can show a dynamic change process of the cloud layer of the preset shape.
[0188] Exemplarily, as shown in (a) of Figure 14 The phone can obtain a mask image 1410 including a puppy pattern 1411, and a region in the mask image 1410 except the puppy pattern 1411 is an invisible region. Then, as shown in (b) of Figure 14 The phone can obtain a first cloud layer noise map 1420 based on the puppy shape. The phone performs cloud layer rendering on the first cloud layer noise map 1420 to obtain a cloud layer image 1430 corresponding to the first cloud layer noise map 1420. As shown in (c) of Figure 14 The cloud layer image 1430 includes a cloud layer of the puppy shape.
[0189] It should be noted that the cloud layer image 1430 is in color,Figure 14 (c) is not shown in FIG. 6.
[0190] In some embodiments, the mobile phone can first determine a plurality of first noise maps based on the preset shape, the plurality of first noise maps being capable of being spliced to obtain a cloud layer of the preset shape; and then, the plurality of first noise maps are seamlessly spliced to obtain a first cloud layer noise map for simulating the cloud layer of the preset shape.
[0191] Alternatively, the mobile phone can store a plurality of fourth cloud layer noise maps corresponding to a plurality of shapes one by one, and the mobile phone can obtain the first cloud layer noise map corresponding to the preset shape from the plurality of fourth cloud layer noise maps.
[0192] It should be noted that the steps performed by the mobile phone described in the above embodiments can be performed by the graphics engine in the mobile phone.
[0193] Referring to FIG. 6, a flowchart of a cloud layer rendering method provided by an embodiment of the present application is shown. As shown in FIG. 6, the display method can further include the following S1501-S1504. Figure 15 Figure 15 S1501, the mobile phone receives and responds to a rendering operation to obtain a first cloud layer noise map.
[0194] S1502, the mobile phone establishes a first pyramid structure corresponding to the first cloud layer noise map, the first pyramid structure including a plurality of second cloud layer noise maps, and the plurality of second cloud layer noise maps having different pixel point sizes.
[0195] S1503, the mobile phone controls a first light ray step, and in the process of the first light ray step, adjusts a step length of the first light ray based on the first pyramid structure, and processes an initial pixel value of a first pixel point in the first cloud layer noise map to obtain a target pixel value of the first pixel point, wherein the first light ray is directed from the first pixel point to a first preset light source position.
[0196] S1504, the mobile phone generates a first cloud layer image based on the target pixel values of a plurality of first pixel points in the first cloud layer noise map.
[0197]
[0198] It can be understood that, in order to implement the above functions, the electronic device contains hardware structure and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of the examples described in the embodiments disclosed in the present text, the embodiments of the present application can be realized in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of the embodiments of the present application.
[0199] This application embodiment can divide the above-described electronic device into functional modules based on the method example described above. For example, each function can be divided into its own functional modules, or two or more functions can be integrated into one processing module. The integrated modules can be implemented in hardware or as software functional modules. It should be noted that the module division in this embodiment is illustrative and only represents one logical functional division; in actual implementation, there may be other division methods.
[0200] This application also provides an electronic device, which includes: a memory and one or more processors; the memory is coupled to the processors; wherein the memory stores computer program code, the computer program code including computer instructions, and when the computer instructions are executed by the processor, the electronic device performs the cloud rendering method provided in the foregoing embodiments.
[0201] This application also provides a computer-readable storage medium including computer instructions that, when executed on an electronic device, cause the electronic device to perform the cloud rendering method provided in the foregoing embodiments.
[0202] This application also provides a computer program product containing executable instructions that, when run on an electronic device, cause the electronic device to execute the cloud rendering method provided in the foregoing embodiments.
[0203] This application also provides a chip system, such as... Figure 16 As shown, the chip system 1600 includes at least one processor 1601 and at least one interface circuit 1602. The processor 1601 and the interface circuit 1602 are interconnected via lines. For example, the interface circuit 1602 can be used to receive signals from other devices (e.g., the memory of an electronic device). As another example, the interface circuit 1602 can be used to send signals to other devices (e.g., the processor 1601).
[0204] For example, interface circuit 1602 can read instructions stored in memory and send those instructions to processor 1601. When the instructions are executed by processor 1601, the chip system can perform the steps in the above embodiments. Of course, the chip system may also include other discrete devices, and this application embodiment does not specifically limit this.
[0205] Through the description of the above embodiments, those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above division of functional modules is taken as an example, and in actual application, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.
[0206] In several embodiments provided in the present application, it should be understood that the disclosed devices / apparatuses and methods can be implemented in other manners. For example, the above-described device / apparatus embodiments are merely illustrative. For example, the division of the modules or units is merely a logical function division, and there can be another division manner in actual implementation. For example, a plurality of units or components can be combined or integrated into another device, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections between different units, can be indirect couplings or communication connections through some interfaces, devices or units, and can be electrical, mechanical or in other forms.
[0207] The units described as separate components can or can not be physically separate, and the components shown as units can be one physical unit or multiple physical units, that is, can be located in one place, or can be distributed in multiple different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiments.
[0208] In addition, each functional unit in the various embodiments of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The above integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0209] The integrated unit, if realized in the form of a software functional unit and sold or used as an independent product, can be stored in a readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application essentially or say the parts that make contributions to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product, which is stored in a storage medium, includes a plurality of instructions to make a device (which can be a single-chip microcomputer, a chip, etc.) or a processor execute all or part of the steps of the methods described in the various embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.
[0210] The above merely provides the specific implementation of the present application, but the protection scope of the present application is not limited to this, any change or replacement within the technical scope disclosed by the present application should be covered in the protection scope of the present application.
Claims
1. A cloud layer rendering method, characterized by, The method is applied to an electronic device, and the method comprises: receiving and responding to a rendering operation, obtaining a first cloud layer noise map; establishing a first pyramid structure corresponding to the first cloud layer noise map, the first pyramid structure comprising a plurality of second cloud layer noise maps, the plurality of second cloud layer noise maps having different pixel point sizes; determining an initial step length corresponding to a first light ray based on the first pyramid structure, wherein the first light ray is directed from a first pixel point in the first cloud layer noise map to a first preset light source position; determining that the first light ray steps to a first stepping point according to the initial step length; in a case where the first light ray is occluded at the first stepping point, reducing the initial step length based on the first pyramid structure to obtain an adjusted step length, and attenuating an initial pixel value of the first pixel point to obtain an updated pixel value; in a case where the first light ray is not occluded at the first stepping point, enlarging the initial step length based on the first pyramid structure to obtain an adjusted step length, and determining that the updated pixel value is the initial pixel value of the first pixel point; determining that the first light ray steps to a second stepping point according to the adjusted step length, and continuing to adjust the adjusted step length and update the updated pixel value; until the step of the first light ray ends, determining that a target pixel value of the first pixel point is the updated pixel value; generating a first cloud layer image based on target pixel values of a plurality of first pixel points in the first cloud layer noise map.
2. The method of claim 1, wherein, The plurality of second cloud layer noise maps in the first pyramid structure are located at different levels, and the higher the level of a second cloud layer noise map in the plurality of second cloud layer noise maps, the smaller or larger the resolution of the second cloud layer noise map; the initial step length is equal to the size of a pixel point in a second cloud layer noise map at an initial level, and the second cloud layer noise map at the initial level has the largest resolution among the plurality of second cloud layer noise maps; wherein the initial step length is reduced based on the first pyramid structure to obtain the adjusted step length, comprising: determining an updated level based on the initial level, wherein the updated level is adjacent to the initial level, and the resolution of the second cloud layer noise map at the updated level is greater than the resolution of the second cloud layer noise map at the initial level; determining that the adjusted step length is equal to the size of a pixel point in the second cloud layer noise map at the updated level.
3. The method of claim 2, wherein, The initial step length is enlarged based on the first pyramid structure to obtain the adjusted step length, comprising: determining an updated level based on the initial level, wherein the updated level is adjacent to the initial level, and the resolution of the second cloud layer noise map at the updated level is less than the resolution of the second cloud layer noise map at the initial level; determining that the adjusted step length is equal to the size of a pixel point in the second cloud layer noise map at the updated level.
4. The method according to any one of claims 1-3, characterized in that, The method further comprises: determine whether the pixel value of the first step point is greater than the initial pixel value of the first pixel point, wherein the pixel value of the first step point being greater than the initial pixel value of the first pixel point indicates that the first step point blocks the first light ray, and the pixel value of the first step point being less than or equal to the initial pixel value of the first pixel point indicates that the first step point does not block the first light ray.
5. The method according to any one of claims 1-3, characterized in that, The method further comprises: In a case where the first pixel point satisfies a preset sampling condition, determining an initial step length corresponding to the first light ray based on the first pyramid structure; The preset sampling condition comprises that the initial pixel value of the first pixel point is out of a preset numerical range, and the preset numerical range comprises a pixel value corresponding to black.
6. The method according to any one of claims 1-3, characterized in that, The method further comprises: In a case where the first light ray steps to an i th step point and a pixel value of the i th step point belongs to a preset numerical range, determining that the stepping of the first light ray is ended, wherein the pixel value of the i th step point belonging to the preset numerical range indicates that the first light ray penetrates through the cloud layer, the preset numerical range comprises a pixel value corresponding to black, and i is a positive integer greater than 1.
7. The method according to any one of claims 1-3, characterized in that, The method further comprises: The method further comprises:
8. The method of claim 7, wherein, establishing a second pyramid structure corresponding to the third cloud noise map; controlling second light ray stepping based on the second pyramid structure, and processing an initial pixel value of a second pixel point in the third cloud noise map to obtain a target pixel value of the second pixel point in a process of the second light ray stepping, wherein the second light ray is directed from the second pixel point to a second preset light source position; generating a second cloud image based on target pixel values of a plurality of second pixel points in the third cloud noise map; sequentially displaying the first cloud image and the second cloud image. The method further comprises: obtaining a mask image, the mask image comprising a pattern of a preset shape; 9. The method of any one of claims 1-3, wherein, The method further comprises: obtaining the first cloud noise map based on the preset shape, wherein the first cloud noise map is used to simulate a cloud layer of the preset shape, and the first cloud image comprises the cloud layer of the preset shape. The electronic device comprises a processor, a memory, and a communication interface; the memory and the communication interface are coupled with the processor, the memory is used to store computer program code, and the computer program code comprises computer instructions; when the processor executes the computer instructions, the electronic device performs the method according to any one of claims 1-9. 10. An electronic device, comprising: 11. A computer readable storage medium, characterized in that, The computer readable storage medium stores computer instructions; when the computer instructions run on the electronic device, the electronic device executes the method in any one of claims 1-9.
12. A chip system, characterized by The chip system comprises a processor and an interface circuit, the processor and the interface circuit are interconnected through a line; wherein the interface circuit is used for receiving a signal from an electronic device and sending the signal to the processor, the signal comprises computer instructions; when the processor executes the computer instructions, the chip system executes the method in any one of claims 1-9.
Citation Information
Patent Citations
Realistic volume cloud construction method and device, equipment and medium
CN117710557A
Volume cloud rendering method and device and electronic equipment
CN118379409A