CN117422814A - OpenGL-based 3D liquid crystal instrument system control system and method - Google Patents

OpenGL-based 3D liquid crystal instrument system control system and method Download PDF

Info

Publication number
CN117422814A
CN117422814A CN202311343418.8A CN202311343418A CN117422814A CN 117422814 A CN117422814 A CN 117422814A CN 202311343418 A CN202311343418 A CN 202311343418A CN 117422814 A CN117422814 A CN 117422814A
Authority
CN
China
Prior art keywords
opengl
edge
liquid crystal
shadow
light source
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311343418.8A
Other languages
Chinese (zh)
Inventor
柯鉴轩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Hangsheng Zhixing Technology Co ltd
Shenzhen Hangsheng Electronic Co Ltd
Original Assignee
Chengdu Hangsheng Zhixing Technology Co ltd
Shenzhen Hangsheng Electronic Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chengdu Hangsheng Zhixing Technology Co ltd, Shenzhen Hangsheng Electronic Co Ltd filed Critical Chengdu Hangsheng Zhixing Technology Co ltd
Priority to CN202311343418.8A priority Critical patent/CN117422814A/en
Publication of CN117422814A publication Critical patent/CN117422814A/en
Pending legal-status Critical Current

Links

Classifications

    • BPERFORMING OPERATIONS; TRANSPORTING
    • B60VEHICLES IN GENERAL
    • B60KARRANGEMENT OR MOUNTING OF PROPULSION UNITS OR OF TRANSMISSIONS IN VEHICLES; ARRANGEMENT OR MOUNTING OF PLURAL DIVERSE PRIME-MOVERS IN VEHICLES; AUXILIARY DRIVES FOR VEHICLES; INSTRUMENTATION OR DASHBOARDS FOR VEHICLES; ARRANGEMENTS IN CONNECTION WITH COOLING, AIR INTAKE, GAS EXHAUST OR FUEL SUPPLY OF PROPULSION UNITS IN VEHICLES
    • B60K35/00Instruments specially adapted for vehicles; Arrangement of instruments in or on vehicles
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/10Geometric effects
    • G06T15/20Perspective computation
    • G06T15/205Image-based rendering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/50Lighting effects
    • G06T15/60Shadow generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/50Depth or shape recovery
    • G06T7/507Depth or shape recovery from shading

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Graphics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Computing Systems (AREA)
  • Mechanical Engineering (AREA)
  • Transportation (AREA)
  • Geometry (AREA)
  • Chemical & Material Sciences (AREA)
  • Combustion & Propulsion (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The invention relates to the technical field of image rendering, in particular to a 3D liquid crystal instrument system control system and method based on OpenGL. According to the invention, the light source-based depth information in the scene is acquired through twice rendering, and the shadow is drawn by referring to the depth information during the second normal rendering, so that the stereoscopic effect is generated. The method is mainly applied to drawing the pointer in the liquid crystal instrument, can realize the effects of real-time shadow and pointer accompaniment, and greatly improves the 3D special effect.

Description

OpenGL-based 3D liquid crystal instrument system control system and method
Technical Field
The invention relates to the technical field of image rendering, in particular to a 3D liquid crystal instrument system control system and method based on OpenGL.
Background
Along with the gradual competition of the automobile market, all large automobile host factories develop related research and development on all liquid crystal instruments, and the all liquid crystal instruments can provide more visual and rich information, so that the automobile instruments are the most advanced automobile instruments so far and are also the development directions and trends in the future.
The traditional liquid crystal instrument interface is mostly realized by adopting 2D pictures, and even though the automobile model part is adopted, the traditional liquid crystal instrument interface is generally displayed by adopting pictures rendered with high precision. However, in the pointer section, if only 2D pictures are used, a problem of poor stereoscopic effect occurs when the pointer rotates.
Disclosure of Invention
The invention aims to provide a 3D liquid crystal instrument system control system and method based on OpenGL, which are used for solving the problem that in the prior art, only 2D pictures are adopted, and when a pointer rotates, a stereoscopic impression is not strong.
The embodiment of the invention is realized by the following technical scheme:
in a first aspect, the present invention provides a 3D liquid crystal instrument system control method based on OpenGL, including;
preparing a scene, wherein the scene comprises a 3D model to be rendered, light source positions and the number of light sources, and setting the position of a camera as the position of the light sources;
creating a buffer with the screen resolution, and setting a depth buffer area in an OpenGL rendering target as the buffer;
objects in the scene are sequentially rendered according to the sequence from far to near of the light source, and a depth buffer area stores depth information of a patch closest to the light source in the scene;
performing edge detection on the depth buffer area, extracting the shadow edge band, and storing the shadow edge band in the shadow edge band texture;
setting the rendering target of OpenGL as a buffer corresponding to the screen, restoring the position of the camera to an initial position, rendering the object from far to near again, and drawing a final shadow according to the depth information and the texture of the shadow edge.
In an embodiment of the invention, the edge detection includes edge detection using a Sobe l operator.
In one embodiment of the present invention, the employing a Sobe l operator includes;
acquiring convolution kernels of a Sobe l operator in X and Y directions;
obtaining the gradient of each pixel of the depth buffer area;
and comparing the edge information with a set threshold value to obtain the edge information in the depth buffer area.
In an embodiment of the present invention, the drawing the shadow with texture according to the depth information and the shadow edge includes;
the current texture color is faded when the current front piece is at the shaded edge;
if not at the edge, the set color RGB values are set to 0.1.
In an embodiment of the invention, the light source uses a point light source or a parallel light source.
In an embodiment of the invention, the 3D model comprises a fixed point and a normal.
In a second aspect, the present invention provides an OpenGL-based 3D liquid crystal meter system, comprising;
the scene setting module is configured to prepare a scene, wherein the scene comprises a 3D model to be rendered, light source positions and the number of light sources, and the camera positions are set as the light source positions;
the creating module is configured to create a buffer with the screen resolution and set a depth buffer in the OpenGL rendering target as the buffer;
the rendering module is configured to sequentially render objects in the scene according to the sequence from far to near of the light source, and the depth buffer area stores the depth information of the surface patch closest to the light source in the scene;
the edge detection module is configured to detect edges of the depth buffer area, extract the edge bands of the shadows and store the edge bands into the shadow edge band textures;
the shadow drawing module is configured to set the rendering target of OpenGL as a buffer corresponding to the screen again, restore the position of the camera to an initial position, render the object from far to near again, and draw a final shadow with textures according to the depth information and the shadow edge;
the main control module is connected with the scenery module, the creation module, the rendering module, the edge detection module and the shadow drawing module and used for executing the 3D liquid crystal instrument system control method based on OpenGL.
In an embodiment of the present invention, the method further includes a Sobe l operator module configured to obtain convolution kernels of the Sobe l operator in the X and Y directions, obtain a gradient of each pixel of the depth buffer, and obtain edge information in the depth buffer by comparing with a set threshold.
In a third aspect, the present invention further provides an electronic device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, where the processor implements the above-mentioned 3D liquid crystal instrument system control method based on OpenGL when executing the computer program.
In a fourth aspect, the present invention further provides a computer readable storage medium, where a computer program is stored, where the computer program, when executed by a processor, implements a method for controlling a 3D liquid crystal instrument system based on OpenGL as described above.
The technical scheme of the embodiment of the invention has at least the following advantages and beneficial effects:
according to the invention, the OpenGL image rendering technology is adopted, the characteristic that the depth buffer area can record the depth relation of objects in a scene is skillfully utilized, so that the relative shielding relation of the objects is obtained, the information is combined when the objects are drawn, if the objects are not shielded, normal drawing is performed, otherwise, shadows are drawn, and a three-dimensional effect is generated. According to the invention, the light source-based depth information in the scene is acquired through twice rendering, and the shadow is drawn by referring to the depth information during the second normal rendering, so that the stereoscopic effect is generated. The method is mainly applied to drawing the pointer in the liquid crystal instrument, can realize the effects of real-time shadow and pointer accompaniment, and greatly improves the 3D special effect.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic flow chart of the present invention;
fig. 2 is a convolution kernel of the Sobe l operator in the X Y direction.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. The components of the embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
The division of the modules presented in this application is a logical division, and there may be other manners of division in practical application, for example, multiple modules may be combined or integrated in another system, or some features may be omitted, or not performed.
The modules or sub-modules described separately may or may not be physically separate, may or may not be implemented in software, and may be implemented in part in software, where the processor invokes the software to implement the functions of the part of the modules or sub-modules, and where other parts of the templates or sub-modules are implemented in hardware, for example in hardware circuits. In addition, some or all of the modules may be selected according to actual needs to achieve the purposes of the present application.
Referring to fig. 1, the method for controlling a 3D liquid crystal instrument system based on OpenGL provided by the present invention is characterized by comprising;
step S1: preparing a scene, wherein the scene comprises a 3D model to be rendered, light source positions and the number of light sources, and setting the position of a camera as the position of the light sources;
step S2: creating a buffer with the screen resolution, and setting a depth buffer area in an OpenGL rendering target as the buffer;
a scene is prepared, including the 3D model to be rendered, the light source position and the number. The 3D model should contain basic information such as vertices, normals, etc. The light source may be a point light source or a parallel light source. And creating a buffer (BF_A) with the screen resolution, setting a depth buffer in the OpenGL rendering target as the buffer, and enabling depth detection.
Step S3: objects in the scene are sequentially rendered according to the sequence from far to near of the light source, and a depth buffer area stores depth information of a patch closest to the light source in the scene;
according to the principle of shadow generation, shadow is generated because incident light is blocked by a front object, the position of a camera in a scene is set as the position of a light source, objects in the scene are sequentially rendered according to the sequence from far to near of the light source, and depth data of a patch close to the light source can be covered far from the light source when depth detection is enabled during rendering, so that after the rendering is finished, depth information of the patch closest to the light source in the scene is stored in a depth buffer zone.
Step S4: performing edge detection on the depth buffer area, extracting the shadow edge band, and storing the shadow edge band in the shadow edge band texture;
step S5: setting the rendering target of OpenGL as a buffer corresponding to the screen, restoring the position of the camera to an initial position, rendering the object from far to near again, and drawing a final shadow according to the depth information and the texture of the shadow edge.
According to the invention, the OpenGL image rendering technology is adopted, the characteristic that the depth buffer area can record the depth relation of objects in a scene is skillfully utilized, so that the relative shielding relation of the objects is obtained, the information is combined when the objects are drawn, if the objects are not shielded, normal drawing is performed, otherwise, shadows are drawn, and a three-dimensional effect is generated. According to the invention, the light source-based depth information in the scene is acquired through twice rendering, and the shadow is drawn by referring to the depth information during the second normal rendering, so that the stereoscopic effect is generated. The method is mainly applied to drawing the pointer in the liquid crystal instrument, can realize the effects of real-time shadow and pointer accompaniment, and greatly improves the 3D special effect.
In this embodiment, the edge detection includes edge detection using a Sobe l operator.
The method comprises the steps of adopting a Sobe l operator; acquiring convolution kernels of a Sobe l operator in X and Y directions; obtaining the gradient of each pixel of the depth buffer area; and comparing the edge information with a set threshold value to obtain the edge information in the depth buffer area.
In more detail, real world shadows are not as dull as they are, often darker nearer the center of the shadow, while shadow edges are somewhat brighter due to scattering of visible light. To achieve this, edge detection of the depth buffer is required in order to extract the edge bands where the depth changes drastically, i.e. shadows. Edge detection can be performed by using a Sobe l operator widely used in the industry, and as shown in fig. 2, the edge detection is a convolution kernel of the Sobe l operator in the X Y direction:
by using the operator, the gradient of each pixel of the depth buffer can be obtained, and the Edge information in the depth buffer can be obtained by comparing the gradient with a set threshold value, and the Edge information is stored in another texture (BF_edge).
In this embodiment, the drawing the shadow with texture according to the depth information and the shadow edge includes; the current texture color is faded when the current front piece is at the shaded edge; if not at the edge, the set color RGB values are set to 0.1.
In detail, the rendering target of OpenGL is set to the buffer corresponding to the screen again, the camera position is restored to the initial position, the object is rendered again from far to near, during rendering, the depth information in step S3 is considered, if the depth of the current front patch is larger than the value stored in the buffer, this means that the current front patch is blocked by the front object, meanwhile, the edge detection information in step S4 is referred to, if the current front patch is at the edge of the shadow, the current texture color is faded, and if not at the edge, the color RGB value is set to (0.1,0.1,0.1) directly, so as to realize the characteristic that the color is darker as the current front patch is closer to the center.
In addition, the invention also provides a 3D liquid crystal instrument system based on OpenGL, which comprises the following components;
the scene setting module is configured to prepare a scene, wherein the scene comprises a 3D model to be rendered, light source positions and the number of light sources, and the camera positions are set as the light source positions;
the creating module is configured to create a buffer with the screen resolution and set a depth buffer in the OpenGL rendering target as the buffer;
the rendering module is configured to sequentially render objects in the scene according to the sequence from far to near of the light source, and the depth buffer area stores the depth information of the surface patch closest to the light source in the scene;
the edge detection module is configured to detect edges of the depth buffer area, extract the edge bands of the shadows and store the edge bands into the shadow edge band textures;
the shadow drawing module is configured to set the rendering target of OpenGL as a buffer corresponding to the screen again, restore the position of the camera to an initial position, and render the object from far to near again, and draw the shadow with texture according to the depth information and the shadow edge;
the main control module is connected with the scenery module, the creation module, the rendering module, the edge detection module and the shadow drawing module and used for executing the 3D liquid crystal instrument system control method based on OpenGL.
In this embodiment, the method further includes a Sobe l operator module configured to obtain convolution kernels of the Sobe l operator in the X and Y directions, obtain a gradient of each pixel of the depth buffer, and obtain edge information in the depth buffer by comparing with a set threshold.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. The computer software product is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of the various embodiments of the invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-On-memory (ROM), a random-access memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The above is only a preferred embodiment of the present invention, and is not intended to limit the present invention, but various modifications and variations can be made to the present invention by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. The control method of the 3D liquid crystal instrument system based on OpenGL is characterized by comprising the following steps of;
preparing a scene, wherein the scene comprises a 3D model to be rendered, light source positions and the number of light sources, and setting the position of a camera as the position of the light sources;
creating a buffer with the screen resolution, and setting a depth buffer area in an OpenGL rendering target as the buffer;
objects in the scene are sequentially rendered according to the sequence from far to near of the light source, and a depth buffer area stores depth information of a patch closest to the light source in the scene;
performing edge detection on the depth buffer area, extracting the shadow edge band, and storing the shadow edge band in the shadow edge band texture;
setting the rendering target of OpenGL as a buffer corresponding to the screen, restoring the position of the camera to an initial position, rendering the object from far to near again, and drawing a final shadow according to the depth information and the texture of the shadow edge.
2. The OpenGL-based 3D liquid crystal meter system control method of claim 1, wherein the edge detection includes edge detection using Sobel operator.
3. The OpenGL-based 3D liquid crystal instrument system control method according to claim 2, wherein the adopting a Sobel operator includes;
acquiring convolution kernels of a Sobel operator in X and Y directions;
obtaining the gradient of each pixel of the depth buffer area;
and comparing the edge information with a set threshold value to obtain the edge information in the depth buffer area.
4. The OpenGL-based 3D liquid crystal meter system control method of claim 1, wherein the drawing the final shadow according to the depth information and the shadow edge texture includes;
the current texture color is faded when the current front piece is at the shaded edge;
if not at the edge, the values of the colors RGB are set to 0.1.
5. The 3D liquid crystal instrument system control method based on OpenGL according to claim 1, wherein the light source uses a point light source or a parallel light source.
6. The OpenGL-based 3D liquid crystal instrument system control method according to claim 1, wherein the 3D model includes a fixed point and a normal.
7. A 3D liquid crystal instrumentation system based on OpenGL, comprising;
the scene setting module is configured to prepare a scene, wherein the scene comprises a 3D model to be rendered, light source positions and the number of light sources, and the camera positions are set as the light source positions;
the creating module is configured to create a buffer with the screen resolution and set a depth buffer in the OpenGL rendering target as the buffer;
the rendering module is configured to sequentially render objects in the scene according to the sequence from far to near of the light source, and the depth buffer area stores the depth information of the surface patch closest to the light source in the scene;
the edge detection module is configured to detect edges of the depth buffer area, extract the edge bands of the shadows and store the edge bands into the shadow edge band textures;
the shadow drawing module is configured to set the rendering target of OpenGL as a buffer corresponding to the screen again, restore the position of the camera to an initial position, render the object from far to near again, and draw a final shadow with textures according to the depth information and the shadow edge;
the main control module is connected with the scenery module, the creation module, the rendering module, the edge detection module and the shadow drawing module and is used for executing the 3D liquid crystal instrument system control method based on OpenGL according to any one of claims 1-6.
8. The OpenGL-based 3D liquid crystal instrument system according to claim 7, further comprising a Sobel operator module configured to obtain a convolution kernel of the Sobel operator in the X and Y directions, obtain a gradient of each pixel of the depth buffer, and obtain edge information in the depth buffer by comparing with a set threshold.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements a 3D liquid crystal meter system control method based on OpenGL as claimed in any one of claims 1 to 6 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements a 3D liquid crystal meter system control method based on OpenGL as claimed in any one of claims 1 to 6.
CN202311343418.8A 2023-10-17 2023-10-17 OpenGL-based 3D liquid crystal instrument system control system and method Pending CN117422814A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311343418.8A CN117422814A (en) 2023-10-17 2023-10-17 OpenGL-based 3D liquid crystal instrument system control system and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311343418.8A CN117422814A (en) 2023-10-17 2023-10-17 OpenGL-based 3D liquid crystal instrument system control system and method

Publications (1)

Publication Number Publication Date
CN117422814A true CN117422814A (en) 2024-01-19

Family

ID=89525717

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311343418.8A Pending CN117422814A (en) 2023-10-17 2023-10-17 OpenGL-based 3D liquid crystal instrument system control system and method

Country Status (1)

Country Link
CN (1) CN117422814A (en)

Similar Documents

Publication Publication Date Title
Chaurasia et al. Depth synthesis and local warps for plausible image-based navigation
Kuster et al. FreeCam: A Hybrid Camera System for Interactive Free-Viewpoint Video.
US20190172183A1 (en) Denoising Filter
US8531457B2 (en) Apparatus and method for finding visible points in a cloud point
CN111508052B (en) Rendering method and device of three-dimensional grid body
Zollmann et al. Image-based ghostings for single layer occlusions in augmented reality
Gibson et al. Rapid shadow generation in real-world lighting environments
Schott et al. A directional occlusion shading model for interactive direct volume rendering
Yu et al. Real‐time depth of field rendering via dynamic light field generation and filtering
Rematas et al. Image-based synthesis and re-synthesis of viewpoints guided by 3d models
US9990761B1 (en) Method of image compositing directly from ray tracing samples
US7528831B2 (en) Generation of texture maps for use in 3D computer graphics
Pfeiffer et al. Model-based real-time visualization of realistic three-dimensional heat maps for mobile eye tracking and eye tracking in virtual reality
US8854392B2 (en) Circular scratch shader
US20150187126A1 (en) Using indirection maps for rendering texture space effects
US20230230311A1 (en) Rendering Method and Apparatus, and Device
US9208606B2 (en) System, method, and computer program product for extruding a model through a two-dimensional scene
CN111199573A (en) Virtual-real mutual reflection method, device, medium and equipment based on augmented reality
Liu et al. Depth of field synthesis from sparse views
CN117422814A (en) OpenGL-based 3D liquid crystal instrument system control system and method
Ogaki et al. Production ray tracing of feature lines
Corcoran et al. Perceptual enhancement of two-level volume rendering
Macedo et al. Revectorization‐Based Soft Shadow Mapping
US10255717B2 (en) Geometry shadow maps with per-fragment atomics
Güssefeld et al. Are reflectance field renderings appropriate for optical flow evaluation?

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination