CN117994431A - Basic graphic element pickup method and device, electronic equipment and storage medium - Google Patents
Basic graphic element pickup method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN117994431A CN117994431A CN202410129971.XA CN202410129971A CN117994431A CN 117994431 A CN117994431 A CN 117994431A CN 202410129971 A CN202410129971 A CN 202410129971A CN 117994431 A CN117994431 A CN 117994431A
- Authority
- CN
- China
- Prior art keywords
- target
- primitive
- dimensional model
- basic
- pixel
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 59
- 238000009877 rendering Methods 0.000 claims abstract description 15
- 230000015654 memory Effects 0.000 claims description 36
- 238000012545 processing Methods 0.000 claims description 15
- 230000000007 visual effect Effects 0.000 claims description 7
- 230000009467 reduction Effects 0.000 abstract description 6
- 239000011159 matrix material Substances 0.000 description 9
- 238000010586 diagram Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 230000001360 synchronised effect Effects 0.000 description 4
- 230000001131 transforming effect Effects 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 230000000694 effects Effects 0.000 description 3
- 230000008569 process Effects 0.000 description 3
- 230000009466 transformation Effects 0.000 description 3
- 235000019800 disodium phosphate Nutrition 0.000 description 2
- 230000005484 gravity Effects 0.000 description 2
- 238000013507 mapping Methods 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- KLDZYURQCUYZBL-UHFFFAOYSA-N 2-[3-[(2-hydroxyphenyl)methylideneamino]propyliminomethyl]phenol Chemical compound OC1=CC=CC=C1C=NCCCN=CC1=CC=CC=C1O KLDZYURQCUYZBL-UHFFFAOYSA-N 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000012512 characterization method Methods 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 201000001098 delayed sleep phase syndrome Diseases 0.000 description 1
- 208000033921 delayed sleep phase type circadian rhythm sleep disease Diseases 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000004549 pulsed laser deposition Methods 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Landscapes
- Image Generation (AREA)
Abstract
The application relates to a method, a device, electronic equipment and a storage medium for picking up basic graphic primitives, wherein the method comprises the following steps: acquiring a target three-dimensional model to be rendered; performing soft grating operation on the target three-dimensional model to obtain all pixel coordinates covered by each basic primitive in the target three-dimensional model in a target screen; determining a target buffer array according to all pixel coordinates covered by each basic primitive in a target screen, wherein the target buffer array comprises primitive information of the basic primitive corresponding to each pixel coordinate in the target screen; rendering the target three-dimensional model into a target screen according to the target buffer array; when a selection area aiming at a target three-dimensional model is acquired in a target screen, determining all pixel coordinates in the selection area; and picking up the basic graphic elements in the selection area according to all the pixel coordinates in the selection area. The application realizes the pick-up of a plurality of basic primitives and is convenient for the subsequent face reduction of the target three-dimensional model.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and apparatus for picking up a base primitive, an electronic device, and a storage medium.
Background
Modern 3D digital content authoring software is a tool for creating and editing 3D models, animations, scenes and effects, widely used in the fields of game development, movie and animation production, advertising and construction, etc. One basic function of the 3D digital content creation software is to pick up basic primitives such as vertexes and faces of the 3D model so as to realize face reduction of the three-dimensional model. At present, the common basic primitive picking methods are a ray picking method and a color buffer picking method, and the ray picking method occupies a cpu (Central Processing Unit ) more, and can only support the picking of a single basic primitive. The color buffer picking method can only pick up the complete three-dimensional model formed by the basic graphic primitives, and cannot pick up the basic graphic primitives.
Disclosure of Invention
In view of the above, in order to solve the above technical problems or some of the technical problems, embodiments of the present application provide a method, an apparatus, an electronic device, and a storage medium for picking up a base primitive.
In a first aspect, the present application provides a method for picking up a base primitive, applied to a CPU, the method including:
Acquiring a target three-dimensional model to be rendered;
Performing soft grating operation on the target three-dimensional model to obtain all pixel coordinates covered by each basic primitive in the target three-dimensional model in a target screen;
Determining a target buffer array according to all pixel coordinates covered by each basic primitive in the target screen, wherein the target buffer array comprises primitive information of the basic primitive corresponding to each pixel coordinate in the target screen;
Rendering the target three-dimensional model into a target screen according to the target buffer array;
When a selection area aiming at the target three-dimensional model is acquired in the target screen, determining all pixel coordinates in the selection area;
and picking up the basic graphic elements in the selection area according to all the pixel coordinates in the selection area.
In an alternative embodiment, the method further comprises:
acquiring an initial buffer array, wherein the initial buffer array comprises primitive information of each basic primitive in the target three-dimensional model;
said determining a target buffer array according to all the pixel coordinates covered by each of the base primitives in the target screen, comprising:
Determining, for each of the base primitives in the target three-dimensional model, primitive information of the base primitive from the initial buffer array, and determining a pixel depth value of each pixel coordinate covered by the base primitive in the target screen according to the primitive information of the base primitive;
For each pixel coordinate in the target screen, determining a target depth value corresponding to the pixel coordinate according to all the pixel depth values corresponding to the pixel coordinate, and determining primitive information of the basic primitive corresponding to the pixel coordinate according to the target depth value;
And updating the initial buffer array according to the primitive information of the basic primitive corresponding to each pixel coordinate in the target screen to obtain a target buffer array.
In an optional embodiment, the determining, according to all the pixel depth values corresponding to the pixel coordinates, a target depth value corresponding to the pixel coordinates includes:
determining the minimum pixel depth value from all the pixel depth values corresponding to the pixel coordinates;
Determining the minimum pixel depth value as the target depth value corresponding to the pixel coordinate;
And determining the primitive information of the basic primitive corresponding to the pixel coordinates according to the target depth value, including:
Determining the basic primitive to which the target depth value belongs;
determining the primitive information of the basic primitive to which the target depth value belongs from the initial buffer array;
And determining the primitive information of the basic primitive to which the target depth value belongs as the primitive information of the basic primitive corresponding to the pixel coordinate.
In an optional embodiment, the target buffer array further includes the target depth value corresponding to each of the pixel coordinates in the target screen;
The picking up the base primitive in the selection area according to all the pixel coordinates in the selection area comprises:
determining the target depth value corresponding to the pixel coordinate from the target buffer array for each pixel coordinate in the selection area;
When the target depth value is smaller than a preset depth value, determining the primitive information of the basic primitive corresponding to the pixel coordinate from the target buffer array, wherein the preset depth value is 1;
And picking up the basic primitive in the selection area according to the primitive information of the basic primitive corresponding to all the pixel coordinates in the selection area.
In an optional implementation manner, the primitive information of the base primitive includes vertex depth values corresponding to respective vertices of the base primitive;
The picking up the basic primitive in the selection area according to the primitive information of the basic primitive corresponding to all the pixel coordinates in the selection area includes:
When the vertexes of the basic primitive are required to be picked up, according to the vertex depth values corresponding to the vertexes of the basic primitive corresponding to the pixel coordinates and the pixel coordinates of the vertexes of the basic primitive corresponding to the pixel coordinates in the target screen, determining all vertexes meeting preset conditions from all vertexes of the basic primitive corresponding to the pixel coordinates, wherein the preset conditions comprise that the pixel coordinates of the vertexes in the target screen are positioned in the selected area and the vertex depth values corresponding to the vertexes are equal to the target depth values corresponding to the pixel coordinates;
and picking up the vertexes of the basic primitive in the selection area according to all vertexes which correspond to all the pixel coordinates in the selection area and meet the preset condition.
In an alternative embodiment, the base primitive is a triangle facet;
And performing soft grating operation on the target three-dimensional model to obtain all pixel coordinates covered by each basic primitive in the target three-dimensional model in a target screen, wherein the soft grating operation comprises the following steps:
performing a soft raster operation on the target three-dimensional model to determine the pixel coordinates in the target screen for which the respective vertices of each of the base primitives in the target three-dimensional model map;
for each base primitive in the target three-dimensional model, determining all pixel coordinates covered by the base primitive in the target screen according to the pixel coordinates of all vertices of the base primitive mapped in the target screen.
In an alternative embodiment, the obtaining the three-dimensional model of the object to be rendered includes:
acquiring a visual cone corresponding to a camera and an initial three-dimensional model;
determining a bounding box corresponding to the initial three-dimensional model;
Determining the initial three-dimensional model as the target three-dimensional model to be rendered while the bounding box is within the optic cone.
In a second aspect, the present application provides a pickup device for a base primitive, including:
The acquisition module is used for acquiring a target three-dimensional model to be rendered;
The processing module is used for executing soft grating operation on the target three-dimensional model to obtain all pixel coordinates covered by each basic primitive in the target three-dimensional model in a target screen;
The determining module is used for determining a target buffer array according to all pixel coordinates covered by each basic primitive in the target screen, wherein the target buffer array comprises primitive information of the basic primitive corresponding to each pixel coordinate in the target screen;
the processing module is used for rendering the target three-dimensional model into a target screen according to the target buffer array;
A determining module, configured to determine, when a selection area for the target three-dimensional model is acquired in the target screen, all the pixel coordinates in the selection area;
and the picking module is used for picking up the basic primitive in the selection area according to all the pixel coordinates in the selection area.
In a third aspect, the present application provides an electronic device, comprising: the device comprises a processor and a memory, wherein the processor is used for executing a picking program of the basic primitive stored in the memory so as to realize the picking method of the basic primitive.
In a fourth aspect, the present application provides a storage medium storing one or more programs executable by one or more processors to implement the method of picking up base primitives as described above.
Compared with the prior art, the technical scheme provided by the embodiment of the application has the following advantages that the method provided by the embodiment of the application comprises the following steps: acquiring a target three-dimensional model to be rendered; performing soft grating operation on the target three-dimensional model to obtain all pixel coordinates covered by each basic primitive in the target three-dimensional model in a target screen; determining a target buffer array according to all pixel coordinates covered by each basic primitive in a target screen, wherein the target buffer array comprises primitive information of the basic primitive corresponding to each pixel coordinate in the target screen; rendering the target three-dimensional model into a target screen according to the target buffer array; when a selection area aiming at a target three-dimensional model is acquired in a target screen, determining all pixel coordinates in the selection area; and picking up the basic graphic elements in the selection area according to all the pixel coordinates in the selection area. Through the method, the soft grating operation is carried out on the target three-dimensional model to be rendered, so that the target buffer array containing the primitive information of the basic primitives shown by the pixel coordinates in the target screen is obtained, and after the target three-dimensional model is rendered into the target screen according to the target buffer array, when the target three-dimensional model in the target screen is selected, the primitive information of the basic primitives corresponding to the selected pixel coordinates can be determined according to the selected pixel coordinates, so that the picking of a plurality of basic primitives is realized, and the subsequent face reduction of the target three-dimensional model is facilitated.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the invention or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, and it will be obvious to a person skilled in the art that other drawings can be obtained from these drawings without inventive effort.
One or more embodiments are illustrated by way of example and not limitation in the figures of the accompanying drawings, in which like references indicate similar elements, and in which the figures of the drawings are not to be taken in a limiting sense, unless otherwise indicated.
FIG. 1 is a flow chart of a method for picking up a basic primitive according to an embodiment of the present application;
FIG. 2 is a flowchart of another basic primitive picking method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a basic primitive pickup device according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
In the above figures:
10. an acquisition module; 20. a processing module; 30. a determining module; 40. a pick-up module;
400. an electronic device; 401. a processor; 402. a memory; 4021. an operating system; 4022. an application program; 403. a user interface; 404. a network interface; 405. a bus system.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The following disclosure provides many different embodiments, or examples, for implementing different structures of the invention. In order to simplify the present disclosure, components and arrangements of specific examples are described below. They are, of course, merely examples and are not intended to limit the invention. Furthermore, the present invention may repeat reference numerals and/or letters in the various examples. This repetition is for the purpose of simplicity and clarity and does not in itself dictate a relationship between the various embodiments and/or configurations discussed.
Referring to fig. 1, fig. 1 is a flowchart of a method for picking up a base primitive according to an embodiment of the present application. The method for picking up the basic graphic element provided by the embodiment of the application comprises the following steps:
S101: and obtaining a target three-dimensional model to be rendered.
In this embodiment, the execution body is a CPU. The number of the target three-dimensional models to be rendered can be one, the number of the target three-dimensional models to be rendered can be multiple, and the number of the target three-dimensional models to be rendered can be determined according to the cone of the camera. Wherein the camera specifically refers to the human eye in the virtual world. And carrying out a target three-dimensional model to be rendered through the cone of the camera so as to reduce the calculation amount of the CPU.
S102: and performing soft grating operation on the target three-dimensional model to obtain all pixel coordinates covered by each basic primitive in the target three-dimensional model in a target screen.
In this embodiment, the base primitive in the target three-dimensional model is actually a triangle surface. The soft grating operation of the target three-dimensional model can be realized through the following steps:
obtaining vertex coordinates of all vertexes of each basic primitive in the target three-dimensional model, a model transformation matrix of the target three-dimensional model, an observation matrix and a projection matrix of a camera;
For each vertex, transforming vertex coordinates of the vertex into world space according to a model transformation matrix, transforming vertex coordinates of the world space into observation space according to an observation matrix, transforming vertex coordinates of the observation space into a clipping space according to a projection matrix, and transforming vertex coordinates of the clipping space into a standard equipment coordinate space by perspective division;
and mapping all vertex coordinates of the standard equipment coordinate space into a target screen to complete the soft rasterization operation of the target three-dimensional model.
The model transformation matrix, the observation matrix and the projection matrix of the camera can be set according to actual needs, and are not particularly limited in this embodiment. It should be noted that the foregoing is only a brief description of the operation of the soft grating, and the detailed implementation manner of the operation of the soft grating may refer to the prior art, and is not specifically limited in this embodiment. The target screen is actually a display screen, and is used for displaying the rendered target three-dimensional model and picking up basic primitives in the rendered target three-dimensional model.
After mapping all vertex coordinates of a standard equipment coordinate space to a target screen to finish a soft raster operation of a target three-dimensional model, pixel coordinates of all vertices of each basic primitive in the target three-dimensional model, which are mapped in the target screen, can be determined, for each basic primitive, according to an area formed by the pixel coordinates of each vertex of the basic primitive, which are mapped in the target screen, so as to determine all pixel coordinates of the basic primitive, which are covered in the target screen, and further, all pixel coordinates of all basic primitives, which are covered in the target three-dimensional model, in the target screen can be obtained, and further, the determination of a target buffer array can be performed according to all pixel coordinates of all basic primitives, which are covered in the target three-dimensional model, in the target screen.
S103: and determining a target buffer array according to all pixel coordinates covered by each basic primitive in the target screen, wherein the target buffer array comprises primitive information of the basic primitive corresponding to each pixel coordinate in the target screen.
In this embodiment, the target buffer array further includes a target depth value corresponding to each pixel coordinate in the target screen, where the target depth value is related to an occlusion relationship between each base primitive, and by determining the target depth value, after rendering the target three-dimensional model by using the target buffer array, the rendered target three-dimensional model presented in the target screen includes a correct occlusion relationship. After obtaining all pixel coordinates covered by all basic pixels in the target three-dimensional model in the target screen, determining the shielding relation among the basic pixels according to the pixel depth value of each basic pixel in the pixel coordinates for each pixel coordinate in the target screen, further obtaining the basic pixel nearest to the target screen, determining the pixel depth value corresponding to the basic pixel as the target depth value corresponding to the pixel coordinates and determining the pixel information of the basic pixel as the pixel information of the basic pixel corresponding to the pixel coordinates. The occlusion relationship is determined by the size of the pixel depth value, with larger pixel depth values representing more distant of the underlying primitive from the target screen. After the target depth value corresponding to each pixel coordinate in the target screen and the primitive information of the basic primitive are obtained, the target depth value corresponding to each pixel coordinate in the target screen and the primitive information of the basic primitive can be cached in a target buffer array mode so as to facilitate the subsequent rendering of the target three-dimensional model.
S104: and rendering the target three-dimensional model into a target screen according to the target buffer array.
In this embodiment, each pixel in the target screen is rendered by using the target buffer array, so that the target three-dimensional model can be rendered into the target screen. Because the target buffer array contains the primitive information and the target depth value of the basic primitive displayed by each pixel coordinate in the target screen, after the target three-dimensional model is rendered, the primitive information and the target depth value of the basic primitive displayed by each pixel coordinate in the target screen are reserved, so that when the rendered target three-dimensional model is picked up by the basic primitive, a plurality of selected pixel coordinates can be read, and primitive information and target depth values of the basic primitive corresponding to different pixel coordinates are obtained from the target buffer array, and the pick-up of a plurality of basic primitives is realized.
S105: when a selection area for the target three-dimensional model is acquired in the target screen, all pixel coordinates in the selection area are determined.
S106: and picking up the basic graphic elements in the selection area according to all the pixel coordinates in the selection area.
For the steps S105 and S106, after the target three-dimensional model is rendered into the target screen, whether a selection area for the target three-dimensional model is acquired or not may be detected in the target screen, when the selection area for the target three-dimensional model is detected, all pixel coordinates included in the selection area are determined, and for each pixel coordinate in the selection area, a query operation may be performed on the target buffer array according to the target depth value and the pixel coordinate corresponding to the pixel coordinate, so as to determine primitive information of the basic primitive corresponding to the pixel coordinate from the target buffer array, thereby implementing pickup of multiple basic primitives.
According to the method for picking up the basic primitives, the soft grating operation is performed on the target three-dimensional model to be rendered, so that the target buffer array containing the primitive information of the basic primitives shown by the pixel coordinates in the target screen is obtained, and after the target three-dimensional model is rendered into the target screen according to the target buffer array, when the target three-dimensional model in the target screen is selected, the primitive information of the basic primitives corresponding to the selected pixel coordinates can be determined according to the selected pixel coordinates, so that the picking up of a plurality of basic primitives is realized, and the subsequent face reduction of the target three-dimensional model is facilitated.
Referring to fig. 2, fig. 2 is a flowchart of another basic primitive picking method according to an embodiment of the present application. The method for picking up the basic graphic element provided by the embodiment of the application comprises the following steps:
S201: and acquiring a target three-dimensional model to be rendered and an initial buffer array, wherein the initial buffer array comprises primitive information of each basic primitive in the target three-dimensional model.
In this embodiment, the primitive in the initial buffer array is a triangle. The primitive information of the basic primitive comprises an ID number of the basic primitive, a three-dimensional model to which the basic primitive belongs, vertex coordinates and vertex depth values of each vertex of the basic primitive. The size of the initial buffer array is the same as the screen resolution of the target screen, and the initial buffer array comprises preset depth values corresponding to the coordinates of all pixels in the target screen, wherein the preset depth values are 1. When the preset depth value is 1, the characterization is farthest from the target screen.
In the above, the step S201 of obtaining the target three-dimensional model to be rendered specifically includes:
acquiring a visual cone corresponding to a camera and an initial three-dimensional model;
determining a bounding box corresponding to the initial three-dimensional model;
when the bounding box is in the visual vertebral body, the initial three-dimensional model is determined as a target three-dimensional model to be rendered.
The camera may refer to the above, and in this embodiment, a description thereof is omitted. The video camera has six planes corresponding to the cone, including a near section, a far section, an upper section, a lower section, a left section and a right section. The bounding box corresponding to the initial three-dimensional model may be determined according to the prior art, and in this embodiment, details are not described here. When the bounding box corresponding to the initial three-dimensional model is in the visual vertebral body, the initial three-dimensional model needs to be processed, the initial three-dimensional model is determined to be the target three-dimensional model, and the following step S202 is executed. And when the bounding box corresponding to the initial three-dimensional model is not in the visual vertebral body, the initial three-dimensional model is not required to be processed. The left lower corner coordinate of the bounding box corresponding to the initial three-dimensional model is the minimum value of the xyz coordinate of the initial three-dimensional model, and the right upper corner coordinate of the bounding box corresponding to the initial three-dimensional model is the maximum value of the xyz coordinate of the initial three-dimensional model. In the embodiment, the bounding box corresponding to the initial three-dimensional model is compared with the cone corresponding to the camera to determine the target three-dimensional model to be processed, so that the subsequent calculated amount is reduced. It should be noted that, when the initial three-dimensional models are plural, the bounding box corresponding to each initial three-dimensional model may be determined, all bounding boxes in the view vertebral body may be determined, the initial three-dimensional model corresponding to each bounding box in the view vertebral body may be determined as the target three-dimensional model, and the following step S202 is executed for each target three-dimensional model.
S202: and performing soft grating operation on the target three-dimensional model to obtain all pixel coordinates covered by each basic primitive in the target three-dimensional model in a target screen.
In this embodiment, the specific step of performing the soft grating operation on the target three-dimensional model may refer to step S102, and details thereof are not described herein. Wherein each basic primitive in the target three-dimensional model is a triangle surface. In step S202, performing a soft raster operation on the target three-dimensional model to obtain all pixel coordinates covered by each basic primitive in the target three-dimensional model in the target screen, including:
performing a soft raster operation on the target three-dimensional model to determine pixel coordinates of each vertex of each base primitive in the target three-dimensional model mapped in the target screen;
For each base primitive in the target three-dimensional model, determining all pixel coordinates covered by the base primitive in the target screen according to the pixel coordinates of all vertices of the base primitive mapped in the target screen.
In the above, the soft raster operation is performed on the target three-dimensional model, and the vertex coordinates of the vertices of the base primitive can be mapped into the target screen, so that the pixel coordinates of each vertex of the base primitive mapped in the target screen can be determined. For each base primitive, since the base primitive is a triangle surface, all pixel coordinates covered by the base primitive in the target screen can be determined according to the triangle surface surrounded by the pixel coordinates of all vertices of the base primitive mapped in the target screen.
S203: and determining the primitive information of the basic primitives from the initial buffer array for each basic primitive in the target three-dimensional model, and determining the pixel depth value of each pixel coordinate covered by the basic primitives in the target screen according to the primitive information of the basic primitives.
S204: for each pixel coordinate in the target screen, determining a target depth value corresponding to the pixel coordinate according to all pixel depth values corresponding to the pixel coordinate, and determining primitive information of a basic primitive corresponding to the pixel coordinate according to the target depth value.
S205: and updating the initial buffer array according to the primitive information of the basic primitive corresponding to each pixel coordinate in the target screen to obtain the target buffer array.
For the steps S203 to S205, after obtaining all the pixel coordinates covered by each base primitive in the target three-dimensional model in the target screen, for each base primitive in the target three-dimensional model, the vertex depth values of all the vertices of the base primitive may be determined from the initial buffer array, and then the vertex depth values of all the vertices may be interpolated by using the triangle gravity interpolation method, so as to obtain the pixel depth values of each pixel coordinate covered by the base primitive in the target screen, and further obtain all the pixel depth values corresponding to each pixel coordinate in the target screen. The triangle gravity center interpolation method can refer to the prior art, and in this embodiment, details are not described here.
After obtaining all pixel depth values corresponding to each pixel coordinate in the target screen, determining a shielding relation between each base primitive according to all pixel depth values corresponding to the pixel coordinate, and determining the nearest base primitive to the target screen according to the shielding relation. And taking the pixel depth value corresponding to the basic pixel closest to the screen as the target depth value corresponding to the pixel coordinate, and taking the primitive information of the basic pixel closest to the screen as the primitive information of the basic pixel corresponding to the pixel coordinate, so that the initial buffer array is updated by utilizing the target depth value corresponding to each pixel in the target screen and the primitive information of the basic primitive, and a target buffer array containing the relation between each pixel coordinate in the target screen and each basic primitive in the target three-dimensional model can be obtained.
In the above, in step S204, determining the target depth value corresponding to the pixel coordinate according to all the pixel depth values corresponding to the pixel coordinate includes:
Determining the minimum pixel depth value from all the pixel depth values corresponding to the pixel coordinates;
and determining the minimum pixel depth value as a target depth value corresponding to the pixel coordinates.
The base primitive corresponding to the smallest pixel depth value is the nearest base primitive to the target screen, so that the pixel depth value of the base primitive in the pixel coordinate can be determined as the target depth value corresponding to the pixel coordinate. According to the method, the target depth value corresponding to each pixel coordinate in the target screen can be obtained.
In the above, in step S204, the determining, according to the target depth value, primitive information of the base primitive corresponding to the pixel coordinate includes:
determining a basic primitive to which the target depth value belongs;
determining primitive information of a basic primitive to which the target depth value belongs from an initial buffer array;
and determining the primitive information of the basic primitive to which the target depth value belongs as the primitive information of the basic primitive corresponding to the pixel coordinates.
For a pixel coordinate, since the target depth value corresponding to the pixel coordinate is determined by the minimum pixel depth value, and the minimum pixel depth value has a corresponding base primitive, the primitive information of the base primitive is determined from the initial buffer array, and the primitive information of the base primitive can be determined as the primitive information of the base primitive corresponding to the pixel coordinate. Specifically, the primitive information of the base primitive corresponding to the pixel coordinates includes: the ID number of the basic primitive, the three-dimensional model information of the basic primitive, the vertex coordinates and vertex depth values of each vertex of the basic primitive.
S206: and rendering the target three-dimensional model into a target screen according to the target buffer array.
In this embodiment, the step S206 specifically includes:
For each pixel coordinate in the target screen, determining a target depth value corresponding to the pixel coordinate and primitive information of a basic primitive from a target buffer array;
and performing pixel rendering according to the target depth value corresponding to the pixel coordinates and the primitive information of the basic primitive so as to render the target three-dimensional model into a target screen.
The target depth value and the primitive information of the basic primitives corresponding to each pixel coordinate in the target buffer array are determined according to the shielding relation of all the basic primitives in the target three-dimensional model, so that the rendered target three-dimensional model obtained by pixel rendering according to the related information corresponding to each pixel coordinate in the target buffer array is a three-dimensional model containing a correct shielding relation. When the target depth value corresponding to a certain pixel coordinate in the target screen is 1, the pixel rendering of the pixel coordinate is not performed.
S207: when a selection area for the target three-dimensional model is acquired in the target screen, all pixel coordinates in the selection area are determined.
In this embodiment, the step S207 is identical to the step S105 described above, and specific reference is made to the above, which is not described here in detail in this embodiment.
S208: and picking up the basic graphic elements in the selection area according to all the pixel coordinates in the selection area.
In this embodiment, the step S208 specifically includes:
determining a target depth value corresponding to the pixel coordinate from the target buffer array for each pixel coordinate in the selected area;
When the target depth value is smaller than the preset depth value, determining primitive information of a basic primitive corresponding to the pixel coordinate from the target buffer array, wherein the preset depth value is 1;
And picking up the basic primitive in the selection area according to the primitive information of the basic primitive corresponding to all the pixel coordinates in the selection area.
After obtaining all the pixel coordinates in the selection area, the pixel coordinates in the selection area can be used as query conditions to perform query operation on the target buffer array, so that a target depth value corresponding to each pixel coordinate in the selection area can be obtained, only when the target depth value is smaller than a preset depth value, the pixel coordinates are characterized to have basic primitives, primitive information of the basic primitives corresponding to the pixel coordinates is determined from the target buffer array, and accordingly, the basic primitives in the selection area are picked up according to the primitive information of the basic primitives corresponding to all the pixel coordinates in the selection area.
In this embodiment, picking up the base primitive in the selection area according to primitive information of the base primitive corresponding to all pixel coordinates in the selection area includes:
When the vertexes of the basic primitives are required to be picked up, aiming at each pixel coordinate in the selection area, according to the vertex depth values corresponding to the vertexes of the basic primitives corresponding to the pixel coordinates and the pixel coordinates of the vertexes of the basic primitives corresponding to the pixel coordinates in the target screen, determining all vertexes meeting the preset conditions from all vertexes of the basic primitives corresponding to the pixel coordinates, wherein the preset conditions comprise that the pixel coordinates of the vertexes in the target screen are positioned in the selection area and the vertex depth values corresponding to the vertexes are equal to the target depth values corresponding to the pixel coordinates;
and picking up the vertexes of the basic primitives in the selection area according to all vertexes which correspond to all pixel coordinates in the selection area and meet the preset condition.
After obtaining the primitive information of the basic primitives corresponding to all the pixel coordinates in the selection area, judging the type of the picked basic primitives, and when the type of the picked basic primitives is a triangle surface, directly returning the primitive information of the basic primitives corresponding to all the pixel coordinates in the selection area to pick up the basic primitives in the selection area; when the type of the picked basic primitive is the vertex of the basic primitive, for each pixel coordinate in the selection area, according to the vertex depth value corresponding to each vertex of the basic primitive corresponding to the pixel coordinate and the pixel coordinate of each vertex of the basic primitive corresponding to the pixel coordinate in the target screen, determining each vertex meeting the preset condition from all vertices of the basic primitive corresponding to the pixel coordinate, and returning all vertices meeting the preset condition corresponding to all the pixel coordinates in the selection area, so as to pick up the vertex of the basic primitive in the selection area. When the type of the picked basic primitive is the polygon surface to which the basic primitive belongs, determining the three-dimensional model information to which the basic primitive corresponding to the pixel coordinate belongs from the target buffer array, and returning the three-dimensional model information to which the basic primitive corresponding to the pixel coordinate belongs, so as to pick up the polygon surface of the basic primitive in the selection area.
According to the method for picking up the basic primitives, the soft grating operation is performed on the target three-dimensional model to be rendered, so that the target buffer array containing the primitive information of the basic primitives shown by the pixel coordinates in the target screen is obtained, and after the target three-dimensional model is rendered into the target screen according to the target buffer array, when the target three-dimensional model in the target screen is selected, the primitive information of the basic primitives corresponding to the selected pixel coordinates can be determined according to the selected pixel coordinates, so that the picking up of a plurality of basic primitives is realized, and the subsequent face reduction of the target three-dimensional model is facilitated.
Referring to fig. 3, fig. 3 is a schematic structural diagram of a base primitive pickup device according to an embodiment of the present application. The pickup device for a base primitive provided in this embodiment includes: the device comprises an acquisition module 10, a processing module 20, a determination module 30 and a pickup module 40. The acquisition module 10 is used for acquiring a target three-dimensional model to be rendered; the processing module 20 is configured to perform a soft raster operation on the target three-dimensional model, so as to obtain all pixel coordinates covered by each basic primitive in the target three-dimensional model in a target screen; a determining module 30, configured to determine a target buffer array according to all the pixel coordinates covered by each of the base primitives in the target screen, where the target buffer array includes primitive information of the base primitives corresponding to each of the pixel coordinates in the target screen; the processing module 20 is configured to render the target three-dimensional model into a target screen according to the target buffer array; a determining module 30, configured to determine, when a selection area for the target three-dimensional model is acquired in the target screen, all the pixel coordinates in the selection area; a picking module 40, configured to pick up the base primitive in the selection area according to all the pixel coordinates in the selection area.
In the present embodiment, the acquisition module 10 is further configured to:
And acquiring an initial buffer array, wherein the initial buffer array comprises primitive information of each basic primitive in the target three-dimensional model.
In this embodiment, the determining module 30 is further configured to:
Determining, for each of the base primitives in the target three-dimensional model, primitive information of the base primitive from the initial buffer array, and determining a pixel depth value of each pixel coordinate covered by the base primitive in the target screen according to the primitive information of the base primitive;
For each pixel coordinate in the target screen, determining a target depth value corresponding to the pixel coordinate according to all the pixel depth values corresponding to the pixel coordinate, and determining primitive information of the basic primitive corresponding to the pixel coordinate according to the target depth value;
And updating the initial buffer array according to the primitive information of the basic primitive corresponding to each pixel coordinate in the target screen to obtain a target buffer array.
In this embodiment, the determining module 30 is further configured to:
determining the minimum pixel depth value from all the pixel depth values corresponding to the pixel coordinates;
And determining the minimum pixel depth value as the target depth value corresponding to the pixel coordinate.
In this embodiment, the determining module 30 is further configured to:
Determining the basic primitive to which the target depth value belongs;
determining the primitive information of the basic primitive to which the target depth value belongs from the initial buffer array;
And determining the primitive information of the basic primitive to which the target depth value belongs as the primitive information of the basic primitive corresponding to the pixel coordinate.
In this embodiment, the target buffer array further includes the target depth value corresponding to each of the pixel coordinates in the target screen.
In the present embodiment, the pick-up module 40 is further configured to:
determining the target depth value corresponding to the pixel coordinate from the target buffer array for each pixel coordinate in the selection area;
When the target depth value is smaller than a preset depth value, determining the primitive information of the basic primitive corresponding to the pixel coordinate from the target buffer array, wherein the preset depth value is 1;
And picking up the basic primitive in the selection area according to the primitive information of the basic primitive corresponding to all the pixel coordinates in the selection area.
In this embodiment, the primitive information of the base primitive includes vertex depth values corresponding to respective vertices of the base primitive.
In the present embodiment, the pick-up module 40 is further configured to:
When the vertexes of the basic primitive are required to be picked up, according to the vertex depth values corresponding to the vertexes of the basic primitive corresponding to the pixel coordinates and the pixel coordinates of the vertexes of the basic primitive corresponding to the pixel coordinates in the target screen, determining all vertexes meeting preset conditions from all vertexes of the basic primitive corresponding to the pixel coordinates, wherein the preset conditions comprise that the pixel coordinates of the vertexes in the target screen are positioned in the selected area and the vertex depth values corresponding to the vertexes are equal to the target depth values corresponding to the pixel coordinates;
and picking up the vertexes of the basic primitive in the selection area according to all vertexes which correspond to all the pixel coordinates in the selection area and meet the preset condition.
In this embodiment, the base primitive is a triangle surface.
In the present embodiment, the processing module 20 is further configured to:
performing a soft raster operation on the target three-dimensional model to determine the pixel coordinates in the target screen for which the respective vertices of each of the base primitives in the target three-dimensional model map;
for each base primitive in the target three-dimensional model, determining all pixel coordinates covered by the base primitive in the target screen according to the pixel coordinates of all vertices of the base primitive mapped in the target screen.
In the present embodiment, the acquisition module 10 is further configured to:
acquiring a visual cone corresponding to a camera and an initial three-dimensional model;
determining a bounding box corresponding to the initial three-dimensional model;
Determining the initial three-dimensional model as the target three-dimensional model to be rendered while the bounding box is within the optic cone.
According to the base primitive pick-up device provided by the embodiment, the soft grating operation is performed on the target three-dimensional model to be rendered, so that the target buffer array containing primitive information of the base primitives shown by the pixel coordinates in the target screen is obtained, and after the target three-dimensional model is rendered into the target screen according to the target buffer array, when the target three-dimensional model in the target screen is selected, since the pixel coordinates in the target screen all have the primitive information of the corresponding base primitive, the primitive information of the base primitive corresponding to the selected pixel coordinate can be determined according to the selected pixel coordinate, so that the pick-up of a plurality of base primitives is realized, and the subsequent face reduction of the target three-dimensional model is facilitated.
Fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application. The electronic device 400 shown in fig. 4 includes: at least one processor 401, memory 402, at least one network interface 404, and other user interfaces 403. The various components in electronic device 400 are coupled together by bus system 405. It is understood that the bus system 405 is used to enable connected communications between these components. The bus system 405 includes a power bus, a control bus, and a status signal bus in addition to a data bus. But for clarity of illustration the various buses are labeled as bus system 405 in fig. 4.
The user interface 403 may include, among other things, a display, a keyboard, or a pointing device (e.g., a mouse, a trackball, a touch pad, or a touch screen, etc.).
It will be appreciated that the memory 402 in embodiments of the application can be either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. The nonvolatile Memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable EPROM (EEPROM), or a flash Memory. The volatile memory may be random access memory (Random Access Memory, RAM) which acts as external cache memory. By way of example, and not limitation, many forms of RAM are available, such as static random access memory (STATIC RAM, SRAM), dynamic random access memory (DYNAMIC RAM, DRAM), synchronous Dynamic Random Access Memory (SDRAM), double data rate Synchronous dynamic random access memory (Double DATA RATE SDRAM, DDRSDRAM), enhanced Synchronous dynamic random access memory (ENHANCED SDRAM, ESDRAM), synchronous link dynamic random access memory (SYNCH LINK DRAM, SLDRAM), and Direct memory bus random access memory (DRRAM). The memory 402 described herein is intended to comprise, without being limited to, these and any other suitable types of memory.
In some implementations, the memory 402 stores the following elements, executable units or data structures, or a subset thereof, or an extended set thereof: an operating system 4021 and application programs 4022.
The operating system 4021 includes various system programs, such as a framework layer, a core library layer, a driver layer, and the like, for implementing various basic services and processing hardware-based tasks. The application programs 4022 include various application programs such as a media player (MEDIA PLAYER), a Browser (Browser), and the like for implementing various application services. A program for implementing the method of the embodiment of the present application may be included in the application program 4022.
In the embodiment of the present application, the processor 401 is configured to execute the method steps provided in the method embodiments by calling a program or an instruction stored in the memory 402, specifically, a program or an instruction stored in the application program 4022, for example, including: acquiring a target three-dimensional model to be rendered; performing soft grating operation on the target three-dimensional model to obtain all pixel coordinates covered by each basic primitive in the target three-dimensional model in a target screen; determining a target buffer array according to all pixel coordinates covered by each basic primitive in a target screen, wherein the target buffer array comprises primitive information of the basic primitive corresponding to each pixel coordinate in the target screen; rendering the target three-dimensional model into a target screen according to the target buffer array; when a selection area aiming at a target three-dimensional model is acquired in a target screen, determining all pixel coordinates in the selection area; and picking up the basic graphic elements in the selection area according to all the pixel coordinates in the selection area.
The method disclosed in the above embodiment of the present application may be applied to the processor 401 or implemented by the processor 401. The processor 401 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in the processor 401 or by instructions in the form of software. The Processor 401 described above may be a general purpose Processor, a digital signal Processor (DIGITAL SIGNAL Processor, DSP), an Application SPECIFIC INTEGRATED Circuit (ASIC), an off-the-shelf programmable gate array (Field Programmable GATE ARRAY, FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. The disclosed methods, steps, and logic blocks in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present application may be embodied directly in the execution of a hardware decoding processor, or in the execution of a combination of hardware and software elements in a decoding processor. The software elements may be located in a random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers, etc. as well known in the art. The storage medium is located in a memory 402, and the processor 401 reads the information in the memory 402 and, in combination with its hardware, performs the steps of the above method.
It is to be understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For a hardware implementation, the Processing units may be implemented within one or more Application SPECIFIC INTEGRATED Circuits (ASICs), digital signal processors (DIGITAL SIGNAL Processing, DSPs), digital signal Processing devices (DSPDEVICE, DSPD), programmable logic devices (Programmable Logic Device, PLDs), field-Programmable gate arrays (Field-Programmable GATE ARRAY, FPGA), general purpose processors, controllers, micro-controllers, microprocessors, other electronic units for performing the functions described herein, or a combination thereof.
For a software implementation, the techniques described herein may be implemented by means of units that perform the functions described herein. The software codes may be stored in a memory and executed by a processor. The memory may be implemented within the processor or external to the processor.
The electronic device provided in this embodiment may be an electronic device as shown in fig. 4, and may perform all steps of the method for picking up the base primitive as shown in fig. 1-2, so as to achieve the technical effects of the method for picking up the base primitive as shown in fig. 1-2, and the description is specifically referred to in fig. 1-2, and is omitted herein for brevity.
The embodiment of the application also provides a storage medium (computer readable storage medium). The storage medium here stores one or more programs. Wherein the storage medium may comprise volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, hard disk, or solid state disk; the memory may also comprise a combination of the above types of memories.
When one or more programs in the storage medium are executable by one or more processors, the above-described picking method of the base primitive performed on the picking device side of the base primitive is implemented.
The processor is configured to execute a picking program of the base primitive stored in the memory, so as to implement the following steps of a base primitive picking method executed on a base primitive picking device side: acquiring a target three-dimensional model to be rendered; performing soft grating operation on the target three-dimensional model to obtain all pixel coordinates covered by each basic primitive in the target three-dimensional model in a target screen; determining a target buffer array according to all pixel coordinates covered by each basic primitive in a target screen, wherein the target buffer array comprises primitive information of the basic primitive corresponding to each pixel coordinate in the target screen; rendering the target three-dimensional model into a target screen according to the target buffer array; when a selection area aiming at a target three-dimensional model is acquired in a target screen, determining all pixel coordinates in the selection area; and picking up the basic graphic elements in the selection area according to all the pixel coordinates in the selection area.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of function in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
It should be noted that references in the specification to "one implementation," "an embodiment," "an example embodiment," "some embodiments," etc., indicate that the embodiment described may include a particular feature, structure, or characteristic, but every embodiment may not necessarily include the particular feature, structure, or characteristic. Moreover, such phrases are not necessarily referring to the same embodiment. Furthermore, when a particular feature, structure, or characteristic is described in connection with an embodiment, it is submitted that it is within the knowledge of one skilled in the art to effect such feature, structure, or characteristic in connection with other embodiments whether or not explicitly described.
It should be noted that in this document, relational terms such as "first" and "second" and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the application.
Claims (10)
1. A method of picking up a base primitive, applied to a CPU, the method comprising:
Acquiring a target three-dimensional model to be rendered;
Performing soft grating operation on the target three-dimensional model to obtain all pixel coordinates covered by each basic primitive in the target three-dimensional model in a target screen;
Determining a target buffer array according to all pixel coordinates covered by each basic primitive in the target screen, wherein the target buffer array comprises primitive information of the basic primitive corresponding to each pixel coordinate in the target screen;
Rendering the target three-dimensional model into a target screen according to the target buffer array;
When a selection area aiming at the target three-dimensional model is acquired in the target screen, determining all pixel coordinates in the selection area;
and picking up the basic graphic elements in the selection area according to all the pixel coordinates in the selection area.
2. The method according to claim 1, characterized in that the method further comprises:
acquiring an initial buffer array, wherein the initial buffer array comprises primitive information of each basic primitive in the target three-dimensional model;
said determining a target buffer array according to all the pixel coordinates covered by each of the base primitives in the target screen, comprising:
Determining, for each of the base primitives in the target three-dimensional model, primitive information of the base primitive from the initial buffer array, and determining a pixel depth value of each pixel coordinate covered by the base primitive in the target screen according to the primitive information of the base primitive;
For each pixel coordinate in the target screen, determining a target depth value corresponding to the pixel coordinate according to all the pixel depth values corresponding to the pixel coordinate, and determining primitive information of the basic primitive corresponding to the pixel coordinate according to the target depth value;
And updating the initial buffer array according to the primitive information of the basic primitive corresponding to each pixel coordinate in the target screen to obtain a target buffer array.
3. The method of claim 2, wherein determining the target depth value corresponding to the pixel coordinate from all the pixel depth values corresponding to the pixel coordinate comprises:
determining the minimum pixel depth value from all the pixel depth values corresponding to the pixel coordinates;
Determining the minimum pixel depth value as the target depth value corresponding to the pixel coordinate;
And determining the primitive information of the basic primitive corresponding to the pixel coordinates according to the target depth value, including:
Determining the basic primitive to which the target depth value belongs;
determining the primitive information of the basic primitive to which the target depth value belongs from the initial buffer array;
And determining the primitive information of the basic primitive to which the target depth value belongs as the primitive information of the basic primitive corresponding to the pixel coordinate.
4. The method of claim 2, wherein the target buffer array further comprises the target depth value for each of the pixel coordinates in the target screen;
The picking up the base primitive in the selection area according to all the pixel coordinates in the selection area comprises:
determining the target depth value corresponding to the pixel coordinate from the target buffer array for each pixel coordinate in the selection area;
When the target depth value is smaller than a preset depth value, determining the primitive information of the basic primitive corresponding to the pixel coordinate from the target buffer array, wherein the preset depth value is 1;
And picking up the basic primitive in the selection area according to the primitive information of the basic primitive corresponding to all the pixel coordinates in the selection area.
5. The method of claim 4, wherein the primitive information of the base primitive comprises vertex depth values corresponding to respective vertices of the base primitive;
The picking up the basic primitive in the selection area according to the primitive information of the basic primitive corresponding to all the pixel coordinates in the selection area includes:
When the vertexes of the basic primitive are required to be picked up, according to the vertex depth values corresponding to the vertexes of the basic primitive corresponding to the pixel coordinates and the pixel coordinates of the vertexes of the basic primitive corresponding to the pixel coordinates in the target screen, determining all vertexes meeting preset conditions from all vertexes of the basic primitive corresponding to the pixel coordinates, wherein the preset conditions comprise that the pixel coordinates of the vertexes in the target screen are positioned in the selected area and the vertex depth values corresponding to the vertexes are equal to the target depth values corresponding to the pixel coordinates;
and picking up the vertexes of the basic primitive in the selection area according to all vertexes which correspond to all the pixel coordinates in the selection area and meet the preset condition.
6. The method of claim 1, wherein the base primitive is a triangle facet;
And performing soft grating operation on the target three-dimensional model to obtain all pixel coordinates covered by each basic primitive in the target three-dimensional model in a target screen, wherein the soft grating operation comprises the following steps:
performing a soft raster operation on the target three-dimensional model to determine the pixel coordinates in the target screen for which the respective vertices of each of the base primitives in the target three-dimensional model map;
for each base primitive in the target three-dimensional model, determining all pixel coordinates covered by the base primitive in the target screen according to the pixel coordinates of all vertices of the base primitive mapped in the target screen.
7. The method of claim 1, wherein the obtaining the target three-dimensional model to be rendered comprises:
acquiring a visual cone corresponding to a camera and an initial three-dimensional model;
determining a bounding box corresponding to the initial three-dimensional model;
Determining the initial three-dimensional model as the target three-dimensional model to be rendered while the bounding box is within the optic cone.
8. A base primitive pickup device, comprising:
The acquisition module is used for acquiring a target three-dimensional model to be rendered;
The processing module is used for executing soft grating operation on the target three-dimensional model to obtain all pixel coordinates covered by each basic primitive in the target three-dimensional model in a target screen;
The determining module is used for determining a target buffer array according to all pixel coordinates covered by each basic primitive in the target screen, wherein the target buffer array comprises primitive information of the basic primitive corresponding to each pixel coordinate in the target screen;
the processing module is used for rendering the target three-dimensional model into a target screen according to the target buffer array;
A determining module, configured to determine, when a selection area for the target three-dimensional model is acquired in the target screen, all the pixel coordinates in the selection area;
and the picking module is used for picking up the basic primitive in the selection area according to all the pixel coordinates in the selection area.
9. An electronic device, comprising: a processor and a memory, the processor being configured to execute a pick-up program of the base primitive stored in the memory to implement the base primitive pick-up method of any one of claims 1 to 7.
10. A storage medium storing one or more programs executable by one or more processors to implement the method of picking up base primitives of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410129971.XA CN117994431A (en) | 2024-01-30 | 2024-01-30 | Basic graphic element pickup method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410129971.XA CN117994431A (en) | 2024-01-30 | 2024-01-30 | Basic graphic element pickup method and device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117994431A true CN117994431A (en) | 2024-05-07 |
Family
ID=90900986
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410129971.XA Pending CN117994431A (en) | 2024-01-30 | 2024-01-30 | Basic graphic element pickup method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117994431A (en) |
-
2024
- 2024-01-30 CN CN202410129971.XA patent/CN117994431A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR102419745B1 (en) | Game rendering method, and game resource file creation method, apparatus, and device | |
US11182952B2 (en) | Hidden culling in tile-based computer generated images | |
WO2022193941A1 (en) | Image rendering method and apparatus, device, medium, and computer program product | |
KR102122454B1 (en) | Apparatus and Method for rendering a current frame using an image of previous tile | |
JP4542153B2 (en) | Flexible anti-aliasing for embedded devices | |
JP2883080B1 (en) | Texture mapping apparatus and method | |
US9589386B2 (en) | System and method for display of a repeating texture stored in a texture atlas | |
JP5579741B2 (en) | Grouping display list control streams in tile-based 3D computer graphics systems | |
TWI434226B (en) | Image processing techniques | |
JP2008533628A (en) | Tiled prefetch and cached depth buffer | |
US11521342B2 (en) | Residency map descriptors | |
TWI479447B (en) | Re-render acceleration of frame with lighting change | |
KR20120132560A (en) | Multi-buffer support for off-screen surfaces in a graphics processing system | |
CN110428504B (en) | Text image synthesis method, apparatus, computer device and storage medium | |
KR20180056316A (en) | Method and apparatus for performing tile-based rendering | |
KR20150093689A (en) | Method for forming an optimized polygon based shell mesh | |
KR20190078086A (en) | A method and an apparatus for performing tile-based rendering using prefetched graphics data | |
CN113900797A (en) | Three-dimensional oblique photography data processing method, device and equipment based on illusion engine | |
US20110069065A1 (en) | Image processing apparatus, computer readable medium and method thereof | |
KR20170025099A (en) | Method and apparatus for rendering | |
JP3629243B2 (en) | Image processing apparatus and method for rendering shading process using distance component in modeling | |
CN111402369A (en) | Interactive advertisement processing method and device, terminal equipment and storage medium | |
US7525551B1 (en) | Anisotropic texture prefiltering | |
JP2003168130A (en) | System for previewing photorealistic rendering of synthetic scene in real-time | |
CN117994431A (en) | Basic graphic element pickup method and device, electronic equipment and storage medium |
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 |