Pipeline medium flow velocity control method based on Unity

By combining the 3D pipeline model with program scripts in Unity, calculating the pipeline length and unifying the flow rate unit, the problem of inconsistent medium flow rate performance in the 3D pipeline model was solved, and efficient and accurate medium flow rate control was achieved.

CN120765862AActive Publication Date: 2025-10-10WUHAN HAIYI HIGH END EQUIP STRUCTURE DESIGN CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202511292349.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-11
Publication Date
2025-10-10
Estimated Expiration
2045-09-11

AI Technical Summary

Technical Problem

In Unity, the medium flow rate representation of the pipeline 3D model is inconsistent with the actual pipeline system. The existing technology of UV animation control has problems such as large errors and low efficiency.

Method used

By combining the pipeline 3D model with Unity program scripts, the pipeline length is calculated and the flow rate data unit is unified. The UV animation Shader script is created using the ShaderGraph editor to achieve precise control of the medium flow rate.

Benefits of technology

It realizes the real simulation of pipeline medium flow velocity in virtual scenes, improves calculation accuracy and work efficiency, and has reusability and parameter configurability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120765862A_ABST
    Figure CN120765862A_ABST
Patent Text Reader

Abstract

The invention discloses a pipeline medium flow velocity control method based on Unity. Firstly, a pipeline three-dimensional model is established, and then UV expansion operation is carried out; the three-dimensional model of the pipeline is imported into Unity; the vertex of the pipeline three-dimensional model is obtained, and the length of the pipeline three-dimensional model is calculated; receiving flow velocity data of the pipeline measuring points; the flow velocity data of the pipeline measuring points are substituted into the system and converted to complete medium flow velocity data; creating a UV animation script of pipeline medium flow; creating a UV material ball, and completing the operation of assigning the UV material ball to the pipeline three-dimensional model; and the medium flow velocity data is transmitted to the speed attribute of the UV material ball, and the control of the pipeline flow velocity data provided by the system pipeline on the pipeline three-dimensional model medium flow velocity is realized. The method has the advantages of reusability, configurable parameters, high calculation precision and the like. Length calculation can be performed according to a three-dimensional model constructed in an equal ratio, and meanwhile, the method has the advantages of saving time cost, improving working efficiency, avoiding manual calculation errors and the like.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of virtual simulation of industrial systems, in particular to a pipeline medium flow rate control method based on Unity. BACKGROUND

[0002] Currently, the performance of pipeline flow rate in Unity is mainly controlled by the UV offset in UV animation, without considering the inconsistency between the length unit of the actual pipeline length and the length unit of the pipeline three-dimensional model, which leads to the problem that the medium flow rate performance in the pipeline three-dimensional model cannot be consistent with the medium flow rate in the actual pipeline system. SUMMARY

[0003] In view of the existing technical conditions and problems, the present application provides a pipeline medium flow rate control method based on Unity. The present application is based on the combination of pipeline three-dimensional model and Unity program script, which solves the demand for uniformity of medium flow rate in the three-dimensional virtual scene and the actual pipeline system, and solves the problems of difficult manual algorithm, large error, and low efficiency.

[0004] The technical scheme adopted by the present application is as follows: Step one, first establish a pipeline three-dimensional model.

[0005] Step two, perform UV unfolding operation on the established pipeline three-dimensional model.

[0006] Step three, import the constructed pipeline three-dimensional model into the Unity project, providing a three-dimensional model basis for subsequent pipeline length calculation and three-dimensional scene performance.

[0007] Step four, obtain the vertices of the pipeline three-dimensional model through the Unity program script, and calculate the length of the pipeline three-dimensional model using the vertices.

[0008] Step five, receive flow rate data from each pipeline measuring point in the system pipeline, providing data support for subsequent pipeline flow rate.

[0009] Step six, bring the flow rate data of the pipeline measuring point into the system, and unify the measurement units in the flow rate data and the length measurement units of the pipeline three-dimensional model, and convert the flow rate of the medium through the pipeline three-dimensional model.

[0010] Step seven, create a UV animation Shader script for pipeline medium flow in the ShaderGraph editor.

[0011] Step 8. In the Unity project, right-click the Shader script and select Create Material. Export the Shader script with the pipeline medium flow UV animation as a UV material ball.

[0012] Step 9. Assign the UV material ball to the pipeline 3D model in the Unity project.

[0013] Step 10: The converted medium flow rate data is transferred to the speed attribute of the UV material ball of the pipeline three-dimensional model, thereby completing the control of the medium flow rate of the pipeline three-dimensional model by the pipeline flow rate data provided by the system pipeline.

[0014] The present invention has the advantages of reusability, configurable parameters, and high calculation accuracy. Length calculations can be performed based on a three-dimensional model constructed with geometric proportions, saving time and costs, improving work efficiency, and avoiding manual calculation errors. Through pipeline length calculation and configurable flow velocity in UV animation material balls, the actual flow velocity of the medium in the pipeline can be simulated in a virtual scene. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 This is a flow chart of the pipeline medium flow rate control method based on Unity of the present invention; Figure 2 This is a Shader script flow chart for constructing UV animation of pipeline medium flow in a ShaderGraph editor according to an embodiment of the present invention. DETAILED DESCRIPTION

[0016] The present invention will be further described below with reference to the accompanying drawings and examples.

[0017] like Figure 1 As shown in the figure, a pipeline medium flow rate control method based on Unity has the following steps: Step 1: First, create a three-dimensional model of the pipeline in proportion in 3dsMax according to customer requirements.

[0018] Step 2: Perform UV unfolding on the completed pipeline 3D model.

[0019] Step 3: Import the constructed pipeline 3D model into the Unity project to provide a 3D model foundation for subsequent pipeline length calculations and 3D scene presentation.

[0020] Step 4: Get the vertices of the pipeline 3D model through the Unity program script, and use the vertices to calculate the length of the pipeline 3D model.

[0021] The steps to calculate the length of a 3D pipeline model using vertices are as follows: A1. Obtain all vertices of the pipeline 3D model and form a vertex array.

[0022] A2. Traverse the vertex array of the pipeline 3D model, find the vertex that is called only once, and define the vertex that is called only once as the initial vertex.

[0023] A3. Traverse the vertex array starting from the initial vertex and find all vertices adjacent to the current vertex to form multiple triangles.

[0024] A4. For each triangle, use the Cross method of the Vector3 class to bring in the vertices of the triangle, calculate the Cross vector of the triangle, and then use the Normalized property of the Cross vector to get the normal vector of the triangle.

[0025] A5. Accumulate the normal vectors of all triangles adjacent to the current vertex, and divide by the number of triangles adjacent to the current vertex to obtain the average normal of the current vertex.

[0026] A6. Using the subscript of the current vertex in the vertex array and the index feature of the vertex array, obtain the normal corresponding to the current vertex from the normals array in the mesh properties of the pipeline 3D model.

[0027] A7. Use the Angle method of the Vector3 vector class to obtain the angle between the normal corresponding to the current vertex and the average normal of the current vertex. This angle is the curvature of the vertex in the 3D pipeline model.

[0028] A8. When the curvature value of the vertex in the three-dimensional pipeline model is greater than 10 degrees, record the vertex corresponding to the curvature value. This vertex is the vertex at the turning point in the three-dimensional pipeline model.

[0029] A9. Perform Euclidean distance calculation on the vertex coordinates of all bends in the three-dimensional pipeline model to obtain the length of the three-dimensional pipeline model.

[0030] Normally, the length data of the pipeline 3D model can also be calculated and output by 3D modelers in the 3D modeling software. In the case of multiple pipeline 3D models, this execution will consume a lot of development manpower of the project team. Therefore, using Unity program scripts to implement this calculation can effectively save project time, improve work efficiency, and greatly reduce the calculation errors caused by manual calculations, and also improve the calculation accuracy.

[0031] Step 5: Receive the flow rate data from each measuring point in the system pipeline to provide data support for the subsequent pipeline flow rate. The measuring point data format is shown in Table 1: Table 1 Measurement point data table .

[0032] Step 6: Bring the flow rate data of the pipeline measuring points into the system, unify the measurement units in the flow rate data and the length measurement units of the pipeline 3D model, and convert the flow rate of the medium through the pipeline 3D model.

[0033] For example, if the flow velocity data at a pipeline measurement point is 2 m / s, and the length unit of the pipeline 3D model is centimeters, then you need to multiply the flow velocity data at the pipeline measurement point by 100 to convert it to 200 cm / s; and use 200 cm / s as the flow velocity of the medium in the pipeline 3D model.

[0034] The unit conversion process is not static. Developers can adjust the flow rate conversion algorithm based on actual project needs to achieve the project's expected flow rate performance. Furthermore, the flow rate conversion process is globally unique. Therefore, by modifying this conversion process, the flow rate performance of all 3D pipeline models in the Unity project can be uniformly adjusted, thereby achieving the effect of flexible parameter configuration. For example, the normal conversion unit is 1 meter = 100 centimeters, but due to project requirements, the flow rate may need to be displayed slower. In this case, the conversion of 1 meter = 100 centimeters can be adjusted to 1 meter = 150 centimeters or even lower. Specific adjustments can be made according to project needs.

