Method, system, storage medium and electronic device for rendering radar scanning animation

By building layer objects and shader programs, the parameters entered by users are processed in real time, and the problems of poor radar scanning animation performance and animation pause in the existing technology are solved, and flexible, easy to expand and high reliability radar scanning animation rendering is achieved. Effect.

CN114387382BActive Publication Date: 2024-11-05GUILIN CHANGHAI DEV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111666440.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-31
Publication Date
2024-11-05
Estimated Expiration
2041-12-31

AI Technical Summary

Technical Problem

Existing radar scanning animations based on the openlayers engine implementation have shortcomings in performance, fluency and flexibility, especially when setting size or color attributes in real time, and animations are paused until they are put when the user drags the map to roam. Turn on the mouse to continue scanning.

Method used

By building layer objects and their corresponding shader programs, the real-time parameters entered by the user are obtained and passed to the shader program for rendering processing, realizing the rendering of radar scanning animations, and using vertex and fragment shader programs to process the radar scanning radius and color respectively. and transparency, rotation direction and speed to achieve real-time control and optimization of animations.

Benefits of technology

It realizes flexible, easy to expand, high reliability and superior performance radar scanning animation rendering, which can control the animation effect in real time while ensuring performance, avoiding the problem of animation pause.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114387382B_ABST
    Figure CN114387382B_ABST
Patent Text Reader

Abstract

The present invention relates to a method, system, storage medium and electronic device for rendering radar scanning animation, the method comprising: constructing a layer object corresponding to the radar scanning animation to be rendered, constructing at least one pair of shader programs corresponding to the layer object, and then obtaining real-time parameters input by a user for map zooming, passing the real-time parameters to the corresponding shader program, so as to render the layer image and obtain the rendered radar scanning animation. The method of the present invention processes the radar scanning animation to be rendered by writing a shader program, and while realizing the rendering of radar scanning lines and scanning afterglow animation, the method also has the characteristics of flexibility, easy expansion, high reliability and excellent performance.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] Currently, many geographic information systems are developed based on the openlayers engine, which provides a wealth of classes. The image class can be used to define icons that can be displayed on a layer, and the rotate() interface of the class can be used to set the icon to rotate. In this way, users can design a rotating radar scanning animation. However, this class is based on the canvas and the CPU renders the animation. Therefore, this implementation method has some performance problems. When it is necessary to set the size or color and other attributes in real time, it cannot be implemented under the premise of ensuring performance. Moreover, when the user uses the mouse to drag the map to roam, the radar scanning animation implemented by this method will pause until the mouse is released to continue scanning. Therefore, it cannot meet the requirements in some application fields that have high requirements for performance, fluency, reliability and flexibility. Summary of the invention

[0003] To solve the above technical problems, the present invention provides a method, system, storage medium and electronic device for rendering radar scanning animation.

[0004] The technical solution of a method for rendering radar scanning animation of the present invention is as follows:

[0005] Constructing a layer object corresponding to the radar scanning animation to be rendered, and constructing at least one pair of shader programs corresponding to the layer object;

[0006] Get the real-time parameters input by the user for map zooming;

[0007] The real-time parameters are passed to a corresponding shader program to render the layer image to obtain a rendered radar scanning animation.

[0008] The beneficial effects of the method for rendering radar scanning animation of the present invention are as follows:

[0009] The method of the present invention constructs a layer object corresponding to the radar scanning animation to be rendered, constructs at least one pair of shader programs corresponding to the layer object, obtains the real-time parameters input by the user for map zooming, and passes the real-time parameters to the corresponding shader program to render the layer image to obtain the rendered radar scanning animation. Therefore, the method of the present invention processes the radar scanning animation to be rendered by writing a shader program, and while achieving the rendering of radar scanning lines and scanning afterglow animation, the method also has the characteristics of flexibility, easy expansion, high reliability and excellent performance.

[0010] Based on the above solution, the method for rendering radar scanning animation of the present invention can also be improved as follows.

[0011] Furthermore, the at least one pair of shader programs includes: a vertex shader program and a fragment shader program.

