Dynamic sectioning and section filling method for three-dimensional geological model at Web end

文档序号:87723 发布日期:2021-10-08 浏览:35次 中文

阅读说明:本技术 一种Web端三维地质模型动态剖切与剖面填充方法 (Dynamic sectioning and section filling method for three-dimensional geological model at Web end ) 是由 向其权 汤二仁 魏涛 唐爽 付强 谭丹 叶斌 徐嘉 刘久胜 杨培源 于 2021-07-05 设计创作,主要内容包括:本发明公开了一种Web端三维地质模型动态剖切与剖面填充方法,包括步骤:通过Three.js加载并展示三维地质模型;通过Three.js中模型材质的clippingPlans属性设定剖面;采用设定的剖面对三维地质模型进行剖切;确认剖面所在的片元,渲染一个与剖面重合且颜色与对应三维地质模型的地层颜色一致的平面,通过模板测试实现剖面填充;移动或点选新的剖面,实时对三维地质模型的所有地层完成动态剖切与剖面填充。其显著效果是:灵活方便的实现了三维地质模型的动态剖切和剖面填充,渲染模型剖面时的快速和有效,结合剖切盒以及点选确定剖面等操作,极大地提高了用户进行三维地质模型剖切时的体验。(The invention discloses a dynamic sectioning and section filling method for a Web-end three-dimensional geological model, which comprises the following steps of: js through three, and displaying the three-dimensional geological model; setting a section through clippingPlans attribute of a model material in thread; sectioning the three-dimensional geological model by adopting a set section; confirming the fragment where the section is located, rendering a plane which is coincident with the section and has the color consistent with the color of the stratum of the corresponding three-dimensional geological model, and realizing section filling through template testing; and moving or clicking a new section, and completing dynamic sectioning and section filling on all stratums of the three-dimensional geological model in real time. The remarkable effects are as follows: the method has the advantages that the dynamic sectioning and section filling of the three-dimensional geological model are flexibly and conveniently realized, the section of the model is rendered quickly and effectively, the operations of sectioning the box, clicking to determine the section and the like are combined, and the experience of a user in sectioning the three-dimensional geological model is greatly improved.)

1. A dynamic sectioning and section filling method for a three-dimensional geological model at a Web end is characterized by comprising the following steps:

step 1, loading and displaying a three-dimensional geological model through three.js;

step 2, setting a section through clippingPlans attribute of the model material in three.js;

step 3, sectioning the three-dimensional geological model by adopting a set section;

step 4, confirming the fragment where the section is located, rendering a plane which is coincident with the section and has the color consistent with the color of the stratum of the corresponding three-dimensional geological model, and realizing section filling through template testing;

and 5, moving or clicking a new section, and returning to the step 3 to carry out circulation until all stratums of the three-dimensional geological model are cut and section filling is completed.

2. The dynamic sectioning and profile filling method of the Web-end three-dimensional geological model according to claim 1, characterized by comprising the following steps: in the step 1, when the three-dimensional geological model is loaded, a necessary scene, a camera and a renderer need to be created in advance through three.

3. The dynamic sectioning and profile filling method of the Web-end three-dimensional geological model according to claim 2, characterized in that: and (3) loading the three-dimensional geological model through GLTFLoader built in three.

4. The dynamic sectioning and profile filling method of the Web-end three-dimensional geological model according to claim 1, characterized by comprising the following steps: and 3, sectioning the three-dimensional geological model by adopting a sectioning box or a sectioning line.

5. The dynamic sectioning and profile filling method of the Web-end three-dimensional geological model according to claim 1, characterized by comprising the following steps: the step 4 of determining the slice element where the section is located comprises the following steps:

controlling through the side attribute of the model material in three.js, and respectively rendering only the back and the front of the three-dimensional geological model;

when the back surface of the three-dimensional geological model is rendered, adding 1 to the template buffer values of all the fragments on the back surface through template test;

when the front surface of the three-dimensional geological model is rendered, subtracting 1 from the template buffer values of all the fragments on the front surface through template test;

all the obtained fragments with the template buffer value of 1 are the fragments where the section is located.

