Real-time sand sea rendering method and electronic equipment
By dynamically noise-perturbing and mapping the world coordinates to generate the global coordinates of the sand sea, an adjustable peak feature sand wave basic shape is generated, and multiple scale sand wave shapes are superimposed and fused with the topographic height map. This solves the problem of insufficient dynamic changes of sand waves in existing sand sea rendering methods, and achieves high-quality landform representation and real-time performance in sand sea rendering.
Patent Information
- Application Number
- CN202510999889.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2025-07-04
- Filing Date
- 2025-07-21
- Publication Date
- 2025-12-09
AI Technical Summary
Existing sand sea rendering methods cannot realistically reflect the dynamic changes of sand waves, resulting in poor visual effects and failing to meet the demands of games, film and television, and other fields for high-quality terrain representation and real-time performance.
By dynamically noise-perturbing the world coordinates, the global coordinates of the sand sea are generated, mapped to a periodic local coordinate space, and the basic shape of the sand waves with adjustable peak features is generated. Multiple scales of sand wave shapes are superimposed to form a composite sand wave height field, which is then dynamically fused with the topographic height map. Finally, the surface normal is calculated and the rendering output is completed.
It achieves realistic rendering of sand waves, supports multi-scale detail control and performance optimization, and meets the high-quality terrain rendering needs of games, movies and other fields.
Smart Images

