A method for generating snow effects based on Cesium 3D rendering engine

Through the improvement method of Cesium 3D rendering engine, realistic snow accumulation effects are generated, which solves the problem of insufficient fidelity of snow accumulation rendering in the existing technology, and achieves high realistic coverage of environmental objects.

CN115170717BActive Publication Date: 2025-08-29XIDIAN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211023849.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-24
Publication Date
2025-08-29
Estimated Expiration
2042-08-24

AI Technical Summary

Technical Problem

The existing Cesium three-dimensional rendering engine lacks a perfect simulation system in scene snow rendering. It only has a simple snow effect based on particle system, which has low fidelity and cannot effectively simulate the snow-covered environment.

Method used

By sampling the model texture map, obtaining the texture coordinate vector, and converting it into the camera space, determining whether to perform snow-covered rendering based on the conversion results, calculating the white scale value based on the snow thickness, and fusing the rendering results to generate a realistic snow-covered effect.

Benefits of technology

It realizes the corresponding snow accumulation effect based on the snow thickness, covering environmental objects, especially in plant building coverage, to achieve the effect of accurately covering the target area and objects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115170717B_ABST
    Figure CN115170717B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for generating snow effects based on the Cesium three-dimensional rendering engine, which relates to the technical field of image rendering and specifically comprises the following steps: first, sampling a texture map of a model to obtain a texture coordinate vector of each texture coordinate point in the texture map; then converting the texture coordinate vector into a camera space, and judging whether to perform snow cover rendering according to the conversion result; finally, performing snow rendering on the texture coordinate points that need to be rendered with snow cover according to the judgment result, and fusing the rendering result with the texture map to achieve a final rendering effect; the present invention can generate a corresponding snow effect according to the thickness of the snow, cover objects in the environment, have a high degree of realism in terms of covering plants and buildings, and can specify specific covering targets to achieve the effect of accurately covering target areas and objects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image rendering, and in particular to a method for generating snow effects based on a Cesium three-dimensional rendering engine. Background Art

[0002] Existing 3D rendering engines are mainly dedicated to the rendering of geographic information, with less research on environmental simulation based on geographic information. They only support simple weather effects based on particle systems, with poor realism. However, in game engines, the rendering effect of snow has a high degree of realism and can highly restore the snow scenes in the real world. However, 3D rendering engines based on geographic information have almost no involvement in scene snow rendering.

[0003] Cesium is a JavaScript-based map engine using WebGL. It can render three-dimensional geographic information based on remote sensing imagery. However, when it comes to rendering snow in scenes, the Cesium framework lacks a complete simulation system. It only provides a simple snow effect based on a particle system, and the effect is very low in realism. It does not involve the simulation of snowy environments. Summary of the Invention

[0004] The purpose of the present invention is to address the problem that Cesium is a map engine written in JavaScript and uses WebGL. It can realize the rendering of three-dimensional geographic information based on remote sensing images. However, in terms of scene snow rendering, the Cesium framework does not have a complete simulation system. It only has a simple snow effect based on a particle system, and the effect fidelity is very low. The simulation effect of the snow environment is not addressed. A snow effect generation method based on the Cesium three-dimensional rendering engine is proposed. The method can generate corresponding snow effects according to the thickness of the snow, cover objects in the environment, and has a high fidelity in covering plants and buildings, thereby solving the above-mentioned problem.

[0005] The technical solutions of the present invention are as follows:

[0006] A method for generating snow effects based on the Cesium 3D rendering engine includes the following steps:

[0007] Step S1: sampling the texture map of the model to obtain the texture coordinate vector of each texture coordinate point in the texture map;

[0008] Step S2: converting the texture coordinate vector into the camera space, and determining whether to perform snow cover rendering based on the conversion result;

[0009] Step S3: Based on the judgment result, snow rendering is performed on the texture coordinate points that need to be rendered with snow cover, and the rendering result is merged with the texture map to achieve the final rendering effect.

[0010] Furthermore, the model is: Cesium's existing shading model.

[0011] Furthermore, the model is a scene model drawn based on geographic image elevation data loaded via a Cesium interface.

[0012] Furthermore, the step S1 includes:

[0013] Step S11: sampling the color texture map and the depth texture map through the sampling function Texture2D to obtain the color vector and depth vector of each texture coordinate point;

[0014] Step S12: parse the depth vector to obtain the depth value depth of each texture coordinate point.

[0015] Furthermore, the step S2 includes:

