A virtual sand ground interaction rendering method, device, equipment and medium

By adjusting the optical properties of sand particles and combining them with ambient lighting, the interaction location and intensity are accurately positioned, and the interaction traces and accumulation effects are simulated. This solves the problems of inconsistent lighting and discontinuous traces in traditional virtual sand rendering, and improves the realism of virtual sand and the user experience.

CN121070505BActive Publication Date: 2026-02-24JIANGXI UNIVERSITY OF FINANCE AND ECONOMICS
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511604874.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-05
Publication Date
2026-02-24
Estimated Expiration
2045-11-05

AI Technical Summary

Technical Problem

Traditional virtual sand rendering technology cannot achieve consistent sand lighting effects with the environment, resulting in a lack of realism, discontinuous interaction traces, and a reduced user experience.

Method used

By adjusting the surface optical properties of sand particles and combining ambient lighting information to render visual changes in real time, the interaction position and intensity are accurately located, simulating interaction traces and accumulation effects, and visual continuity is maintained through interpolation algorithms.

Benefits of technology

It achieves dynamic changes in the reflected light of sand grains with ambient light, and continuous display of interactive traces, enhancing the visual realism and physical consistency of the virtual sand dune and improving the user's interactive experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121070505B_ABST
    Figure CN121070505B_ABST
Patent Text Reader

Abstract

The application provides a virtual sand ground interaction rendering method and device, equipment and medium, wherein a scene containing a virtual character and a virtual sand ground is displayed through a graphical interface of an electronic device, the method comprises: based on the surface optical property parameters of the sand particles in the virtual sand ground, combining the ambient light information to calculate and render the visual change effect of the virtual sand ground under dynamic light in real time; in response to the interaction event between the virtual character and the virtual sand ground, determining the interaction position and the interaction intensity of the interaction event, simulating the interaction trace effect and the sand particle accumulation effect of the virtual sand ground based on the interaction position and the interaction intensity; determining the space mapping parameters based on the displacement change of the virtual character between adjacent frames, and mapping the historical interaction trace data to the graphical interface according to the space mapping parameters through an interpolation algorithm, so as to maintain the visual continuity. The above scheme is adopted to improve the realism of the virtual sand ground interaction rendering, and further improve the experience of the user in the virtual reality scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer rendering, and more specifically, to a virtual sand interactive rendering method, apparatus, device, and medium. Background Technology

[0002] In game development and virtual reality scene construction, interactive sand effects have received widespread attention as a key element in enhancing scene realism and user experience. Traditional virtual sand solutions mainly rely on static textures and fixed lighting to achieve basic visual effects. This involves covering the terrain surface with pre-made dune textures and calculating light and shadow effects using fixed lighting parameters. In terms of interactivity, traditional sand interactions only provide false feedback through pre-made static textures or simple animations. For example, switching the texture pattern on the sand surface to simulate "footprints" or playing a preset animation of a character's feet contacting the sand.

[0003] However, research has found that traditional methods, which cover the terrain surface with pre-made dune textures and calculate lighting effects using fixed lighting parameters, lead to a disconnect between the sand's lighting effects and the dynamic environment. This results in sand grains failing to exhibit natural reflection and scattering differences as the angle and intensity of light change, lacking the shimmering effect of real sand grains under dynamic lighting, and producing a stiff and rigid visual appearance. Conversely, using pre-made static textures or simple animations to create artificial feedback results in interactive effects that contradict physical laws. Virtual characters cannot leave realistic depth accumulation marks when stepping on sand, nor do they exhibit the changes in the aggregate shape of sand grains after compression. The interactive traces lack continuity and realism, thus reducing the user's experience of realistic interaction in virtual reality scenarios. Summary of the Invention

[0004] In view of this, the purpose of the present invention is to provide a virtual sand interactive rendering method, apparatus, device and medium to improve the realism of virtual sand interactive rendering, thereby improving the user's experience of virtual sand interaction in virtual reality scenes.

[0005] In a first aspect, embodiments of this application provide a virtual sand interactive rendering method, which displays a scene including virtual characters and a virtual sand area through a graphical interface of an electronic device. The method includes:

[0006] Based on the surface optical property parameters of the sand grains in the virtual sandy area, combined with the ambient lighting information, the visual changes of the virtual sandy area under dynamic lighting are calculated and rendered in real time.

[0007] In response to the interaction event between the virtual character and the virtual sand, the interaction location and interaction intensity of the interaction event are determined, and the interaction trace effect and sand accumulation effect of the virtual sand are simulated based on the interaction location and interaction intensity.

[0008] Based on the displacement changes of the virtual character between adjacent frames, spatial mapping parameters are determined. Historical interaction trace data are then mapped to the graphical interface using an interpolation algorithm according to the spatial mapping parameters to maintain visual continuity.

[0009] Optionally, the step of calculating and rendering the visual changes of the virtual sand dune under dynamic lighting in real time based on the surface optical property parameters of the sand grains in the virtual sand dune and combined with ambient lighting information includes:

[0010] For the sand grain material in the virtual sandy area, its surface optical property parameters are adjusted, including reflectivity and roughness, to simulate the reflection and scattering characteristics of sand grains on light.

[0011] The Unreal Engine's real-time global illumination system is used to obtain the overall lighting distribution data of the scene, and the reflected light information of the surrounding environment is captured by the reflection probe and integrated to form the ambient lighting information.

[0012] By dynamically calculating the reflectivity and roughness parameters of the sand material in conjunction with the ambient lighting information, the reflected light from the sand particles is naturally integrated with the ambient light, and the natural shimmering effect of the sand particles under dynamic lighting is rendered and presented in real time to enhance the visual realism of the virtual sand.

[0013] Optionally, determining the interaction location and interaction intensity of the interaction event includes:

[0014] A ray is emitted onto the surface of the virtual sandy area using a preset component. Based on the ray detection results, the collision coordinates between the interactive part of the virtual character and the surface of the sandy area are determined, and the collision coordinates are used as the interactive position.

[0015] The depth of the depression corresponding to the interaction is calculated based on the height difference between the sand surface and the interaction area. The depression depth is then corrected by range limitation processing, and the corrected depression depth is used as an indicator to quantify the intensity of the interaction.

[0016] Optionally, simulating the interaction traces effect of the virtual sand based on the interaction location and interaction intensity includes:

[0017] Sand deformation data containing depth information is generated at the interaction location, wherein the sand deformation data corresponds to the depression depth of the interaction intensity;

[0018] The sand deformation data is stored in a rendering target using the raw32 format to record the depth information of the interaction position with high precision.

