Electromechanical shielding and retreating method and device

By performing multi-objective rendering and background color occlusion on straight lines in engineering design software, the problems of real-time and low efficiency of electromechanical occlusion and concession in the existing technology are solved, real-time and efficient occlusion and concession display effect is achieved, and user experience is improved.

CN115964824BActive Publication Date: 2025-08-19GLODON CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111183460.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-11
Publication Date
2025-08-19
Estimated Expiration
2041-10-11

AI Technical Summary

Technical Problem

When existing engineering design software realizes the shading and concession between professional pipelines and equipment, there are problems such as real-time display difficulties and low calculation and processing efficiency.

Method used

By obtaining the components to be displayed in the target scene and the background color, multi-objective rendering of the straight lines in the target scene, obtaining texture data, and determining whether the current pixel point needs to be backward based on the texture data, using the background color to block it to achieve backward display effect.

Benefits of technology

Real-time and efficient occlusion and concession display in large scenarios is realized, which improves processing efficiency, is easy to maintain and integrates the code, and meets the designer's readability needs for aesthetics and elevation relationships.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115964824B_ABST
    Figure CN115964824B_ABST
Patent Text Reader

Abstract

The present invention provides an electromechanical occlusion and concession method and device, which includes: obtaining the background color of each component to be displayed in a target scene and the target scene; performing multi-target rendering on a straight line in the target scene to obtain texture data, the texture data including: an identification texture of the component to which the line belongs, a start and end point texture of the line, and a depth texture of the line; judging whether the current pixel of the component to be displayed needs to be concessioned based on the identification texture of the component to which the line belongs, the start and end point textures of the line, and the depth texture of the line; and when the current pixel needs to be concessioned, rendering the current pixel using the background color. Thus, by using the background color of the target scene to occlude it, a concession display effect is achieved. The concession method is simple to implement, the code is easier to maintain, easy to integrate, has good real-time performance, does not require pre-calculation, and improves processing efficiency. This screen-space-based occlusion and concession method enables real-time and efficient display even in large scenes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computer-aided design, and in particular to an electromechanical shielding and retreating method and device. Background Art

[0002] During the design phase of engineering design software, because pipelines and equipment in the electromechanical field of a project are spatially related, plan views and elevation views can only display two-dimensional space. To express the different elevations of pipelines and equipment, it is necessary to reflect the electromechanical occlusion and concession relationships in the two-dimensional views. This is done by creating an effect of occlusion and gaps in the two-dimensional views to enhance the aesthetics and readability of the elevation relationships in the designer's drawing interface and output.

[0003] However, existing engineering design software generally has problems such as difficulty in real-time display and low calculation efficiency when implementing the above-mentioned occlusion and concession systems between pipelines and equipment in the electromechanical profession. Summary of the Invention

[0004] In view of this, embodiments of the present invention provide an electromechanical shading retreat method and apparatus to solve the problems of low efficiency and poor real-time performance of the electromechanical shading retreat method in the prior art.

[0005] According to a first aspect, an embodiment of the present invention provides an electromechanical shading retreat method, comprising:

[0006] Obtaining each component to be displayed in the target scene and the background color of the target scene;

[0007] Performing multi-target rendering on the straight line in the target scene to obtain texture data, wherein the texture data includes: a component identification texture to which the straight line belongs, a start and end point texture of the straight line, and a depth texture of the straight line;

[0008] Based on the identification texture of the component to which the line belongs, the start and end point textures of the line, and the depth texture of the line, determining whether the current pixel point of the component to be displayed needs to be retracted;

[0009] When the current pixel point needs to be retracted, the current pixel point is drawn using the background color.

[0010] Optionally, judging whether a current pixel point of the component to be displayed needs to be retracted based on the component identification texture to which the line belongs, the start and end point textures of the line, and the depth texture of the line includes:

[0011] Based on the start and end point textures of the straight line, determining whether there is a second straight line intersecting the first straight line corresponding to the current pixel point of the component to be displayed;

[0012] When a second straight line intersects the first straight line corresponding to the current pixel point, determining whether the first straight line and the second straight line belong to different components that are not connected based on the component identification texture to which the first straight line belongs;

[0013] When the first straight line and the second straight line belong to different components that are not connected, determining whether the position of the current pixel point is within a preset concession area of the intersecting pixel points of the first straight line and the second straight line;