[0016] Step S21: convert the texture coordinate point to the camera space through the depth value depth to obtain the coordinate vector posEC of the texture coordinate point in the camera space coordinate system;

[0017] Step S22: multiplying the texture view transposition matrix inverseView by the coordinate vector posEC to obtain the position coordinate vector posWC of the texture coordinate point in the model coordinate system or the scene coordinate system;

[0018] Step S23: Calculate the normal vector normalWC of the texture coordinate point in the scene coordinate system using the position coordinate vector posWC; calculate the orientation angle of the texture coordinate point by multiplying the normal vector normalWC with the coordinate component posWC.xyz of the position coordinate vector posWC;

[0019] Step S24: Determine whether snow cover rendering is required based on the orientation angle.

[0020] Furthermore, the step S24 includes:

[0021] The range of the orientation angle is from 0° to 90°;

[0022] Whether to perform snow cover rendering is positively correlated with the orientation angle; when the orientation angle is 90°, snow cover rendering is performed, and snow cover rendering is not performed at other orientation angles.

[0023] Furthermore, the step S3 includes:

[0024] Step S31: Calculating the white ratio value of the texture coordinate point that needs to be rendered with snow cover according to the snow thickness;

[0025] Step S32: Analyze the color vector to obtain the original color value of each texture coordinate point;

[0026] Step S33: The white ratio value of the texture coordinate point that needs to be rendered with snow cover is merged with the original color value of each texture coordinate point to achieve the final rendering effect.

[0027] Furthermore, the step S33 includes:

[0028] The white ratio value of the texture coordinate point that needs to be rendered with snow cover is proportionally merged with its original color value to obtain the color value to be rendered;

[0029] The texture coordinate points that do not need to be rendered with snow cover use their original color values ​​as the color values ​​to be rendered;

[0030] The shader performs final rendering according to the to-be-rendered color values ​​of the texture coordinate points that need to be rendered for snow cover rendering and the to-be-rendered color values ​​of the texture coordinate points that do not need to be rendered for snow cover rendering.

[0031] Furthermore, the fusion to obtain the color value to be rendered includes:

[0032] Vec4(1.0, 1.0, 1.0, 1.0)*alpha+color*(1-alpha)=color'

[0033] in:

[0034] Vec4(1.0, 1.0, 1.0, 1.0) is the color value of white in the shader;

[0035] Alpha is a preset proportional value in the shader. The value range of alpha is 0-1. The thicker the snow, the closer the alpha is to 1.

[0036] Color is the original color value of the texture coordinate point;

[0037] 'color' is the color value of the texture coordinate point to be rendered.

[0038] Compared with the existing technology, the beneficial effects of the present invention are:

[0039] A method for generating snow effects based on the Cesium 3D rendering engine comprises the following steps: step S1: sampling a texture map of a model to obtain a texture coordinate vector of each texture coordinate point in the texture map; step S2: converting the texture coordinate vector into camera space, and judging whether to perform snow cover rendering based on the conversion result; step S3: performing snow rendering on the texture coordinate points requiring snow cover rendering based on the judgment result, and fusing the rendering result with the texture map to achieve a final rendering effect; the method can generate a corresponding snow effect according to the snow thickness, covering objects in the environment, has a high degree of realism in terms of covering plants and buildings, and can specify specific covering targets to achieve the effect of accurately covering target areas and objects. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 This is a flowchart of a method for generating snow effects based on the Cesium 3D rendering engine;

[0041] Figure 2 This is a before-and-after comparison of a snow effect generation method based on the Cesium 3D rendering engine. DETAILED DESCRIPTION

[0042] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus comprising the element.

[0043] The features and performance of the present invention are further described in detail below with reference to the embodiments.

[0044] Example 1

[0045] Existing 3D rendering engines are mainly dedicated to the rendering of geographic information, with less research on environmental simulation based on geographic information. They only support simple weather effects based on particle systems, with poor realism. However, in game engines, the rendering effect of snow has a high degree of realism and can highly restore the snow scenes in the real world. In terms of scene snow rendering, game engines use a combination of shaders and models to make the snow effect closer to the real physical laws. However, 3D rendering engines based on geographic information have almost no involvement in scene snow rendering.

[0046] Cesium is a JavaScript-based map engine using WebGL. It can render three-dimensional geographic information based on remote sensing imagery. However, when it comes to rendering snow in scenes, the Cesium framework lacks a complete simulation system. It only provides a simple snow effect based on a particle system, and the effect is very low in realism. It does not involve the simulation of snowy environments.