6. The dynamic sectioning and profile filling method for the Web-end three-dimensional geological model according to claim 1 or 5, characterized by comprising the following steps: the concrete steps of realizing the section filling through the template test in the step 4 are as follows:

rendering a plane which is coincident with the section and has the color consistent with the color of the stratum of the corresponding three-dimensional geological model based on the fragment where the determined section is located;

and through template test, keeping the fragment with the template buffer value of 1, and discarding the rest fragments to realize the filling of the section.

7. The dynamic sectioning and profile filling method of the Web-end three-dimensional geological model according to claim 1, characterized by comprising the following steps: and 5, when section filling is carried out on all stratums of the three-dimensional geological model in the step 5, a default value needs to be appointed for the fragment where each stratum is located, 1 adding and 1 subtracting operations are carried out on the default value, when the template buffer value of the fragment is the default value plus 1, the corresponding fragment is reserved, and otherwise, the corresponding fragment is discarded.

Technical Field

The invention relates to the technical field of geological model three-dimensional display, in particular to a dynamic sectioning and section filling method for a three-dimensional geological model at a Web end.

Background

Nowadays, three-dimensional technology is greatly developed, and the display, analysis and application of three-dimensional models are increasingly popularized, but in various professional industry fields, such as geological industry, the used three-dimensional model program is a traditional desktop client program, the use environment is limited by a specific operating system, and the cross-platform access capability is not provided. With the development of the WebGL technology, the capability of three-dimensional display and analysis on Web is stronger and stronger, so that a Web end program can be free from cross-platform influence and can provide a three-dimensional model display analysis function more conveniently without installing complex software. At present, systems and software in various industries are developed towards the direction of movement and Web, and it is more and more important to say that the three-dimensional function of a traditional desktop client is migrated to a Web end, and a three-dimensional geological model is displayed and processed at the Web end.

However, the three-dimensional geological model differs from other 3D models in that the three-dimensional geological model is a combination of models of different strata, and in the prior art, the three-dimensional geological model lacks a sectioning process, often a single 3D model. On the other hand, the sectioning of the three-dimensional geological model is mostly based on the preprocessing applied at the desktop end, for example, a sectioned three-dimensional geological model is made in advance and then displayed at the Web end, so that a user cannot dynamically perform the sectioning of the three-dimensional geological model, for example, the direction and the angle of sectioning are selected, and the flexibility is poor. In the mode that part of the three-dimensional geological model can be dynamically cut, because the three-dimensional geological model is hollow, a section which is not filled or only can support a single-layer section is obtained, and the section of the hollow model is not filled, the condition of the section of the three-dimensional geological model cannot be well observed, and simultaneously, the performance is low due to the multi-layer geological model. Based on the above situation, it is important to realize dynamic sectioning and section filling of the three-dimensional geological model at the Web end.

Disclosure of Invention

Aiming at the defects of the prior art, the invention aims to provide a dynamic sectioning and section filling method for a Web-end three-dimensional geological model, which is used for displaying and processing the three-dimensional geological model based on a Web-end open-source WebGL 3D engine three.js, and carrying out section filling through template buffering, template testing and the like of WebGL, can flexibly and conveniently realize the rapidness and the effectiveness in the process of rendering the section of the model, and greatly optimizes the experience of a user in sectioning the three-dimensional geological model.

In order to achieve the purpose, the technical scheme adopted by the invention is as follows:

a dynamic sectioning and section filling method for a three-dimensional geological model at a Web end is characterized by comprising the following steps:

step 1, loading and displaying a three-dimensional geological model through three.js;

step 2, setting a section through clippingPlans attribute of the model material in three.js;

step 3, sectioning the three-dimensional geological model by adopting a set section;

step 4, confirming the fragment where the section is located, rendering a plane which is coincident with the section and has the color consistent with the color of the stratum of the corresponding three-dimensional geological model, and realizing section filling through template testing;

and 5, moving or clicking a new section, and returning to the step 3 to carry out circulation until all stratums of the three-dimensional geological model are cut and section filling is completed.

Furthermore, when the three-dimensional geological model is loaded in the step 1, a necessary scene, a camera and a renderer need to be created in advance through three.

Further, in the step 1, a three-dimensional geological model is loaded through built-in GLTFLoader of three.

