Method and apparatus for capturing motion trajectory of to-be-rendered virtual object and electronic device
View Patent ↗Disclosed is a method for capturing a motion trajectory of a to-be-rendered virtual object, rendering a virtual object, and drawing a tracking primitive, including. determining at least one tracking primitive corresponding to a to-be-rendered virtual object in a virtual scene based on the to-be-rendered virtual object, the tracking primitive corresponding to the to-be-rendered virtual object covering a movable part of the to-be-rendered virtual object; drawing the tracking primitive corresponding to the to-be-rendered virtual object in the virtual scene; and capturing the motion trajectory of the to-be-rendered virtual object in the virtual scene based on a motion trajectory corresponding to the drawn tracking primitive.
1 . A method for capturing a motion trajectory of a to-be-rendered virtual object, comprising:
determining at least one tracking primitive corresponding to a to-be-rendered virtual object in a virtual scene based on the to-be-rendered virtual object, wherein the at least one tracking primitive covers a movable part of the to-be-rendered virtual object, and wherein the at least one tracking primitive does not cover a whole of the to-be-rendered virtual object;
drawing the at least one tracking primitive in the virtual scene based on following a motion or an attitude of a respective mesh model corresponding to a respective movable part of the to-be-rendered virtual object;
capturing a motion trajectory of the to-be-rendered virtual object in the virtual scene based on a motion of the at least one tracking primitive; and
rendering the to-be-rendered virtual object in the virtual scene based on the motion trajectory.
2 . The method according to claim 1 , wherein the at least one tracking primitive comprises a first tracking primitive and a second tracking primitive, the first tracking primitive following a first mesh model associated with a first moving part of the to-be-rendered virtual object, and the second tracking primitive following a second mesh model associated with a second moving part of the to-be-rendered virtual object.
3 . The method according to claim 1 , wherein the drawing comprises:
classifying the at least one tracking primitive according to primitive types of the at least one tracking primitive, in order to obtain a tracking primitive set corresponding to each of the primitive types; and
submitting, for the tracking primitive set, a draw call for drawing all tracking primitives in the tracking primitive set at a time.
4 . The method according to claim 1 , wherein the drawing comprises:
determining an attribute change of the at least one tracking primitive based on interaction data of each virtual object in the virtual scene and operation data of a controlled virtual object; and
drawing the at least one tracking primitive based on the attribute change corresponding to the at least one tracking primitive.
5 . The method according to claim 1 , further comprising:
determining interaction data corresponding to the at least one tracking primitive based on the drawn tracking primitive; and
determining motion trajectories corresponding to the at least one tracking primitive based on the interaction data.
6 . The method according to claim 1 , wherein the determining comprises:
acquiring a motion state of a to-be-rendered virtual object in the virtual scene;
determining at least one primitive identifier corresponding to the to-be-rendered virtual object based on the motion state of the to-be-rendered virtual object; and
determining the at least one tracking primitive based on the at least one primitive identifier.
7 . The method according to claim 6 , wherein the determining the at least one tracking primitive based on the at least one primitive identifier comprises:
determining, based on the at least one primitive identifier, whether the at least one tracking primitive has been created;
updating a corresponding tracking primitive in a list of to-be-drawn primitives based on determining that the at least one tracking primitive has been created; and
creating the corresponding tracking primitive and adding the corresponding tracking primitive to the list of to-be-drawn primitives in based on determining that the at least one tracking primitive has not been created.
8 . The method according to claim 1 , further comprising:
displaying the to-be-rendered virtual object on a display screen based on the motion trajectory of the to-be-rendered virtual object in the virtual scene.
9 . An apparatus for capturing a motion trajectory of a to-be-rendered virtual object, the apparatus comprising:
at least one non-transitory memory configured to store instructions; and
at least one processor configured to execute the instructions, wherein the instructions, when executed by the at least one processor, cause the at least one processor to:
determine at least one tracking primitive corresponding to a to-be-rendered virtual object in a virtual scene based on the to-be-rendered virtual object, wherein the at least one tracking primitive covers a movable part of the to-be-rendered virtual object, and wherein the at least one tracking primitive does not cover a whole of the to-be-rendered virtual object;
draw the at least one tracking primitive in the virtual scene based on following a motion or an attitude of a respective mesh model corresponding to a respective movable part of the to-be-rendered virtual object;
capture a motion trajectory of the to-be-rendered virtual object in the virtual scene based on a motion of the at least one tracking primitive; and
render the to-be-rendered virtual object in the virtual scene based on the motion trajectory.
10 . The apparatus according to claim 9 , wherein the at least one tracking primitive comprises a first tracking primitive and a second tracking primitive, the first tracking primitive following a first mesh model associated with a first moving part of the to-be-rendered virtual object, and and the second tracking primitive following a second mesh model associated with a second moving part of the to-be-rendered virtual object.
11 . The apparatus according to claim 9 , wherein the drawing comprises:
classifying the at least one tracking primitive according to primitive types of the at least one tracking primitive, in order to obtain a tracking primitive set corresponding to each of the primitive types; and
submitting, for the tracking primitive set, a draw call for drawing all tracking primitives in the tracking primitive set at a time.
12 . The apparatus according to claim 9 , wherein the drawing comprises:
determining an attribute change of the at least one tracking primitive based on interaction data of each virtual object in the virtual scene and operation data of a controlled virtual object; and
drawing the at least one tracking primitive based on the attribute change corresponding to the at least one tracking primitive.
13 . The apparatus according to claim 9 , wherein the instructions when executed by the at least one processor, further cause the at least one processor to:
determine interaction data corresponding to the at least one tracking primitive based on the at least one tracking primitive; and
determine motion trajectories corresponding to the at least one tracking primitive based on the interaction data.
14 . The apparatus according to claim 9 , wherein the determining comprises:
acquiring a motion state of a to-be-rendered virtual object in the virtual scene;
determining at least one primitive identifier corresponding to the to-be-rendered virtual object based on the motion state of the to-be-rendered virtual object; and
determining the at least one tracking primitive based on the at least one primitive identifier.
15 . The apparatus according to claim 14 , wherein the determining the at least one tracking primitive based on the at least one primitive identifier comprises:
determining, based on the at least one primitive identifier, whether the at least one tracking primitive has been created;
updating a corresponding tracking primitive in a list of to-be-drawn primitives based on determining that the at least one tracking primitive has been created; and
creating the corresponding tracking primitive and adding the corresponding tracking primitive to the list of to-be-drawn primitives in based on determining that the at least one tracking primitive has not been created.
16 . The apparatus according to claim 9 , wherein the instructions when executed by the at least one processor, further cause the at least one processor to:
displaying the to-be-rendered virtual object on a display screen based on the motion trajectory of the to-be-rendered virtual object in the virtual scene.
17 . A non-transitory computer-readable medium containing program code which, when executed by at least one processor of a device for capturing a motion trajectory of a to-be-rendered virtual object, causes the at least one processor to:
determine at least one tracking primitive corresponding to a to-be-rendered virtual object in a virtual scene based on the to-be-rendered virtual object, wherein the at least one tracking primitive covers a movable part of the to-be-rendered virtual object, and wherein the at least one tracking primitive does not cover a whole of the to-be-rendered virtual object;
draw the at least one tracking primitive in the virtual scene based on following a motion or an attitude of a respective mesh model corresponding to a respective movable part of the to-be-rendered virtual object;
capture a motion trajectory of the to-be-rendered virtual object in the virtual scene based on a motion of the at least one tracking primitive; and
render the to-be-rendered virtual object in the virtual scene based on the motion trajectory.
18 . The non-transitory computer-readable medium according to claim 17 , wherein the at least one tracking primitive comprises a first tracking primitive and a second tracking primitive, the first tracking primitive following a first mesh model associated with a first moving part of the to-be-rendered virtual object, and the second tracking primitive following a second mesh model associated with a second moving part of the to-be-rendered virtual object.
19 . The non-transitory computer-readable medium of claim 17 , wherein to draw the at least one tracking primitive, the program code is further configured to cause the at least one processor to:
classify the at least one tracking primitive according to primitive types of the at least one tracking primitive, in order to obtain a tracking primitive set corresponding to each of the primitive types; and
submit, for the tracking primitive set, a draw call for drawing all tracking primitives in the tracking primitive set at a time.
20 . The non-transitory computer-readable medium of claim 17 , wherein to draw the at least one tracking primitive, the program code is further configured to cause the at least one processor to:
determine an attribute change of the at least one tracking primitive based on interaction data of each virtual object in the virtual scene and operation data of a controlled virtual object; and
draw the at least one tracking primitive based on the attribute change corresponding to the at least one tracking primitive.