Cloud model rendering method and device, storage medium and electronic device
By performing patch processing and texture sampling on the cloud model, the problem of poor cloud model rendering in mobile games was solved, and the simulation of flocculent and flowing effects was achieved, reducing rendering costs and computational complexity.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NETEASE (HANGZHOU) NETWORK CO LTD
- Filing Date
- 2022-08-15
- Publication Date
- 2026-07-21
AI Technical Summary
In existing technologies, mobile games suffer from poor rendering effects and high costs when rendering cloud models. In particular, it is difficult to simulate the wispy texture and edge texture of clouds under realistic rendering, and the production of cloud models is complex and difficult to control.
By interpolating the initial cloud model, sampling based on polygonal patches and model vertex information, and rendering using transparency and noise maps, the creation of multi-layered cloud models is avoided, simplifying the calculation process and simulating the wispy and flowing effects of clouds.
It improves the rendering effect of cloud models, reduces rendering costs, avoids texture distortion and complex calculations, and enhances rendering efficiency and system performance.
Smart Images

Figure CN115375822B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of image rendering, and more specifically, to a method, apparatus, storage medium, and electronic device for rendering a cloud model. Background Technology
[0002] Currently, a major bottleneck for mobile games is performance, and rendering volumetric clouds under performance constraints is a significant challenge for many mobile games. In related technologies, cloud scenes are typically avoided during game art design, especially in games requiring realistic rendering, where images are often chosen and observation from a distance is necessary. In less realistic games, different techniques are used to simulate clouds. For example, volumetric clouds are drawn as multi-layered cloud models, with the vertices of each layer extending along the normal direction at a certain distance. Then, 3D noise maps are used for cropping; the outer layers of the cloud model have more of the model clipped.
[0003] Creating cloud models requires building multiple layers, each involving complex calculations, thus increasing production costs. Furthermore, the rendering of these cloud models is rather stiff, lacking the fluffy texture and smooth edges desired by artists. Additionally, creating volumetric cloud models involves sampling 3D noise maps using the model's texture coordinates. However, artists often struggle to control the design parameters of these 3D noise maps when creating volumetric cloud models, resulting in random and ambiguous rendering effects.
[0004] There is currently no effective solution to the above problems. Summary of the Invention
[0005] This disclosure provides at least some embodiments of a cloud model rendering method, apparatus, storage medium, and electronic device to at least solve the technical problem of poor rendering effect in the prior art when rendering cloud models.
[0006] According to one embodiment of this disclosure, a method for rendering a cloud model is provided, comprising: obtaining an initial cloud model to be rendered; performing patching processing on the model vertices of the initial cloud model based on polygon patches to obtain a patched initial cloud model; sampling a preset transparent texture based on the texture coordinates of the polygon patches in the patched initial cloud model to obtain first sampling information; sampling a preset noise texture based on the vertex information of the model vertices to obtain second sampling information; and rendering the patched initial cloud model based on the first sampling information and the second sampling information to obtain a target cloud model.
[0007] According to one embodiment of this disclosure, a cloud model rendering apparatus is also provided, comprising: an acquisition module for acquiring an initial cloud model to be rendered; an interpolation module for interpolating the model vertices of the initial cloud model based on polygonal patches to obtain an interpolated initial cloud model; a first sampling module for sampling a preset transparent texture based on the texture coordinates of the polygonal patches in the interpolated initial cloud model to obtain first sampling information; a second sampling module for sampling a preset noise texture based on the vertex information of the model vertices to obtain second sampling information; and a rendering module for rendering the interpolated initial cloud model based on the first sampling information and the second sampling information to obtain a target cloud model.
[0008] According to one embodiment of this disclosure, a computer-readable storage medium is also provided, which stores a computer program configured to execute the above-described cloud model rendering method at runtime.
[0009] According to one embodiment of this disclosure, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to execute the above-described cloud model rendering method.
[0010] In at least some embodiments of this disclosure, a rendering method is employed for the interpolated cloud model. After obtaining the initial cloud model of the model to be rendered, interpolation processing is performed on the model vertices of the initial cloud model based on polygonal patches to obtain the interpolated initial cloud model. Then, based on the texture coordinates of the polygonal patches in the interpolated initial cloud model, a preset transparent texture is sampled to obtain first sampling information. Simultaneously, a preset noise texture is sampled based on the vertex information of the model vertices to obtain second sampling information. Finally, the interpolated initial cloud model is rendered based on the first and second sampling information to obtain the target cloud model.
[0011] In the aforementioned process, during the rendering of the cloud model, there is no need to create multi-layered cloud models. Only inlay processing of the cloud model is required, followed by rendering of the inlaid cloud model. Furthermore, the rendering process does not require complex calculations; only sampling of the corresponding textures is needed. This avoids the high rendering cost associated with creating multi-layered cloud models in related technologies. In addition, sampling the transparency texture can simulate the wispy texture of clouds, improving the rendering effect of the cloud model. Moreover, using the model's vertex information to sample the noise texture, rather than the model's texture coordinates, avoids the texture distortion problem that occurs when sampling noise textures using the model's texture coordinates in related technologies, further improving the rendering effect of the cloud model.
[0012] As can be seen from the above, the solution provided in this disclosure achieves the purpose of rendering cloud models, thereby improving the rendering effect of cloud models and solving the technical problem of poor rendering effect in existing cloud models. Attached Figure Description
[0013] The accompanying drawings, which are included to provide a further understanding of this disclosure and form part of this application, illustrate exemplary embodiments of this disclosure and are used to explain this disclosure, but do not constitute an undue limitation of this disclosure. In the drawings:
[0014] Figure 1 This is a hardware structure block diagram of a mobile terminal for a cloud model rendering method according to an embodiment of this disclosure.
[0015] Figure 2 This is a flowchart of a cloud model rendering method according to one embodiment of the present disclosure;
[0016] Figure 3 This is a schematic diagram of the initial cloud model after inserting according to one embodiment of the present disclosure;
[0017] Figure 4 This is a schematic diagram of a preset transparent texture according to one embodiment of the present disclosure;
[0018] Figure 5 This is a schematic diagram of a cloud model before insertion according to one embodiment of the present disclosure;
[0019] Figure 6 This is a schematic diagram of a cloud model after inserting a chip according to one embodiment of the present disclosure;
[0020] Figure 7 It is a noise map according to one embodiment of the present disclosure;
[0021] Figure 8 This is a schematic diagram of a rendered model according to one embodiment of the present disclosure;
[0022] Figure 9 This is a schematic diagram of a rendered model according to one embodiment of the present disclosure;
[0023] Figure 10 This is a schematic diagram of a cloud model according to one embodiment of the present disclosure;
[0024] Figure 11 This is a schematic diagram of a cloud model with smoothed normals according to one embodiment of the present disclosure;
[0025] Figure 12 This is a schematic diagram of a cloud model according to one embodiment of the present disclosure;
[0026] Figure 13This is a schematic diagram of a cloud model according to one embodiment of the present disclosure;
[0027] Figure 14 This is a structural block diagram of a cloud model rendering apparatus according to one embodiment of the present disclosure;
[0028] Figure 15 This is a schematic diagram of an electronic device according to one embodiment of the present disclosure. Detailed Implementation
[0029] To enable those skilled in the art to better understand the present disclosure, the technical solutions of the present disclosure will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of the present disclosure, and not all embodiments. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present disclosure.
[0030] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0031] According to one embodiment of this disclosure, an embodiment of a cloud model rendering method is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0032] This method embodiment can be executed on a mobile terminal, computer terminal, or similar computing device. Taking running on a mobile terminal as an example, the mobile terminal can be a smartphone (such as an Android phone, iOS phone, etc.), tablet computer, PDA, mobile Internet Device (MID), PAD, game console, and other terminal devices. Figure 1 This is a hardware structure block diagram of a mobile terminal for a cloud model rendering method according to an embodiment of this disclosure. For example... Figure 1As shown, a mobile terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a central processing unit (CPU), graphics processing unit (GPU), digital signal processing (DSP) chip, microprocessor (MCU), programmable logic device (FPGA), neural network processor (NPU), tensor processor (TPU), artificial intelligence (AI) type processor, etc.) and a memory 104 for storing data are also shown. Optionally, the mobile terminal may further include a transmission device 106 for communication functions, an input / output device 108, and a display device 110. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0033] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the cloud model rendering method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thereby implementing the aforementioned cloud model rendering method. The memory 104 may include high-speed random access memory and non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to a mobile terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0034] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0035] The inputs in input / output device 108 can come from multiple human interface devices (HIDs). Examples include keyboards and mice, gamepads, and other dedicated game controllers (such as steering wheels, fishing rods, dance mats, and remote controls). Some HIDs, in addition to providing input functions, can also provide output functions, such as force feedback and vibration from gamepads, and audio output from controllers.
[0036] Display device 110 may be, for example, a head-up display (HUD), a touchscreen liquid crystal display (LCD), and a touch display (also referred to as a "touchscreen" or "touch display"). The LCD allows a user to interact with the user interface of the mobile terminal. In some embodiments, the mobile terminal has a graphical user interface (GUI), which allows the user to interact with the GUI by touching and / or gesturing on a touch-sensitive surface. Optional human-computer interaction functions include: creating web pages, drawing, word processing, creating electronic documents, playing games, video conferencing, instant messaging, sending and receiving emails, a call interface, playing digital video, playing digital music, and / or web browsing, etc. Executable instructions for performing the above human-computer interaction functions are configured / stored in one or more processor-executable computer program products or readable storage media.
[0037] The cloud model rendering method in one embodiment of this disclosure can run on a local terminal device and provide a graphical user interface through the terminal device. The terminal device can be the aforementioned local terminal device or a client device in the cloud interaction system. Figure 2 This is a flowchart of a cloud model rendering method according to one embodiment of the present disclosure, such as... Figure 2 As shown, the method includes the following steps:
[0038] Step S202: Obtain the initial cloud model to be rendered.
[0039] In step S202, the GPU (Graphics Processing Unit) of the terminal device can obtain relevant information about the initial cloud model to be rendered and render the initial cloud model. The initial cloud model can be a volumetric cloud model, but it does not have a flocculent appearance; that is, the initial cloud model is a volumetric cloud model with sharp edges.
[0040] It should be noted that in this embodiment, the rendering of the cloud model is implemented in the GPU, while the CPU (Central Processing Unit) of the terminal device only performs simple data processing, thereby improving the performance of the rendering system.
[0041] Step S204: Based on polygonal patches, perform patching on the model vertices of the initial cloud model to obtain the patched initial cloud model.
[0042] In step S204, the GPU inserts a polygonal patch at each vertex position of the initial cloud model. During subsequent model rendering, a transparency map can be used to process these polygonal patches to simulate wispy clouds. Figure 3 In the schematic diagram of the initial cloud model after patching, the white part represents the basic cloud model, and the black blocks represent the polygonal faces on the corresponding vertices of the initial cloud model. Furthermore, in step S204, the polygonal faces corresponding to each model vertex are identical; for example, the polygonal faces of each model vertex can be triangles, quadrilaterals, pentagons, etc.
[0043] It should be noted that the interpolation tiles are mainly used to sample transparent textures to simulate the fuzzy texture of clouds. Quadrilateral tiles are perfectly capable of ensuring the fuzzy texture of clouds. However, if tiles larger than quadrilaterals (e.g., pentagonal tiles) are used, the overall number of vertices in the model will increase. The number of vertices increases exponentially with the total number of vertices in the cloud model, resulting in unnecessary performance overhead. Triangular tiles, on the other hand, cannot guarantee the smoothness of the cloud model, resulting in a poor rendering effect. Therefore, in this embodiment, the aforementioned polygonal tiles are quadrilateral tiles.
[0044] Furthermore, it should be noted that this embodiment requires the generation of a large number of polygon patches. If the CPU generates polygon patches one by one and then sends them to the GPU for rendering, it will increase the time cost of rendering the cloud model and reduce system performance. To avoid the above problems, this embodiment uses the Unity game engine's native API (Application Programming Interface) to implement the patching process for model vertices using a GPU Instancing solution. That is, the CPU passes the relevant information of the model vertices of the initial cloud model (e.g., normal information) to the GPU, which then batch processes the relevant information of the model vertices to generate and render the cloud model, thereby reducing performance consumption and shortening the model generation time.
[0045] The GPU Instancing solution described above draws multiple objects with the same mesh and material in the same layer's Draw Call. Although GPU Instancing can only render objects with the same mesh and material in the same layer's Draw Call, each instance can have different material parameters (e.g., color, range), which can significantly improve the rendering engine's rendering performance and efficiency.
[0046] Step S206: Based on the texture coordinates of the polygonal patch in the initial cloud model after patching, sample the preset transparent texture to obtain the first sampling information.
[0047] Optionally, the aforementioned preset transparent texture can be a texture that includes at least the solid portion and the blurred portion. For example, the preset transparent texture can be... Figure 4 The image shown is a texture with a solid center and blurred edges. It should be noted that in practical applications, when sampling a preset transparent texture, it is usually sampled based on the origin of the polygonal facet. When the preset transparent texture is a texture with a solid center and blurred edges, the user can set the origin of the polygonal facet to its center point; for example, the center point of a quadrilateral facet can be the intersection of its two diagonals. When the preset transparent texture is another type of texture, the user can adjust the origin of the polygonal facet according to the distribution of the solid and blurred parts in the preset transparent texture.
[0048] Furthermore, it should be noted that in related technologies, the overall effect of volumetric clouds is rather stiff, lacking a fluffy feel and a smooth, textured edge. To simulate the wispy texture of clouds, in this embodiment, the transparency map is sampled, and the transparency of the polygonal faces of the initial cloud model after interpolation is adjusted based on the sampling results (i.e., the aforementioned first sampling information). This simulates the wispy texture of clouds, improving the rendering effect of the cloud model, resulting in a fluffy, textured cloud model.
[0049] Step S208: Sample the preset noise map based on the vertex information of the model vertices to obtain the second sampling information.
[0050] It should be noted that in related technologies, noise maps are sampled based on the texture coordinates of the cloud model. However, the actual cloud model is not a simple plane. When sampling the noise map, there are gaps in the texture coordinates of the cloud model, resulting in a lack of natural transitions between different surfaces in three-dimensional space and poor rendering quality. To avoid this problem, this embodiment uses the model vertices of the cloud model to sample the noise map, thereby reducing sampling errors and significantly minimizing breaks that occur when model vertex offsets, thus improving the rendering quality of the cloud model.
[0051] Step S210: Render the initial cloud model after interpolation based on the first sampling information and the second sampling information to obtain the target cloud model.
[0052] It should be noted that the first sampling information represents the transparency information of the cloud model, and the second sampling information represents the texture information of the cloud model. That is, in this application, only simple sampling of the preset transparency map and noise map is required, and the cloud model can be rendered using the sampling results without complex calculations. This avoids the problem of high cloud model rendering cost that requires the creation of multi-layer cloud models in related technologies, and improves the rendering efficiency of cloud models and the system performance of the rendering system.
[0053] Based on the scheme defined in steps S202 to S210 above, it can be understood that, in at least some embodiments of this disclosure, a method of rendering the interpolated cloud model is adopted. After obtaining the initial cloud model of the model to be rendered, the model vertices of the initial cloud model are interpolated based on polygonal patches to obtain the interpolated initial cloud model. Based on the texture coordinates of the polygonal patches in the interpolated initial cloud model, a preset transparent texture is sampled to obtain first sampling information. Simultaneously, a preset noise texture is sampled based on the vertex information of the model vertices to obtain second sampling information. Finally, the interpolated initial cloud model is rendered based on the first and second sampling information to obtain the target cloud model.
[0054] It's noteworthy that during the rendering of the cloud model, there's no need to create multiple layers. Only inlaying is required, followed by rendering of the inlaid cloud model. Furthermore, the rendering process eliminates the need for complex calculations; only sampling of the corresponding textures is necessary. This avoids the high rendering cost associated with creating multiple cloud models in related technologies. Additionally, sampling transparency textures simulates the wispy texture of clouds, enhancing the rendering effect. Moreover, sampling noise textures using the model's vertex information, rather than the model's texture coordinates, avoids the texture distortion issues that occur when sampling noise textures using the model's texture coordinates in related technologies, further improving the cloud model's rendering quality.
[0055] As can be seen from the above, the solution provided in this disclosure achieves the purpose of rendering cloud models, thereby improving the rendering effect of cloud models and solving the technical problem of poor rendering effect in existing cloud models.
[0056] In an alternative embodiment, by Figure 1 It is understood that after the GPU of the terminal device obtains the initial cloud model to be rendered, it performs tile interpolation on the initial cloud model. After interpolating the model vertices of the initial cloud model based on polygonal patches to obtain the interpolated initial cloud model, the terminal device can determine the information corresponding to each polygonal patch. Specifically, the terminal device obtains multiple groups of information, where each group of information includes at least the vertex information of the corresponding model vertex and the vertex identifier of the corresponding model vertex.
[0057] It should be noted that the GPU of the terminal device obtains the above-mentioned grouping information from the CPU. The above-mentioned vertex information may include, but is not limited to, vertex position information, normal information, texture coordinates, transformation matrix, etc. of the model vertex.
[0058] Optionally, the CPU of the terminal device distinguishes and packages all the relevant information of the model vertices (including vertex information and vertex identifiers) and sends it to the GPU. That is, all the relevant information of the model vertices is grouped according to the vertex identifiers, and all the grouped information is sent to the GPU. Before the CPU sends the grouped information to the GPU, the CPU can pass the above grouped information to the shader through the Compute Buffer, that is, enter the GPU rendering stage. Then, in the GPU rendering stage, the shader can perform operations such as lighting calculation, basic color rendering, vertex animation, etc. on the cloud model.
[0059] It should be noted that when the GPU instantiates a facet, it generates a facet identifier (Instance ID) to distinguish facets. Simultaneously, the GPU uses this Instance ID to read the grouping information of the corresponding model vertices from the Compute Buffer in the shader, thus enabling the vertex information of the model vertices to be passed to the corresponding polygon facets. Figure 5 The cloud model before chip insertion. Figure 6 The cloud model after interpolation, i.e. Figure 6 The vertex normals of the cloud model have been visually represented to be passed to the corresponding polygon patches.
[0060] Furthermore, such as Figure 1 As shown, after the initial cloud model is processed by interpolation, the GPU of the terminal device can sample the preset transparent texture and the preset noise texture respectively. The two sampling processes can be performed simultaneously or in a preset order; the specific sampling order is not limited here. Step S106 has already described the sampling process for the preset transparent texture; the following describes the sampling process for the preset noise texture.
[0061] In one optional embodiment, during the sampling of the preset noise map, the GPU of the terminal device determines the vertex information of the model vertices corresponding to the polygon patches based on the vertex identifiers, and then samples the preset two-dimensional noise map based on the vertex information of the model vertices to obtain the second sampling information.
[0062] It should be noted that in related technologies, noise maps are sampled based on the texture coordinates of the cloud model. However, the actual cloud model used is not a simple plane, and there are gaps in the texture coordinates of the cloud model when sampling the noise map. Therefore, if the noise map is sampled based on texture coordinates, model breaks may occur, such as... Figure 7 and Figure 8 As shown, where, Figure 7 For noise mapping, Figure 8 This is the model obtained after rendering. Figure 7 In the medium texture view, each square corresponds to a face of a cube. When texture coordinates are disordered, texture sampling will also be disordered, such as... Figure 8 A fracture occurred between the first and second faces of the model shown.
[0063] To address the aforementioned issues, this embodiment employs a three-sided mapping approach. Specifically, it uses the vertex coordinates of the cloud model instead of texture coordinates to sample the noise map, thereby reducing sampling errors and consequently minimizing breakage during vertex offset. For example... Figure 9As shown, the solution provided in this disclosure eliminates the break between two faces of the model, thereby improving the rendering effect of the model.
[0064] Furthermore, it should be noted that in this embodiment, the preset noise map is a noise grayscale image. Optionally, the noise map is a two-dimensional noise map. Compared with the 3D noise map in the prior art, the use of a two-dimensional noise map can make the rendering effect controllable, thereby ensuring the rendering effect of the cloud model.
[0065] In one optional embodiment, after obtaining the first sampling information and the second sampling information, the GPU of the terminal device renders the interpolated initial cloud model based on the first sampling information and the second sampling information to obtain the target cloud model. Specifically, the GPU of the terminal device blurs the edges of the interpolated initial cloud model based on the first sampling information and dynamically processes the interpolated initial cloud model based on the second sampling information to obtain the target cloud model.
[0066] In this disclosure, the edges of the cloud model can be blurred based on the first sampling information, so that the rendered cloud model can vividly simulate flocculent clouds; while the cloud model can be made dynamic based on the second sampling information, so that the rendered cloud model can vividly simulate the flow of cloud layers and improve the rendering effect of the cloud model.
[0067] During the process of blurring the edges of the initial cloud model after interpolation based on the first sampling information, the GPU of the terminal device determines the transparency information corresponding to the polygonal facets, and blurs the edges of the initial cloud model after interpolation based on the transparency information and the first sampling information.
[0068] Optionally, users can set the transparency of each polygon facet and render the polygon facets using the first sampling information and the transparency of each polygon facet, thereby blurring the edges of the cloud model and ensuring that the rendered cloud model has a flocculent feel.
[0069] During the dynamic processing of the initial cloud model after interpolation based on the second sampling information, the GPU of the terminal device offsets the texture coordinates of the initial cloud model after interpolation to obtain the offset initial cloud model, and renders the offset initial cloud model based on the second sampling information to obtain the dynamic cloud model.
[0070] It should be noted that while sampling a preset noise map using vertex information from the model's vertices can achieve overall cloud model movement, it lacks the detail of flow within the cloud layer. In this embodiment, flow mapping technology is used to enhance the sense of flow within the cloud layer.
[0071] A flow map is a texture that records two-dimensional vector information. The color (usually an RG channel) on the flow map records the direction of the vector field at that point, making a point on the model exhibit quantitative flow characteristics. Typically, the flow effect is simulated by offsetting the texture coordinates in the shader and then sampling a preset texture map.
[0072] Optionally, the cloud model can be made dynamic through the following steps:
[0073] Step S1: Sample the Flow Map to obtain vector field information;
[0074] Step S2: Determine the change information of texture coordinates when sampling the preset texture map based on vector field information. The change information of texture coordinates can be the phase difference of texture coordinates between two samples.
[0075] Step S3: Based on the change information of the texture coordinates mentioned above, the same texture is sampled (for example, sampled twice with a phase difference of half a cycle), and linear interpolation is performed to make the texture flow continuous, thereby realizing the flowing effect of the cloud model.
[0076] It should be noted that, in Figure 10 In the schematic diagram of the cloud model shown, each vertex has two normals. In this scenario, if the normal direction of a vertex is offset, the vertex will travel in two different directions, resulting in discontinuities in the cloud model's surfaces and causing breakage. Therefore, before offsetting the vertex in the shader, it is necessary to smooth the normals of the cloud model.
[0077] Specifically, the GPU of the terminal device obtains the normal information of the model vertices corresponding to the inset initial cloud model from the vertex information, and smooths the normals of the inset initial cloud model based on the normal information. Optionally, the GPU of the terminal device can average the normals of multiple normals of the same model vertex to make the normals of the model vertex point in only one direction, thus obtaining a target normal, which is the normal corresponding to the model vertex. Figure 11 As shown, after smoothing the model vertices, each model vertex has only one normal.
[0078] In addition, before rendering the initial cloud model after interpolation based on the first and second sampling information to obtain the target cloud model, the GPU of the terminal device also performs lighting calculations on the cloud model.
[0079] Specifically, the GPU of the terminal device determines the position of the initial cloud model after chip insertion in the target scene, and determines the position of the virtual light source based on the model position. Finally, it performs lighting calculations on the initial cloud model after chip insertion based on the light source position.
[0080] Optionally, in this embodiment, the classic Blinn-Phong lighting model can be used to perform lighting calculations on the cloud model. Additionally, to simulate the transparency often found in clouds, especially when backlit, a small portion of the light rays shines out along the cloud's outline, such as... Figure 12 The cloud model shown has light emanating from its outline. In this embodiment, the virtual light source is positioned behind the initial cloud model after the insert, so that when the initial cloud model is backlit, the light source illuminates the cloud model from behind, as shown. Figure 13 The cloud model shown.
[0081] As described above, this disclosure inserts polygonal patches at each vertex of the cloud model. These polygonal patches are processed using transparent textures designed by the artists to simulate wispy clouds. Then, the data of the corresponding vertex of the cloud model is passed to the patch of that vertex for lighting calculation. In addition, to simulate the flow of the cloud layer, the solution provided in this disclosure also incorporates vertex position offsets and uses flow map technology to enrich the details of the flow, thereby adding wispy clouds on the original basis. Furthermore, the artists can have maximum control over the rendering effect in the workflow, while also ensuring the natural flow effect of the cloud sea.
[0082] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this disclosure.
[0083] This embodiment also provides a cloud model rendering apparatus for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0084] Figure 14 This is a structural block diagram of a cloud model rendering apparatus according to one embodiment of the present disclosure, such as... Figure 14 As shown, the device includes: an acquisition module 1401, an insert module 1403, a first sampling module 1405, a second sampling module 1407, and a rendering module 1409.
[0085] The system includes: an acquisition module 1401 for acquiring an initial cloud model to be rendered; an interpolation module 1403 for interpolating polygonal faces onto the vertices of the initial cloud model to obtain an interpolated initial cloud model; a first sampling module 1405 for sampling a preset transparent texture based on the texture coordinates of the polygonal faces in the interpolated initial cloud model to obtain first sampling information; a second sampling module 1407 for sampling a preset noise texture based on the vertex information of the model vertices to obtain second sampling information; and a rendering module 1409 for rendering the interpolated initial cloud model based on the first and second sampling information to obtain a target cloud model.
[0086] Optionally, the cloud model rendering device further includes: a first acquisition module, used to acquire multiple grouping information after performing patching processing on the model vertices of the initial cloud model based on polygon patches to obtain the patched initial cloud model, wherein each grouping information includes at least the vertex information of the corresponding model vertex and the vertex identifier of the corresponding model vertex.
[0087] Optionally, the second sampling module includes a first determining module and a third sampling module. The first determining module is used to determine the vertex information of the model vertices corresponding to the polygonal facets based on vertex identifiers; the third sampling module is used to sample a preset two-dimensional noise map based on the vertex information of the model vertices to obtain the second sampling information.
[0088] Optionally, the rendering module includes a processing module, used to blur the edges of the initial cloud model after interpolation based on the first sampling information, and to dynamically process the initial cloud model after interpolation based on the second sampling information to obtain the target cloud model.
[0089] Optionally, the processing module includes a second determining module and an edge blurring module. The second determining module is used to determine the transparency information corresponding to the polygonal facets; the edge blurring module is used to blur the edges of the initial cloud model after interpolation based on the transparency information and the first sampling information.
[0090] Optionally, the processing module includes a coordinate offset module and a first rendering module. The coordinate offset module is used to offset the texture coordinates of the initial cloud model after interpolation, obtaining the offset initial cloud model; the first rendering module is used to render the offset initial cloud model based on the second sampling information, obtaining a dynamic cloud model.
[0091] Optionally, the cloud model rendering device further includes: a second acquisition module and a smoothing module. The second acquisition module is used to acquire the normal information of the model vertices corresponding to the initial cloud model after interpolation from the vertex information before offsetting the texture coordinates of the interpolated initial cloud model to obtain the offset initial cloud model; the smoothing module is used to smooth the normals of the interpolated initial cloud model based on the normal information.
[0092] Optionally, the cloud model rendering device further includes: a third determining module, a fourth determining module, and a lighting calculation module. The third determining module is used to determine the model position of the initial cloud model after interpolation in the target scene before rendering the initial cloud model after interpolation based on the first and second sampling information to obtain the target cloud model; the fourth determining module is used to determine the light source position of the virtual light source based on the model position; and the lighting calculation module is used to perform lighting calculations on the initial cloud model after interpolation based on the light source position.
[0093] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.
[0094] Embodiments of this disclosure also provide a computer-readable storage medium storing a computer program configured to execute the steps described in the method embodiments above when the computer program is run.
[0095] Optionally, in this embodiment, the aforementioned non-volatile storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0096] Optionally, in this embodiment, the non-volatile storage medium may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.
[0097] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a computer-readable storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.
[0098] In exemplary embodiments of this application, a computer-readable storage medium stores a program product capable of implementing the methods described above in this embodiment. In some possible implementations, various aspects of the embodiments of this disclosure may also be implemented as a program product including program code, which, when the program product is run on a terminal device, causes the terminal device to perform the steps according to various exemplary embodiments of this disclosure described in the "Exemplary Methods" section above.
[0099] The program product for implementing the above-described method according to embodiments of the present disclosure may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the embodiments of the present disclosure is not limited thereto. In the embodiments of the present disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0100] The aforementioned program product may take the form of any combination of one or more computer-readable media. Such computer-readable storage media may be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples (not exhaustive) of computer-readable storage media include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0101] It should be noted that the program code contained on the computer-readable storage medium can be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0102] Embodiments of this disclosure also provide an electronic device including a memory and a processor, the memory storing a computer program and the processor being configured to run the computer program to perform the steps in the above method embodiments.
[0103] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0104] Figure 15 This is a schematic diagram of an electronic device according to an embodiment of the present disclosure. Figure 15 As shown, the electronic device 1500 is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.
[0105] like Figure 15 As shown, the electronic device 1500 is presented in the form of a general-purpose computing device. The components of the electronic device 1500 may include, but are not limited to: at least one processor 1510, at least one memory 1520, a bus 1530 connecting different system components (including memory 1520 and processor 1510), and a display 1540.
[0106] The memory 1520 stores program code that can be executed by the processor 1510, causing the processor 1510 to perform the steps described in the method section of the embodiments of this application according to various exemplary implementations of this disclosure.
[0107] The memory 1520 may include a readable medium in the form of volatile memory cells, such as random access memory (RAM) 15201 and / or cache memory 15202, and may further include read-only memory (ROM) 15203, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory.
[0108] In some instances, memory 1520 may also include programs / utilities 15204 having a set (at least one) of program modules 15205, including but not limited to: an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Memory 1520 may further include memory remotely located relative to processor 1510, which can be connected to electronic device 1500 via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0109] Bus 1530 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, peripheral bus, graphics acceleration port, processor 1510, or a local bus using any of the various bus structures.
[0110] The display 1540 may be, for example, a touchscreen liquid crystal display (LCD) that allows a user to interact with the user interface of the electronic device 1500.
[0111] Optionally, the electronic device 1500 can also communicate with one or more external devices 1600 (e.g., keyboard, pointing device, Bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 1500, and / or any device that enables the electronic device 1500 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via the input / output (I / O) interface 1550. Furthermore, the electronic device 1500 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via the network adapter 1560. Figure 15 As shown, network adapter 1560 communicates with other modules of electronic device 1500 via bus 1530. It should be understood that, although... Figure 15 As not shown, other hardware and / or software modules may be used in conjunction with electronic device 1500, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0112] The aforementioned electronic device 1500 may further include: a keyboard, a cursor control device (such as a mouse), an input / output interface (I / O interface), a network interface, a power supply, and / or a camera.
[0113] Those skilled in the art will understand that Figure 15 The structure shown is for illustrative purposes only and does not limit the structure of the electronic device described above. For example, the electronic device 1500 may also include components that are more... Figure 15 The more or fewer components shown, or having the same Figure 15 Different configurations are shown. The memory 1520 can be used to store computer programs and corresponding data, such as the computer program and corresponding data corresponding to the cloud model rendering method in this embodiment. The processor 1510 executes various functional applications and data processing by running the computer program stored in the memory 1520, thereby implementing the aforementioned cloud model rendering method.
[0114] The sequence numbers of the embodiments disclosed above are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0115] In the above embodiments of this disclosure, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0116] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0117] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0118] Furthermore, the functional units in the various embodiments of this disclosure can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0119] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0120] The above description is only a preferred embodiment of this disclosure. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principles of this disclosure, and these improvements and modifications should also be considered within the scope of protection of this disclosure.
Claims
1. A method for rendering a cloud model, characterized in that, include: Obtain the initial cloud model to be rendered; The initial cloud model vertices are interpolated based on polygonal patches to obtain the interpolated initial cloud model. Based on the texture coordinates of the polygonal patch in the initial cloud model after the interpolation, a preset transparent texture is sampled to obtain first sampling information, wherein the first sampling information is used to characterize the transparency information of the initial cloud model after the interpolation. Based on the vertex information of the model vertices, a preset noise map is sampled to obtain second sampling information, wherein the second sampling information is used to characterize the texture information of the initial cloud model after the interpolation; Based on the first sampling information, the edges of the initial cloud model after the patch are blurred, and based on the second sampling information, the initial cloud model after the patch is dynamically processed to obtain the target cloud model.
2. The method according to claim 1, characterized in that, After performing patching processing on the model vertices of the initial cloud model based on polygon patches to obtain the patched initial cloud model, the method further includes: Obtain multiple grouping information, wherein each grouping information includes at least the vertex information of the corresponding model vertex and the vertex identifier of the corresponding model vertex.
3. The method according to claim 2, characterized in that, Based on the vertex information of the model vertices, a preset noise map is sampled to obtain second sampling information, including: The vertex information of the model vertices corresponding to the polygonal facets is determined based on the vertex identifiers; Based on the vertex information of the model vertices, a preset two-dimensional noise map is sampled to obtain the second sampling information.
4. The method according to claim 1, characterized in that, Based on the first sampling information, the edges of the initial cloud model after the patching are blurred, including: Determine the transparency information corresponding to the polygonal facet; The edges of the initial cloud model after the insertion are blurred based on the transparency information and the first sampling information.
5. The method according to claim 1, characterized in that, Based on the second sampling information, the initial cloud model after patching is dynamically processed, including: The texture coordinates of the initial cloud model after the insert are offset to obtain the offset initial cloud model; The offset initial cloud model is rendered based on the second sampling information to obtain a dynamic cloud model.
6. The method according to claim 5, characterized in that, Before offsetting the texture coordinates of the initial cloud model after the interpolation to obtain the offset initial cloud model, the method further includes: Obtain the normal information of the model vertices corresponding to the initial cloud model after patching from the vertex information; The normals of the initial cloud model after interpolation are smoothed based on the normal information.
7. The method according to claim 1, characterized in that, Before blurring the edges of the initial cloud model after interpolation based on the first sampling information, and dynamically processing the initial cloud model after interpolation based on the second sampling information to obtain the target cloud model, the method further includes: Determine the model position of the initial cloud model after the insertion in the target scene; The position of the virtual light source is determined based on the position of the model. Illumination calculations are performed on the initial cloud model after the insertion of the patch based on the location of the light source.
8. A rendering device for a cloud model, characterized in that, include: The acquisition module is used to acquire the initial cloud model to be rendered; The interpolation module is used to perform interpolation processing on the model vertices of the initial cloud model based on polygonal patches to obtain the interpolated initial cloud model. The first sampling module is used to sample a preset transparent texture based on the texture coordinates of the polygonal patch in the initial cloud model after the patching to obtain first sampling information, wherein the first sampling information is used to characterize the transparency information of the initial cloud model after the patching. The second sampling module is used to sample the preset noise map based on the vertex information of the model vertices to obtain second sampling information, wherein the second sampling information is used to characterize the texture information of the initial cloud model after the interpolation. The rendering module is used to blur the edges of the initial cloud model after interpolation based on the first sampling information, and to dynamically process the initial cloud model after interpolation based on the second sampling information to obtain the target cloud model.
9. A computer-readable storage medium, characterized in that, A computer-readable storage medium stores a computer program, wherein the computer program is configured to execute, when run by a processor, the rendering method of the cloud model as described in any one of claims 1 to 7.
10. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the rendering method of the cloud model as described in any one of claims 1 to 7.