[0014] When the position of the current pixel point belongs to the preset concession area of the intersecting pixel points, it is determined whether the current pixel point needs to be concessioned based on the straight line depth texture.

[0015] Optionally, the determining whether the current pixel needs to be retracted based on the straight line depth texture includes:

[0016] Extracting a first depth value and a second depth value corresponding to the current pixel and the intersecting pixel from the linear depth texture respectively;

[0017] Determining whether the first depth value is greater than the second depth value;

[0018] When the first depth value is greater than the second depth value, it is determined that the current pixel needs to be retracted.

[0019] Optionally, the determining, based on the straight line start and end point textures, whether there is a second straight line intersecting with the first straight line corresponding to the current pixel point includes:

[0020] Determining, based on the straight line start and end point textures, first starting point coordinates and first end point coordinates of a first straight line corresponding to the current pixel point, and second starting point coordinates and second end point coordinates of a second straight line, where the second straight line is any straight line in the target scene except the first straight line;

[0021] Determining whether the first starting point coordinates and the first end point coordinates satisfy a preset line segment intersection condition with the second starting point coordinates and the second end point coordinates;

[0022] When a preset line segment intersection condition is satisfied between the first starting point coordinates and the first end point coordinates and the second starting point coordinates and the second end point coordinates, it is determined that the second straight line intersects the first straight line.

[0023] Optionally, the determining whether the first straight line and the second straight line belong to different components that are not connected is performed based on the identification texture of the component to which the straight line belongs;

[0024] Extracting respectively a first component identifier corresponding to the first straight line and a second component identifier corresponding to the second straight line from the component identifier texture to which the straight line belongs;

[0025] determining whether the first component identifier is different from the second component identifier;

[0026] When the first component identifier and the second component identifier are different, determining whether the first straight line has a connection relationship with the second straight line based on the first component identifier, the second component identifier and a connection relationship database of components to be displayed;

[0027] When the first straight line and the second straight line have a connection relationship, it is determined that the first straight line and the second straight line belong to different components without a connection relationship.

[0028] Optionally, before performing multi-target rendering on the straight line in the target scene, the method further includes:

[0029] Obtain component identifiers corresponding to components to be displayed and connection relationships between components to be displayed;

[0030] Based on the component identifiers corresponding to the components to be displayed and the connection relationships between the components to be displayed, a connection relationship database of the components to be displayed is established.

[0031] Optionally, the determining whether the position of the current pixel point belongs to a preset concession area of intersecting pixels of the first straight line and the second straight line includes:

[0032] Calculating the distance between the current pixel and the intersecting pixel;

[0033] Determining whether the distance is less than a preset distance threshold;

[0034] When the distance is less than the preset distance threshold, it is determined that the position of the current pixel point belongs to a preset concession area of the intersecting pixel points.

[0035] Optionally, the method further includes:

[0036] When the current pixel point does not need to be retracted, the current pixel point is drawn with a completely transparent color.

[0037] According to a second aspect, an embodiment of the present invention provides an electromechanical shielding and retreating device, comprising:

[0038] An acquisition module, configured to acquire each component to be displayed in a target scene and the background color of the target scene;

[0039] A first processing module is configured to perform multi-target rendering on the straight lines in the target scene to obtain texture data, wherein the texture data includes: a component identification texture to which the straight line belongs, a start and end point texture of the straight line, and a depth texture of the straight line;

[0040] A second processing module is configured to determine whether a current pixel of the component to be displayed needs to be retracted based on the component identification texture to which the line belongs, the start and end point textures of the line, and the depth texture of the line;

[0041] The third processing module is configured to draw the current pixel point using the background color when the current pixel point needs to be retracted.

[0042] According to a third aspect, an embodiment of the present invention provides a non-transitory computer-readable storage medium, which stores computer instructions. When the computer instructions are executed by a processor, they implement the method described in the first aspect of the present invention and any optional method thereof.

[0043] According to the fourth aspect, an embodiment of the present invention provides an electronic device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the method described in the first aspect of the present invention and any optional method thereof by executing the computer instructions.

[0044] The technical solution of the present invention has the following advantages:

[0045] The embodiment of the present invention provides an electromechanical occlusion and concession method and device. The method obtains the background color of each component to be displayed in a target scene and the target scene; performs multi-target rendering on a line in the target scene to obtain texture data, the texture data including: a line component identification texture, a line start and end point texture, and a line depth texture; determines whether the current pixel of the component to be displayed needs to be concession based on the line component identification texture, the line start and end point texture, and the line depth texture; and when the current pixel needs to be concession, the current pixel is drawn using the background color. Thus, by performing multi-target rendering on a line in the target scene to obtain texture data to determine whether the current pixel needs to be concession, and when it is determined that the current pixel needs to be concession, it is occluded by using the background color of the target scene to achieve the concession display effect. The concession method has a simple implementation concept, is easier to maintain and integrate, has good real-time performance, does not require pre-calculation, and improves processing efficiency. This screen-space-based occlusion and concession method enables real-time and efficient display even in large scenes. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0047] Figure 1 Flowchart of the electromechanical shielding and retreating method according to an embodiment of the present invention;

[0048] Figure 2 Schematic diagram of a connection relationship database of components to be displayed in an embodiment of the present invention;

[0049] Figure 3 This is a schematic diagram of the program design principle of the electromechanical shielding and retreating method in an embodiment of the present invention;

[0050] Figure 4 Schematic diagram of electromechanical shielding and retreat results in an embodiment of the present invention;

[0051] Figure 5 Schematic diagram of the structure of the electromechanical shielding and retreating device in an embodiment of the present invention;

[0052] Figure 6 Schematic diagram of the structure of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION

[0053] The technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0054] In addition, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0055] During the design phase of engineering design software, because pipelines and equipment in the electromechanical field of a project are spatially related, plan views and elevation views can only display two-dimensional space. To express the different elevations of pipelines and equipment, it is necessary to reflect the electromechanical occlusion and concession relationships in the two-dimensional views. This is done by creating an effect of occlusion and gaps in the two-dimensional views to enhance the aesthetics and readability of the elevation relationships in the designer's drawing interface and output.

[0056] However, existing engineering design software generally has problems such as difficulty in real-time display and low calculation efficiency when implementing the above-mentioned occlusion and concession systems between pipelines and equipment in the electromechanical profession.

[0057] Based on the above problems, the embodiment of the present invention provides an electromechanical shielding retreat method, such as Figure 1 As shown, the electromechanical shielding retreat method specifically includes the following steps:

[0058] Step S101: Acquire each component to be displayed in a target scene and the background color of the target scene.

[0059] Among them, the target scene is the plan view / elevation view scene of the engineering design software currently performing electromechanical design display. In this scene, the user can pre-set the background color of the scene, such as black, etc. The components to be displayed are the components that the user needs to display in the target scene. The component color can be designed arbitrarily. In order to ensure the display effect, the component color is different from the scene background color.

[0060] Step S102: performing multi-target rendering on the straight lines in the target scene to obtain texture data.

[0061] The lines in the target scene represent the display form of each component to be displayed. For example, a pipeline is represented by a line. The texture data includes the component identification texture of the line, the line's starting and ending points, and the line's depth texture.

[0062] Specifically, by utilizing OpenGL's multi-target rendering (MRT) feature, multi-target rendering is performed on the lines in the target scene, resulting in four textures: color texture, ID texture, depth texture, and line texture. These textures represent the line color texture, the component identification texture to which the line belongs, the line depth texture, and the line start and end point textures, respectively, to store the color, ID tag, depth, and start and end points of the line. Due to the yield requirement, if two lines do not intersect, even if they have different depths and do not belong to the same component, no yield is made. However, for GPU programs, a line has been discretized into individual pixels, and the start and end points of the line have been discarded. Therefore, a separate texture is used to record the start and end points of the line.

[0063] Step S103: Based on the identification texture of the component to which the line belongs, the start and end point textures of the line, and the depth texture of the line, it is determined whether the current pixel point of the component to be displayed needs to be retracted.

[0064] Among them, concession refers to the intersection of two straight lines with a gap at the intersection, which is used to indicate that the heights of the straight lines are different, and generally the higher straight line interrupts the lower straight line.

[0065] Step S104: When the current pixel needs to be retracted, the current pixel is painted using the background color.