[0019] When multiple sand deformation data writing operations occur at the same interaction location, the written sand deformation data are processed using the maximum value superposition rule, retaining only the maximum depth value at the location to simulate the physical characteristics of accumulated interaction traces.

[0020] Optionally, simulating the sand accumulation effect of the virtual sand dune based on the interaction location and the interaction intensity includes:

[0021] Using virtual height field mesh technology, the sand mesh near the virtual character is subdivided in a targeted manner, and the vertices of the subdivided mesh are offset upward based on the depth data in the rendering target to form a raised shape after the sand grains are accumulated.

[0022] Read the depth value from the rendering target and apply the height offset, then merge the stacking effect of the raised shape with the original terrain height map through multiplication.

[0023] The rendering target is converted into a normal map using Unreal Engine's built-in nodes, and the normal intensity is adjusted to enhance the realism of the lighting and shadow details in the sand accumulation area.

[0024] Optionally, determining the spatial mapping parameters based on the displacement changes of the virtual character between adjacent frames includes:

[0025] Calculate the difference between the current frame position and the previous frame position of the virtual character to obtain the displacement change data between adjacent frames;

[0026] The displacement change data is pixel-aligned based on the sand accuracy parameters.

[0027] The UV offset in texture space is calculated based on the displacement change data after pixel alignment processing, and the UV offset is used as the space mapping parameter.

[0028] Optionally, mapping the historical interaction trace data to the graphical interface using an interpolation algorithm according to the spatial mapping parameters includes:

[0029] Call the rendering target that stores historical sand interaction trace data, and perform a UV coordinate translation operation on the historical interaction trace data in the rendering target based on the spatial mapping parameters, so that the historical data shifts synchronously with the displacement of the virtual character;

[0030] An interpolation algorithm is used to sample and calculate the historical interaction trace data after translation in order to eliminate the visual discontinuity generated during the data translation process;

[0031] The interpolated historical interaction trace data is written into a new display area of ​​the graphical interface to ensure that the sand interaction traces remain clear and continuous in the new area when the virtual character moves.

[0032] Secondly, embodiments of this application provide a virtual sand interactive rendering device. The device is installed in an electronic device and displays a scene including virtual characters and a virtual sand area through the graphical interface of the electronic device. The device includes:

[0033] The first rendering module is used to calculate and render the visual changes of the virtual sand under dynamic lighting in real time based on the surface optical property parameters of the sand particles in the virtual sand and combined with the ambient lighting information.

[0034] The second rendering module is used to respond to the interaction event between the virtual character and the virtual sand, determine the interaction position and interaction intensity of the interaction event, and simulate the interaction trace effect and sand accumulation effect of the virtual sand based on the interaction position and interaction intensity.

[0035] The third rendering module is used to determine the spatial mapping parameters based on the displacement changes of the virtual character between adjacent frames, and to map the historical interaction trace data to the graphical interface according to the spatial mapping parameters through an interpolation algorithm to maintain visual continuity.

[0036] Optionally, the step of calculating and rendering the visual changes of the virtual sand dune under dynamic lighting in real time based on the surface optical property parameters of the sand grains in the virtual sand dune and combined with ambient lighting information includes:

[0037] For the sand grain material in the virtual sandy area, its surface optical property parameters are adjusted, including reflectivity and roughness, to simulate the reflection and scattering characteristics of sand grains on light.

[0038] The Unreal Engine's real-time global illumination system is used to obtain the overall lighting distribution data of the scene, and the reflected light information of the surrounding environment is captured by the reflection probe and integrated to form the ambient lighting information.

[0039] By dynamically calculating the reflectivity and roughness parameters of the sand material in conjunction with the ambient lighting information, the reflected light from the sand particles is naturally integrated with the ambient light, and the natural shimmering effect of the sand particles under dynamic lighting is rendered and presented in real time to enhance the visual realism of the virtual sand.

[0040] Optionally, determining the interaction location and interaction intensity of the interaction event includes:

[0041] A ray is emitted onto the surface of the virtual sandy area using a preset component. Based on the ray detection results, the collision coordinates between the interactive part of the virtual character and the surface of the sandy area are determined, and the collision coordinates are used as the interactive position.

[0042] The depth of the depression corresponding to the interaction is calculated based on the height difference between the sand surface and the interaction area. The depression depth is then corrected by range limitation processing, and the corrected depression depth is used as an indicator to quantify the intensity of the interaction.

[0043] Optionally, simulating the interaction traces effect of the virtual sand based on the interaction location and interaction intensity includes:

[0044] Sand deformation data containing depth information is generated at the interaction location, wherein the sand deformation data corresponds to the depression depth of the interaction intensity;

[0045] The sand deformation data is stored in a rendering target using the raw32 format to record the depth information of the interaction position with high precision.

[0046] When multiple sand deformation data writing operations occur at the same interaction location, the written sand deformation data are processed using the maximum value superposition rule, retaining only the maximum depth value at the location to simulate the physical characteristics of accumulated interaction traces.

[0047] Optionally, simulating the sand accumulation effect of the virtual sand dune based on the interaction location and the interaction intensity includes:

[0048] Using virtual height field mesh technology, the sand mesh near the virtual character is subdivided in a targeted manner, and the vertices of the subdivided mesh are offset upward based on the depth data in the rendering target to form a raised shape after the sand grains are accumulated.

[0049] Read the depth value from the rendering target and apply the height offset, then merge the stacking effect of the raised shape with the original terrain height map through multiplication.

[0050] The rendering target is converted into a normal map using Unreal Engine's built-in nodes, and the normal intensity is adjusted to enhance the realism of the lighting and shadow details in the sand accumulation area.

[0051] Optionally, determining the spatial mapping parameters based on the displacement changes of the virtual character between adjacent frames includes:

[0052] Calculate the difference between the current frame position and the previous frame position of the virtual character to obtain the displacement change data between adjacent frames;

[0053] The displacement change data is pixel-aligned based on the sand accuracy parameters.

[0054] The UV offset in texture space is calculated based on the displacement change data after pixel alignment processing, and the UV offset is used as the space mapping parameter.

[0055] Optionally, mapping the historical interaction trace data to the graphical interface using an interpolation algorithm according to the spatial mapping parameters includes:

[0056] Call the rendering target that stores historical sand interaction trace data, and perform a UV coordinate translation operation on the historical interaction trace data in the rendering target based on the spatial mapping parameters, so that the historical data shifts synchronously with the displacement of the virtual character;

[0057] An interpolation algorithm is used to sample and calculate the historical interaction trace data after translation in order to eliminate the visual discontinuity generated during the data translation process;

[0058] The interpolated historical interaction trace data is written into a new display area of ​​the graphical interface to ensure that the sand interaction traces remain clear and continuous in the new area when the virtual character moves.