Figure CN121095402A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of graphics rendering technology, specifically to a real-time sand sea rendering method and electronic device. Background Technology
[0002] In the field of computer graphics and real-time rendering, the simulation of natural landscapes, especially the generation of irregular dynamic terrains such as deserts, dunes, and sand seas, has always been a significant challenge in balancing high-precision visual representation and performance optimization.
[0003] Traditional methods for rendering sand dunes or desert landscapes can be broadly categorized into two types: 1. Static heightmap-based modeling: This type of method generates dune shapes by sampling fixed heightmap textures. Although it is easy to implement and has low computational cost, it cannot reflect the dynamic changes of real sand waves and lacks a sense of natural flow and visual hierarchy.
[0004] 2. Dynamic morphology generation based on noise functions: Techniques such as Berlin noise and Simplex noise are used to simulate the surface undulations of sand dunes, which have a certain degree of randomness and naturalness. However, this type of method still has the following drawbacks: it is difficult to generate dune shapes with physical structural features (such as windward slopes, leeward slopes, and transitions between soft and hard peaks); the sand dunes cannot adapt to complex terrain changes; the rendering results are monotonous; the spatial hierarchy is lacking; the lighting is unrealistic; and the visual effects are harsh.
[0005] In addition, most existing dynamic sand dune renderings use uniform noise perturbation and simple height overlay, which cannot achieve highly editable dune configurations with flexible local detail control, making it difficult to meet the needs of games, film and television and other fields that require both high-quality terrain representation and real-time performance.
[0006] Therefore, existing dynamic sand rendering cannot reflect the dynamic changes of real sand waves, resulting in poor visual effects. Summary of the Invention
[0007] In view of this, embodiments of this application provide a real-time sand sea rendering method and electronic device to solve the problem that traditional real-time sand sea rendering methods cannot reflect the dynamic changes of real sand waves and have poor visual effects.
[0008] The first aspect of this application provides a real-time sand sea rendering method, including: Dynamic noise perturbation is applied to the world coordinates to generate the global coordinates of the desert. The global coordinates are mapped to a periodic local coordinate space to obtain the local coordinates; Based on the local coordinates, a basic sand wave morphology with adjustable peak features is generated; The superposition of sand wave patterns at multiple scales forms a composite sand wave height field; The composite sand wave height field is dynamically fused with the topographic height map; The surface normals are calculated based on the fusion results, and the rendering output is completed.
[0009] A second aspect of this application provides a real-time sand and sea rendering device, comprising: The global coordinate generation module is used to dynamically noise-perturb the world coordinates to generate the global coordinates of the desert. A local coordinate generation module is used to map the global coordinates to a periodic local coordinate space to obtain local coordinates; The basic morphology generation module is used to generate a basic morphology of sand waves with adjustable peak features based on the local coordinates. The overlay module is used to overlay sand wave patterns at multiple scales to form a composite sand wave height field; The fusion module is used to dynamically fuse the composite sand wave height field with the topographic height map; The rendering module is used to calculate surface normals based on the fusion results and complete the rendering output.
[0010] A third aspect of this application provides an electronic device including a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the electronic device implements the real-time sand and sea rendering method provided in the first aspect of this application.
[0011] A fourth aspect of this application provides a computer program product including a computer program that, when run, causes the method described in the first aspect of this application to be performed.
[0012] The real-time sand sea rendering method provided in the first aspect of this application generates global coordinates for the sand sea by dynamically perturbing world coordinates; maps the global coordinates to a periodic local coordinate space to obtain local coordinates; generates a basic sand wave morphology with adjustable peak features based on the local coordinates; superimposes sand wave morphologies at multiple scales to form a composite sand wave height field; dynamically fuses the composite sand wave height field with a topographic height map; calculates surface normals based on the fusion result and completes the rendering output. It can realistically represent the flow of sand waves while highly integrating with elements such as topographic height maps and masking maps, and simultaneously supports multi-scale detail control and performance optimization. It can meet the needs of games, film and television, and other fields that prioritize both high-quality terrain representation and real-time performance.
[0013] It is understood that the beneficial effects of the second to fourth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description
[0014] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0015] Figure 1 This is a schematic flowchart of a real-time sand and sea rendering method provided in an embodiment of this application; Figure 2 This is a schematic diagram of the structure of the real-time sand and sea rendering device provided in the embodiments of this application; Figure 3 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0016] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0017] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0018] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0019] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."
[0020] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0021] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0022] This application provides a real-time sand sea rendering method for large-scale open-world scenes. Addressing the problems of stiff dynamic sand wave movement, low noise sampling efficiency, and high overhead in traditional methods, it incorporates dynamic sand wave generation, controllable hard and soft sand wave peaks, efficient noise sampling, terrain composite mapping technology, and zero-overhead hole-cutting optimization. By introducing dynamic Burmester noise perturbation, multi-frequency sand wave synthesis, controllable peak morphology construction, and terrain interaction, a sand sea rendering effect with natural undulations and realistic dynamics is achieved. This method is suitable for real-time graphics rendering systems requiring the generation of natural landscapes and dynamic terrain, such as virtual reality, 3D terrain simulation, game engines, and film visualization.
[0023] like Figure 1 As shown, the real-time sand and sea rendering method provided in this application embodiment includes the following steps S101 to S106: Step S101: Perform dynamic noise perturbation processing on the world coordinates to generate the global coordinates of the sand sea; Step S102: Map the global coordinates to a periodic local coordinate space to obtain the local coordinates; Step S103: Based on local coordinates, generate the basic morphology of sand waves with adjustable peak features; Step S104: Superimpose sand wave patterns of multiple scales to form a composite sand wave height field; Step S105: Dynamically fuse the composite sand wave height field with the topographic height map; Step S106: Calculate the surface normals based on the fusion results and complete the rendering output.
[0024] This application's embodiments generate global coordinates through dynamic noise perturbation, mapping macroscopic terrain to periodic local space to construct a basic sand wave morphology with adjustable peak features, and then superimposing multi-scale sand waves to form a composite height field. This solves the problem of traditional static height maps lacking a sense of movement and avoids the physical distortion of sand wave structures in simple noise generation. Through the collaborative design of coordinate mapping and multi-scale fusion, dynamic movement effects are achieved while preserving the natural morphology of sand dunes, providing a technical foundation for large-scale open-world scenarios.
[0025] In one embodiment, step S101 includes: Step S1011: Add perturbation to the world coordinates using first-order Berlin noise.
[0026] In the application, the initial world coordinates are perturbed using first-order Burmester noise, making the sand waves appear irregular on a macroscopic scale: wp.x = wp.x + n0 × Lw × 2.0; where wp.x is the initial world coordinates, n0 is the four-way continuous first-order Burmester noise, and Lw is the wavelength of the sand waves.
[0027] Step S1012: Superimpose a second Berlin noise onto the world coordinates to form an S-shaped dune shape in the top view, wherein the second Berlin noise is translated over time on the x-axis of the world coordinates.
[0028] In the application, an additional Burmester noise, which is translated over time along the x-axis of the world coordinate system, is added. This second Burmester noise has a higher frequency than the Burmester noise used to add perturbation to the initial world coordinate system. The second Burmester noise is superimposed on the coordinate system to give the sand waves an S-shaped shape when viewed from the top view: wp.x = wp.x + n1 × L × 1.5; where n1 is the four-dimensional continuous second Burmester noise.
[0029] Step S1013: Introduce time parameters to translate the world coordinates to simulate the dynamic movement of sand waves.
[0030] In the application, the time factor is further superimposed to shift the coordinates and simulate the effect of sand waves moving forward: wp.x = wp.x + Time × _TimeMutiply; where Time is the time, and _TimeMutiply is a multiple of the time, i.e., the speed.
[0031] In the application, Berlin noise is used to perturb the world spatial coordinates, making the sand dunes appear as an "S"-shaped curve in the top view. By introducing a time parameter to dynamically translate the coordinates and noise, a dynamic sand wave effect with a sense of flow is formed, completing the global coordinate calculation of the sand sea.
[0032] This application's embodiments control sand wave morphology through dual-layered Berlin noise. The first layer of noise constructs the basic perturbation, while the second layer of high-frequency noise, combined with time translation, forms an S-shaped dune outline, breaking through the mechanical feel of traditional single-noise systems. The introduction of a time parameter synchronizes coordinate translation with noise evolution, achieving physical plausibility in sand wave flow. This layered perturbation mechanism naturally unifies macroscopic dune orientation with microscopic sand ripple changes, significantly enhancing the visual realism of dynamic sand seas.
[0033] In one embodiment, step S102 includes: Step S1021: Perform remainder processing on the global coordinates based on the sand wave wavelength and gap spacing; Step S1022: Map the remainder result to the [0,1] interval to obtain locally normalized coordinates; The wavelength range is mapped to the [0,1] range, and the gap range is fixed at 1.
[0034] In the application, the global coordinates are moduloed based on the wavelength and gap, and then the coordinate interval is transformed to [0,1], where the wavelength part is [0,1] and the gap part has a value of 1.
[0035] Then, the initial x-coordinate is transformed as follows: Localx=saturate(Fmod(x,l+cap) / l) ; Where Localx is the transformed local coordinate, used as the x-coordinate input for the dunes; saturate truncates the input value to the interval [0,1]; Fmod is the remainder; cap is the gap between the two dunes; and x is the initial x-coordinate. l The wavelength of the sand dune in space.
[0036] In the application, the global coordinates from the previous step are moduloed by the wavelength of the sand waves and the gap spacing, and the results are mapped to the [0,1] interval. Values within the wavelength interval are mapped to [0,1], while values within the gap interval are uniformly set to 1, thus achieving a controllable periodic dune distribution.
[0037] This application's embodiments discretize continuous terrain into periodic dune units through a modulo mapping of wavelength and gap spacing. Mapping the wavelength range to a continuous value range ensures the integrity of the dune morphology, while fixing the gap interval eliminates seams. This mapping mechanism makes the distribution of sand waves both regular and random, maintaining natural landform characteristics while reducing computational complexity and providing standardized input for subsequent sand wave morphology generation.
[0038] In one embodiment, step S103 includes: Step S1031: Based on local coordinates, fit the windward slope shape using the first cosine curve function and fit the leeward slope shape using the second cosine curve function; Step S1032: The cosine curves of the windward slope and the leeward slope are fused by a smooth interpolation algorithm to generate a basic sand wave morphology with adjustable peak characteristics. The smooth interpolation algorithm includes an adjustment factor that controls the softness or hardness of the peak.
[0039] In the application, the sand sea morphology is generated by using two cosine curves for interpolation to construct the basic shape of the sand waves. The interpolation method is minimum smooth interpolation. Adjusting the interpolation parameters can control the softness or hardness of the peaks, thus obtaining the basic height value of the sand sea.
[0040] This application employs hyperbolic fitting and controllable interpolation to construct sand wave profiles. The windward and leeward slopes are each fitted with independent cosine curves, and the two are connected by a smooth interpolation algorithm with adjustment factors, overcoming the limitation that traditional single curves cannot represent the asymmetrical characteristics of sand dunes. The adjustment factors directly control the softness and hardness of the peak transitions, allowing the sand wave morphology to adapt to different geological environment requirements and achieving a physically realistic feel that is artistically controllable.
[0041] In one embodiment, the first cosine curve function is: ; The second cosine curve function is: ; in, Let x be the coordinates on the x-axis. This represents the proportion of the peak inflection point of the dune waveform.
[0042] In application, the shape of sand dunes can be simplified into windward and leeward slopes, with the peak being the transition point between these two slopes. The transition at the peak can be adjusted to be soft or hard according to artistic requirements. The derivatives and heights of the sand wave curves are both zero at both ends, so there can be a seamless connection between any two sand dunes.
[0043] In this embodiment, the windward slope achieves a gentle ascent using the aforementioned formula, while the leeward slope constructs a steep descent using the same formula. The derivatives of the two functions at their endpoints are zero and their heights are consistent within the x∈[0,1] interval, ensuring seamless connection between dune units. This mathematical model accurately reproduces the dune profile characteristics formed by fluid dynamics while maintaining computational efficiency.
[0044] In one embodiment, the calculation formula for the smooth interpolation algorithm is: ; ; in, The basic morphological curve of the sand wave can be used to obtain the height of the dune cross section. The calculated smooth interpolation factor is... Let be the cosine function of the windward slope. For the leeward slope, the cosine function is... The adjustment factor is used to control the hardness or softness of the peak, with a range of [1e-6,1]. When it approaches 0, it is hard, and when it approaches 1, it is soft. To truncate the input value to between 0 and 1, Linear interpolation is used. The interpolation curve is continuous and its first derivative is 0, ensuring seamless splicing between dunes. After smoothing the interpolation using a smoothing interpolation algorithm, the cross-sectional height of the dunes is obtained. Using texture sampling as input, k allows artists to define the hardness of the dune peaks in different locations.
[0045] In the application, the final dune curve is obtained by smoothing the two cosine curves of the windward and leeward slopes through interpolation. The purpose is to merge the two curves and make the peak of the dune wave controllable.
[0046] In one embodiment, step S104 includes: Step S1041: Generate sand wave patterns of at least three scales (large, medium, and small) based on different wavelength parameters, and calculate the maximum height of sand waves at each scale.
[0047] In applications, the height of the sand wave crest is calculated based on the wavelength, generating sand waves of three different wavelengths (large, medium, and small) for mixing. The formula for calculating the maximum height of the sand wave based on wavelength is: PeakHeight=1.35×L×(1-Xm) / PI×hs; Where PeakHeight is the maximum height of the wave, PI is pi, and hs is the height multiple.
[0048] Using three parameters for different wavelengths, sand waves of three different wavelengths (large, medium, and small) were calculated. The standard height of each wavelength was then obtained by multiplying it by its maximum height.
[0049] Step S1042: Generate a first hybrid mask based on the height of large-scale sand waves and the maximum height value, and use the first hybrid mask to fuse large-scale and medium-scale sand waves.
[0050] In the application, the calculation of the mask used to blend large and medium waves utilizes the maximum height of the large waves to make the medium waves more likely to appear at the bottom of the large waves: BlendMask0=smoothstep(0.45,0.7,n2)×pow(1.0-h0 / PeakHeight0,2); Where BlendMask0 is the first blending mask used to blend large and medium waves, smoothstep is the smoothing interpolation function; n2 is the Berlin noise used to generate the first blending mask, pow is the exponential function, h0 is the height of the large wave, and PeakHeight0 is the height of the peak of the large wave.
[0051] Using the first hybrid mask to perform linear interpolation on the large and medium waves, we obtained sand waves with varying heights, and some medium waves would randomly appear at the bottom of the large waves.
[0052] Step S1043: Use high-frequency noise to disturb small-scale sand waves, and use sand wave trough masking for secondary fusion.
[0053] In the application, the small waves are multiplied by a high-frequency Burmester noise, giving them varying heights. The troughs of the height obtained in the previous step are then used as masks to be incorporated into the small waves, thus completing the calculation of the sand wave height.
[0054] In the application, sand waves of three scales—large, medium, and small—are generated based on different wavelengths, and their maximum height values are calculated using a waveform height formula. A noise-controlled hybrid mask is then used to fuse the three, resulting in a multi-frequency sand wave height map with rich layers and natural variations.
[0055] This application establishes a multi-scale sand wave fusion mechanism. By generating a hybrid mask based on the height and peak value of large waves, medium waves are naturally distributed at the bottom of large waves. Small waves are further fused by a wave trough mask after being disturbed by high-frequency noise. The three-level wavelength mixing simulates the energy spectrum distribution of real sand seas, solving the problem of lack of layering at a single scale and significantly reducing the computational cost of multi-frequency noise superposition.
[0056] In one embodiment, step S105 includes: Step S1051: Obtain the terrain height map and the multi-channel mask map. The first channel of the multi-channel mask map stores the terrain feature distance field data, the second channel stores the sand wave height adjustment coefficient, and the third channel stores the hole mask data.
[0057] In this application, the terrain is undulating. To eliminate sand dunes in certain areas, a mask map is used for blending. The mask map also controls the height of sand dunes in different areas and enables the function of digging holes in the sand. A composite texture map is used, integrated together as a mask map, with R, G, and B maps each having different functions: The R channel stores the distance field map from the terrain to the reef; The G channel is the wave height coefficient used to adjust the amplitude; Channel B is a hole-covered area.
[0058] Step S1052: Superimpose the composite sand wave height field onto the terrain height based on the multi-channel masking map; wherein, the fusion boundary between the sand wave and terrain obstacles is determined based on the distance field data, the sand wave amplitude is dynamically adjusted based on the height adjustment coefficient, and illegal height values are marked on the vertices of the specified area based on the hole masking data.
[0059] Step S1053: Automatically remove vertices with illegal height values using graphics hardware to complete dynamic fusion.
[0060] In applications, "hole-punching" involves marking the world position offset of a vertex as an invalid value, triggering hardware culling of vertices with invalid values. This avoids the reduced rendering efficiency of using mask materials while achieving the same desired effect.
[0061] In the application, the sampling terrain height map and multi-channel mask map are used to overlay the sand wave height onto the actual terrain, achieving dynamic fusion of the sand sea and the terrain. At the same time, the mask map is used to control the distribution range, height weight, and representation of special areas (such as depressions and cavities) of the sand waves.
[0062] This application embodiment controls the merging boundary between sand waves and obstacles through the distance field in a multi-channel masking image, dynamically adjusts the amplitude of the height coefficient, and triggers GPU culling by marking illegal vertices in the hole-punching mask. This design combines artistic control, physical simulation, and hardware acceleration to achieve dynamic hole punching and terrain adaptation with zero rendering overhead, overcoming the performance bottleneck of masking rendering in traditional solutions.
[0063] In one embodiment, step S106 includes: Step S1061: After offsetting the X-axis and Y-axis directions in the world coordinate system, calculate the height and calculate the normal through vector cross product.
[0064] In the application, the world space coordinates are offset by a value in the horizontal X and Y directions, and then the height is calculated separately. The cross product can be used to calculate the normal. The height and normal can be used to render the final sand sea effect.
[0065] Step S1062: Based on the fused height and the calculated normal, perform lighting rendering and visual output for the desert.
[0066] In the application, the lighting is calculated using the previously obtained normals, employing the engine's built-in PBR lighting model. The composite height of the sand waves and terrain, superimposed with S1053, is used to change the position of the mesh vertices, modifying only the vertical displacement of the vertices. Then, a shimmering effect for the sand particles is added. The mesh is divided using world coordinates, and each mesh is randomly filled with a color. Finally, the random color is multiplied by the camera vector to obtain a random grayscale value related to the viewpoint. This grayscale value is then raised to the power of 10 to obtain the shimmering effect for the sand particles, thus completing the sand sea rendering.
[0067] This application's embodiment captures the differential changes in the height field through dual-axis offset sampling, and accurately restores the surface normal direction through cross product calculation. This avoids the distortion problems of traditional normal maps in dynamic terrain, ensuring that the lighting and shadows of sand dunes change with their shape in real time, and providing geometrically correct lighting input for PBR rendering.
[0068] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0069] This application also provides a real-time sand and sea rendering device for executing the steps described in the above-described real-time sand and sea rendering method embodiments. The real-time sand and sea rendering device can be a virtual appliance within an electronic device, run by the electronic device's processor, or it can be the electronic device itself.
[0070] like Figure 2 As shown, the real-time sand and sea rendering device 100 provided in this application embodiment includes: The global coordinate generation module 101 is used to perform dynamic noise perturbation processing on the world coordinates to generate the global coordinates of the sand sea. The local coordinate generation module 102 is used to map global coordinates to a periodic local coordinate space to obtain local coordinates; The basic morphology generation module 103 is used to generate the basic morphology of sand waves with adjustable peak features based on local coordinates. The superposition module 104 is used to superimpose sand wave patterns at multiple scales to form a composite sand wave height field; The fusion module 105 is used to dynamically fuse the composite sand wave height field with the topographic height map; Rendering module 106 is used to calculate surface normals based on the fusion result and complete the rendering output.
[0071] In applications, the modules in a real-time sand and sea rendering device can be software program modules, or they can be implemented through different logic circuits integrated in a processor, or they can be implemented through multiple distributed processors.
[0072] like Figure 3 As shown, this application embodiment also provides an electronic device 200, including: at least one processor 201 ( Figure 3 The diagram shows only one processor, memory 202, and computer program 203 stored in memory 202 and executable on at least one processor 201. When processor 201 executes computer program 203, it implements the steps in the various method embodiments described above.
[0073] In applications, electronic devices may include, but are not limited to, processors and memory. Those skilled in the art will understand that... Figure 3 This is merely an example of an electronic device and does not constitute a limitation on the electronic device. It may include more or fewer components than shown, or a combination of certain components, or different components.
[0074] In applications, the processor can be a Central Processing Unit (CPU), but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0075] In applications, memory can be an internal storage unit of an electronic device in some embodiments, such as a hard drive or RAM. In other embodiments, memory can be an external storage device of the electronic device, such as a plug-in hard drive, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card. Furthermore, memory can include both internal and external storage units of the electronic device. Memory is used to store operating systems, applications, bootloaders, data, and other programs, such as program code for computer programs. Memory can also be used to temporarily store data that has been output or will be output.
[0076] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.
[0077] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments 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. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0078] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps described in the various method embodiments above.
[0079] This application provides a computer program product, including a computer program, which, when run on an electronic device, enables the electronic device to perform the steps described in the various method embodiments above.
[0080] 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, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. A computer-readable medium can include at least: any entity or device capable of carrying computer program code to a device / electronic device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.
[0081] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0082] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0083] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0084] 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 network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0085] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A real-time sand sea rendering method, characterized in that, include: Dynamic noise perturbation is applied to the world coordinates to generate the global coordinates of the desert. The global coordinates are mapped to a periodic local coordinate space to obtain the local coordinates; Based on the local coordinates, a basic sand wave morphology with adjustable peak features is generated; The superposition of sand wave patterns at multiple scales forms a composite sand wave height field; The composite sand wave height field is dynamically fused with the topographic height map; The surface normals are calculated based on the fusion results, and the rendering output is completed.
2. The real-time sand sea rendering method as described in claim 1, characterized in that, The process of dynamically noise-perturbing the world spatial coordinates to generate the global coordinates of the sand sea includes: Add perturbation to the world coordinates using first-order Berlin noise; A second Berlin noise is superimposed on the world coordinates to form an S-shaped dune shape in the top view, wherein the second Berlin noise is translated over time on the x-axis of the world coordinates; A time parameter is introduced to translate the world coordinates to simulate the dynamic movement of sand waves.
3. The real-time sand sea rendering method as described in claim 1, characterized in that, The step of mapping the global coordinates to a periodic local coordinate space to obtain local coordinates includes: The global coordinates are moduloed based on the sand wave wavelength and the gap spacing. Mapping the remainder result to the [0,1] interval yields locally normalized coordinates; The wavelength range is mapped to the [0,1] range, and the gap range is fixed at 1.
4. The real-time sand sea rendering method as described in claim 1, characterized in that, The generation of the basic morphology of sand waves with adjustable peak features based on the local coordinates includes: Based on the local coordinates, the windward slope morphology is fitted using a first cosine curve function, and the leeward slope morphology is fitted using a second cosine curve function. By fusing the cosine curves of the windward and leeward slopes using a smooth interpolation algorithm, a basic sand wave morphology with adjustable peak characteristics is generated. The smooth interpolation algorithm includes an adjustment factor that controls the softness or hardness of the peak.
5. The real-time sand sea rendering method as described in claim 4, characterized in that, The first cosine curve function is: ; The second cosine curve function is: ; in, Let x be the coordinates on the x-axis. This represents the proportion of the peak inflection point of the dune waveform.
6. The real-time sand sea rendering method as described in claim 4, characterized in that, The calculation formula for the smooth interpolation algorithm is as follows: ; ; in, This is the basic shape curve of the sand wave. The calculated smooth interpolation factor is... Cos is the cosine function of the windward slope. For the leeward slope, the cosine function is... This is an adjustment factor used to control the hardness or softness of the peak. To truncate the input value to between 0 and 1, This is a linear interpolation.
7. The real-time sand sea rendering method as described in claim 1, characterized in that, The superimposed sand wave morphologies at multiple scales form a composite sand wave height field, including: Based on different wavelength parameters, at least three scales of sand wave morphology (large, medium, and small) are generated, and the maximum height of sand waves at each scale is calculated. A first hybrid mask is generated based on the height of large-scale sand waves and the maximum height value, and the first hybrid mask is used to fuse large-scale and medium-scale sand waves. High-frequency noise is used to disturb small-scale sand waves, and secondary fusion is performed using sand wave trough masking.
8. The real-time sand sea rendering method as described in claim 1, characterized in that, The dynamic fusion of the composite sand wave height field with the topographic height map includes: Obtain a terrain height map and a multi-channel mask map. The first channel of the multi-channel mask map stores terrain feature distance field data, the second channel stores sand wave height adjustment coefficient, and the third channel stores hole mask data. The composite sand wave height field is superimposed onto the terrain height based on the multi-channel masking map; wherein, the fusion boundary between the sand wave and terrain obstacles is determined based on the distance field data, the sand wave amplitude is dynamically adjusted based on the height adjustment coefficient, and illegal height values are marked on the vertices of the specified area based on the hole masking data. Dynamic fusion is achieved by automatically removing vertices with illegal height values using graphics hardware.
9. The real-time sand sea rendering method as described in claim 1, characterized in that, The process of calculating surface normals based on the fusion results and completing the rendering output includes: The height is calculated after offsetting the X and Y axes in the world coordinate system, and the normal is calculated by vector cross product. Based on the fused height and the calculated normal, the lighting rendering and visual output of the desert are performed.
10. An electronic device, characterized in that, The device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, characterized in that, when the processor executes the computer program, the electronic device performs the method as described in any one of claims 1-9.