[0012] The beneficial effect of adopting the above further solution is: different functions are respectively realized by different shader programs, so as to achieve the effect of rendering radar scanning animation.

[0013] Furthermore, the real-time parameters include: radar scanning radius, color parameters, transparency parameters, rotation direction and rotation speed; wherein, the rendering resolution ratio is obtained according to the view zoom level corresponding to the user when zooming the map, and the rendering resolution ratio is mapped to the radar scanning radius.

[0014] Furthermore, the step of passing the real-time parameters to a corresponding shader program to render the layer image to obtain a rendered radar scanning animation specifically includes:

[0015] Sending the radar scanning radius to the vertex shader program to perform texture coordinate scaling on the radar scanning radius to obtain radar scanning texture coordinates;

[0016] Based on a preset control condition, the color parameter and the transparency parameter are sent to the fragment shader program, and according to the optimized rendering point generated by the fragment shader, a radar scanning circle and afterglow transparency corresponding to the color parameter and the transparency parameter are obtained;

[0017] The rotation direction and the rotation speed are sent to the vertex shader program to control the rotation behavior of the radar scanning animation.

[0018] The beneficial effect of adopting the above further solution is: the radar scanning circle color, afterglow transparency, and rotation direction and speed are controlled in real time through different real-time parameters.

[0019] Furthermore, the preset control condition is: optimizing the original rendering point that has been magnified by the fragment shader program to obtain the optimized rendering point.

[0020] The beneficial effect of adopting the above further solution is that the rendered image without graphics is optimized, so that the radar scanning line and scanning afterglow fading effect can be better achieved.

[0021] The technical solution of a system for rendering radar scanning animation of the present invention is as follows:

[0022] Includes: pre-configuration module, acquisition module and operation module;

[0023] The preconfiguration module is used to: construct a layer object corresponding to the radar scanning animation to be rendered, and construct at least one pair of shader programs corresponding to the layer object;

[0024] The acquisition module is used to: acquire real-time parameters input by a user for map zooming;

[0025] The operation module is used to: pass the real-time parameters to the corresponding shader program to render the layer image to obtain a rendered radar scanning animation.

[0026] The beneficial effects of the system for rendering radar scanning animation of the present invention are as follows:

[0027] The system of the present invention constructs a layer object corresponding to the radar scanning animation to be rendered, constructs at least one pair of shader programs corresponding to the layer object, obtains the real-time parameters input by the user for map zooming, and passes the real-time parameters to the corresponding shader program to render the layer image to obtain the rendered radar scanning animation. Therefore, the system of the present invention processes the radar scanning animation to be rendered by writing a shader program. While realizing the rendering of radar scanning lines and scanning afterglow animation, the method is also flexible, easy to expand, highly reliable, and has excellent performance.

[0028] Based on the above solution, the system for rendering radar scanning animation of the present invention can also be improved as follows.

[0029] Furthermore, the at least one pair of shader programs includes: a vertex shader program and a fragment shader program.

[0030] Furthermore, the real-time parameters include: radar scanning radius, color parameters, transparency parameters, rotation direction and rotation speed; wherein, the rendering resolution ratio is obtained according to the view zoom level corresponding to the user when zooming the map, and the rendering resolution ratio is mapped to the radar scanning radius.

[0031] A technical solution of a storage medium of the present invention is as follows:

[0032] The storage medium stores instructions, and when a computer reads the instructions, the computer executes the steps of the method for rendering radar scanning animation as described in any one of the above items.

[0033] The technical solution of an electronic device of the present invention is as follows:

[0034] The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the computer is caused to execute the steps of the method for rendering radar scanning animation as described in any one of the above items. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1A schematic diagram of a flow chart of a method for rendering radar scanning animation according to an embodiment of the present invention;

[0036] Figure 2 It is a structural schematic diagram of a system for rendering radar scanning animation according to an embodiment of the present invention. DETAILED DESCRIPTION

[0037] like Figure 1 As shown, the method for rendering radar scanning animation according to an embodiment of the present invention comprises the following steps:

[0038] S1. Construct a layer object corresponding to the radar scanning animation to be rendered, and construct at least one pair of shader programs corresponding to the layer object;

[0039] The method of this embodiment uses web technology, the language is JavaScript, the shading language is GLSL, and the engine is openlayers.

[0040] Among them, a map object is defined using the openlayers Map class, which contains a target attribute for specifying the HTML tag, a layer layers array attribute, and a view view attribute. The radar scanning animation to be rendered will be added to the layers array as a layer to obtain the layer object of the radar scanning animation to be rendered.

[0041] At least one pair of shader programs is designed in the layer object to process vertices or fragments in the radar scanning animation; the processing methods include but are not limited to: transformation or calculation.

[0042] S2. Obtaining real-time parameters input by the user for map zooming;

[0043] Specifically, according to the map zooming operation instruction input by the user, the real-time parameters when the user zooms the map are obtained.

[0044] S3. Pass the real-time parameters to a corresponding shader program to render the layer image to obtain a rendered radar scanning animation.

[0045] The radar scanning animation to be rendered is rendered by rendering the constructed layer object to obtain the rendered radar scanning animation.

[0046] Preferably, the at least one pair of shader programs includes: a vertex shader program and a fragment shader program.

[0047] Among them, the vertex shader program is used to perform transformations such as projection, rotation, and scaling on vertices, and the fragment shader program is used to calculate the color value of each fragment.

[0048] It should be noted that the vertex shader program and the fragment shader program can be set as a pair of shader programs or multiple pairs of shader programs according to user needs.

[0049] Preferably, the real-time parameters include: radar scanning radius, color parameters, transparency parameters, rotation direction and rotation speed; wherein, the rendering resolution ratio is obtained according to the view zoom level corresponding to the user when zooming the map, and the rendering resolution ratio is mapped to the radar scanning radius.

[0050] The radar scanning radius will change according to the zoom ratio of the user, so the following steps must be followed to implement real-time control of the radar scanning radius based on the zoom ratio:

[0051] 1) Obtain the rendering resolution ratio of the map at that level according to the view zoom level;

[0052] 2) Convert the linear mapping of the resolution ratio into the radar scanning radius;

[0053] 3) Pass the radar scanning radius into the vertex shader program;

[0054] 4) In the vertex shader program, the texture coordinates are scaled according to the radar scanning radius, thereby changing the radius of the inscribed circle of the square, and finally achieving the effect that the radar scanning radius changes with the view zoom.

[0055] Among them, the radar scanning radius is obtained by linear mapping based on the distance that the specific radar can scan and the current map or chart scale data. A map or chart is a tile image containing actual geographic information that is spliced ​​and projected onto a window of a certain size. Different levels of a map or chart projected onto a window of the same size have different marked distances or areas. The radar scanning area radius is relative to the actual geographic data. Once the map level is zoomed, the radar scanning radius is adjusted according to the level. For example, a viewport with a side length of 100 renders a circular radar scan with a radius of 50. If the current level radius is 50 and the corresponding geographic distance is 10 kilometers, then when the level is changed, the corresponding viewport size also needs to change. The view window is the window area of ​​the actual map or chart.

[0056] Preferably, the S3 specifically includes:

[0057] S31, sending the radar scanning radius to the vertex shader program to perform texture coordinate scaling on the radar scanning radius to obtain radar scanning texture coordinates;

[0058] According to the scaling function in the vertex shader program, the texture coordinates of the radar scanning radius are scaled to obtain the radar scanning texture coordinates.

[0059] S32, based on a preset control condition, sending the color parameter and the transparency parameter to the fragment shader program, and obtaining a radar scanning circle and afterglow transparency corresponding to the color parameter and the transparency parameter according to the optimized rendering point generated by the fragment shader;

[0060] S33, sending the rotation direction and the rotation speed to the vertex shader program to control the rotation behavior of the radar scanning animation.

[0061] Preferably, the preset control condition is: optimizing the original rendering point that has been magnified by the fragment shader program to obtain the optimized rendering point.