[0059] Thirdly, embodiments of this application provide a computer device, including: a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the computer device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, the steps of the virtual sand interactive rendering method described in any of the optional embodiments of the second aspect above are performed.

[0060] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the virtual sand interactive rendering method described in any of the optional embodiments of the second aspect above.

[0061] The technical solution provided in this application includes, but is not limited to, the following beneficial effects:

[0062] This application uses the surface optical properties of sand grains in a virtual sandy area combined with ambient lighting information to render dynamic lighting effects in real time. By finely adjusting parameters such as reflectivity and roughness, the reflected light of the sand grains changes dynamically with the ambient lighting, accurately presenting the natural shimmering effect of the sand grains under different lighting conditions. This solves the problem of stiff lighting in traditional static textures and significantly enhances the visual realism of the virtual sandy area.

[0063] This application also responds to interactive events by simulating interactive traces and sand accumulation effects. It accurately locates the interactive position and quantifies the interactive intensity through ray detection, and utilizes high-precision rendering target storage deformation data and maximum value superposition rules to achieve the "the deeper you step, the deeper the trace accumulation" characteristic. At the same time, through mesh subdivision, high blending and normal processing, it presents the natural accumulation shape of sand after being squeezed, making the interactive effect conform to the real physical laws and breaking through the limitations of traditional fake animation feedback.

[0064] This application also determines spatial mapping parameters based on character displacement and maps historical interaction traces. Pixel alignment processing ensures that displacement data matches texture accuracy, and interpolation algorithms eliminate visual breaks, so that historical traces are synchronously offset with character movement and continuously displayed in new areas. This solves the problems of easily broken traces and limited drawing areas in traditional solutions, and ensures the continuity of interaction traces and scene scalability.

[0065] This application optimizes the virtual sand dune's dynamic performance and interactive experience across three dimensions—visual realism, physical interaction rationality, and trace display continuity—through the aforementioned steps. This comprehensively enhances the realism of the virtual sand dune's interactive rendering, thereby improving the user's experience of interacting with the virtual sand dune in a virtual reality scenario.

[0066] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0067] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0068] Figure 1 The flowchart of a virtual sand interactive rendering method provided in Embodiment 1 of the present invention is shown;

[0069] Figure 2 A flowchart illustrating a visual change effect simulation provided in Embodiment 1 of the present invention is shown;

[0070] Figure 3 A flowchart of an interactive information determination method provided in Embodiment 1 of the present invention is shown;

[0071] Figure 4 The flowchart of an interaction trace effect simulation provided in Embodiment 1 of the present invention is shown;

[0072] Figure 5 A flowchart of a sand accumulation effect simulation method provided in Embodiment 1 of the present invention is shown;

[0073] Figure 6 A flowchart of a method for determining spatial mapping parameters provided in Embodiment 1 of the present invention is shown;

[0074] Figure 7 A flowchart of a spatial mapping parameter mapping method provided in Embodiment 1 of the present invention is shown;

[0075] Figure 8 This diagram illustrates the structure of a virtual sand interactive rendering device provided in Embodiment 2 of the present invention.

[0076] Figure 9 A schematic diagram of the structure of a computer device provided in Embodiment 3 of the present invention is shown. Detailed Implementation

[0077] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.

[0078] Example 1

[0079] To facilitate understanding of this application, the following is combined with... Figure 1 The flowchart of the virtual sand interactive rendering method provided in Embodiment 1 of the present invention will be described in detail for Embodiment 1 of this application.

[0080] This application provides a flowchart of a virtual sand interactive rendering method in Embodiment 1. See also... Figure 1 As shown, Figure 1 The flowchart of a virtual sand interactive rendering method provided in Embodiment 1 of the present invention is shown, wherein the method includes steps S101 to S103:

[0081] S101: Based on the surface optical property parameters of the sand particles in the virtual sandy area, combined with the ambient lighting information, calculate and render the visual changes of the virtual sandy area under dynamic lighting in real time.

[0082] Specifically, the core optical parameters of the sand material in the virtual sand area were finely adjusted: the reflectivity (controlling the intensity of light reflection by sand particles) and roughness (simulating light scattering caused by the irregularity of the sand surface) were optimized. By fine-tuning the parameters, the sand material was made to visually present the light reflection characteristics of particles, laying the foundation for subsequent lighting interaction.

[0083] Then, Unreal Engine 5's real-time global illumination system is used to obtain overall scene lighting distribution data (such as the intensity and direction of sunlight and ambient light). At the same time, reflection probe technology is used to capture reflected light information from the surrounding environment (such as reflected light data from surrounding objects and the skybox). The two types of data are integrated into complete ambient lighting information to ensure that the reflected light from the sand grains is consistent with the scene's ambient light.

[0084] Finally, by using real-time interactive calculations of the reflectivity and roughness parameters of sand particles and ambient lighting information, the differences in light reflection of sand particles under different lighting angles and intensities are simulated: when the lighting changes (such as the angle of sunlight moving or the intensity of ambient light changing), the reflected light of the sand particles dynamically adjusts with the ambient light, presenting a natural flickering effect (such as highlight flickering under strong light and soft scattering under weak light). Finally, the visual effect of sand under dynamic lighting is output through the Unreal Engine rendering pipeline.

[0085] S102: In response to the interaction event between the virtual character and the virtual sand, determine the interaction location and interaction intensity of the interaction event, and simulate the interaction trace effect and sand accumulation effect of the virtual sand based on the interaction location and interaction intensity.

[0086] Specifically, a detection ray is emitted to the virtual sand surface through a preset sand interaction detection component (such as the BP_SandBrush component, where BP_SandBrush is the name of a material detection component), and the collision coordinates of the virtual character's interactive parts (such as feet and tools) with the sand surface are captured in real time. This coordinate point is used as the interaction position to ensure that the spatial position of the interaction can be quantified and tracked.

[0087] The difference between the sand surface height and the height of the interaction area, obtained from ray detection, is converted into an interaction intensity index—the depression depth—using an algorithm. The specific calculation logic is: Depression depth = (Sand surface height - Interaction area height) / Scaling factor. The Clamp function (a tool used in various programming and style languages ​​to limit values ​​within a specified range) is then used to restrict the depression depth (e.g., limiting the depth to 0.0~0.2), ensuring that the intensity value conforms to the physical deformation characteristics of the sand and avoids exceeding a reasonable range.

[0088] When simulating interactive trace effects, sand deformation data containing depth information is generated at the interaction location (the depth value corresponds one-to-one with the depression depth of the interaction intensity), and this data is written into a render target using the raw32 format. The high precision of the raw32 format can completely preserve microscopic deformation details, ensuring the accuracy of the trace data.