[0035] In Unity projects, the standard unit for 3D space is meters, while the flow velocity data at each point in the system can be expressed in centimeters per second, meters per second, or even other units. Therefore, the adjustable unit conversion process can maximize the flexibility of flow velocity display.

[0036] Step 7. Create a UV animation Shader script for pipeline medium flow in the ShaderGraph editor.

[0037] First, create a new Shader script in the Unity project through Assets -> Create -> Shader Graph -> URP -> Lit Shader Graph in the menu bar, then double-click the Shader script, the Unity project will automatically open the Shader script in the Shader Graph editor mode, and then set the Shader script as a fragment shader in the Shader Graph editor panel. Figure 2 Set the normal attribute in Shader Graph.

[0038] like Figure 2 As shown, the Shader script process for constructing UV animation of pipeline medium flow in the ShaderGraph editor in this embodiment is as follows: B1. Create a two-dimensional vector in the ShaderGraph editor to represent the pipeline medium flow rate and provide a data interface for the subsequent input of pipeline medium flow rate data.

[0039] B2. Call the Time function provided by ShaderGraph in the ShaderGraph editor and obtain the time value from it. The unit of the time value is counted in seconds.

[0040] B3. Use the multiplication function in the ShaderGraph editor to multiply the time value by the pipeline medium flow rate attribute to obtain a two-dimensional vector. This two-dimensional vector represents the displacement in seconds.

[0041] B4. Create a Tiling And OffSet function in the ShaderGraph editor and assign the UV offset to the Offset property of the Tiling And OffSet function to offset the UVs of the pipeline 3D model. Then, use the Out property of the Tiling And OffSet function to obtain the UV coordinate information after the offset.

[0042] B5. Create a texture map in the ShaderGraph editor to provide a data interface for the texture map that is subsequently passed into the medium representation.

[0043] B6. Create a SampleTexture2D function in the ShaderGraph editor and assign the medium's texture map and the displaced UV information to the SampleTexture2D function's map attribute and UV attribute, respectively, to obtain a texture map with UV displacement animation attributes.

[0044] B7. Assign the texture map with UV displacement animation attributes to the normal attribute of the fragment shader, that is, construct a shader script with UV animation of pipeline medium flow.

[0045] Step 8. In the Unity project, right-click the Shader script and select Create Material. Export the Shader script with the pipeline medium flow UV animation as a UV material ball.

[0046] The construction of the UV animation material ball (where the UV material ball provides a "flow rate" property) can adjust the displacement of the texture map in seconds according to the change of the flow rate property value, thereby affecting the visual performance of the flow rate of the UV animation material ball.

[0047] Step 9. Assign the UV material ball to the pipeline 3D model in the Unity project.

[0048] Drag the created UV material ball to the Material property of the pipeline 3D model in the Unity project to complete the operation of assigning the UV material ball to the pipeline 3D model.

[0049] Step 10: The converted medium flow rate data is transferred to the speed attribute of the UV material ball of the pipeline three-dimensional model, thereby completing the control of the medium flow rate of the pipeline three-dimensional model by the pipeline flow rate data provided by the system pipeline.

[0050] This method uses Unity scripts to parse the mesh data of the pipeline 3D model, extracts vertex data and facet data from the mesh data, and then uses a curvature algorithm to obtain all vertices at the turns in the pipeline 3D model. The Euclidean distance operation is performed on the vertex coordinates at each turn in the pipeline 3D model to obtain the length of the pipeline 3D model.

[0051] By receiving the pipeline flow rate data provided by the system pipeline, the flow rate data unit and the pipeline three-dimensional model length unit are converted to obtain the medium flow rate in the pipeline three-dimensional model, and the converted medium flow rate data is passed to the speed attribute of the UV material ball of the pipeline three-dimensional model, thereby realizing the control of the pipeline three-dimensional model medium flow rate by the pipeline flow rate data provided by the system pipeline.

[0052] This method first constructs a one-to-one 3D model of the system's pipelines, which then provides flow velocity sensor data for each pipeline. Using this data, the system utilizes 3D pipeline model length calculations, converts system pipeline flow velocity data units to 3D pipeline model length units, and uses UV material balls with media flow animation to create a technology that simulates flow velocity control for media flow effects within the 3D pipeline model within a virtual scene.

Claims