[0047] In response to the above problems, this embodiment proposes a snow effect generation method based on the Cesium 3D rendering engine, which can generate corresponding snow effects according to the thickness of the snow, cover objects in the environment, and has a high degree of realism in covering plants and buildings.

[0048] See also Figure 1-Figure 2 A method for generating snow effects based on the Cesium 3D rendering engine. It should be noted that this generation method can be used for scene post-processing or to modify Cesium's existing shading model to directly implement snow effect rendering on the existing model.

[0049] In this embodiment, a method for generating snow effects based on the Cesium 3D rendering engine, with respect to scene post-processing, specifically includes the following steps:

[0050] Step S1: sampling the texture map of the model to obtain the texture coordinate vector of each texture coordinate point in the texture map; preferably, the model is a scene model drawn based on geographic image elevation data loaded via a Cesium interface;

[0051] Step S2: converting the texture coordinate vector into the camera space, and determining whether to perform snow cover rendering based on the conversion result;

[0052] Step S3: Based on the judgment result, snow rendering is performed on the texture coordinate points that need to be rendered with snow cover, and the rendering result is merged with the texture map to achieve the final rendering effect.

[0053] In this embodiment, specifically, step S1 includes:

[0054] Step S11: sampling the color texture map and the depth texture map through the sampling function Texture2D to obtain the color vector and depth vector of each texture coordinate point; it should be noted that the color texture map and the depth texture map are both four-dimensional vectors, the texture coordinate points are two-dimensional vectors, and all texture coordinate points constitute a point set of texture coordinate points; the sampling results are color vectors and depth vectors, and the color vectors and depth vectors are both four-dimensional vectors; preferably, step S11 is to sample the color texture map and depth texture map of the constructed scene;

[0055] Step S12: parse the depth vector to obtain the depth value depth of each texture coordinate point.

[0056] In this embodiment, specifically, step S2 includes:

[0057] Step S21: converting the texture coordinate point into the camera space by the depth value depth to obtain the coordinate vector posEC of the texture coordinate point in the camera space coordinate system; it should be noted that the coordinate vector posEC is a four-dimensional vector;

[0058] Step S22: multiplying the texture view transposition matrix inverseView by the coordinate vector posEC to obtain the position coordinate vector posWC of the texture coordinate point in the scene coordinate system; it should be noted that the texture view transposition matrix inverseView is built-in in Cesium; the position coordinate vector posWC is a four-dimensional vector;

[0059] Step S23: Calculate the normal vector normalWC of the texture coordinate point in the scene coordinate system using the position coordinate vector posWC; calculate the orientation angle of the texture coordinate point by multiplying the normal vector normalWC by the coordinate component posWC.xyz of the position coordinate vector posWC; it should be noted that the normal vector normalWC is a three-dimensional vector;

[0060] Step S24: Determine whether snow cover rendering is required based on the orientation angle.

[0061] In this embodiment, specifically, step S24 includes:

[0062] The range of the orientation angle is from 0° to 90°;

[0063] Whether to perform snow cover rendering is positively correlated with the orientation angle; when the orientation angle is 90°, snow cover rendering is performed, and snow cover rendering is not performed at other orientation angles.

[0064] In this embodiment, specifically, step S3 includes:

[0065] Step S31: Calculating the white ratio value of the texture coordinate point that needs to be rendered with snow cover according to the snow thickness;

[0066] Step S32: Analyze the color vector to obtain the original color value of each texture coordinate point;

[0067] Step S33: The white ratio value of the texture coordinate point that needs to be rendered with snow cover is merged with the original color value of each texture coordinate point to achieve the final rendering effect.

[0068] In this embodiment, specifically, step S33 includes:

[0069] The white ratio value of the texture coordinate point that needs to be rendered with snow cover is proportionally merged with its original color value to obtain the color value to be rendered;

[0070] The texture coordinate points that do not need to be rendered with snow cover use their original color values ​​as the color values ​​to be rendered;

[0071] The shader performs final rendering according to the to-be-rendered color values ​​of the texture coordinate points that need to be rendered for snow cover rendering and the to-be-rendered color values ​​of the texture coordinate points that do not need to be rendered for snow cover rendering.

[0072] Furthermore, the fusion to obtain the color value to be rendered includes:

[0073] Vec4(1.0, 1.0, 1.0, 1.0)*alpha+color*(1-alpha)=color'

[0074] in:

[0075] Vec4(1.0, 1.0, 1.0, 1.0) is the color value of white in the shader;

[0076] Alpha is a preset proportional value in the shader. The value range of alpha is 0-1. The thicker the snow, the closer the alpha is to 1.

[0077] Color is the original color value of the texture coordinate point;

[0078] 'color' is the color value of the texture coordinate point to be rendered.

[0079] Example 2

[0080] In this embodiment, a method for generating snow effects based on the Cesium 3D rendering engine, targeting the existing Cesium shading model, specifically includes the following steps:

[0081] Step S1: sampling the texture map of the model to obtain the texture coordinate vector of each texture coordinate point in the texture map; preferably, the model is: Cesium's existing shading model;

[0082] Step S2: converting the texture coordinate vector into the camera space, and determining whether to perform snow cover rendering based on the conversion result;

[0083] Step S3: Based on the judgment result, snow rendering is performed on the texture coordinate points that need to be rendered with snow cover, and the rendering result is merged with the texture map to achieve the final rendering effect.

[0084] In this embodiment, specifically, step S1 includes:

[0085] Step S11: sampling the color texture map and the depth texture map through the sampling function Texture2D to obtain the color vector and depth vector of each texture coordinate point; it should be noted that the color texture map and the depth texture map are both four-dimensional vectors, the texture coordinate points are two-dimensional vectors, and all texture coordinate points constitute a point set of texture coordinate points; the sampling results are color vectors and depth vectors, and the color vectors and depth vectors are both four-dimensional vectors; preferably, step S11 is to sample the color texture map and depth texture map of the existing shading model of Cesium;

[0086] Step S12: parse the depth vector to obtain the depth value depth of each texture coordinate point.

[0087] In this embodiment, specifically, step S2 includes:

[0088] Step S21: converting the texture coordinate point into the camera space by the depth value depth to obtain the coordinate vector posEC of the texture coordinate point in the camera space coordinate system; it should be noted that the coordinate vector posEC is a four-dimensional vector;

[0089] Step S22: multiplying the texture view transposition matrix inverseView by the coordinate vector posEC to obtain the position coordinate vector posWC of the texture coordinate point in the model coordinate system; it should be noted that the texture view transposition matrix inverseView is built-in in Cesium; the position coordinate vector posWC is a four-dimensional vector;

[0090] Step S23: Calculate the normal vector normalWC of the texture coordinate point in the model coordinate system using the position coordinate vector posWC; calculate the orientation angle of the texture coordinate point by multiplying the normal vector normalWC by the coordinate component posWC.xyz of the position coordinate vector posWC; it should be noted that the normal vector normalWC is a three-dimensional vector;

[0091] Step S24: Determine whether snow cover rendering is required based on the orientation angle.

[0092] In this embodiment, specifically, step S24 includes:

[0093] The range of the orientation angle is from 0° to 90°;

[0094] Whether to perform snow cover rendering is positively correlated with the orientation angle; when the orientation angle is 90°, snow cover rendering is performed, and snow cover rendering is not performed at other orientation angles.

[0095] In this embodiment, specifically, step S3 includes:

[0096] Step S31: Calculating the white ratio value of the texture coordinate point that needs to be rendered with snow cover according to the snow thickness;

[0097] Step S32: Analyze the color vector to obtain the original color value of each texture coordinate point;

[0098] Step S33: The white ratio value of the texture coordinate point that needs to be rendered with snow cover is merged with the original color value of each texture coordinate point to achieve the final rendering effect.

[0099] In this embodiment, specifically, step S33 includes:

[0100] The white ratio value of the texture coordinate point that needs to be rendered with snow cover is proportionally merged with its original color value to obtain the color value to be rendered;

[0101] The texture coordinate points that do not need to be rendered with snow cover use their original color values ​​as the color values ​​to be rendered;

[0102] The shader performs final rendering according to the to-be-rendered color values ​​of the texture coordinate points that need to be rendered for snow cover rendering and the to-be-rendered color values ​​of the texture coordinate points that do not need to be rendered for snow cover rendering.

[0103] Furthermore, the fusion to obtain the color value to be rendered includes:

[0104] Vec4(1.0, 1.0, 1.0, 1.0)*alpha+color*(1-alpha)=color'

[0105] in:

[0106] Vec4(1.0, 1.0, 1.0, 1.0) is the color value of white in the shader;

[0107] Alpha is a preset proportional value in the shader. The value range of alpha is 0-1. The thicker the snow, the closer the alpha is to 1.