[0089] When there are multiple interactions at the same location (such as multiple steps at the same location), the sand deformation data in the rendering target adopts the "maximum value" stacking rule: only the maximum depth value in the historical data written at that location is retained to ensure that the interaction traces show the cumulative effect of "the more you step, the deeper it gets", and to avoid shallow traces covering deep traces.

[0090] When simulating the effect of sand accumulation, virtual height field mesh technology is used to subdivide the sand mesh near the virtual character (to improve local accuracy), and the vertices of the subdivided mesh are offset upward based on the depth data in the rendering target to form the bulging shape after sand accumulation, which intuitively presents the spatial structure of the accumulation.

[0091] Read the depth value from the rendering target, calculate the actual height offset by "depth value × sand scaling factor (e.g., 0.1)," and merge the stacking effect with the original terrain height map through multiplication (using the rendering target as a mask to make the stacking area transition naturally with the original terrain), simulating the physical effect of "sand sinking after being stepped on - surrounding accumulation".

[0092] The rendering target is converted into a normal map by using Unreal Engine's built-in nodes, and the normal intensity is adjusted (e.g., reduced to 0.3) to enhance the lighting and shadow details of the stacked area. At the same time, the horizontal blurring and translation operation is performed on the rendering target every frame by the material M_SandFlow (material ball name) to simulate the sliding trend of sand grains under the action of gravity, making the stacking effect more natural.

[0093] S103: Based on the displacement changes of the virtual character between adjacent frames, spatial mapping parameters are determined, and historical interaction trace data are mapped to the graphical interface according to the spatial mapping parameters through an interpolation algorithm to maintain visual continuity.

[0094] Specifically, the difference between the current frame position and the previous frame position of the virtual character is obtained in real time to obtain displacement change data between adjacent frames (including movement distance and direction), which reflects the dynamic changes in the character's movement.

[0095] The displacement change data is pixel-aligned using sand accuracy parameters (e.g., 512 pixels / meter). The displacement difference is quantified using the formula Delta = Floor(Delta*512) / 512 to ensure the displacement data matches the pixel accuracy in the texture space. Delta is the data variable, and Floor is the name of the ground model (representing all ground attributes). Based on the processed displacement data, the UV offset in the texture space is calculated, and this UV offset is used as a spatial mapping parameter for coordinate transformation of historical data.

[0096] The rendering target storing historical trace data is invoked. Based on the UV offset, a UV coordinate translation operation is performed on the historical data in the rendering target (such as the return TextureSample(RT_SandSave,UV+UVOffset) logic of the material M_SandShift). return TextureSample is the command to restore the material sampling, RT_SandSave is the material surface texture name, and UV+UVOffset is the U-axis and V-axis textures and their offsets, so that the historical traces are synchronously offset with the character's movement. An interpolation algorithm is used to sample and calculate the translated historical data to eliminate the visual discontinuity caused by the data translation. Finally, the interpolated historical data is written to a new display area of ​​the graphical interface to ensure that the sand traces remain clear and continuous in the new area when the character moves.

[0097] The three steps of this application realize the complete process of virtual sand from static rendering to dynamic interaction and then to continuous display through the technical chain of optical parameters, lighting interaction, interactive positioning, trace accumulation, displacement mapping and trace continuity. The core relies on the high-precision storage of raw32 format rendering targets, deformation simulation of virtual height field mesh, and accurate positioning of UV coordinate mapping, and finally achieves a virtual sand interaction effect with strong realism and optimized performance.

[0098] In an optional implementation, see Figure 2 As shown, Figure 2 The flowchart of a visual change effect simulation provided in Embodiment 1 of the present invention is shown, wherein the step of calculating and rendering the visual change effect of the virtual sand under dynamic lighting in real time based on the surface optical property parameters of sand particles in the virtual sand and combined with ambient lighting information includes steps S201~S203:

[0099] S201: Adjust the surface optical property parameters of the sand particles in the virtual sandy area, wherein the surface optical property parameters include reflectivity and roughness, to simulate the reflection and scattering characteristics of sand particles on light.

[0100] Specifically, for the sand grain material in the virtual sand dune, the core surface optical property parameters are finely adjusted using the material editor. Reflectivity: controls the intensity of incident light reflected by the sand grains. The brightness of the highlight areas on the sand grain surface is adjusted by parameter values ​​(such as 0.1~0.3) to simulate the difference in reflectivity under different sand grain densities;

[0101] Roughness: Set the irregularity parameter of the sand grain surface (e.g., 0.6~0.8). By increasing the micro-unevenness of the surface, light is scattered on the sand grain surface, avoiding the plastic feel caused by single highlights and presenting natural granular light reflection characteristics.

[0102] The combination of the two simulates the reflection and scattering of light by sand grains from an optical perspective, providing basic material properties for subsequent lighting interactions.

[0103] S202: Utilizes Unreal Engine's real-time global illumination system to obtain overall scene lighting distribution data, and captures reflected light information from the surrounding environment through a reflection probe, integrating them to form ambient lighting information.

[0104] Specifically, the intensity, direction, and attenuation characteristics of main light sources such as sunlight and skylight in the scene are calculated in real time through Unreal Engine's real-time global illumination system, generating global illumination distribution data covering the entire sand scene.

[0105] Reflection probes are deployed at key locations in sandy environments to sample reflected light data from the surrounding environment (such as sand dunes, vegetation, and skyboxes), and to record the color and intensity of ambient light in different directions in order to capture reflected light information.

[0106] By merging global illumination distribution data and reflected light information into unified ambient illumination information, the integration of illumination information is achieved, ensuring that subsequent calculations of sand grain reflected light can match the actual illumination conditions of the scene and avoid illumination discrepancies.

[0107] S203: Through dynamic interactive calculation of the reflectivity and roughness parameters of the sand material and the ambient lighting information, the reflected light of the sand particles is naturally integrated with the ambient light, and the natural shimmering effect of the sand particles under dynamic lighting is rendered and presented in real time to enhance the visual realism of the virtual sand.

[0108] Specifically, light reflection logic is written in the material shader (compilable material) to dynamically calculate the reflectivity and roughness parameters of sand grains with ambient lighting information (such as light source direction and reflected light color), and to formulaically calculate the reflected light intensity of each pixel: reflected light intensity = ambient light intensity × reflectivity × (1 - roughness); where roughness affects the light scattering range and adjusts the diffusion degree of the highlight area.

[0109] By utilizing changes in the angle of illumination (such as the movement of sunlight) and fluctuations in ambient light intensity (such as cloud cover), the reflected light changes in real time: when the angle of light changes, the highlight position on the surface of the sand grain moves with the light source, presenting a visual effect of "dynamic flashing with the light".