Further, in the step 3, a sectioning box or a sectioning line is adopted to section the three-dimensional geological model.

Further, the step of determining the slice element where the cross section is located in step 4 is as follows:

controlling through the side attribute of the model material in three.js, and respectively rendering only the back and the front of the three-dimensional geological model;

when the back surface of the three-dimensional geological model is rendered, adding 1 to the template buffer values of all the fragments on the back surface through template test;

when the front surface of the three-dimensional geological model is rendered, subtracting 1 from the template buffer values of all the fragments on the front surface through template test;

all the obtained fragments with the template buffer value of 1 are the fragments where the section is located.

Further, the specific steps of implementing the profile filling through the template test in the step 4 are as follows:

rendering a plane which is coincident with the section and has the color consistent with the color of the stratum of the corresponding three-dimensional geological model based on the fragment where the determined section is located;

and through template test, keeping the fragment with the template buffer value of 1, and discarding the rest fragments to realize the filling of the section.

Further, when the sections of all the stratums of the three-dimensional geological model are filled in the step 5, a default value needs to be assigned to the fragment where each stratum is located, operations of adding 1 and subtracting 1 are performed on the default value, when the template buffer value of the fragment is the default value plus 1, the corresponding fragment is reserved, and otherwise, the corresponding fragment is discarded.

The invention has the following remarkable effects: compared with the defects that three-dimensional sectioning is lack of flexibility, section filling is not performed on hollow wood stars, customized processing is lack, and the like in the traditional method, dynamic sectioning and section filling of a three-dimensional geological model are achieved based on three.js, a user can manually operate the sectioning direction, angle, distance and the like, and the method is more flexible and convenient; after the first loading, the device can be used off line without a network request; by fully utilizing template buffering and template testing of the native WebGL, a fragment shader and the like, the method realizes rapidness and effectiveness in rendering the section of the model, combines operations of sectioning a box, clicking to determine the section and the like, and greatly improves the experience of a user in sectioning the three-dimensional geological model.

Drawings

FIG. 1 is a flow chart of a method of the present invention;

FIG. 2 is a schematic view of a cutting of a model using a cutting box;

FIG. 3 is a schematic view of a model cut using a cut line;

FIG. 4 is a schematic diagram of stencil buffer and stencil test.

Detailed Description

The following provides a more detailed description of the embodiments and the operation of the present invention with reference to the accompanying drawings.

First, in the embodiment, three-dimensional geological models are displayed and processed based on a Web gl 3D engine with a Web end open source, three. The format of the three-dimensional geological model is a cross-platform GLTF format, and simultaneously supports all model formats which can be supported by the model loader provided by three.

A dynamic sectioning and section filling method for a three-dimensional geological model at a Web end is shown in figure 1, and comprises the following specific steps:

step 1, loading and displaying a three-dimensional geological model through three.js;

js well packages WebGL, so that developers can conveniently perform three-dimensional processing, and a model with a specified format can be loaded through a built-in model loader method.

Before loading the model, firstly creating a necessary scene, a camera and a renderer through three. In order to control the rotation and movement of the three-dimensional geological model conveniently, the scene and the camera can be processed through a built-in OrbitControl.

After the three-dimensional geological model is loaded, the position of the center point of the three-dimensional geological model can be set and the size of the three-dimensional geological model can be scaled to the default size for convenience of display. At the moment, the loading, the displaying and other preparation works of the three-dimensional geological model are ready, and then the dynamic sectioning and the section filling processes of the three-dimensional geological model are carried out.

Step 2, setting a section through clippingPlans attribute of the model material in three.js;

step 3, sectioning the three-dimensional geological model by adopting a set section;

in the embodiment, the dynamic sectioning of the three-dimensional geological model is mainly divided into two modes, namely, a sectioning box with the same size as the model is established, and the model can be sectioned from the positive and negative directions of the x axis, the y axis and the z axis at the same time, as shown in fig. 2. Another way is that the user determines point positions by clicking the model to form a cutting line, each cutting line is parallel to the y axis to form planes for cutting, and the model is cut to form a cutting plane, as shown in fig. 3.

