[go: up one dir, main page]

CN110648385B - Triangular surface picking method, triangular surface picking device, electronic equipment and computer readable medium - Google Patents

Triangular surface picking method, triangular surface picking device, electronic equipment and computer readable medium Download PDF

Info

Publication number
CN110648385B
CN110648385B CN201810681142.7A CN201810681142A CN110648385B CN 110648385 B CN110648385 B CN 110648385B CN 201810681142 A CN201810681142 A CN 201810681142A CN 110648385 B CN110648385 B CN 110648385B
Authority
CN
China
Prior art keywords
triangular
index
elements
vertexes
index array
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810681142.7A
Other languages
Chinese (zh)
Other versions
CN110648385A (en
Inventor
修磊
刘享军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201810681142.7A priority Critical patent/CN110648385B/en
Publication of CN110648385A publication Critical patent/CN110648385A/en
Application granted granted Critical
Publication of CN110648385B publication Critical patent/CN110648385B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/50Lighting effects
    • G06T15/80Shading
    • G06T15/87Gouraud shading

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Graphics (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Generation (AREA)

Abstract

The disclosure provides a triangular surface picking method, a triangular surface picking device, electronic equipment and a computer readable medium, and belongs to the technical field of Internet. The method comprises the following steps: counting the triangular faces where the vertexes stored in the vertexes forming the model are located, and obtaining a triangular face index array corresponding to the vertexes; expanding the number of elements in the triangular surface index array corresponding to all the vertexes to the same number of elements; acquiring a triangular surface index value of a pixel point; the pixel shader interpolates the triangular index array where the pixel point is located to obtain an interpolation result; and the vertex shader locates the index value of the triangular surface according to the interpolation result to obtain the corresponding target triangular surface. According to the method, the triangular index value is reversely positioned from the vertex shader according to the interpolation result of the pixel shader, and because the interpolation process of the pixel shader is completed through hardware, the extra searching process can be avoided, and the picking efficiency is improved.

Description

Triangular surface picking method, triangular surface picking device, electronic equipment and computer readable medium
Technical Field
The present disclosure relates generally to the field of internet technology, and in particular, to a triangular surface picking method, apparatus, electronic device, and computer readable medium.
Background
The three-dimensional scene is composed of a model and the model is composed of triangular faces, so that accurate picking of the model is to form a ray through the virtual camera and a back projection point of a screen click coordinate, and the ray intersects with a certain triangular face of the model to form an intersection point, and a picking result is obtained.
But the number of triangles in a three-dimensional scene is typically very large, perhaps in the order of millions, and the manner of most directly traversing all the triangles to find the intersection point by the ray intersecting the triangle is time consuming, resulting in inefficient picking.
Therefore, there is still a need for improvement in the technical solutions of the prior art.
The above information disclosed in the background section is only for enhancement of understanding of the background of the disclosure and therefore it may include information that does not form the prior art that is already known to a person of ordinary skill in the art.
Disclosure of Invention
The present disclosure provides a triangular surface picking method, apparatus, electronic device, and computer readable medium, which solve the above technical problems.
Other features and advantages of the present disclosure will be apparent from the following detailed description, or may be learned in part by the practice of the disclosure.
According to an aspect of the present disclosure, there is provided a triangular face picking method including:
Counting the triangular faces where the vertexes stored in the vertexes forming the model are located, and obtaining a triangular face index array corresponding to the vertexes;
Expanding the number of elements in the triangular surface index array corresponding to all the vertexes to the same number of elements;
Acquiring a triangular surface index value of a pixel point;
the pixel shader interpolates the triangular index array where the pixel point is located to obtain an interpolation result;
And the vertex shader locates the index value of the triangular surface according to the interpolation result to obtain the corresponding target triangular surface.
In one embodiment of the present disclosure, counting a triangle surface where a vertex stored in a vertex constituting a model is located, to obtain a triangle surface index array corresponding to the vertex includes:
The model comprises n vertexes, wherein every three vertexes in the n vertexes form a triangular surface;
And constructing the elements of the triangular surface index array according to the index values of the triangular surfaces where the vertexes are positioned, and obtaining the triangular surface index array corresponding to the vertexes.
In one embodiment of the present disclosure, expanding the number of elements in the triangular face index array corresponding to all vertices to the same number includes:
obtaining the maximum value of the number of elements in the triangular surface index array corresponding to all vertexes;
And expanding the triangular index array with the number of elements not reaching the maximum value of the number of elements so that the number of elements of all the triangular index arrays is the same.
In one embodiment of the present disclosure, expanding the triangular index array in which the number of elements does not reach the maximum value of the number of elements includes:
filling positions of which the number of elements is smaller than the maximum value of the number of elements by using a preset value;
The extended triangular index array comprises effective elements and filled supplementary elements which originally form the triangular index array.
In one embodiment of the present disclosure, obtaining the triangular index value where the pixel point is located includes:
Sorting and exchanging elements in the triangular index array with the same element number;
And determining the triangular surface index value of the pixel point by the fact that the triangular surface index array has the same value under the same subscript.
In one embodiment of the present disclosure, ordering and exchanging elements in the triangular index array having the same number of elements includes:
starting from a first vertex for the n vertexes, traversing elements in the triangular index array corresponding to the first vertex one by one according to the increasing sequence of the array footmarks;
If the element in the triangular index array is the preset value, continuing to traverse the subsequent element is skipped until all elements in the triangular index array are traversed;
when the element in the triangular surface index array is an effective element, searching the element with the same value as the effective element from the triangular surface index array corresponding to the subsequent vertex;
If the footer of the found element is different from the footer of the effective element, exchanging the element with the element at the adjacent position, so that the value of the triangular index array under the same footer is the same.
In one embodiment of the present disclosure, the vertex shader locating the index value of the triangular surface according to the interpolation result, and obtaining the corresponding target triangular surface includes:
Transmitting the vertex number into the triangular surface index array corresponding to the vertex;
And selecting a triangular face with the index value of the triangular face index array being a positive integer according to the interpolation result to obtain the target triangular face.
According to yet another aspect of the present disclosure, there is provided a triangular face picking apparatus including:
the statistics module is configured to count triangular faces where the vertexes stored in vertexes forming the model are located, and a triangular face index array corresponding to the vertexes is obtained;
the expansion module is configured to expand the number of elements in the triangular index array corresponding to all the vertexes to the same number of elements;
the pixel acquisition module is configured to acquire a triangular surface index value where the pixel point is located;
the interpolation module is configured to interpolate the triangular index array where the pixel points are located by the pixel shader to obtain an interpolation result;
And the selecting module is configured to locate the index value of the triangular surface by the vertex shader according to the interpolation result to obtain a corresponding target triangular surface.
According to yet another aspect of the present disclosure, there is provided an electronic device including a processor; a memory storing instructions for the processor to control the method steps as described above.
According to another aspect of the present disclosure, there is provided a computer readable medium having stored thereon computer executable instructions which when executed by a processor implement the method steps as described above.
According to the triangular surface picking method, the triangular surface picking device, the electronic equipment and the computer readable medium, the triangular surface index value is reversely positioned from the vertex shader according to the interpolation result of the pixel shader, and because the interpolation process of the pixel shader is completed through hardware, the additional searching process can be avoided, and the picking efficiency is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent by describing in detail exemplary embodiments thereof with reference to the attached drawings.
FIG. 1 illustrates a flow chart of a method of triangular face picking provided in an embodiment of the present disclosure.
FIG. 2 is a flow chart illustrating specific processing steps of a triangular face picking method in an embodiment of the present disclosure.
Fig. 3 shows a schematic diagram of an apparatus for determining a target point according to another embodiment of the present disclosure.
Fig. 4 is a schematic structural diagram of an electronic device suitable for implementing an embodiment of the present disclosure.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments may be embodied in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the example embodiments to those skilled in the art. The drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus a repetitive description thereof will be omitted.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the present disclosure. One skilled in the relevant art will recognize, however, that the aspects of the disclosure may be practiced without one or more of the specific details, or with other methods, components, devices, steps, etc. In other instances, well-known structures, methods, devices, implementations, materials, or operations are not shown or described in detail to avoid obscuring aspects of the disclosure.
Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in software or in one or more hardware modules or integrated circuits or in different networks and/or processor devices and/or microcontroller devices.
The present invention will be further described in detail below with reference to specific embodiments and with reference to the accompanying drawings, in order to make the objects, technical solutions and advantages of the present invention more apparent.
In the related embodiment of the disclosure, the octree is utilized to recursively divide the scene space according to three coordinate axes, the model can be conveniently searched according to the bounding box size of the model, although the method can find the model nodes relatively quickly, a large number of triangular faces still need to be traversed in the model to pick, so that the efficiency is greatly influenced, namely the picking efficiency still cannot be improved.
FIG. 1 shows a flow chart of a method of triangular face picking provided in an embodiment of the present disclosure, including the steps of:
As shown in fig. 1, in step S110, a triangle surface where the vertex stored in the vertex constituting the model is located is counted to obtain a triangle surface index array corresponding to the vertex.
As shown in fig. 1, in step S120, the number of elements in the triangular index array corresponding to all vertices is extended to the same number of elements.
As shown in fig. 1, in step S130, a triangular index value where the pixel point is located is obtained.
As shown in fig. 1, in step S140, the pixel shader interpolates the triangular index array where the pixel point is located, to obtain an interpolation result.
As shown in fig. 1, in step S150, the vertex shader locates the index value of the triangular surface according to the interpolation result, and obtains the corresponding target triangular surface.
According to the triangular surface picking method provided by the embodiment of the disclosure, the triangular surface index value is reversely positioned from the vertex shader according to the interpolation result of the pixel shader, and because the interpolation process of the pixel shader is completed through hardware, the additional searching process can be avoided, and the picking efficiency is improved.
The triangular face picking method provided by the present disclosure is described in detail below with reference to the flowchart shown in fig. 1, and specifically includes the following steps:
In step S110, a triangle face where the vertex stored in the vertex constituting the model is located is counted, and a triangle face index array corresponding to the vertex is obtained.
In one embodiment of the present disclosure, the model includes n vertices, where each three vertices of the n vertices form a triangle, and elements of the triangle index array may be formed according to index values of the triangle on which the vertex is located, so as to obtain a triangle index array corresponding to the vertex.
Let p1, p2, p3 in the model, pn have n vertices, which is a structure that stores point information on space, specifically including coordinates of points, normals of points, texture coordinates of points, and so on. The plurality of vertices may form a polygon, which further forms the entire model, in this embodiment the polygon forming the model is described by way of example as a triangular surface. Every three vertices form a triangular surface, assuming t1, t2, t 3. Since there is a case where one vertex is shared by a plurality of triangular surfaces, for each vertex, an index value of the triangular surface where the vertex is located is stored by an array tr, for example, triangular surface index array tr1= {1,2,3,4}, tr1 represents the triangular surface index array corresponding to the first vertex p1, and tr1= {1,2,3,4} represents that triangular surfaces with index values of 1,2,3 and 4 are all used for the vertex p1.
In step S120, the number of elements in the triangular index array corresponding to all vertices is extended to the same number of elements.
In one embodiment of the present disclosure, step S120 first obtains a maximum value of the number of elements in the triangular index array corresponding to all vertices; and then expanding the triangular index array with the number of elements not reaching the maximum value of the number of elements so that the number of elements of all the triangular index arrays is the same.
When the triangular index array is expanded, the expansion can be specifically performed in the following manner:
And filling the positions of which the number of elements is smaller than the maximum value of the number of elements by using a preset value, wherein the extended triangular index array comprises effective elements originally forming the triangular index array and filled supplementary elements.
For example, since the number of arrays corresponds to the number of vertices, there are n triangular index arrays, i.e., arrays tr1, tr2, tr3, & gt, trn. Because the vertex is shared by the triangular faces, the number of elements in the arrays is different, and the maximum value of the number of elements in all triangular face index array tr arrays needs to be found in the step and marked as MAX_LEN; then, the number of elements of all tr arrays is expanded to MAX_LEN, and the specific expansion rules are as follows: on the back of the original active element, some very large values, such as the maximum floating point value, are added, simply noted as max_num. Taking two arrays as an example, the first array has 6 elements, the second array has 4 elements, and the second array is expanded from 4 elements to 6 elements, namely, two complementary elements after the original 4-lattice effective element in the second array are MAX_NUM.
In step S130, a triangular index value where the pixel point is located is obtained.
In one embodiment of the present disclosure, step S130 orders and swaps elements in the triangular index array having the same number of elements; and determining the triangular surface index value of the pixel point by the same value of the triangular surface index array under the same subscript.
Wherein, the elements in the triangular index array with the same element number are ordered and exchanged in the following manner:
starting from a first vertex for the n vertexes, traversing elements in the triangular index array corresponding to the first vertex one by one according to the increasing sequence of the array footmarks;
If the element in the triangular index array is the preset value, continuing to traverse the subsequent element is skipped until all elements in the triangular index array are traversed;
when the element in the triangular surface index array is an effective element, searching the element with the same value as the effective element from the triangular surface index array corresponding to the subsequent vertex;
If the footer of the found element is different from the footer of the effective element, exchanging the element with the element at the adjacent position, so that the value of the triangular index array under the same footer is the same.
In step S140, the pixel shader interpolates the triangular index array where the pixel point is located, to obtain an interpolation result. Since the interpolation process of the pixel shader is done in hardware, no additional process is introduced, so there is little impact on efficiency.
In step S150, the vertex shader locates the index value of the triangular surface according to the interpolation result, and obtains the corresponding target triangular surface.
In one embodiment of the present disclosure, step S150 first passes a vertex number into the triangular face index array corresponding to the vertex; and then selecting a triangular face with the index value of the triangular face index array being a positive integer according to the interpolation result to obtain the target triangular face.
Based on the foregoing, the triangle face picking method summarized in the embodiments of the present disclosure will be described in detail with reference to the flowchart of the specific processing steps of the triangle face picking method shown in fig. 2:
as shown in fig. 2, in step S201, vertices and triangular surfaces constituting the model are counted.
Wherein the vertices include p1, p2, p3,..pn is n vertices in total, and the triangular faces formed include t1, t2, t3,..tm, and the triangular face index arrays corresponding to each vertex are tr1, tr2, tr3,...
As shown in fig. 2, in step S202, the maximum value of the number of elements in the triangular face index array is found, denoted as max_len, and the number of elements in all triangular face index arrays is extended to max_len elements.
As shown in fig. 2, in step S203, from the beginning of the first vertex p1, the elements in the corresponding triangular index array tr1 sequentially perform the operations of step S204 described below, and if a certain element in tr1 appears max_num, the operations of the subsequent elements in tr1 are skipped and continue to be performed until all elements in tr1 are traversed.
As shown in fig. 2, in step S204, the elements in the triangular index array having the same number of elements are sorted and swapped.
For the vertex pi (i is from 1 to n), the corresponding triangular face array tri [ max_len ], for the kth element therein, is denoted tri [ k ] =t, that is, the triangular face where the index at which the vertex pi is located is t.
The element value t in trj [ MAX_LEN ] is found in the triangular face array trj [ MAX_LEN ] in the subsequent vertex pj (j from i+1 to n). If found, assuming trj s=t, if trj S has been adjusted (i.e. trj S original element is not in the position, the adjustment rule repeats steps S203-S204), then exchanging tri k with its following elements, then proceeding to step S204 from the next element (i.e. to the next element, and then starting again according to the rule of step S204), otherwise interacting the S-th element with the k-th element in trj, so that trj k=t; if not, then the next vertex is looked up until all nodes are traversed.
For example:
The elements on the partial positions of the first two adjacent arrays are adjusted as follows:
Tri[i]
x
Tri[i+1]
z x
the elements on the partial positions of the two adjacent arrays after adjustment are as follows:
Tri[i]
x
Tri[i+1]
x z
as shown in fig. 2, in step S205, the triangular index value where the pixel point is located is determined by the triangular index array having the same value under the same subscript.
By repeating the processes of step S203 to step S204 until all are traversed. The end result is that for all tra (a from 1 to n), each column j (j from 1 to max_len) of elements tri [ j ], the value of which is either max_num or a value t (t from 1 to m), and if t, there must be and are only two further arrays trb and trc (b from 1 to n, c from 1 to n) such that tra [ j ] = trb [ j ] = t, that is to say the corresponding vertices pa, pb, pc are co-located on a triangular surface, the index of which is t. Since the above steps are done offline, although more complex, they do not affect rendering efficiency and these data are no longer changed for the model.
As shown in FIG. 2, in step S206, the vertex shader enters an array tri for each vertex i. The vertex shader is used for processing information such as transformation and illumination of each vertex.
As shown in fig. 2, in step S207, the pixel shader interpolates the triangular index array where the pixel points are located, where the pixel shader is used to process each pixel, such as setting texture coordinates, attaching texel colors, color mixing, and so on.
Wherein the data for each pixel is an interpolation of the vertex data for the triangular surface. Assuming that the index of the triangular surface where the pixel x is located is t, there are three vertices pa, pb, pc (a, b, c from 1 to n), so that each element in the array trx used for the pixel is interpolated from tra, trb and trc. From the above steps, it can be known that each element in tra, trb and trc is either an interpolation of the same index t (interpolation of three same values or t), or there is at least one max_len and interpolation of elements in the other two arrays, the result is also very large, and compared with t (t is from 1 to m), we also mark max_len, that is, the element in trx is either t or max_len, and the triangle corresponding to the pixel x is only one (or in extreme case, there are a plurality of, taking any one) so as to find out the index which is a positive integer value in trx, and the corresponding triangular surface is the triangular surface where the pixel is located.
As shown in fig. 2, in step S208, triangular surface picking is performed.
For example, the current pixel can be obtained according to the picked screen coordinates, and the current pixel is transmitted to a pixel shader to find out the positive integer index in the tr array below the pixel, and the corresponding triangular surface is the picked triangular surface.
Further optimization of step S208 may be performed, where the node index (the node index may be obtained by recording the order of each node when the model is generated) +the triangle index may be formed into a hash value, and the indices of the initial triangle are unified, so that in the current drawing scene, the corresponding node and triangle may be sorted.
Based on the above steps, since the interpolation process of the pixel shader is done in hardware, no additional process is introduced, so the effect on efficiency is small, and the picking time is not increased.
In summary, in the triangular face sorting method provided by the embodiment of the present disclosure, before rendering, a proper sorting algorithm is selected to ensure that the triangular face index arrays stored in the vertices are under the same footmarks, and the indexes of the triangular faces are the same. And traversing all nodes by the vertex shader in the rendering stage to render, and reversely finding out indexes in the vertex shader according to the pixel where the mouse is selected by the pixel shader, so that an additional searching process is avoided, and the efficiency is improved.
Fig. 3 shows a schematic diagram of a triangular surface picking device according to another embodiment of the disclosure, as shown in fig. 3, the device 300 includes: a statistics module 310, an expansion module 320, a pixel acquisition module 330, an interpolation module 340, and a sorting module 350.
The statistics module 310 is configured to perform statistics on a triangle surface where the vertex stored in the vertex forming the model is located, so as to obtain a triangle surface index array corresponding to the vertex; the expansion module 320 is configured to expand the number of elements in the triangular index array corresponding to all the vertices to the same number of elements; the pixel acquisition module 330 is configured to acquire a triangular index value where the pixel point is located; the interpolation module 340 is configured to perform interpolation on the triangular index array where the pixel point is located by the pixel shader, so as to obtain an interpolation result; the sorting module 350 is configured to locate the index value of the triangular surface by the vertex shader according to the interpolation result, so as to obtain the corresponding target triangular surface.
The functions of each module in the apparatus are described in the above method embodiments, and are not described herein.
In another aspect, the present disclosure also provides an electronic device, including a processor and a memory, the memory storing operation instructions for the processor to control:
counting the triangular faces where the vertexes stored in the vertexes forming the model are located, and obtaining a triangular face index array corresponding to the vertexes; expanding the number of elements in the triangular surface index array corresponding to all the vertexes to the same number of elements; acquiring a triangular surface index value of a pixel point; the pixel shader interpolates the triangular index array where the pixel point is located to obtain an interpolation result; and the vertex shader locates the index value of the triangular surface according to the interpolation result to obtain the corresponding target triangular surface.
Referring now to FIG. 4, there is illustrated a schematic diagram of a computer system 400 suitable for use in implementing an electronic device of an embodiment of the present application. The electronic device shown in fig. 4 is only an example and should not be construed as limiting the functionality and scope of use of the embodiments of the application.
As shown in fig. 4, the computer system 400 includes a Central Processing Unit (CPU) 401, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 402 or a program loaded from a storage portion 407 into a Random Access Memory (RAM) 403. In RAM403, various programs and data required for the operation of system 400 are also stored. The CPU 401, ROM 402, and RAM403 are connected to each other by a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
The following components are connected to the I/O interface 405: an input section 406 including a keyboard, a mouse, and the like; an output portion 407 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker, and the like; a storage section 408 including a hard disk or the like; and a communication section 409 including a network interface card such as a LAN card, a modem, or the like. The communication section 409 performs communication processing via a network such as the internet. The drive 410 is also connected to the I/O interface 405 as needed. A removable medium 411 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed on the drive 410 as needed, so that a computer program read therefrom is installed into the storage section 408 as needed.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion 409 and/or installed from the removable medium 411. The above-described functions defined in the system of the present application are performed when the computer program is executed by a Central Processing Unit (CPU) 401.
The computer readable medium shown in the present application may be a computer readable signal medium or a computer readable medium, or any combination of the two. The computer readable medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present application, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present application may be implemented in software or in hardware. The described units may also be provided in a processor, for example, described as: a processor includes a transmitting unit, an acquiring unit, a determining unit, and a first processing unit. The names of these units do not constitute a limitation on the unit itself in some cases, and for example, the transmitting unit may also be described as "a unit that transmits a picture acquisition request to a connected server".
In another aspect, the present disclosure also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise the method steps of:
counting the triangular faces where the vertexes stored in the vertexes forming the model are located, and obtaining a triangular face index array corresponding to the vertexes; expanding the number of elements in the triangular surface index array corresponding to all the vertexes to the same number of elements; acquiring a triangular surface index value of a pixel point; the pixel shader interpolates the triangular index array where the pixel point is located to obtain an interpolation result; and the vertex shader locates the index value of the triangular surface according to the interpolation result to obtain the corresponding target triangular surface.
It should be clearly understood that this disclosure describes how to make and use particular examples, but the principles of this disclosure are not limited to any details of these examples. Rather, these principles can be applied to many other embodiments based on the teachings of the present disclosure.
Exemplary embodiments of the present disclosure are specifically illustrated and described above. It is to be understood that this disclosure is not limited to the particular arrangements, instrumentalities and methods of implementation described herein; on the contrary, the disclosure is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.

Claims (9)

1. A method of triangular face picking, comprising:
counting the triangular faces where the vertexes are stored in the vertexes forming the model to obtain triangular face index arrays corresponding to the vertexes, wherein the triangular face index arrays corresponding to the vertexes are formed according to the index values of the triangular faces where the vertexes are located, and one triangular face index value is used for indexing one triangular face;
Expanding the number of elements in the triangular surface index array corresponding to all the vertexes to the same number of elements;
Acquiring a triangular surface index value of a pixel point;
the pixel shader interpolates the triangular index array where the pixel point is located to obtain an interpolation result;
the vertex shader locates the index value of the triangular surface according to the interpolation result to obtain a corresponding target triangular surface;
the acquiring the triangular surface index value of the pixel point comprises the following steps:
Sorting and exchanging elements in the triangular index array with the same element number;
And determining the triangular surface index value of the pixel point by the fact that the triangular surface index array has the same value under the same subscript.
2. The method of claim 1, wherein counting the triangular faces where the vertices stored in the vertices constituting the model are located to obtain a triangular face index array corresponding to the vertices comprises:
The model comprises n vertexes, wherein every three vertexes in the n vertexes form a triangular surface;
And constructing the elements of the triangular surface index array according to the index values of the triangular surfaces where the vertexes are positioned, and obtaining the triangular surface index array corresponding to the vertexes.
3. The method of claim 1, wherein expanding the number of elements in the triangular index array corresponding to all vertices to the same number comprises:
obtaining the maximum value of the number of elements in the triangular surface index array corresponding to all vertexes;
And expanding the triangular index array with the number of elements not reaching the maximum value of the number of elements so that the number of elements of all the triangular index arrays is the same.
4. A method of triangular face picking as claimed in claim 3 wherein expanding the triangular face index array where the number of elements does not reach the maximum of the number of elements comprises:
filling positions of which the number of elements is smaller than the maximum value of the number of elements by using a preset value;
The extended triangular index array comprises effective elements and filled supplementary elements which originally form the triangular index array.
5. The method of claim 4, wherein ordering and swapping elements in the triangular index array having the same number of elements comprises:
Starting from a first vertex for n vertexes, traversing elements in the triangular index array corresponding to the first vertex one by one according to the ascending sequence of the array footmarks;
If the element in the triangular index array is the preset value, continuing to traverse the subsequent element is skipped until all elements in the triangular index array are traversed;
when the element in the triangular surface index array is an effective element, searching the element with the same value as the effective element from the triangular surface index array corresponding to the subsequent vertex;
If the footer of the found element is different from the footer of the effective element, exchanging the element with the element at the adjacent position, so that the value of the triangular index array under the same footer is the same.
6. The triangle face picking method of claim 1, wherein the vertex shader locating the index value of the triangle face based on the interpolation result, the obtaining the corresponding target triangle face comprises:
Transmitting the vertex number into the triangular surface index array corresponding to the vertex;
And selecting a triangular face with the index value of the triangular face index array being a positive integer according to the interpolation result to obtain the target triangular face.
7. A triangular face picking device, comprising:
The statistics module is configured to count triangular faces where the vertexes are stored in vertexes forming the model to obtain triangular face index arrays corresponding to the vertexes, wherein the triangular face index arrays corresponding to the vertexes are formed according to index values of the triangular faces where the vertexes are located, and one triangular face index value is used for indexing one triangular face;
the expansion module is configured to expand the number of elements in the triangular index array corresponding to all the vertexes to the same number of elements;
the pixel acquisition module is configured to acquire a triangular surface index value where the pixel point is located;
the interpolation module is configured to interpolate the triangular index array where the pixel points are located by the pixel shader to obtain an interpolation result;
the selecting module is configured to enable the vertex shader to locate index values of triangular faces according to the interpolation result, and obtain corresponding target triangular faces;
the acquiring the triangular surface index value of the pixel point comprises the following steps:
Sorting and exchanging elements in the triangular index array with the same element number;
And determining the triangular surface index value of the pixel point by the fact that the triangular surface index array has the same value under the same subscript.
8. An electronic device, comprising:
A processor;
Memory storing method steps for the processor to control any one of claims 1-6.
9. A computer readable medium having stored thereon computer executable instructions, which when executed by a processor implement the method steps of any of claims 1-6.
CN201810681142.7A 2018-06-27 2018-06-27 Triangular surface picking method, triangular surface picking device, electronic equipment and computer readable medium Active CN110648385B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810681142.7A CN110648385B (en) 2018-06-27 2018-06-27 Triangular surface picking method, triangular surface picking device, electronic equipment and computer readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810681142.7A CN110648385B (en) 2018-06-27 2018-06-27 Triangular surface picking method, triangular surface picking device, electronic equipment and computer readable medium

Publications (2)

Publication Number Publication Date
CN110648385A CN110648385A (en) 2020-01-03
CN110648385B true CN110648385B (en) 2024-10-18

Family

ID=68988662

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810681142.7A Active CN110648385B (en) 2018-06-27 2018-06-27 Triangular surface picking method, triangular surface picking device, electronic equipment and computer readable medium

Country Status (1)

Country Link
CN (1) CN110648385B (en)

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6784894B2 (en) * 2000-08-24 2004-08-31 Sun Microsystems, Inc. Mapping time-sorted to direction-sorted triangle vertices
JP4139590B2 (en) * 2001-12-21 2008-08-27 シャープ株式会社 CMYK color printer black generation method using multiple look-up tables and interpolation method
US7952588B2 (en) * 2006-08-03 2011-05-31 Qualcomm Incorporated Graphics processing unit with extended vertex cache
US9123151B2 (en) * 2008-08-05 2015-09-01 Autodesk, Inc. Exchanging data between vertex shaders and fragment shaders on a graphics processing unit
US8947444B1 (en) * 2008-12-09 2015-02-03 Nvidia Corporation Distributed vertex attribute fetch
US8558842B1 (en) * 2009-10-14 2013-10-15 Nvidia Corporation Parallel duplicate primitive vertex detection and batching
US10096079B2 (en) * 2013-06-10 2018-10-09 Sony Interactive Entertainment Inc. Fragment shaders perform vertex shader computations
US9495767B2 (en) * 2014-05-15 2016-11-15 Google Inc. Indexed uniform styles for stroke rendering
CN104182571B (en) * 2014-08-12 2018-05-04 电子科技大学 Kriging interpolation methods based on Delaunay and GPU
US10282889B2 (en) * 2016-11-29 2019-05-07 Samsung Electronics Co., Ltd. Vertex attribute compression and decompression in hardware
CN108122189B (en) * 2016-11-29 2021-11-30 三星电子株式会社 Vertex attribute compression and decompression in hardware

Also Published As

Publication number Publication date
CN110648385A (en) 2020-01-03

Similar Documents

Publication Publication Date Title
CN111260766B (en) Virtual light source processing method, device, medium and electronic equipment
Steinbrücker et al. Volumetric 3D mapping in real-time on a CPU
US6392647B1 (en) System and method for computer modeling of 3D objects or surfaces by mesh constructions having optimal quality characteristics and dynamic resolution capabilities
CN111640180B (en) Three-dimensional reconstruction method and device and terminal equipment
CN111612882B (en) Image processing method, image processing device, computer storage medium and electronic equipment
US9224233B2 (en) Blending 3D model textures by image projection
JP3034483B2 (en) Object search method and apparatus using the method
CN112489213A (en) Three-dimensional terrain model generation method and device, electronic equipment and storage medium
US11488347B2 (en) Method for instant rendering of voxels
US8941660B2 (en) Image generating apparatus, image generating method, and image generating integrated circuit
US10930072B1 (en) Multi-resolution mesh real-time contouring
US9092907B2 (en) Image shader using two-tiered lookup table for implementing style attribute references
CN117557711B (en) Method, device, computer equipment and storage medium for determining visual field
CN110648385B (en) Triangular surface picking method, triangular surface picking device, electronic equipment and computer readable medium
CN114299242A (en) Method, device and equipment for processing images in high-precision map and storage medium
JPH10134198A (en) Space searching method and system using the same method
CN110378948B (en) 3D model reconstruction method and device and electronic equipment
CN112002007A (en) Model obtaining method and device based on air-ground image, equipment and storage medium
JPH10293862A (en) Three-dimensional object data processing method
CN117710551A (en) Entity rendering method and device, electronic equipment and storage medium
Chen et al. A clipping algorithm for real-scene 3D models
CN116630502A (en) Relationship diagram rendering method, device, equipment, medium and program product
CN116630516A (en) 3D characteristic-based 2D rendering ordering method, device, equipment and medium
US6567082B1 (en) Incremental resolution changes in multi-resolution meshes with update records
US10930073B1 (en) Multi-resolution surface clipping with asynchronous incremental on-demand marking of spatial index nodes

Legal Events

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