[0110] The Unreal Engine rendering pipeline outputs the calculation results to the graphical interface in real time, making the virtual sand appear to shimmer naturally under dynamic lighting, thus enhancing the visual realism and immersion of the scene.

[0111] In an optional implementation, see Figure 3 As shown, Figure 3The flowchart of an interactive information determination method provided in Embodiment 1 of the present invention is shown, wherein determining the interaction position and interaction intensity of the interactive event includes steps S301-S302:

[0112] S301: A ray is emitted onto the surface of the virtual sandy area through a preset component. Based on the ray detection results, the collision coordinates between the interactive part of the virtual character and the surface of the sandy area are determined, and the collision coordinates are used as the interactive position.

[0113] Specifically, a ray detection module is bound to the interactive parts of the virtual character (such as the foot bone nodes). Each frame, vertical or oblique detection rays are emitted towards the virtual sand surface. The direction of the rays is consistent with the normal direction of the sand surface to ensure detection accuracy.

[0114] When the ray collides with the sand surface, the three-dimensional coordinate data (X, Y, Z axis coordinates) of the collision point are obtained through the Unreal Engine's collision detection interface. This coordinate point directly corresponds to the spatial position of the sand grain being interacted with.

[0115] The collision coordinates obtained from ray detection are used as interaction locations and stored in temporary variables to provide spatial positioning basis for the subsequent generation of sand deformation data.

[0116] S302: Calculate the depression depth corresponding to the interaction based on the height difference between the sand surface and the interaction part, correct the depression depth through range limitation processing, and use the corrected depression depth as an indicator to quantify the interaction intensity.

[0117] Specifically, based on the ray detection results, the height of the sand surface (Z-axis coordinate of the collision point) and the height of the virtual character's interactive part (Z-axis coordinate of the ray emission point) are extracted, and the difference between the two (height of the sand surface - height of the interactive part) is calculated. This difference reflects the potential depth of the interaction's compression of the sand.

[0118] The height difference is converted into the actual depression depth by using a preset scaling factor (such as 10.0). The formula is: Initial depression depth = (height of sand surface - height of interactive part) / scaling factor. This factor is used to balance visual effect and physical rationality, and to avoid the depth value being too large or too small.

[0119] The Clamp function is used to limit the initial depression depth (e.g., limit the depth range to 0.0~0.2) to ensure that the corrected depression depth conforms to the physical characteristics of sandy land (too shallow and the interaction effect cannot be reflected, too deep and the logic of real sand grain accumulation is violated). Finally, the corrected depression depth is used as the core indicator for quantifying the interaction intensity and is used to generate subsequent sandy land deformation data.

[0120] In an optional implementation, see Figure 4 As shown, Figure 4 The flowchart of an interaction trace effect simulation provided in Embodiment 1 of the present invention is shown, wherein simulating the interaction trace effect of the virtual sand based on the interaction location and interaction intensity includes steps S401~S403:

[0121] S401: Generate sand deformation data containing depth information at the interaction location, wherein the sand deformation data corresponds to the depression depth of the interaction intensity.

[0122] Specifically, the sand deformation data is based on depth information, and its numerical value corresponds one-to-one with the depth of the depression of the interaction intensity (e.g., when the depression depth is 0.1, the deformation data depth value is synchronously 0.1), ensuring that the data can directly reflect the degree of impact of the interaction on the sand.

[0123] At the coordinates of the interaction location, single-pixel or regional depth data is dynamically generated based on the depth of the depression. The data format is adapted to the precision requirements of the subsequent storage medium (rendering target), laying the foundation for high-precision recording.

[0124] S402: Store the sand deformation data in a rendering target using the raw32 format to record the depth information of the interaction position with high precision.

[0125] Specifically, the raw32 format is a 32-bit floating-point texture that supports high-precision storage of decimal places (such as millimeter-level depth differences). It can completely preserve the details of the micro-deformation of sand and avoid depth data loss or quantization errors caused by low-precision formats (such as 8-bit and 16-bit).

[0126] By using material or blueprint logic, the sand deformation data generated by S401 is written to the corresponding UV coordinates of the rendering target in real time (mapped to the world coordinates of the interaction position), ensuring that the spatial location of the data storage is accurately matched with the interaction position, and providing a data source for subsequent trace rendering.

[0127] S403: When there are multiple sand deformation data writing operations at the same interaction location, the written sand deformation data is processed by the superposition rule of taking the maximum value, and only the maximum depth value of the location is retained to simulate the physical characteristics of the accumulation of interaction traces.

[0128] Specifically, when multiple sand deformation data write operations occur at the same coordinate point, the current write depth value is compared with the historical depth values ​​already stored in the rendering target. Only the maximum value of the two is retained and updated in the rendering target. For example, if the first interaction writes a depth value of 0.05 and the second interaction writes a depth value of 0.1, then 0.1 is retained as the final depth value for that location.

[0129] This rule simulates the deformation characteristics of real sand – sand grains form depressions when stepped on, and subsequent steps can only deepen the depressions (rather than make them shallower), avoiding the unreasonable visual effect of shallow marks covering deep marks, and making the accumulation process of interactive marks consistent with the user's cognitive logic of real sand.

[0130] In an optional implementation, see Figure 5 As shown, Figure 5 The flowchart illustrates a method for simulating sand accumulation effects according to Embodiment 1 of the present invention, wherein simulating the sand accumulation effect of the virtual sand dune based on the interaction location and the interaction intensity includes steps S501-S503:

[0131] S501: Using virtual height field mesh technology, the sand mesh near the virtual character is subdivided in a targeted manner, and the vertices of the subdivided mesh are offset upward based on the depth data in the rendering target to form a raised shape after the sand grains are accumulated.

[0132] Specifically, for the sandy area near the virtual character (the area of ​​interaction influence), the basic sandy grid is subdivided using virtual height field grid technology to increase the local grid density (e.g., from 10m / grid to 1m / grid) to ensure the detail of the stacking effect; areas far from the character maintain a low-precision grid to balance performance and accuracy.

[0133] Based on the depth data (the depth of the depression at the interaction position) stored in the rendering target by S402, an upward offset operation is performed on the subdivided mesh vertices—the mesh vertices around the interaction position move upward along the normal direction, and the moving distance is positively correlated with the depth data (the greater the depth, the greater the offset), forming the natural shape of sand grains being squeezed and bulging outward, intuitively presenting the physical correspondence of "depression-accumulation".

[0134] S502: Read the depth value in the rendering target and apply the height offset, then merge the stacking effect of the raised shape with the original terrain height map through multiplication.