Since the three-dimensional geological model itself is hollow, filling of the profile is required at this time. Although there are two ways of operating dynamic sectioning, the basic principles of sectioning and section filling are consistent.

The basic principle of section filling is to perform stencil test through stencil buffer and stencil test of WebGL, when a fragment shader of WebGL finishes processing a fragment, the stencil test is executed, and at this time, the fragment can be discarded or retained. The stencil test is based on stencil buffers, each of which has 8 bits of stencil value, so there are 256 different values, and by setting the stencil value to the value we want, then when the stencil value of a fragment is the specified value, the fragment can be selected to be discarded or retained, as shown in fig. 4.

After template buffering and template testing are known, when the three-dimensional geological model is cut, as long as the section is located after cutting is confirmed, a plane with a corresponding color is used for rendering at a specified position, and the filled section can be obtained. See step 4 for details.

Step 4, confirming the fragment where the section is located, rendering a plane which is coincident with the section and has the color consistent with the color of the stratum of the corresponding three-dimensional geological model, and realizing section filling through template testing;

the determination step of the section position fragment is as follows:

controlling through the side attribute of the model material in three.js, and respectively rendering only the back and the front of the three-dimensional geological model;

when the back surface of the three-dimensional geological model is rendered, adding 1 to the template buffer values of all the fragments on the back surface through template test;

when the front surface of the three-dimensional geological model is rendered, subtracting 1 from the template buffer values of all the fragments on the front surface through template test;

in this way, since the model is cut, the front surface lacks the cut part of the slice, and the back surface lacks the cut part of the slice, so that all the obtained slices with the template buffer value of 1 are the slices where the section is located.

Further, rendering a plane which is coincident with the section and has the color consistent with the color of the stratum of the corresponding three-dimensional geological model based on the fragment where the determined section is located; by means of the stencil test, a slice with a stencil buffer value of 1 is retained and the remaining slices are discarded, thus realizing the filling of a profile with one plane.

The filling of one section is realized, and for a model which is a three-dimensional geological model and is composed of a plurality of stratums, the section cannot be filled by only using one plane, so that the same operation needs to be carried out on each stratum in the three-dimensional geological model, only when the template test is carried out, a default value needs to be appointed for a fragment where each stratum is located, and the operations of adding 1 and subtracting 1 are carried out on the default value, when the template buffer value of the fragment is the default value plus 1, the corresponding fragment is reserved, and the multilayer geological sectioning and the section filling of the three-dimensional geological model can be realized.

And 5, determining the section by combining the movement or clicking of the mouse operation section, returning to the step 3 for circulation, performing template test on each stratum of the three-dimensional geological model in real time, confirming the position of the cut gap, and filling the cut gap with a specified plane until all the stratums of the three-dimensional geological model are cut and the section is filled.

In the existing scheme, some schemes preprocess the three-dimensional geological model through desktop software, make the section of the three-dimensional geological model in advance, and then display the section at a Web end, and the scheme is lack of flexibility. In addition, the other scheme only realizes the dynamic sectioning of the three-dimensional geological model, but does not fill the section of the hollow model, and simultaneously has lower performance due to the multilayer geological model. In other proposals, the 3D model is cut and the section is generated, but the special 3D model, the three-dimensional geological model, is not customized.

Js based on three, the dynamic sectioning and section filling of the three-dimensional geological model are realized, and a user can manually operate the sectioning direction, angle, distance and the like, so that the three-dimensional geological model is more flexible and convenient; after the first loading, the device can be used off line without a network request; by fully utilizing template buffering and template testing of the native WebGL, a fragment shader and the like, the method realizes rapidness and effectiveness in rendering the section of the model, combines operations of sectioning a box, clicking to determine the section and the like, and greatly improves the experience of a user in sectioning the three-dimensional geological model.

The technical solution provided by the present invention is described in detail above. The principles and embodiments of the present invention are explained herein using specific examples, which are presented only to assist in understanding the method and its core concepts. It should be noted that, for those skilled in the art, it is possible to make various improvements and modifications to the present invention without departing from the principle of the present invention, and those improvements and modifications also fall within the scope of the claims of the present invention.

8页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:基于事件相机的高速结构光三维重建系统及重建方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!