[0066] Specifically, the background color of the target scene is used to block the pixel corresponding to the original straight line at the current pixel to produce a "concession" display effect.

[0067] By executing the above steps, the electromechanical occlusion and concession method provided by the embodiment of the present invention performs multi-target rendering on the straight line in the target scene to obtain texture data to determine whether the current pixel point needs to be concessioned, and when it is determined that the current pixel point needs to be concessional display effect, it is occluded by using the background color of the target scene to achieve the concession display effect. The concession method is simple in implementation, the code is easier to maintain, easy to integrate, has good real-time performance, does not require pre-calculation, and improves processing efficiency. This screen space-based occlusion and concession method enables real-time and efficient display even in large scenes.

[0068] Specifically, in one embodiment, before step S102, the electromechanical shielding retreat method further includes the following steps:

[0069] Step S105: Obtain component identifiers corresponding to the components to be displayed and connection relationships between the components to be displayed.

[0070] Specifically, all components within the target scene are retrieved and assigned ID tags as component identifiers. This is used to distinguish between identical components and to determine whether components are connected. For example, if there are 100 components to be displayed in the target scene, the ID numbering starts at 1 and continues to 100. According to electromechanical yielding rules, no yielding is performed if there is a connection. If two lines belong to the same component, no yielding is performed between them.

[0071] Step S106: establishing a connection relationship database of components to be displayed based on the component identifiers corresponding to the components to be displayed and the connection relationships between the components to be displayed.

[0072] Specifically, two arrays are created to transmit the connection relationship between each component. For example, the ID of component A is 5 and the ID of B is 6. To record their connection relationship, two arrays are used. The size of array 1 is the number of components in the target scene, and it stores the address of the connection relationship, while array2 stores the actual connection relationship. For example, the data content of array1 is 0, 0, 1, 0, 0, 3, 0. This means that for the first component, since array1[1] is 0, there is no component connected to it. If array1[2] is 1, the connection relationship of the component with ID 2 is that array2[1] and subsequent components are all connected to it until 0 is encountered. If the ID of component A is 5 and array1[5] is 3, then array2[3] and subsequent components are all connected to component A until 0 is encountered. If the content after array2[3] does not contain 6, then components A and B have no connection relationship. This connection relationship transmission method can be better applied to GPU programs and further improve computing processing efficiency. It should be noted that, for C++ programs, a map may also be used to record the connection relationship between components, but the present invention is not limited to this.

[0073] For example, Figure 2 As shown in the figure, assume that the target scene contains five components, a, b, c, d, and e, with IDs numbered from 1 to 5. a, b, and c are interconnected, and d and e are also connected. For example, if we want to find the connection relationship of b, since b's ID is 2, we search in the first array and get a value of 4, indicating that the connection relationship of b starts at 4 in the second array. We get a and c, but it should be noted that in the second array, 0 indicates the end of the connection relationship. Similarly, to find the connection relationship of e, we first find 12, then start searching at position 12 in the second array, and continue searching until we reach 0, ending the search at 0, thus finding d.

[0074] Specifically, in one embodiment, the above step S103 specifically includes the following steps:

[0075] Step S301: Based on the straight line start and end point textures, it is determined whether there is a second straight line intersecting with the first straight line corresponding to the current pixel point of the component to be displayed.

[0076] Specifically, the above-mentioned step S301 specifically determines the first starting point coordinates and the first end point coordinates of the first straight line corresponding to the current pixel point based on the straight line start and end point textures, and the second starting point coordinates and the second end point coordinates of the second straight line, where the second straight line is any straight line in the target scene except the first straight line; determines whether the first starting point coordinates and the first end point coordinates meet the preset line segment intersection condition with the second starting point coordinates and the second end point coordinates; when the preset line segment intersection condition is met between the first starting point coordinates and the first end point coordinates and the second starting point coordinates and the second end point coordinates, determines that the second straight line intersects with the first straight line.

[0077] Among them, the above-mentioned preset line segment intersection condition is the judgment condition in the existing technology that uses the endpoints of two line segments to determine whether the two line segments intersect, such as: whether the two line segments cross each other, etc. For details, please refer to the relevant description of the existing technology, which will not be repeated here.

[0078] Step S302: When a second straight line intersects the first straight line corresponding to the current pixel point, determine whether the first straight line and the second straight line belong to different components that are not connected based on the component identification texture to which the straight lines belong.