[0062] Among them, since the openlayers engine only supports point rendering in shader programs, and the points are all square, therefore, in order to realize a circular scanning animation, it must be realized by rendering points. The radius of the point needs to be enlarged into a square, and then the corresponding fragments are discarded through conditional judgment in the fragment shader program (for example, the four corners outside the inscribed circle of the rectangle in the texture coordinates, so that the square becomes a circle) and different alpha gradient transparency is set for different areas to realize the radar scanning circle (line) and scanning afterglow fading effect.

[0063] Among them, the radius of the point can be understood as the radius of the radar scanning circle, which is actually the radius of the scanning animation circle. A point in the computer can be represented by one screen pixel or four screen pixels on the computer screen. The larger the radius, the more screen pixels are used to represent the point, and the wider the screen area occupied by the square that makes up the point.

[0064] In addition, a two-dimensional rotation matrix is ​​defined in the vertex shader program in step S33 to realize the rotation transformation of the radar scanning circle, specifically: Where θ is the rotation angle, which is passed to the shader program by the application in real time. The effect achieved by this rotation transformation is essentially a point rotating. When the point radius is enlarged, it becomes a square rotating around the center point.

[0065] The technical solution of this embodiment constructs a layer object corresponding to the radar scanning animation to be rendered, and constructs at least one pair of shader programs corresponding to the layer object, and then obtains the real-time parameters input by the user for map zooming, and passes the real-time parameters to the corresponding shader program to render the layer image to obtain the rendered radar scanning animation. Therefore, the technical solution of this embodiment processes the radar scanning animation to be rendered by writing a shader program. While achieving the rendering of radar scanning lines and scanning afterglow animation, this method also has the characteristics of flexibility, easy expansion, high reliability and excellent performance.

[0066] like Figure 2 As shown, a system 200 for rendering radar scanning animation according to an embodiment of the present invention comprises a pre-configuration module 210, an acquisition module 220 and an operation module 230;

[0067] The preconfiguration module 210 is used to: construct a layer object corresponding to the radar scanning animation to be rendered, and construct at least one pair of shader programs corresponding to the layer object;

[0068] The acquisition module 220 is used to: acquire real-time parameters input by a user for map zooming;

[0069] The operation module 230 is used to: pass the real-time parameters to the corresponding shader program to render the layer image to obtain a rendered radar scanning animation.

[0070] Preferably, the at least one pair of shader programs includes: a vertex shader program and a fragment shader program.

[0071] Preferably, the real-time parameters include: radar scanning radius, color parameters, transparency parameters, rotation direction and rotation speed; wherein, the rendering resolution ratio is obtained according to the view zoom level corresponding to the user when zooming the map, and the rendering resolution ratio is mapped to the radar scanning radius.

[0072] The technical solution of this embodiment constructs a layer object corresponding to the radar scanning animation to be rendered, and constructs at least one pair of shader programs corresponding to the layer object, and then obtains the real-time parameters input by the user for map zooming, and passes the real-time parameters to the corresponding shader program to render the layer image to obtain the rendered radar scanning animation. Therefore, the technical solution of this embodiment processes the radar scanning animation to be rendered by writing a shader program. While achieving the rendering of radar scanning lines and scanning afterglow animation, this method also has the characteristics of flexibility, easy expansion, high reliability and excellent performance.

[0073] The above-mentioned parameters in the system 200 for rendering radar scanning animation and the steps for each module to implement corresponding functions in this embodiment can refer to the parameters and steps in the embodiment of a method for rendering radar scanning animation above, and will not be repeated here.

[0074] A storage medium provided by an embodiment of the present invention includes: instructions stored in the storage medium, and when a computer reads the instructions, the computer executes steps such as a method for rendering a radar scanning animation. For details, please refer to the parameters and steps in the embodiment of a method for rendering a radar scanning animation above, which will not be repeated here.

[0075] Computer storage media such as USB flash drives, mobile hard disks, etc.