[0135] Specifically, the depth value of the interaction position is read from the rendering target, and the actual height offset is calculated by combining it with the sand scaling factor (such as 0.1). The formula is: Actual height offset = Rendering target depth value × Sand scaling factor. This factor is used to balance the visual effect and scene proportion to avoid the stacked height being too high or too low.

[0136] The calculated height offset is applied to the original terrain height map, and the accumulation effect is fused with the original terrain data through multiplication. The depth data in the rendering target is used as a mask to add the offset to the height value of the accumulation area on the basis of the original terrain, while the non-accumulation area retains the original terrain height. This ensures that the transition between the accumulation shape and the original terrain is smooth and without discontinuity, simulating the real physical change of sand grains "being stepped on and sinking, and then naturally accumulating around them".

[0137] S503: Convert the rendering target into a normal map using Unreal Engine's built-in nodes and adjust the normal intensity to enhance the realism of the lighting and shadow details in the sand accumulation area.

[0138] Specifically, the Normal From Height map node built into Unreal Engine (a node used to generate normal maps from height maps) is used to convert the rendering target (height map) storing the stacking effect into a normal map. The normal map accurately reflects the microscopic bumps and depressions of the stacked area (such as the slope changes of the raised edges) by recording the direction of the surface normals.

[0139] Reduce the intensity of the converted normals to a reasonable range (e.g., 0.3) to avoid overly sharp lighting and shadows due to excessively high intensity (or loss of detail due to excessively low intensity). The adjusted normal map makes the accumulated area present a natural transition of light and shadow under lighting—the raised areas are brighter on the lit side and darker on the shaded side, while the recessed areas form shadows, enhancing the three-dimensionality and light and shadow layering of the sand accumulation and improving the overall visual realism.

[0140] In an optional implementation, see Figure 6 As shown, Figure 6 The flowchart of a spatial mapping parameter determination method provided in Embodiment 1 of the present invention is shown, wherein determining the spatial mapping parameters based on the displacement change of the virtual character between adjacent frames includes steps S601 to S603:

[0141] S601: Calculate the difference between the current frame position and the previous frame position of the virtual character to obtain displacement change data between adjacent frames.

[0142] Specifically, each frame records the virtual character's world position coordinates (e.g., the current frame position and the previous frame position). The displacement change data is calculated using the coordinate difference, with the formula: Displacement change data = Current position - Last position. This data includes the distance and direction of the character's movement (e.g., horizontal displacement along the X and Y axes), providing a basis for the generation of subsequent spatial mapping parameters.

[0143] S602: Perform pixel alignment processing on the displacement change data by combining the sand accuracy parameters.

[0144] Specifically, a preset sand accuracy parameter (e.g., "512 pixels / meter") is used, which defines the mapping ratio between world space and texture space (1 meter corresponds to 512 pixels). The displacement change data is quantized using a formula to eliminate accuracy errors caused by sub-pixel displacement. The formula is: pixel-aligned displacement data = Floor(displacement change data × sand accuracy parameter) / sand accuracy parameter, where Floor is the name of the ground model (representing all ground attributes).

[0145] S603: Calculate the UV offset in texture space based on the displacement change data after pixel alignment processing, and use the UV offset as the space mapping parameter.

[0146] Specifically, the pixel-aligned displacement data is converted into UV offsets in texture space. The formula is: UV offset = pixel-aligned displacement data / sand area size, where "sand area size" is the range parameter of the virtual sand in world space (such as the canvas size defined by Vector2D), and Vector2D is the size on a two-dimensional vector. This ensures that the UV offset matches the coordinate range of texture space (UV coordinates are usually between 0 and 1).

[0147] The calculated UV offset is used as the final spatial mapping parameter. This parameter directly determines the translation direction and distance of the historical interaction trace data in the texture space, providing a precise coordinate transformation basis for the subsequent historical traces to move synchronously with the character.

[0148] In an optional implementation, see Figure 7 As shown, Figure 7 The flowchart illustrates a spatial mapping parameter mapping method provided in Embodiment 1 of the present invention, wherein the step of mapping historical interaction trace data to the graphical interface according to the spatial mapping parameters using an interpolation algorithm includes steps S701-S703:

[0149] S701: Call the rendering target that stores historical sand interaction trace data, and perform a UV coordinate translation operation on the historical interaction trace data in the rendering target based on the spatial mapping parameters, so that the historical data is synchronously offset with the displacement of the virtual character.

[0150] Specifically, the rendering target storing historical sand interaction trace data is invoked. This rendering target stores the depth information of the interaction traces recorded through steps S401 to S403. Based on the spatial mapping parameters (i.e., UV offsets) determined in S603, the UV coordinates of the historical interaction trace data in the rendering target are translated. This is specifically implemented through material logic (such as the M_SandShift material), with the core formula being: translated UV coordinates = original UV coordinates + UV offset.

[0151] This operation causes the position of historical trace data in texture space to shift synchronously with the displacement of the virtual character, ensuring that the relative positional relationship between the trace and the character remains consistent and avoiding the disconnection problem where the trace remains in the original position after the character moves.

[0152] S702: An interpolation algorithm is used to sample and calculate the historical interaction trace data after translation in order to eliminate the visual discontinuity generated during the data translation process.

[0153] Specifically, during the UV coordinate translation process, if the displacement amount does not fully match the pixel precision (even after S602 pixel alignment processing, rapid movement may still produce slight deviations), it may cause the data connection between adjacent pixels to be inconsistent, forming visual discontinuities (such as jagged edges or gaps appearing on the trace edges).

[0154] Bilinear or trilinear interpolation algorithms are used to sample and calculate the historical interaction trace data after translation. The interpolation algorithm generates smooth data for the transition region by weighted averaging the depth values ​​of adjacent pixels, filling the pixel gaps and making the trace edges transition naturally from sharp to blurred, eliminating discontinuities. For example, the final depth value of the current pixel is obtained by weighted calculation of the depth values ​​of the four adjacent pixels around the UV coordinates after translation, ensuring data continuity.

[0155] S703: The interpolated historical interaction trace data is written to a new display area of ​​the graphical interface to ensure that the sand interaction traces remain clear and continuous in the new area when the virtual character moves.

[0156] Specifically, the interpolated historical interaction trace data is written into a new display area of ​​the graphical interface (i.e., the field of view after the character moves). This area is associated with the character's current position to ensure that the traces are always within the visible range.

[0157] By updating the writing logic in real time, the trace data of the new display area is seamlessly connected with the historical data. When the character moves, the traces in the old area gradually fade out of the view as the character moves, and the traces in the new area are generated synchronously with the interpolation process. In the end, the visual effect of character movement - trace following - continuous display is presented, which solves the problems of limited drawing area and easy breakage of traces in traditional solutions.

[0158] Example 2