[0079] Specifically, the above-mentioned step S302 is specifically performed by respectively extracting the first component identifier corresponding to the first straight line and the second component identifier corresponding to the second straight line from the component identifier texture to which the straight lines belong; judging whether the first component identifier is different from the second component identifier; when the first component identifier is different from the second component identifier, judging whether the first straight line has a connection relationship with the second straight line based on the first component identifier, the second component identifier and the connection relationship database of the components to be displayed; when the first straight line has a connection relationship with the second straight line, determining that the first straight line and the second straight line belong to different components that have no connection relationship.

[0080] For example, it is assumed that the first component corresponding to the first straight line is identified as Figure 2 The second component corresponding to the second straight line is identified as Figure 2 The e component in Figure 2 It can be seen that the first straight line and the second straight line belong to different components that are not connected. Assume that the first component corresponding to the first straight line is identified as Figure 2 The second component corresponding to the second straight line is identified as Figure 2 The b component in Figure 2 It can be seen that the first straight line and the second straight line belong to different components that have a connection relationship. In addition, the same component may also have multiple straight lines that intersect in the two-dimensional view.

[0081] Therefore, by using the component identification information corresponding to the straight line, the pixel points that need to be displayed in a concession can be accurately determined, so that the final concession display effect is consistent with the concession display effect expected by the user, further improving the computing and processing efficiency, realizing real-time processing, and improving the user experience.

[0082] Step S303: When the first straight line and the second straight line belong to different components that are not connected, determine whether the position of the current pixel point belongs to a preset concession area of the intersection pixel points of the first straight line and the second straight line.

[0083] Specifically, the above step S303 calculates the distance between the current pixel and the intersecting pixel; determines whether the distance is less than a preset distance threshold; when the distance is less than the preset distance threshold, determines that the position of the current pixel belongs to the preset concession area of the intersecting pixel.

[0084] The preset distance threshold can be flexibly set according to the actual yielding display effect requirements. The larger the distance threshold, the larger the yielding range, and vice versa. This improves the flexibility of the yielding display effect.

[0085] Step S304: When the position of the current pixel point is within the preset concession area of the intersecting pixels, it is determined whether the current pixel point needs to be concessioned based on the straight line depth texture.

[0086] Specifically, step S304 extracts the first and second depth values corresponding to the current pixel and the intersecting pixel from the line depth texture; determines whether the first depth value is greater than the second depth value; and, if the first depth value is greater than the second depth value, determines that the current pixel needs to be retracted. By utilizing depth information to determine whether the current pixel needs to be retracted, the resulting retracted display effect is consistent with the user's desired retracted display effect, further improving computational efficiency, enabling real-time processing, and enhancing the user experience.

[0087] Specifically, in one embodiment, the electromechanical shielding retreat method further includes the following steps:

[0088] Step S107: When the current pixel does not need to be retracted, the current pixel is painted with a completely transparent color.

[0089] Specifically, since the original scene (i.e., all components to be displayed) are drawn normally, the final full-screen HUD texture must be mostly transparent. This allows the original scene to be seen through it, ensuring normal display of the non-recessed portion. The recessed portion, however, is completely opaque, using the scene's background color to obscure the original scene, achieving a "recessed" display effect. Figure 3This is a schematic diagram of the electromechanical shielding and retreating program design in an embodiment of the present invention. Figure 4 This is a schematic diagram showing the results of electromechanical shading concession.

[0090] By executing the above steps, the electromechanical occlusion and concession method provided by the embodiment of the present invention performs multi-target rendering on the straight line in the target scene to obtain texture data to determine whether the current pixel point needs to be concessioned, and when it is determined that the current pixel point needs to be concessional display effect, it is occluded by using the background color of the target scene to achieve the concession display effect. The concession method is simple in implementation, the code is easier to maintain, easy to integrate, has good real-time performance, does not require pre-calculation, and improves processing efficiency. This screen space-based occlusion and concession method enables real-time and efficient display even in large scenes.

[0091] The embodiment of the present invention also provides an electromechanical shielding and retreating device, such as Figure 5 As shown, the electromechanical shielding and retreating device specifically includes:

[0092] The acquisition module 101 is used to acquire each component to be displayed in the target scene and the background color of the target scene. For details, please refer to the relevant description of step S101 in the above method embodiment, which will not be repeated here.

[0093] The first processing module 102 is configured to perform multi-target rendering on the lines in the target scene to obtain texture data. The texture data includes a line component identification texture, line start and end point textures, and line depth texture. For details, refer to the description of step S102 in the above method embodiment and will not be repeated here.

[0094] The second processing module 103 is used to determine whether the current pixel of the component to be displayed needs to be retracted based on the component identification texture, the start and end point textures, and the depth texture of the line. For details, please refer to the description of step S103 in the above method embodiment, which will not be repeated here.

[0095] The third processing module 104 is used to draw the current pixel using the background color when the current pixel needs to be retracted. For details, please refer to the relevant description of step S104 in the above method embodiment, which will not be repeated here.

[0096] The further functional description of each of the above modules is the same as that of the above corresponding method embodiments and will not be repeated here.

[0097] Through the coordinated cooperation of the above-mentioned components, the electromechanical occlusion and retreat device provided in the embodiment of the present invention performs multi-target rendering on the straight lines in the target scene to obtain texture data to determine whether the current pixel point needs to be retreated. When it is determined that the current pixel point needs to retreat for display effect, it is occluded by using the background color of the target scene to achieve the retreat display effect. The retreat method is simple in implementation, the code is easier to maintain and integrate, has good real-time performance, does not require pre-calculation, and improves processing efficiency. This screen space-based occlusion and retreat method enables real-time and efficient display even in large scenes.

[0098] The embodiment of the present invention further provides an electronic device, such as Figure 6 As shown, the electronic device may include a processor 901 and a memory 902, wherein the processor 901 and the memory 902 may be connected via a bus or other means. Figure 6 The bus connection is taken as an example.

[0099] The processor 901 may be a central processing unit (CPU). The processor 901 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.

[0100] Memory 902, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as the program instructions / modules corresponding to the methods in the embodiments of the present invention. Processor 901 executes the non-transitory software programs, instructions, and modules stored in memory 902 to perform various processor functions and data processing, thereby implementing the aforementioned methods.

[0101] The memory 902 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and application programs required for at least one function; the data storage area may store data created by the processor 901, etc. In addition, the memory 902 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 902 may optionally include a memory remotely located relative to the processor 901, and these remote memories may be connected to the processor 901 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0102] One or more modules are stored in the memory 902 and, when executed by the processor 901 , perform the above method.

[0103] The specific details of the above electronic device can be understood by referring to the corresponding descriptions and effects in the above method embodiments, and will not be repeated here.

[0104] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the above-mentioned embodiments. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD), or a solid-state drive (SSD). The storage medium can also include a combination of the above-mentioned types of memory.

[0105] The above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit the same. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be included in the scope of the claims of the present invention.

Claims

1. A method for electromechanical shielding and retreating, characterized in that: include: Obtaining each component to be displayed in the target scene and the background color of the target scene; Performing multi-target rendering on the straight line in the target scene to obtain texture data, wherein the texture data includes: a component identification texture to which the straight line belongs, a start and end point texture of the straight line, and a depth texture of the straight line; Based on the identification texture of the component to which the line belongs, the start and end point textures of the line, and the depth texture of the line, determining whether the current pixel point of the component to be displayed needs to be retracted; When the current pixel point needs to be retracted, the current pixel point is painted using the background color; The determining whether the current pixel of the component to be displayed needs to be retracted based on the component identification texture to which the line belongs, the start and end point textures of the line, and the depth texture of the line includes: Based on the start and end point textures of the straight line, determining whether there is a second straight line intersecting the first straight line corresponding to the current pixel point of the component to be displayed; When a second straight line intersects the first straight line corresponding to the current pixel point, determining whether the first straight line and the second straight line belong to different components that are not connected based on the component identification texture to which the first straight line belongs; When the first straight line and the second straight line belong to different components that are not connected, determining whether the position of the current pixel point is within a preset concession area of the intersecting pixel points of the first straight line and the second straight line; When the position of the current pixel point belongs to the preset concession area of the intersecting pixel points, judging whether the current pixel point needs to be concession based on the straight line depth texture; The determining, based on the straight line depth texture, whether the current pixel point needs to be retreated includes: Extracting a first depth value and a second depth value corresponding to the current pixel and the intersecting pixel from the linear depth texture respectively; Determining whether the first depth value is greater than the second depth value; When the first depth value is greater than the second depth value, it is determined that the current pixel needs to be retracted.