[0076] An electronic device provided by an embodiment of the present invention includes a memory, a processor, and a computer program stored in the memory and executable on the processor. The electronic device is characterized in that when the processor executes the computer program, the computer executes steps of a method for rendering a radar scanning animation. For details, reference may be made to the parameters and steps in the embodiment of a method for rendering a radar scanning animation described above, which will not be elaborated here.

[0077] Those skilled in the art will appreciate that the present invention may be implemented as a method, a system, a storage medium, and an electronic device.

[0078] Therefore, the present invention can be specifically implemented in the following forms, that is, it can be complete hardware, it can be complete software (including firmware, resident software, microcode, etc.), or it can be a combination of hardware and software, which is generally referred to as "circuit", "module" or "system" herein. In addition, in some embodiments, the present invention can also be implemented in the form of a computer program product in one or more computer-readable media, and the computer-readable medium contains computer-readable program code. Any combination of one or more computer-readable media can be used. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to - an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device. Although the embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and cannot be construed as limiting the present invention, and those skilled in the art may make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present invention.

Claims

1. A method for rendering radar scanning animation, characterized in that: include: Constructing a layer object corresponding to the radar scanning animation to be rendered, and constructing at least one pair of shader programs corresponding to the layer object; Get the real-time parameters input by the user for map zooming; Passing the real-time parameters to a corresponding shader program to render the layer object to obtain a rendered radar scanning animation; The at least one pair of shader programs includes: a vertex shader program and a fragment shader program; The real-time parameters include: radar scanning radius, color parameter, transparency parameter, rotation direction and rotation speed; wherein a rendering resolution ratio is obtained according to a view zoom level corresponding to the user when zooming the map, and the rendering resolution ratio is mapped to the radar scanning radius; The step of passing the real-time parameters to a corresponding shader program to render the layer object to obtain a rendered radar scanning animation specifically includes: Sending the radar scanning radius to the vertex shader program to perform texture coordinate scaling on the radar scanning radius to obtain radar scanning texture coordinates; Based on a preset control condition, the color parameter and the transparency parameter are sent to the fragment shader program, and according to the optimized rendering point generated by the fragment shader program, a radar scanning circle and afterglow transparency corresponding to the color parameter and the transparency parameter are obtained; The rotation direction and the rotation speed are sent to the vertex shader program to control the rotation behavior of the radar scanning animation.

2. The method for rendering radar scanning animation according to claim 1, characterized in that: The preset control condition is: optimizing the original rendering point that has been magnified by the fragment shader program to obtain the optimized rendering point.

3. A system for rendering radar scanning animation, characterized in that: include: Preconfigure modules, obtain modules, and run modules; The preconfiguration module is used to: construct a layer object corresponding to the radar scanning animation to be rendered, and construct at least one pair of shader programs corresponding to the layer object; The acquisition module is used to: acquire real-time parameters input by a user for map zooming; The operation module is used to: pass the real-time parameters to the corresponding shader program to render the layer object to obtain a rendered radar scanning animation; The at least one pair of shader programs includes: a vertex shader program and a fragment shader program; The real-time parameters include: radar scanning radius, color parameter, transparency parameter, rotation direction and rotation speed; wherein a rendering resolution ratio is obtained according to a view zoom level corresponding to the user when zooming the map, and the rendering resolution ratio is mapped to the radar scanning radius; The operation module is specifically used for: Sending the radar scanning radius to the vertex shader program to perform texture coordinate scaling on the radar scanning radius to obtain radar scanning texture coordinates; Based on a preset control condition, the color parameter and the transparency parameter are sent to the fragment shader program, and according to the optimized rendering point generated by the fragment shader program, a radar scanning circle and afterglow transparency corresponding to the color parameter and the transparency parameter are obtained; The rotation direction and the rotation speed are sent to the vertex shader program to control the rotation behavior of the radar scanning animation.

4. A storage medium, characterized in that: The storage medium stores instructions, and when a computer reads the instructions, the computer executes the method for rendering radar scanning animation as claimed in claim 1 or 2.

5. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the electronic device is caused to perform the method for rendering radar scanning animation as claimed in claim 1 or 2.