Virtual snowfield rendering method and device
By acquiring the regional attribute information and flicker rendering dimension of the virtual snowfield, multiple specular data are superimposed to render the snowfield area, solving the problem of insufficient dynamic rendering of the virtual snowfield and achieving a more dynamic and realistic rendering effect.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHUHAI KINGSOFT ONLINE GAME TECH CO LTD
- Filing Date
- 2026-03-19
- Publication Date
- 2026-05-15
AI Technical Summary
In existing technologies, the dynamic rendering effect of virtual snowfields is insufficient, making it difficult to respond to real-time dynamic changes, resulting in insufficient flexibility and real-time performance.
By acquiring the regional attribute information and flicker rendering dimension of the snow area to be rendered in the virtual scene, at least two specular data are determined, and the snow area is rendered by overlaying these specular data to enhance the dynamic rendering effect.
It enriches the dynamic rendering methods of virtual snowfields, enhances the dynamic realism of snow surfaces under lighting, and improves the flexibility and realism of rendering effects.
Smart Images

Figure CN122049178A_ABST
Abstract
Description
Technical Field
[0001] This manual relates to the fields of digital cultural and creative activities and computer technology, and in particular to rendering methods and devices, computing devices and storage media for virtual snowfields. Background Technology
[0002] Currently, runtime virtual textures (RVTs) are commonly used as the core solution for rendering snow materials in virtual scenes. This technology solves the problems of seams, stretching, and repetition inherent in traditional sampling methods by baking multiple layers of snow materials into one or more virtual texture atlases in real time. This pre-baking mechanism can achieve consistency in snow effects over a wide range.
[0003] However, this pre-baked static blending mechanism has certain limitations when facing dynamic rendering requirements. Since the textures generated by RVT are essentially pre-calculated and locked based on the results of multi-layer material blending, they are difficult to respond to real-time dynamic changes, resulting in insufficient flexibility and real-time expressiveness when facing visual effects that require dynamic changes.
[0004] Therefore, how to achieve dynamic rendering of virtual snowfields has become a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0005] In view of this, embodiments of this specification provide a method for rendering a virtual snowfield to address the technical deficiencies in the prior art. Embodiments of this specification also provide a virtual snowfield rendering apparatus, a computing device, a computer-readable storage medium, and a computer program product.
[0006] According to a first aspect of the embodiments of this specification, a method for rendering a virtual snowfield is provided, comprising: Obtain the region attribute information and flicker rendering dimension of the snow area to be rendered in the virtual scene; Based on the flicker rendering dimension and the region attribute information, at least two specular data are determined, wherein the at least two specular data correspond to different flicker rendering dimensions; The snowy area to be rendered is rendered by overlaying the at least two specular data to obtain the rendering result.
[0007] According to a second aspect of the embodiments of this specification, a rendering apparatus for a virtual snowfield is provided, comprising: The acquisition module is configured to acquire the regional attribute information and flicker rendering dimension of the snow area to be rendered in the virtual scene. The determining module is configured to determine at least two specular data based on the flicker rendering dimension and the region attribute information, wherein the at least two specular data correspond to different flicker rendering dimensions; The rendering module is configured to render the snowy area to be rendered based on the superposition of the at least two specular data, and obtain the rendering result.
[0008] According to a third aspect of the embodiments of this specification, a computing device is provided, comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor executes the computer-executable instructions to implement the steps of the virtual snowfield rendering method.
[0009] According to a fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided that stores computer-executable instructions, which, when executed by a processor, implement the steps of the virtual snow rendering method.
[0010] According to a fifth aspect of the embodiments of this specification, a chip is provided that stores a computer program, which, when executed by the chip, implements the steps of the virtual snow rendering method.
[0011] According to a sixth aspect of the embodiments of this specification, a computer program product is provided, including a computer program or instructions that, when executed by a processor, implement the steps of the above-described virtual snowfield rendering method.
[0012] This specification describes a method for rendering virtual snow. The method involves acquiring regional attribute information and a flicker rendering dimension for the snow area to be rendered in a virtual scene. Based on the flicker rendering dimension and the regional attribute information, at least two specular data points are determined, each corresponding to a different flicker rendering dimension. The snow area is then rendered by overlaying these at least two specular data points to obtain a rendering result. By acquiring regional attribute information and a flicker rendering dimension, and determining specular data corresponding to at least two different rendering dimensions, the method renders a flickering effect on the virtual snow, enriching the dynamic rendering methods and effects, and enhancing the dynamic realism of the snow surface under illumination. Attached Figure Description
[0013] Figure 1 This is a flowchart of a virtual snowfield rendering method provided in one embodiment of this specification; Figure 2 This is a flowchart illustrating a virtual snowfield rendering method provided in one embodiment of this specification. Figure 3 This is a schematic diagram of three layers of highlight overlay provided in one embodiment of this specification; Figure 4This is a schematic diagram of a snow pit and snow accumulation provided in one embodiment of this specification; Figure 5 This is a schematic diagram of the flat land value mapping result provided in one embodiment of this specification; Figure 6 This is a schematic diagram of the structure of a virtual snowfield rendering device provided in one embodiment of this specification; Figure 7 This is a structural block diagram of a computing device provided in one embodiment of this specification. Detailed Implementation
[0014] Many specific details are set forth in the following description to provide a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this specification. Therefore, this specification is not limited to the specific implementations disclosed below.
[0015] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of this specification. The singular forms “a,” “described,” and “the” as used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0016] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this specification, and similarly, second may also be referred to as first.
[0017] First, the terms and concepts used in one or more embodiments of this specification will be explained.
[0018] The Blinn-Phong model is a local lighting model used to simulate lighting effects and calculate specular reflections from object surfaces.
[0019] Power function: represents the operation of multiplying a number (base) by itself a certain number of times (exponent).
[0020] The Phong model uses simple calculations to simulate the three basic visual phenomena that occur when light shines on the surface of an object, giving the rendered object a sense of depth and gloss.
[0021] Multiply Blend is a blending mode in image processing that darkens the overall image by multiplying the colors of the upper and lower layers.
[0022] Shadow Mask Information: The ShadowMask generated by the main light source is a mask texture used in the Unity engine's rendering pipeline to blend real-time shadows and baked shadows.
[0023] This specification provides a method for rendering a virtual snowfield, and also relates to a rendering apparatus for a virtual snowfield, a computing device, a computer-readable storage medium, and a computer program product, which will be described in detail in the following embodiments.
[0024] The virtual snowfield rendering provided in this specification can be used for digital culture production software and development. By obtaining the regional attribute information and flicker rendering dimension of the snowfield area to be rendered in the virtual scene, at least two specular data are determined. The snowfield area to be rendered is then rendered based on the superposition of the at least two specular data to obtain the rendering result, thereby realizing the production of digital culture products and providing users with immersive digital culture content services.
[0025] Figure 1 A flowchart illustrating a method for rendering a virtual snowfield according to an embodiment of this specification is shown, specifically including the following steps: Step 102: Obtain the regional attribute information and flicker rendering dimension of the snow area to be rendered in the virtual scene.
[0026] Specifically, the virtual snow rendering method described in this manual can be applied to scenarios where virtual snow is rendered, such as film and television scenes, game scenes, etc. Before rendering the virtual snow, it is necessary to obtain the current attribute information of the virtual snow.
[0027] Here, "virtual scene" refers to a virtual space containing the snow area to be rendered; "snow area to be rendered" refers to the area in the virtual scene that requires snow rendering; "region attribute information" refers to the region attribute information corresponding to the snow area to be rendered, such as region geometric data and region material data; "flicker rendering dimension" refers to the dimension for flicker rendering of the snow area to be rendered, which may include basic flicker dimension, reflection flicker dimension, and random flicker dimension. In practical applications, one or more flicker rendering dimensions can be selected to jointly render the snow area in the virtual scene. Preferably, multiple different flicker rendering dimensions can be selected so that the flicker rendering of the snow area can be achieved from multiple dimensions in the future.
[0028] In a specific embodiment of this specification, when rendering a snowy area in a virtual mountain scene in film and television, the snowy area to be rendered is first determined in the virtual mountain scene; the geometric data and material data corresponding to the snowy area to be rendered are obtained, and three flicker rendering dimensions—basic flicker dimension, reflection flicker dimension, and random flicker dimension—are obtained based on rendering requirements.
[0029] By defining a virtual scene, we can obtain the regional attribute information and flicker rendering dimension of the area to be rendered in the virtual scene. This allows us to subsequently render the snowy area to be rendered based on the regional attribute information and flicker rendering dimension, thereby improving the rendering effect.
[0030] Step 104: Determine at least two specular data points based on the flicker rendering dimension and the region attribute information, wherein the at least two specular data points correspond to different flicker rendering dimensions.
[0031] Among them, specular data refers to the data used to perform flicker rendering on the snow area to be rendered, and at least two specular data correspond to different flicker rendering dimensions. For example, if the first specular data and the second specular data are determined, the first specular data corresponds to the basic flicker dimension, while the second specular data corresponds to the reflection flicker dimension.
[0032] Specifically, after determining the flash rendering dimensions and region attribute information, the specular data corresponding to each flash rendering dimension can be calculated based on the flash rendering dimensions and region attribute information.
[0033] In practical applications, based on the flicker rendering dimension and the region attribute information, at least two specular data points are determined, including: The basic specular data corresponding to the basic flicker dimension is determined based on the preset lighting model, specular material property information, and geometric data. Based on the preset flash map, roughness, and geometric data, determine the reflective specular data corresponding to the reflective flash dimension; Based on the preset noise texture, determine the random specular data corresponding to the random flicker dimension; At least two specular data points are determined from the base specular data, the reflected specular data, and the random specular data.
[0034] Specifically, different flicker rendering dimensions can be selected to render the virtual snowfield according to the actual rendering requirements, and the specular data corresponding to different flicker rendering dimensions can be obtained by different processing methods.
[0035] Among them, the preset lighting model refers to the model used to calculate the basic specular range, such as the Phong model and the Blinn-Phong model; the specular material property information refers to the material information corresponding to the specular area in the snow area to be rendered, such as roughness and specular color; the geometric data refers to the physical information corresponding to the snow area to be rendered, such as normal vector, view direction, and light direction; and the basic specular data refers to the data for overall basic flicker rendering of the snow area to be rendered.
[0036] In one specific embodiment of this specification, a snow-covered flashing rendering is performed on a virtual mountain. The preset lighting model selected is the Blinn-Phong model. The basic specular range is calculated by using the surface roughness of the snow-covered area to be rendered in the virtual mountain through the Blinn-Phong specular reflection model, that is, the basic specular data is calculated.
[0037] In practical applications, the specific reflective specular data corresponding to the reflective flicker dimension is determined based on the preset flash map, roughness, and geometric data, including: The flash texture is sampled to obtain the flash sampling result, and the roughness is exponentially calculated to obtain the roughness curve; The reflected specular data are calculated based on the flash sampling results and the roughness curve.
[0038] Among them, the preset blink map refers to a grayscale image containing blink attribute information; roughness refers to a key parameter representing the microscopic smoothness of the model surface; and reflective specular data refers to the data used for blink rendering of each pixel in the snow area to be rendered. In one specific embodiment of this specification, a preset flash map is sampled to obtain the flash attribute information corresponding to each pixel. The preset flash map is pre-drawn based on rendering requirements. The roughness is exponentially calculated, and the reflected specular data is calculated based on the calculation result and the flash attribute information.
[0039] By exponentially calculating the roughness, the shape and distribution of the flash points can be precisely constrained, making the final rendering effect closer to the reflective properties of real snow crystals.
[0040] In practical applications, the random specular data corresponding to the random flickering dimension is determined based on a preset noise texture, including: The preset noise texture is sampled based on the model's UV coordinates to obtain the model sampling result; The preset noise texture is sampled based on screen space coordinates to obtain spatial sampling results; Random specular data is calculated based on the model sampling results and the spatial sampling results.
[0041] Among them, the preset noise texture refers to the grayscale noise map of random flash point information. In practical applications, the preset noise texture is a pre-calculated grayscale noise map that records random flash point information; random specular data refers to the data of overall random flash rendering of the snow area to be rendered; model UV coordinates refer to the two-dimensional coordinates used to map the two-dimensional texture image to the surface of the three-dimensional model; screen space coordinates refer to the two-dimensional pixel positions that are finally presented on the display device after the complete graphics pipeline transformation.
[0042] In one specific embodiment of this specification, a preset noise texture is sampled based on the UV coordinates of the model of the snow area to be rendered to obtain a model sampling result; a preset noise texture is sampled based on the screen space coordinates to obtain a spatial sampling result; the two sampling results are multiplied and mixed to obtain random specular data.
[0043] By introducing a texture based on a preset noise texture, that is, a texture with a continuous flickering effect that is independent of the direction of the main light source and dynamically changes with the viewing angle, and then using two sampling calculations to obtain random highlight data, the distortion caused by UV stretching is effectively avoided, and the randomness and naturalness of the flickering are enhanced.
[0044] Preferably, in a specific embodiment of this specification, a three-layer superimposed specular flashing mechanism is used to render the snowy area to be rendered. Specifically, the method for determining at least two specular data points may include: The basic specular data corresponding to the basic flicker dimension is determined based on the preset lighting model, specular material property information, and geometric data. Based on the preset flash map, roughness, and geometric data, determine the reflective specular data corresponding to the reflective flash dimension; Based on the preset noise texture, determine the random specular data corresponding to the random flicker dimension; The basic specular data, the reflected specular data, and the random specular data are all used as specular data.
[0045] By simultaneously acquiring specular data from three flickering rendering dimensions, it becomes easier to overlay three layers of specular data to render the snowfield, greatly enhancing the dynamic realism of the specular flickering on the snow surface under illumination.
[0046] Step 106: Render the snow area to be rendered based on the superposition of the at least two specular data to obtain the rendering result.
[0047] Specifically, after determining the specular data corresponding to each flashing rendering dimension, the various specular data can be superimposed on the material attribute information of the snow area to be rendered based on at least two specular data and the material attribute information of the snow area to be rendered, thus completing the rendering of the flashing effect of the snow area to be rendered.
[0048] In practical applications, to ensure the uniformity of scene lighting—that is, to ensure that the flash effect only appears in the illuminated areas and to avoid unrealistically bright flickering in the shadow areas—this specification describes a method for rendering the snowy area to be rendered based on the superposition of at least two specular data points. The method for obtaining the rendering result includes: Obtain the shadow mask information of the main light source; The snowy area to be rendered is rendered by overlaying the shadow mask information and the at least two specular data to obtain the rendering result.
[0049] Among them, the shadow masking information of the main light source refers to the information that marks which parts of the scene are illuminated by the main light source and which parts are in shadow.
[0050] Specifically, to ensure the consistency of the rendered lighting, at least two specular data will be modulated with the shadow mask information generated by the main light source. That is, based on the shadow mask information of the main light source, at least two specular data are controlled to complete the flicker rendering of the specular data in the snow area to be rendered, including the rendering of the brightness, color and other aspects of the flickering points based on the main light source.
[0051] By modulating at least two specular data points with the shadow mask information of the main light source, the flickering rendering can ensure the uniformity of scene lighting and avoid unrealistic over-brightness flickering in shadow areas.
[0052] Furthermore, after dynamically rendering the snow scene with a flashing effect, if the virtual character leaves footprints after moving in the snow, the footprint effect also needs to be dynamically rendered accordingly.
[0053] In practical applications, after rendering the snow area to be rendered based on the superposition of the at least two specular data points and obtaining the rendering result, the process further includes: In response to the interaction data of the target virtual object in the snow area to be rendered, a real-time footprint path map is generated; The footprint range and snow accumulation range are determined based on the real-time footprint path map. Based on the footprint range and the snow accumulation range, the real-time footprint path map is mapped into a dynamic permutation map; The snowy area to be rendered is rendered based on the dynamic displacement map to obtain the footprint rendering effect.
[0054] Among them, the target virtual object refers to the object that interacts with the snow area to be rendered, such as a virtual character walking or running in the snow area to be rendered; the interaction data refers to the key skeletal motion information of the interaction, such as foot position information; the real-time footprint path map refers to the grayscale map generated based on the real-time interaction data; in practical applications, the interaction process will continue, so multiple real-time footprint path maps will be generated, and the grayscale values in the real-time footprint path map represent the range of the snow that the character sinks into.
[0055] In one specific embodiment of this specification, the interaction information of the target virtual object in the snow area to be rendered is monitored. When the interaction data of the interaction with the snow area to be rendered is obtained, a real-time grayscale image of the encoded footprint path in the 0-1 range is generated based on the interaction information.
[0056] Specifically, the system monitors interaction data in the snowy area to be rendered. When interaction data of the target virtual object in the snowy area to be rendered is detected, a real-time footprint path map is generated based on the interaction data. The footprint range and the corresponding snow accumulation range are determined based on the real-time footprint path map. Based on the footprint range and the snow accumulation range, the real-time footprint path map is mapped into a dynamic displacement map. The snowy area to be rendered is then rendered based on the dynamic displacement map to obtain the footprint rendering effect.
[0057] In practical applications, determining the footprint range and snow accumulation range based on the real-time footprint path map includes: Edge detection is performed on the real-time footprint path map to obtain the footprint range; The snow accumulation range is determined based on a preset accumulation algorithm and the footprint range.
[0058] Edge detection refers to the detection method for the boundary line between footprints and background in a grayscale image. This specification does not limit the specific algorithm used for edge detection; any algorithm that can accurately locate the contour edge of the footprint is acceptable. The preset accumulation algorithm refers to an algorithm that can calculate the corresponding snow accumulation range based on the depression range in the footprint range.
[0059] Specifically, edge detection is performed on each real-time footprint path map to obtain accurate footprint range information, i.e., footprint range; based on the preset stacking algorithm and footprint range, the snow accumulation corresponding to each footprint is calculated to obtain the snow accumulation range, and appropriate Gaussian blur can also be applied to achieve a natural transition effect.
[0060] In practical applications, the real-time footprint path map is mapped to a dynamic permutation map based on the footprint range and the snow accumulation range, including: The real-time footprint path map is adjusted based on the footprint range and the snow accumulation range to obtain the target footprint path map; The target footprint path map is mapped into a dynamic permutation map based on a preset flat ground value.
[0061] Among them, the target footprint path map refers to a grayscale map based on the recorded precise footprint range and snow accumulation range; the preset flat ground value refers to the value used to map the current flat ground value range to the preset flat ground value range, which can be adjusted according to actual needs. For example, if the original flat ground value range is 0 to 1 and the flat ground value is 0.7, the mapped preset flat ground value range is 0 to 0.7 for the snow pit area and 0.7 to 1 for the snow accumulation range; the dynamic permutation map refers to the map obtained after mapping the target footprint path map.
[0062] In a specific embodiment of this specification, the real-time footprint path map is adjusted according to the footprint range and the snow accumulation range to obtain the target footprint path map; based on a flat ground value of 0.7, the target footprint path map with a flat ground value range of 0-1 is mapped to a dynamic permutation map with a preset flat ground value range including: snow pit area 0 to 0.7 and snow accumulation range 0.7 to 1.
[0063] In practical applications, the footprint effect automatically generated based on the above method may still have some discrepancy with the actual rendering requirements. Therefore, this specification also provides a parameter adjustment module, allowing users to adjust the model parameters according to their needs. Specifically, rendering the snow area to be rendered based on the dynamic displacement map to obtain the footprint rendering effect includes: Based on the dynamic displacement map, the snow area to be rendered is initially rendered to obtain preliminary footprint rendering results; Based on the snow pit adjustment parameters and snow accumulation parameters, the preliminary footprint rendering results are adjusted to obtain the footprint rendering effect.
[0064] The initial footprint rendering result refers to the result after rendering the snow area to be rendered based on the dynamic displacement map. In practical applications, in order to better adjust the rendering details, the method in this manual sets two sets of independently adjustable art parameters to control the details of snow pits and snow piles respectively. The specific art parameters include vertex offset displacement, overall snow pit normal intensity, and superimposed high-frequency normal map. Snow pit adjustment parameter information refers to the information obtained by adjusting the snow pit adjustment parameters, and snow accumulation parameter information refers to the information obtained by adjusting the snow accumulation adjustment parameters. The snow pit adjustment parameter information and snow accumulation parameter information are obtained by adjusting the art parameters set based on the preset flat ground value.
[0065] In one specific embodiment of this specification, the dynamic displacement map performs preliminary rendering of the snow area to be rendered. After obtaining the preliminary footprint rendering result, the dynamic displacement map is passed back to the shader. The shader uses the footprints and snowdrifts defined in the dynamic displacement map, with a preset flat ground value as the dividing line, and applies two sets of independently adjustable art parameters to control the rendering details of the snow pits and snowdrifts respectively. Specifically, it adjusts the preliminary footprint rendering result according to the snow pit adjustment parameter information and the snow accumulation parameter information to obtain the footprint rendering effect.
[0066] By setting a variety of artistic parameters for users to adjust, users can render effects according to their needs and enhance the subtle undulations of the snow surface.
[0067] To ensure that the snow layer and the underlying terrain interact without geometric overlap or floating, this specification also sets a preset height in the rendering calculation to avoid rendering clipping issues. Specifically, the method for performing preliminary rendering of the snow area to be rendered based on the dynamic displacement map to obtain preliminary footprint rendering results may include: Obtain the terrain height and target pixel height corresponding to the snow area to be rendered; Calculate the difference between the terrain height and the target pixel height to obtain the preset height; Based on the dynamic permutation map, determine the current vertex height corresponding to the footprint range or snow accumulation range, and the current terrain height corresponding to the current vertex height; If the current vertex height is greater than the sum of the current terrain height and the preset height, the snow area to be rendered is initially rendered based on the current vertex height to obtain preliminary footprint rendering results; If the current vertex height is less than the sum of the current terrain height and the preset height, the snow area to be rendered is initially rendered based on the sum of the current terrain height and the preset height to obtain preliminary footprint rendering results.
[0068] Among them, terrain height refers to the height of the terrain below the snow-covered area; target pixel height refers to the height of any pixel in the snow area to be rendered; terrain height and target pixel height can be obtained through a top-view camera or a pre-calculated height map; current vertex height refers to the snow vertex height obtained after adjusting the snow height, and current terrain height refers to the terrain height corresponding to the current vertex height.
[0069] In one specific embodiment of this specification, the underlying terrain height information is obtained through a pre-calculated height map, and the vertical height difference between the currently rendered vertex and its corresponding point projected onto the terrain below is calculated; the current vertex height corresponding to the footprint range or snow accumulation range, and the current terrain height corresponding to the current vertex height are determined based on the dynamic displacement map; when processing vertex displacement, i.e., displacement caused by adjusting snow pits or accumulation, the final world coordinate height value of the vertex is limited to the maximum value between the original height of the current vertex and the sum of the height of the terrain point corresponding to the current vertex and the vertical height difference.
[0070] The height adjustment method described above only takes effect when the displacement (vertex downward movement distance) calculated from the snow pit replacement curve will result in the final position being lower than the height of the underlying terrain. This method prevents physical artifacts while preserving the main features of the snow pit's shape, effectively ensuring the geometric correctness and visual plausibility of the edge in contact with the terrain, and eliminating artifacts of material suspension.
[0071] This specification describes a method for rendering virtual snow. The method involves acquiring regional attribute information and a flicker rendering dimension for the snow area to be rendered in a virtual scene. Based on the flicker rendering dimension and the regional attribute information, at least two specular data points are determined, each corresponding to a different flicker rendering dimension. The snow area is then rendered by overlaying these at least two specular data points to obtain a rendering result. By acquiring regional attribute information and a flicker rendering dimension, and determining specular data corresponding to at least two different rendering dimensions, the method renders a flickering effect on the virtual snow, enriching the dynamic rendering methods and effects, and enhancing the dynamic realism of the snow surface under illumination.
[0072] The following is in conjunction with the appendix Figure 2 Taking the application of the virtual snowfield rendering method provided in this specification in virtual mountain rendering as an example, the rendering method of the virtual snowfield will be further explained. Among other things, Figure 2 The present specification illustrates a flowchart of a virtual snowfield rendering method according to an embodiment, which specifically includes the following steps: Step 202: Obtain the regional attribute information and flicker rendering dimension of the snowfield area to be rendered in the virtual mountain.
[0073] Specifically, when rendering a snowy area in a virtual mountain scene, the snowy area to be rendered is first determined in the virtual mountain scene; the geometric data and material data corresponding to the snowy area to be rendered are obtained, and based on the rendering requirements, three flicker rendering dimensions are obtained: basic flicker dimension, reflection flicker dimension, and random flicker dimension.
[0074] Step 204: Determine three specular data points based on the flicker rendering dimension and region attribute information. The three specular data points correspond to different flicker rendering dimensions.
[0075] Specifically, the basic specular data corresponding to the basic flicker dimension is determined based on the preset lighting model, specular material attribute information, and geometric data; the reflected specular data corresponding to the reflected flicker dimension is determined based on the preset flash map, roughness, and geometric data; the random specular data corresponding to the random flicker dimension is determined based on the preset noise texture; and the basic specular data, reflected specular data, and random specular data are used as specular data.
[0076] Step 206: Render the snow area to be rendered based on the superposition of three specular data to obtain the rendering result.
[0077] Specifically, after determining the specular data corresponding to each flashing rendering dimension, the three specular data points and the material attribute information of the snow area to be rendered can be used as a basis to overlay the various specular data points on top of the material attribute information, thus completing the rendering of the flashing effect of the snow area to be rendered. For example... Figure 3 As shown, Figure 3 This is a schematic diagram of a three-layer specular overlay provided in an embodiment of this specification. In the specular area of the snow area to be rendered, reflective specular data determined based on a flash map, random specular data determined based on a preset noise texture, basic specular data determined based on a preset lighting model, and original lighting information are overlaid to perform flash rendering on the snow area to be rendered.
[0078] Step 208: In response to the interaction data of the target virtual object in the snow area to be rendered, generate a real-time footprint path map.
[0079] Specifically, the system monitors interaction data in the snowy area to be rendered, and generates a real-time footprint path map based on the interaction data when interaction data of the target virtual object in the snowy area to be rendered is detected.
[0080] Step 210: Determine the footprint range and snow accumulation range based on the real-time footprint path map.
[0081] Specifically, such as Figure 4 As shown, Figure 4 As shown in the schematic diagram of snow pits and snow accumulation provided in one embodiment of this specification, edge detection is performed on the real-time footprint path map to obtain the precise footprint range, and the real-time footprint path map after edge detection is blurred; the range of snow pits and snow accumulation range are determined based on the blurred real-time footprint path map.
[0082] Step 212: Map the real-time footprint path map to a dynamic permutation map based on the footprint range and snow accumulation range.
[0083] Specifically, the real-time footprint path map is adjusted based on the footprint range and snow accumulation range to obtain the target footprint path map; based on a flat ground value of 0.7, the target footprint path map with a flat ground value range of 0-1 is mapped to a dynamic permutation map with preset flat ground value ranges including: snow pit area 0 to 0.7 and snow accumulation range 0.7 to 1, as shown below. Figure 5 As shown, Figure 5 This is a schematic diagram of the flat land value mapping result provided in one embodiment of this specification.
[0084] Step 214: Render the snow area to be rendered based on the dynamic displacement graph to obtain the footprint rendering effect.
[0085] This specification describes a method for rendering virtual snow. The method involves acquiring regional attribute information and a flicker rendering dimension for the snow area to be rendered in a virtual scene. Based on the flicker rendering dimension and the regional attribute information, at least two specular data points are determined, each corresponding to a different flicker rendering dimension. The snow area is then rendered by overlaying these at least two specular data points to obtain a rendering result. By acquiring regional attribute information and a flicker rendering dimension, and determining specular data corresponding to at least two different rendering dimensions, the method renders a flickering effect on the virtual snow, enriching the dynamic rendering methods and effects, and enhancing the dynamic realism of the snow surface under illumination.
[0086] Corresponding to the above method embodiments, this specification also provides embodiments of a virtual snowfield rendering device. Figure 6 A schematic diagram of a virtual snowfield rendering apparatus according to an embodiment of this specification is shown. Figure 6 As shown, the device includes: The acquisition module 602 is configured to acquire the regional attribute information and flicker rendering dimension of the snow area to be rendered in the virtual scene. The determining module 604 is configured to determine at least two specular data based on the flicker rendering dimension and the region attribute information, wherein the at least two specular data correspond to different flicker rendering dimensions; The rendering module 606 is configured to render the snowy area to be rendered based on the superposition of the at least two specular data to obtain a rendering result.
[0087] In an optional embodiment, the determining module 604 is further configured to: The basic specular data corresponding to the basic flicker dimension is determined based on the preset lighting model, specular material property information, and geometric data. Based on the preset flash map, roughness, and geometric data, determine the reflective specular data corresponding to the reflective flash dimension; Based on the preset noise texture, determine the random specular data corresponding to the random flicker dimension; At least two specular data points are determined from the base specular data, the reflected specular data, and the random specular data.
[0088] In an optional embodiment, the determining module 604 is further configured to: The flash texture is sampled to obtain the flash sampling result, and the roughness is exponentially calculated to obtain the roughness curve; The reflected specular data are calculated based on the flash sampling results and the roughness curve.
[0089] In an optional embodiment, the determining module 604 is further configured to: The preset noise texture is sampled based on the model's UV coordinates to obtain the model sampling result; The preset noise texture is sampled based on screen space coordinates to obtain spatial sampling results; Random specular data is calculated based on the model sampling results and the spatial sampling results.
[0090] In an optional embodiment, the rendering module 606 is further configured to: Obtain the shadow mask information of the main light source; The snowy area to be rendered is rendered by overlaying the shadow mask information and the at least two specular data to obtain the rendering result.
[0091] In an optional embodiment, the apparatus further includes a footprint rendering module configured to: In response to the interaction data of the target virtual object in the snow area to be rendered, a real-time footprint path map is generated; The footprint range and snow accumulation range are determined based on the real-time footprint path map. Based on the footprint range and the snow accumulation range, the real-time footprint path map is mapped into a dynamic permutation map; The snowy area to be rendered is rendered based on the dynamic displacement map to obtain the footprint rendering effect.
[0092] In an optional embodiment, the footprint rendering module is further configured to: Edge detection is performed on the real-time footprint path map to obtain the footprint range; The snow accumulation range is determined based on a preset accumulation algorithm and the footprint range.
[0093] In an optional embodiment, the footprint rendering module is further configured to: The real-time footprint path map is adjusted based on the footprint range and the snow accumulation range to obtain the target footprint path map; The target footprint path map is mapped into a dynamic permutation map based on a preset flat ground value.
[0094] In an optional embodiment, the footprint rendering module is further configured to: Based on the dynamic displacement map, the snow area to be rendered is initially rendered to obtain preliminary footprint rendering results; Based on the snow pit adjustment parameters and snow accumulation parameters, the preliminary footprint rendering results are adjusted to obtain the footprint rendering effect.
[0095] In an optional embodiment, the footprint rendering module is further configured to: Obtain the terrain height and target pixel height corresponding to the snow area to be rendered; Calculate the difference between the terrain height and the target pixel height to obtain the preset height; Based on the dynamic permutation map, determine the current vertex height corresponding to the footprint range or snow accumulation range, and the current terrain height corresponding to the current vertex height; If the current vertex height is greater than the sum of the current terrain height and the preset height, the snow area to be rendered is initially rendered based on the current vertex height to obtain preliminary footprint rendering results; If the current vertex height is less than the sum of the current terrain height and the preset height, the snow area to be rendered is initially rendered based on the sum of the current terrain height and the preset height to obtain preliminary footprint rendering results.
[0096] This specification describes a virtual snowfield rendering device. The device includes an acquisition module configured to acquire regional attribute information and a flicker rendering dimension of the snowfield area to be rendered in a virtual scene; a determination module configured to determine at least two specular highlight data points based on the flicker rendering dimension and the regional attribute information, wherein the at least two specular highlight data points correspond to different flicker rendering dimensions; and a rendering module configured to render the snowfield area to be rendered by overlaying the at least two specular highlight data points to obtain a rendering result. By acquiring regional attribute information and flicker rendering dimension, and determining specular highlight data corresponding to at least two different rendering dimensions, the device renders a flickering effect on the virtual snowfield, enriching the dynamic rendering methods and effects, and enhancing the dynamic realism of the snow surface under illumination.
[0097] The above is a schematic scheme of a virtual snowfield rendering device according to this embodiment. It should be noted that the technical solution of this virtual snowfield rendering device and the technical solution of the aforementioned virtual snowfield rendering method belong to the same concept. Details not described in detail in the technical solution of the virtual snowfield rendering device can be found in the description of the technical solution of the aforementioned virtual snowfield rendering method. Furthermore, the components in the device embodiment should be understood as functional modules necessary to implement each step of the program flow or each step of the method; these functional modules are not actual functional divisions or separations. A device claim defined by such a set of functional modules should be understood as a functional module architecture that primarily implements the solution through the computer program described in the specification, and not as a physical device that primarily implements the solution through hardware.
[0098] Figure 7 A structural block diagram of a computing device 700 according to an embodiment of this specification is shown. The components of the computing device 700 include, but are not limited to, a memory 710 and a processor 720. The processor 720 is connected to the memory 710 via a bus 730, and a database 750 is used to store data.
[0099] The computing device 700 also includes an access device 740, which enables the computing device 700 to communicate via one or more networks 760. Examples of these networks include a Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the Internet. The access device 740 may include one or more of any type of wired or wireless network interface (e.g., a Network Interface Card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) interface, a Wi-MAX interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, and so on.
[0100] In one embodiment of this specification, the above-described components of the computing device 700 and Figure 7 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 7 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0101] The computing device 700 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or PCs. The computing device 700 can also be a mobile or stationary server.
[0102] The processor 720 is configured to execute computer-executable instructions for the rendering method of the virtual snowfield.
[0103] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the virtual snow rendering method described above belong to the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the virtual snow rendering method described above.
[0104] An embodiment of this specification also provides a computer-readable storage medium storing computer instructions that, when executed by a processor, are used for a method of rendering a virtual snowfield.
[0105] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the virtual snow rendering method described above belong to the same concept. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the virtual snow rendering method described above.
[0106] An embodiment of this specification also provides a chip that stores a computer program, which, when executed by the chip, implements the steps of the virtual snow rendering method.
[0107] An embodiment of this specification also provides a computer program product, including a computer program or instructions that, when executed by a processor, implement the steps of the above-described virtual snowfield rendering method.
[0108] The above is an illustrative scheme of a computer program product according to this embodiment. It should be noted that the technical solution of this computer program product and the technical solution of the above-described virtual snow rendering method belong to the same concept. For details not described in detail in the technical solution of the computer program product, please refer to the description of the technical solution of the above-described virtual snow rendering method.
[0109] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0110] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or certain intermediate forms. The computer-readable medium may include any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added to or subtracted according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.
[0111] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this specification is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this specification. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this specification.
[0112] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0113] The preferred embodiments disclosed above are merely illustrative of this specification. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the content of this specification. These embodiments have been selected and specifically described in this specification to better explain the principles and practical applications of this specification, thereby enabling those skilled in the art to better understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents.
Claims
1. A method for rendering a virtual snowfield, characterized in that, include: Obtain the region attribute information and flicker rendering dimension of the snow area to be rendered in the virtual scene; Based on the flicker rendering dimension and the region attribute information, at least two specular data are determined, wherein the at least two specular data correspond to different flicker rendering dimensions; The snowy area to be rendered is rendered by overlaying the at least two specular data to obtain the rendering result.
2. The method according to claim 1, characterized in that, Based on the flicker rendering dimension and the region attribute information, at least two specular data points are determined, including: The basic specular data corresponding to the basic flicker dimension is determined based on the preset lighting model, specular material property information, and geometric data. Based on the preset flash map, roughness, and geometric data, determine the reflective specular data corresponding to the reflective flash dimension; Based on the preset noise texture, determine the random specular data corresponding to the random flicker dimension; At least two specular data points are determined from the base specular data, the reflected specular data, and the random specular data.
3. The method according to claim 2, characterized in that, Based on the preset flash map, roughness, and geometric data, determine the reflective specular data corresponding to the reflective flash dimension, including: The flash texture is sampled to obtain the flash sampling result, and the roughness is exponentially calculated to obtain the roughness curve; The reflected specular data are calculated based on the flash sampling results and the roughness curve.
4. The method according to claim 2, characterized in that, Based on the preset noise texture, determine the random specular data corresponding to the random flickering dimension, including: The preset noise texture is sampled based on the model's UV coordinates to obtain the model sampling result; The preset noise texture is sampled based on screen space coordinates to obtain spatial sampling results; Random specular data is calculated based on the model sampling results and the spatial sampling results.
5. The method according to claim 1, characterized in that, The snow-covered area to be rendered is rendered based on the superposition of the at least two specular data points to obtain a rendering result, including: Obtain the shadow mask information of the main light source; The snowy area to be rendered is rendered by overlaying the shadow mask information and the at least two specular data to obtain the rendering result.
6. The method according to claim 1, characterized in that, After rendering the snow area to be rendered based on the superposition of the at least two specular data, and obtaining the rendering result, the process further includes: In response to the interaction data of the target virtual object in the snow area to be rendered, a real-time footprint path map is generated; The footprint range and snow accumulation range are determined based on the real-time footprint path map. Based on the footprint range and the snow accumulation range, the real-time footprint path map is mapped into a dynamic permutation map; The snowy area to be rendered is rendered based on the dynamic displacement map to obtain the footprint rendering effect.
7. The method according to claim 6, characterized in that, Determining the footprint range and snow accumulation range based on the real-time footprint path map includes: Edge detection is performed on the real-time footprint path map to obtain the footprint range; The snow accumulation range is determined based on a preset accumulation algorithm and the footprint range.
8. The method according to claim 6, characterized in that, Based on the footprint range and the snow accumulation range, the real-time footprint path map is mapped to a dynamic permutation map, including: The real-time footprint path map is adjusted based on the footprint range and the snow accumulation range to obtain the target footprint path map; The target footprint path map is mapped into a dynamic permutation map based on a preset flat ground value.
9. The method according to claim 8, characterized in that, The snowfield region to be rendered is rendered based on the dynamic displacement map to obtain a footprint rendering effect, including: Based on the dynamic displacement map, the snow area to be rendered is initially rendered to obtain preliminary footprint rendering results; Based on the snow pit adjustment parameters and snow accumulation parameters, the preliminary footprint rendering results are adjusted to obtain the footprint rendering effect.
10. The method according to claim 9, characterized in that, Based on the dynamic displacement map, a preliminary rendering of the snow area to be rendered is performed to obtain preliminary footprint rendering results, including: Obtain the terrain height and target pixel height corresponding to the snow area to be rendered; Calculate the difference between the terrain height and the target pixel height to obtain the preset height; Based on the dynamic permutation map, determine the current vertex height corresponding to the footprint range or snow accumulation range, and the current terrain height corresponding to the current vertex height; If the current vertex height is greater than the sum of the current terrain height and the preset height, the snow area to be rendered is initially rendered based on the current vertex height to obtain preliminary footprint rendering results; If the current vertex height is less than the sum of the current terrain height and the preset height, the snow area to be rendered is initially rendered based on the sum of the current terrain height and the preset height to obtain preliminary footprint rendering results.
11. A rendering device for a virtual snowfield, characterized in that, include: The acquisition module is configured to acquire the regional attribute information and flicker rendering dimension of the snow area to be rendered in the virtual scene. The determining module is configured to determine at least two specular data based on the flicker rendering dimension and the region attribute information, wherein the at least two specular data correspond to different flicker rendering dimensions; The rendering module is configured to render the snowy area to be rendered based on the superposition of the at least two specular data, and obtain the rendering result.
12. A computing device, characterized in that, include: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the steps of the method according to any one of claims 1-10.
13. A computer-readable storage medium storing computer instructions, characterized in that, When executed by the processor, this instruction implements the steps of the method according to any one of claims 1-10.
14. A computer program product comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1-10.