[0108] Color is the original color value of the texture coordinate point;

[0109] 'color' is the color value of the texture coordinate point to be rendered.

[0110] The above-described embodiments merely represent specific implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of protection of the present application. It should be noted that a person skilled in the art would be able to make numerous variations and improvements without departing from the technical concept of the present application, and all such variations and improvements fall within the scope of protection of the present application.

Claims

1. A method for generating snow effects based on the Cesium 3D rendering engine, characterized in that: The steps include: Step S1: sampling the texture map of the model to obtain the texture coordinate vector of each texture coordinate point in the texture map; Step S2: converting the texture coordinate vector into the camera space, and determining whether to perform snow cover rendering based on the conversion result; Step S3: Based on the judgment result, snow rendering is performed on the texture coordinate points that need to be rendered for snow cover, and the rendering result is merged with the texture map to achieve the final rendering effect; The step S2 includes: Step S21: convert the texture coordinate point to the camera space through the depth value depth to obtain the coordinate vector posEC of the texture coordinate point in the camera space coordinate system; Step S22: multiplying the texture view transposition matrix inverseView by the coordinate vector posEC to obtain the position coordinate vector posWC of the texture coordinate point in the model coordinate system or the scene coordinate system; Step S23: Calculate the normal vector normalWC of the texture coordinate point in the scene coordinate system using the position coordinate vector posWC; calculate the orientation angle of the texture coordinate point by multiplying the normal vector normalWC with the coordinate component posWC.xyz of the position coordinate vector posWC; Step S24: Determine whether snow cover rendering is required based on the orientation angle.

2. The method for generating snow effects based on the Cesium 3D rendering engine according to claim 1, characterized in that: The model described is: Cesium's existing shading model.

3. The method for generating snow effects based on the Cesium 3D rendering engine according to claim 1, characterized in that: The model is a scene model drawn based on geographic image elevation data loaded via the Cesium interface.

4. A method for generating snow effects based on a Cesium 3D rendering engine according to claim 2 or 3, characterized in that: The step S1 includes: Step S11: sampling the color texture map and the depth texture map through the sampling function Texture2D to obtain the color vector and depth vector of each texture coordinate point; Step S12: parse the depth vector to obtain the depth value depth of each texture coordinate point.

5. The method for generating snow effects based on the Cesium 3D rendering engine according to claim 1, characterized in that: The step S24 includes: The range of the orientation angle is from 0° to 90°; Whether to perform snow cover rendering is positively correlated with the orientation angle; when the orientation angle is 90°, snow cover rendering is performed, and snow cover rendering is not performed at other orientation angles.

6. The method for generating snow effects based on the Cesium 3D rendering engine according to claim 5, characterized in that: The step S3 includes: Step S31: Calculating the white ratio value of the texture coordinate point that needs to be rendered with snow cover according to the snow thickness; Step S32: Analyze the color vector to obtain the original color value of each texture coordinate point; Step S33: The white ratio value of the texture coordinate point that needs to be rendered with snow cover is merged with the original color value of each texture coordinate point to achieve the final rendering effect.

7. The method for generating snow effects based on the Cesium 3D rendering engine according to claim 6, characterized in that: The step S33 includes: The white ratio value of the texture coordinate point that needs to be rendered with snow cover is proportionally merged with its original color value to obtain the color value to be rendered; The texture coordinate points that do not need to be rendered with snow cover use their original color values ​​as the color values ​​to be rendered; The shader performs final rendering according to the to-be-rendered color values ​​of the texture coordinate points that need to be rendered for snow cover rendering and the to-be-rendered color values ​​of the texture coordinate points that do not need to be rendered for snow cover rendering.

8. The method for generating snow effects based on the Cesium 3D rendering engine according to claim 7, characterized in that: The fusion obtains the color value to be rendered, including: Vec 4(1.0,1.0,1.0,1.0)* alpha+color* (1- alpha )= color ’ in: Vec 4 (1.0, 1.0, 1.0, 1.0) is the color value of white in the shader; alpha is the preset scale value in the shader, alpha The value range is 0-1, the thicker the snow alpha The closer to 1; color is the original color value of the texture coordinate point; color 'The color value to be rendered for the texture coordinate point.

Citation Information

Patent Citations

  • Snowscape rendering method and device for large scene, equipment and storage medium

    CN112233214A

  • Three-dimensional video fusion method and system based on WebGL

    CN112437276A