[0159] See Figure 8 As shown, Figure 8 A schematic diagram of a virtual sand interactive rendering device provided in Embodiment 2 of the present invention is shown. The device is installed in an electronic device and displays a scene including virtual characters and a virtual sand area through the graphical interface of the electronic device. The device includes:

[0160] The first rendering module 801 is used to calculate and render the visual change effect of the virtual sand under dynamic lighting in real time based on the surface optical property parameters of the sand particles in the virtual sand and combined with the ambient lighting information.

[0161] The second rendering module 802 is used to respond to the interaction event between the virtual character and the virtual sand, determine the interaction position and interaction intensity of the interaction event, and simulate the interaction trace effect and sand accumulation effect of the virtual sand based on the interaction position and interaction intensity.

[0162] The third rendering module 803 is used to determine the spatial mapping parameters based on the displacement changes of the virtual character between adjacent frames, and to map the historical interaction trace data to the graphical interface according to the spatial mapping parameters through an interpolation algorithm in order to maintain visual continuity.

[0163] In an optional implementation, the step of calculating and rendering the visual changes of the virtual sand dune under dynamic lighting in real time based on the surface optical property parameters of the sand grains in the virtual sand dune and in combination with ambient lighting information includes:

[0164] For the sand grain material in the virtual sandy area, its surface optical property parameters are adjusted, including reflectivity and roughness, to simulate the reflection and scattering characteristics of sand grains on light.

[0165] The Unreal Engine's real-time global illumination system is used to obtain the overall lighting distribution data of the scene, and the reflected light information of the surrounding environment is captured by the reflection probe and integrated to form the ambient lighting information.

[0166] By dynamically calculating the reflectivity and roughness parameters of the sand material in conjunction with the ambient lighting information, the reflected light from the sand particles is naturally integrated with the ambient light, and the natural shimmering effect of the sand particles under dynamic lighting is rendered and presented in real time to enhance the visual realism of the virtual sand.

[0167] In an optional implementation, determining the interaction location and intensity of the interaction event includes:

[0168] A ray is emitted onto the surface of the virtual sandy area using a preset component. Based on the ray detection results, the collision coordinates between the interactive part of the virtual character and the surface of the sandy area are determined, and the collision coordinates are used as the interactive position.

[0169] The depth of the depression corresponding to the interaction is calculated based on the height difference between the sand surface and the interaction area. The depression depth is then corrected by range limitation processing, and the corrected depression depth is used as an indicator to quantify the intensity of the interaction.

[0170] In an optional implementation, simulating the interaction traces effect of the virtual sand based on the interaction location and interaction intensity includes:

[0171] Sand deformation data containing depth information is generated at the interaction location, wherein the sand deformation data corresponds to the depression depth of the interaction intensity;

[0172] The sand deformation data is stored in a rendering target using the raw32 format to record the depth information of the interaction position with high precision.

[0173] When multiple sand deformation data writing operations occur at the same interaction location, the written sand deformation data are processed using the maximum value superposition rule, retaining only the maximum depth value at the location to simulate the physical characteristics of accumulated interaction traces.

[0174] In an optional implementation, simulating the sand accumulation effect of the virtual sand dune based on the interaction location and the interaction intensity includes:

[0175] Using virtual height field mesh technology, the sand mesh near the virtual character is subdivided in a targeted manner, and the vertices of the subdivided mesh are offset upward based on the depth data in the rendering target to form a raised shape after the sand grains are accumulated.

[0176] Read the depth value from the rendering target and apply the height offset, then merge the stacking effect of the raised shape with the original terrain height map through multiplication.

[0177] The rendering target is converted into a normal map using Unreal Engine's built-in nodes, and the normal intensity is adjusted to enhance the realism of the lighting and shadow details in the sand accumulation area.

[0178] In an optional implementation, determining the spatial mapping parameters based on the displacement changes of the virtual character between adjacent frames includes:

[0179] Calculate the difference between the current frame position and the previous frame position of the virtual character to obtain the displacement change data between adjacent frames;

[0180] The displacement change data is pixel-aligned based on the sand accuracy parameters.

[0181] The UV offset in texture space is calculated based on the displacement change data after pixel alignment processing, and the UV offset is used as the space mapping parameter.

[0182] In an optional implementation, mapping the historical interaction trace data to the graphical interface using an interpolation algorithm according to the spatial mapping parameters includes:

[0183] Call the rendering target that stores historical sand interaction trace data, and perform a UV coordinate translation operation on the historical interaction trace data in the rendering target based on the spatial mapping parameters, so that the historical data shifts synchronously with the displacement of the virtual character;

[0184] An interpolation algorithm is used to sample and calculate the historical interaction trace data after translation in order to eliminate the visual discontinuity generated during the data translation process;

[0185] The interpolated historical interaction trace data is written into a new display area of ​​the graphical interface to ensure that the sand interaction traces remain clear and continuous in the new area when the virtual character moves.

[0186] Example 3

[0187] Based on the same application concept, see [link / reference] Figure 9 As shown, Figure 9 A schematic diagram of the structure of a computer device provided in Embodiment 3 of the present invention is shown, wherein, as Figure 9 As shown, the computer device 900 provided in Embodiment 3 of this application includes:

[0188] The computer device 900 includes a processor 901, a memory 902, and a bus 903. The memory 902 stores machine-readable instructions that can be executed by the processor 901. When the computer device 900 is running, the processor 901 communicates with the memory 902 through the bus 903. When the machine-readable instructions are executed by the processor 901, the steps of the virtual sand interactive rendering method shown in Embodiment 1 are performed.

[0189] Example 4

[0190] Based on the same concept, this application also provides a computer-readable storage medium storing a computer program, which, when run by a processor, executes the steps of the virtual sand interactive rendering method described in any of the above embodiments.

[0191] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and apparatus described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0192] The computer program product for virtual sand interactive rendering provided in this embodiment of the invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementation details, please refer to the method embodiments, which will not be repeated here.

[0193] The virtual sand interactive rendering device provided in this embodiment of the invention can be specific hardware on a device or software or firmware installed on the device. The implementation principle and technical effects of the device provided in this embodiment of the invention are the same as those in the foregoing method embodiments. For the sake of brevity, any parts not mentioned in the device embodiments can be referred to the corresponding content in the foregoing method embodiments. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can all be referred to the corresponding processes in the above method embodiments, and will not be repeated here.

[0194] In the embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the coupling or direct coupling or communication connection shown or discussed may be through some communication interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0195] 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.

[0196] In addition, the functional units in the embodiments provided by the present invention 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.