2. The method according to claim 1, characterized in that The determining, based on the straight line start and end point textures, whether there is a second straight line intersecting with the first straight line corresponding to the current pixel point includes: Determining, based on the straight line start and end point textures, first starting point coordinates and first end point coordinates of a first straight line corresponding to the current pixel point, and second starting point coordinates and second end point coordinates of a second straight line, where the second straight line is any straight line in the target scene except the first straight line; Determining whether the first starting point coordinates and the first end point coordinates satisfy a preset line segment intersection condition with the second starting point coordinates and the second end point coordinates; When a preset line segment intersection condition is satisfied between the first starting point coordinates and the first end point coordinates and the second starting point coordinates and the second end point coordinates, it is determined that the second straight line intersects the first straight line.

3. The method according to claim 1, characterized in that determining whether the first straight line and the second straight line belong to different components that are not connected based on the identification texture of the component to which the straight line belongs; Extracting respectively a first component identifier corresponding to the first straight line and a second component identifier corresponding to the second straight line from the component identifier texture to which the straight line belongs; determining whether the first component identifier is different from the second component identifier; When the first component identifier and the second component identifier are different, determining whether the first straight line has a connection relationship with the second straight line based on the first component identifier, the second component identifier and a connection relationship database of components to be displayed; When the first straight line and the second straight line have a connection relationship, it is determined that the first straight line and the second straight line belong to different components without a connection relationship.

4. The method according to claim 1, wherein The step of determining whether the position of the current pixel point belongs to a preset concession area of the intersecting pixel points of the first straight line and the second straight line includes: Calculating the distance between the current pixel and the intersecting pixel; Determining whether the distance is less than a preset distance threshold; When the distance is less than the preset distance threshold, it is determined that the position of the current pixel point belongs to a preset concession area of the intersecting pixel points.

5. The method according to claim 1, wherein Also includes: When the current pixel point does not need to be retracted, the current pixel point is drawn with a completely transparent color.

6. An electromechanical shielding and retreating device, characterized in that: include: An acquisition module, configured to acquire each component to be displayed in a target scene and the background color of the target scene; A first processing module is configured to perform multi-target rendering on the straight lines in the target scene to obtain texture data, wherein the texture data includes: a component identification texture to which the straight line belongs, a start and end point texture of the straight line, and a depth texture of the straight line; The second processing module is used to judge whether the current pixel point of the component to be displayed needs to be retracted based on the identification texture of the component to which the straight line belongs, the textures of the starting and ending points of the straight line, and the depth texture of the straight line; the judging whether the current pixel point of the component to be displayed needs to be retracted based on the identification texture of the component to which the straight line belongs, the textures of the starting and ending points of the straight line, and the depth texture of the straight line includes: judging whether there is a second straight line intersecting with the first straight line corresponding to the current pixel point of the component to be displayed based on the textures of the starting and ending points of the straight line; when there is a second straight line intersecting with the first straight line corresponding to the current pixel point, judging whether the first straight line and the second straight line belong to different components with no connection relationship based on the identification texture of the component to which the straight line belongs; when the first straight line and the second straight line belong to different components with no connection relationship, Determining whether the position of the current pixel point belongs to a preset concession area of an intersecting pixel point of the first straight line and the second straight line; when the position of the current pixel point belongs to the preset concession area of the intersecting pixel point, determining whether the current pixel point needs to be concession based on the straight line depth texture; the determining whether the current pixel point needs to be concession based on the straight line depth texture includes: extracting a first depth value and a second depth value corresponding to the current pixel point and the intersecting pixel point from the straight line depth texture respectively; determining whether the first depth value is greater than the second depth value; and when the first depth value is greater than the second depth value, determining that the current pixel point needs to be concession; The third processing module is configured to draw the current pixel point using the background color when the current pixel point needs to be retracted.

7. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 5 is implemented.

8. An electronic device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method according to any one of claims 1 to 5 by executing the computer instructions.

Citation Information

Patent Citations

  • Picture rendering method and device, storage medium, and electronic device

    CN109461199A