1. A pipeline medium flow rate control method based on Unity, characterized in that: The method has the following steps: Step 1: First, create a three-dimensional model of the pipeline; Step 2: Perform UV unfolding on the completed pipeline 3D model; Step 3: Import the constructed pipeline 3D model into the Unity project to provide a 3D model foundation for subsequent pipeline length calculation and 3D scene presentation; Step 4: Obtain the vertices of the pipeline 3D model through the Unity program script, and use the vertices to calculate the length of the pipeline 3D model; Step 5: Receive flow rate data from each pipeline measuring point in the system pipeline to provide data support for subsequent pipeline flow rate; Step 6: Bring the flow rate data of the pipeline measuring points into the system, unify the measurement units in the flow rate data and the length measurement units of the pipeline 3D model, and convert the flow rate of the medium through the pipeline 3D model; Step 7. Create a UV animation Shader script for pipeline medium flow in the ShaderGraph editor; Step 8. In the Unity project, right-click the Shader script and select Create Material. Export the Shader script with the pipeline medium flow UV animation as a UV material ball. Step 9. Assign the UV material ball to the pipeline 3D model in the Unity project; Step 10: The converted medium flow rate data is transferred to the speed attribute of the UV material ball of the pipeline three-dimensional model, thereby completing the control of the medium flow rate of the pipeline three-dimensional model by the pipeline flow rate data provided by the system pipeline.

2. A pipeline medium flow rate control method based on Unity according to claim 1, characterized in that: In step 4, the steps for calculating the length of the 3D pipeline model using vertices are as follows: A1. Obtain all vertices of the pipeline 3D model and form a vertex array; A2. Traverse the vertex array of the pipeline 3D model, find the vertex that is called only once, and define the vertex that is called only once as the initial vertex; A3. Starting from the initial vertex, traverse the vertex array and find all vertices adjacent to the current vertex to form multiple triangles. A4. For each triangle, use the Cross method of the Vector3 class to insert the vertices of the triangle, calculate the Cross vector of the triangle, and then use the Normalized property of the Cross vector to obtain the normal vector of the triangle. A5. Accumulate the normal vectors of all triangles adjacent to the current vertex and divide by the number of triangles adjacent to the current vertex to obtain the average normal of the current vertex. A6. Using the subscript of the current vertex in the vertex array and the indexing characteristics of the vertex array, obtain the normal corresponding to the current vertex from the normals array in the mesh properties of the pipeline 3D model. A7. Use the Angle method of the Vector3 class to obtain the angle between the normal corresponding to the current vertex and the average normal of the current vertex. This angle is the curvature of the vertex in the 3D pipeline model. A8. When the curvature value of a vertex in the 3D pipeline model is greater than 10 degrees, record the vertex corresponding to the curvature value. This vertex is the vertex at the bend in the 3D pipeline model. A9. Perform Euclidean distance calculation on the vertex coordinates of all bends in the three-dimensional pipeline model to obtain the length of the three-dimensional pipeline model.

3. The pipeline medium flow rate control method based on Unity according to claim 1 is characterized in that: In step 7, the Shader script process for building the UV animation of the pipeline medium flow in the ShaderGraph editor is as follows: B1. Create a two-dimensional vector in the ShaderGraph editor to represent the pipeline medium flow rate and provide a data interface for the subsequent input of pipeline medium flow rate data; B2. Call the Time function provided by ShaderGraph in the ShaderGraph editor and obtain the time value from it; B3. Use the multiplication function in the ShaderGraph editor to multiply the time value by the pipeline medium flow rate attribute to obtain a two-dimensional vector. This two-dimensional vector represents the displacement in seconds. B4. Create a Tiling And Offset function in the ShaderGraph editor and assign the UV offset to the Offset property of the Tiling And Offset function to offset the UV coordinates of the 3D pipeline model. Use the Out property of the Tiling And Offset function to obtain the UV coordinates after the offset. B5. Create a texture map in the ShaderGraph editor to provide a data interface for the texture map that is subsequently passed into the medium representation; B6. Create a SampleTexture2D function in the ShaderGraph editor and assign the medium's texture map and the displaced UV information to the SampleTexture2D function's texture attributes and UV attributes, respectively, to obtain a texture map with UV displacement animation attributes. B7. Assign the texture map with UV displacement animation attributes to the normal attribute of the fragment shader, that is, construct a shader script with UV animation of pipeline medium flow.

Citation Information

Patent Citations

  • Method for rapidly drawing pipeline system dynamic schematic diagram

    CN104933748A

  • Method for simulating oil flow in hydraulic loop pipeline based on Unity

    CN112365776A

  • Pipe network fluid simulation method and device, electronic equipment and readable storage medium

    CN116070378A

  • Pipeline follow-up three-dimensional layout design method

    CN117709032A

  • Method for realizing dynamic simulation of fluid characteristics in three-dimensional pipeline based on shader

    CN118334224A