[0197] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a portion 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, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0198] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0199] Finally, it should be noted that the above-described embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, 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 the present invention. All should be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A virtual sand interactive rendering method, characterized in that, The method of displaying a scene containing virtual characters and a virtual sand dune through a graphical interface of an electronic device includes: Based on the surface optical property parameters of the sand grains in the virtual sandy area, combined with the ambient lighting information, the visual changes of the virtual sandy area under dynamic lighting are calculated and rendered in real time. In response to the interaction event between the virtual character and the virtual sand, the interaction location and interaction intensity of the interaction event are determined, and the interaction trace effect and sand accumulation effect of the virtual sand are simulated based on the interaction location and interaction intensity. Based on the displacement changes of the virtual character between adjacent frames, spatial mapping parameters are determined. Historical interaction trace data are then mapped to the graphical interface using an interpolation algorithm according to the spatial mapping parameters to maintain visual continuity. The interaction traces simulated based on the interaction location and intensity in the virtual sand area include: Sand deformation data containing depth information is generated at the interaction location, wherein the sand deformation data corresponds to the depression depth of the interaction intensity; The sand deformation data is stored in a rendering target using the raw32 format to record the depth information of the interaction position with high precision. When multiple sand deformation data writing operations occur at the same interaction location, the written sand deformation data are processed using the maximum value superposition rule, and only the maximum depth value at the location is retained to simulate the physical characteristics of interaction trace accumulation. Simulating the sand accumulation effect of the virtual sand dune based on the interaction location and the interaction intensity includes: Using virtual height field mesh technology, the sand mesh near the virtual character is subdivided in a targeted manner, and the vertices of the subdivided mesh are offset upward based on the depth data in the rendering target to form a raised shape after the sand grains are accumulated. Read the depth value from the rendering target and apply the height offset, then merge the stacking effect of the raised shape with the original terrain height map through multiplication. The rendering target is converted into a normal map using Unreal Engine's built-in nodes, and the normal intensity is adjusted to enhance the realism of the lighting and shadow details in the sand accumulation area.

2. The method according to claim 1, characterized in that, The process of calculating and rendering the visual changes of the virtual sand dune under dynamic lighting in real time based on the surface optical property parameters of the sand grains in the virtual sand dune and combined with ambient lighting information includes: For the sand grain material in the virtual sandy area, its surface optical property parameters are adjusted, including reflectivity and roughness, to simulate the reflection and scattering characteristics of sand grains on light. The Unreal Engine's real-time global illumination system is used to obtain the overall lighting distribution data of the scene, and the reflected light information of the surrounding environment is captured by the reflection probe and integrated to form the ambient lighting information. By dynamically calculating the reflectivity and roughness parameters of the sand material in conjunction with the ambient lighting information, the reflected light from the sand particles is naturally integrated with the ambient light, and the natural shimmering effect of the sand particles under dynamic lighting is rendered and presented in real time to enhance the visual realism of the virtual sand.

3. The method according to claim 1, characterized in that, Determining the interaction location and intensity of the interaction event includes: A ray is emitted onto the surface of the virtual sandy area using a preset component. Based on the ray detection results, the collision coordinates between the interactive part of the virtual character and the surface of the sandy area are determined, and the collision coordinates are used as the interactive position. The depth of the depression corresponding to the interaction is calculated based on the height difference between the sand surface and the interaction area. The depression depth is then corrected by range limitation processing, and the corrected depression depth is used as an indicator to quantify the intensity of the interaction.

4. The method according to claim 1, characterized in that, The determination of spatial mapping parameters based on the displacement changes of the virtual character between adjacent frames includes: Calculate the difference between the current frame position and the previous frame position of the virtual character to obtain the displacement change data between adjacent frames; The displacement change data is pixel-aligned based on the sand accuracy parameters. The UV offset in texture space is calculated based on the displacement change data after pixel alignment processing, and the UV offset is used as the space mapping parameter.

5. The method according to claim 1, characterized in that, The step of mapping historical interaction trace data to the graphical interface according to the spatial mapping parameters using an interpolation algorithm includes: Call the rendering target that stores historical sand interaction trace data, and perform a UV coordinate translation operation on the historical interaction trace data in the rendering target based on the spatial mapping parameters, so that the historical data shifts synchronously with the displacement of the virtual character; An interpolation algorithm is used to sample and calculate the historical interaction trace data after translation in order to eliminate the visual discontinuity generated during the data translation process; The interpolated historical interaction trace data is written into a new display area of ​​the graphical interface to ensure that the sand interaction traces remain clear and continuous in the new area when the virtual character moves.

6. A virtual sand interactive rendering device, characterized in that, The device is installed in an electronic device and displays a scene including virtual characters and a virtual sandy area through the graphical interface of the electronic device. The device includes: The first rendering module is used to calculate and render the visual changes of the virtual sand under dynamic lighting in real time based on the surface optical property parameters of the sand particles in the virtual sand and combined with the ambient lighting information. The second rendering module is used to respond to the interaction event between the virtual character and the virtual sand, determine the interaction position and interaction intensity of the interaction event, and simulate the interaction trace effect and sand accumulation effect of the virtual sand based on the interaction position and interaction intensity. The third rendering module is used to determine the spatial mapping parameters based on the displacement changes of the virtual character between adjacent frames, and to map the historical interaction trace data to the graphical interface according to the spatial mapping parameters through an interpolation algorithm in order to maintain visual continuity. The interaction traces simulated based on the interaction location and intensity in the virtual sand area include: Sand deformation data containing depth information is generated at the interaction location, wherein the sand deformation data corresponds to the depression depth of the interaction intensity; The sand deformation data is stored in a rendering target using the raw32 format to record the depth information of the interaction position with high precision. When multiple sand deformation data writing operations occur at the same interaction location, the written sand deformation data are processed using the maximum value superposition rule, and only the maximum depth value at the location is retained to simulate the physical characteristics of interaction trace accumulation. Simulating the sand accumulation effect of the virtual sand dune based on the interaction location and the interaction intensity includes: Using virtual height field mesh technology, the sand mesh near the virtual character is subdivided in a targeted manner, and the vertices of the subdivided mesh are offset upward based on the depth data in the rendering target to form a raised shape after the sand grains are accumulated. Read the depth value from the rendering target and apply the height offset, then merge the stacking effect of the raised shape with the original terrain height map through multiplication. The rendering target is converted into a normal map using Unreal Engine's built-in nodes, and the normal intensity is adjusted to enhance the realism of the lighting and shadow details in the sand accumulation area.

7. A computer device, characterized in that, include: The computer device includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the computer device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, they perform the steps of the virtual sand interactive rendering method as described in any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the virtual sand interactive rendering method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Weather rendering method and device in virtual environment, equipment and storage medium

    CN112263837A

  • Work site simulation system

    WO2025164338A1