Summary of the invention
The objective of the invention is to overcome prior art and can't realize the defective of three dimensional stress visualized operation is carried out in large-scale virtual crowd motion, thereby a kind of efficient, general and method that modeling cost is low is provided.
To achieve these goals, the invention provides a kind of three-dimensional visualization method of virtual crowd motion, comprise following steps:
The virtual crowd that will occur in step 10), the analytic system is classified individuality, sets up a three-dimensional (3 D) manikin as template model for every kind of classification by resemblance, obtains the template model storehouse; And, select one group to derive from the position according to the feature of each template model, and define each and derive from the material that position can be used, join in the Materials Library;
Step 20), catch or manual generate human body movement data, and exercise data is input in the motion database;
Step 30), resultant motion data;
Step 40), template model and synthetic exercise data are drawn pre-service;
Step 50), the simple script data of input description crowd motion, the information in the script comprises: each type, each individual current position, each individual current motion state under individual in the colony;
Step 60), according to step 50) in the data of input, from the template model storehouse, select template model, and, generate virtual individual in conjunction with the derivation of Materials Library implementation model;
Step 70), to step 60) virtual individual that generates, according to this individuality in step 50) in the motion state information of input, from described motion database, select exercise data, and calculate this exercise data over time, with the motion of driving virtual individual; All virtual individuals in the traversal colony generate dynamic virtual crowd;
Step 80), realize the colony of virtual crowd is played up.
In the technique scheme, in step 10), described individuality is done classification is that age, sex according to individuality divided the crowd.
In the technique scheme, in step 10), clothes, hair style, shoes and hats that described derivation position selects human body to wear.
In the technique scheme, described step 20) comprising:
Step 21), the motion state that may occur of the virtual individual in the statistical system;
Step 22), utilize capturing movement equipment to gather or use motion to generate and the manual step 21 that generates of software for editing) in the human body movement data of the every kind of motion state that obtains of adding up;
In described step 22) in, the capture movement The data based on electromagnetism or based on optics or based on the method for capturing movement of acoustics, described motion generation and software for editing comprise special software 3dsmax or Maya or SOFTIMAGE|XSI or Blender.
In the technique scheme, in described step 30) in, the method for described resultant motion The data art designing hand adjustment or the method that adopts motion fusion, flying splice, motion to be redirected.
In the technique scheme, in step 40) in, template model is drawn pre-service with synthetic exercise data comprises:
41), to each masterplate model, to the executable action data of each this template model,, calculate the three-dimensional model of corresponding this frame to each frame of this action data;
42), to step 41) in the three-dimensional model that obtains, draw pre-service; Wherein, required drafting preprocess method comprise drafting preprocess method based on image, based on the drafting preprocess method of point sampling, based on the preprocess method of grid animation, based on the preprocess method of level of detail technology.
In the technique scheme, described step 60) comprising:
Step 61), at each individuality among the system virtualization crowd, according in step 50) type information of the individuality in the data of importing, from the template model storehouse, select the template corresponding model;
Step 62), judge that whether current individuality occurs first, if, carry out next step, otherwise, execution in step 64);
Step 63), individuality occurs first, still unallocated material is selected a cover material at random from described Materials Library, and in internal memory storage material sequence number, execution in step 70 then);
Step 64), individuality distributed material, directly reads the material sequence number of this template model from internal memory, and uses corresponding material, play up.
In the technique scheme, described step 70) comprising:
Step 71), at each individuality in the colony, according to step 50) the input data in should individuality type information and current time should individuality motion state information, from motion database, select corresponding exercise data;
Step 72), according to should the individuality current time in the input data, last one constantly and the positional information in next moment, ask for current movement velocity of this individuality and direction of motion;
Step 73), according to each constantly motion vector, individual each motion vector, individual last selected exercise data frame index of a moment of emulated data constantly of exercise data of from motion database, selecting, calculate the exercise data of current time individuality, described exercise data comprises individual current position, the athletic posture of health various piece;
Step 74), utilize step 73) in the current time exercise data and the step 72 that obtain) in the direction of motion actuation step 60 that obtains) in the virtual individual that generates;
Step 75), travel through the whole individualities in the colony, generation dynamic virtual colony.
In the technique scheme, described step 80) method that employing is played up by the colony of being narrated in comprises method for drafting based on image, based on the method for drafting of point sampling, based on the method for drafting of grid animation, based on the method for drafting of level of detail technology.Advantage of the present invention mainly shows:
1, the input of system is comparatively simple, mainly is script datas such as different individual down constantly states, position, can be embedded into other application systems easily or is called by them, has good versatility;
2, by using technology such as bone covering, capturing movement, system can control to freedom and flexibility each individuality in the colony, satisfies the requirement of user for the human motion verisimilitude;
3, by the derivation technology that uses a model, can derive a large amount of personalized models from less model template, farthest reduce the modeling cost of three-dimensional population model, and save memory cost and computing cost that model is written into, stores;
4, by using the motion deformation technology, just movement effects true to nature be can produce, thereby the memory cost and the computing cost of model-driven saved with less exercise data;
5, by using, realized the three-dimensional real-time rendering of large-scale crowd data based on technology such as playing up of point sampling.
Embodiment
The present invention is further illustrated below in conjunction with the drawings and specific embodiments.
As shown in Figure 1, the three-dimensional visualization method of virtual crowd motion of the present invention may further comprise the steps:
One, pre-treatment step
The fundamental purpose of pre-treatment step is to generate needed template model storehouse, Materials Library, motion database and drafting storehouse when handling in real time.Therefore comprise that template model modeling, exercise data are caught, exercise data synthesize, template model and exercise data drafting pre-service four sub-steps.
The template model storehouse is set up in step 10, template model modeling.
The virtual crowd that occurs in step 11, the analysis application system is classified individuality wherein according to certain standard.For example: can the individuality among the crowd be divided into: the elderly man, the elderly woman, young people man, young people woman, children man, children woman six classes according to age and sex.
Step 12, at the resemblance of each type individuality, set up a three-dimensional (3 D) manikin as template model.For example, in step 11), virtual crowd is divided into the elderly man, the elderly woman, young people man, young people woman, children man, children woman six classes, in this step, for the elderly man sets up a three-dimensional (3 D) manikin, this model is as the elderly man's template model, virtual crowd to other kinds is also done similar operation, obtains the template model of the elderly man, the elderly woman, young people man, young people woman, children man, children woman six class individualities at last.Fig. 2 is exactly the template model of the elderly man, the elderly woman, young people man, young people woman, children man, children woman six class individualities.
Step 13, at the feature of each template model, select one group to derive from the position, define the possible material that each derives from the position, and join in the Materials Library.Generally speaking, can select clothes that human body wears, hair style, shoes and hats as deriving from part.With the elderly man model template die type is example, if specify upper garment and trousers as the derivation position, and the possible material of depositing in the Materials Library that is upper garment and trousers, these may materials artificially be specified according to the application system needs by the user.
Step 20, catch human body movement data, generate human body movement data perhaps by hand, and exercise data is input in the motion database.
The motion state that virtual individual in step 21, the statistics application system may occur.For example, under the situation of personnel level land emergency evacuation, the motion state that individuality may occur comprises: walk, run, stop to look around, death falls down to the ground.
Step 22, utilize capturing movement equipment or use motion to generate and software for editing the human body movement data of the every kind of motion state that obtains of adding up in the acquisition step 21.Can adopt existing method for capturing movement to catching of human body movement data, comprise based on electromagnetism, based on optics, based on the method for capturing movement of acoustics, the capturing movement equipment that is adopted can adopt VICON.Described motion generation and software for editing comprise special software 3dsmax or Maya or SOFTIMAGE|XSI or Blender.
Step 30, exercise data synthesize.Different template models owing to have anthropometry information such as different height, leg length, if adopt identical exercise data to drive, will produce problems such as step slides, limbs penetrate.Therefore, need handle, meet the exercise data of this model build for the synthetic cover of each template model the exercise data that captures.In addition, in order to save storage space, each exercise data need be processed into broadcast capable of circulation, the cyclical movement data that promptly first frame and tail frame can seamlessly transit.The resultant motion data can adopt the method for art designing's hand adjustment, also can adopt technology such as motion fusion, flying splice, motion are redirected, if the data that generate be true to nature, meet the template model physical characteristic, can loop play just passable.
Step 40, template model and exercise data are drawn pre-service.In order to improve the template model rendering speed, rendering algorithm need be drawn pre-service to template model and exercise data usually efficiently.For example, adopt rendering algorithm, need carry out point sampling, generate multi-resolution models the model of template model after exercise data drives based on point sampling; Employing also needs to drive the image that the back model generates different visual angles according to this based on the rendering algorithm of image.Template model is drawn pretreated specific implementation step with synthetic exercise data to be comprised:
Step 41, to each masterplate model, to the executable action data of each this template model,, calculate the three-dimensional model of corresponding this frame to each frame of this action data;
Step 42, the three-dimensional model to obtaining in the step 41 are drawn pre-service.
Wherein, in step 42 required drafting preprocess method comprise drafting preprocess method based on image, based on the drafting preprocess method of point sampling, based on the preprocess method of grid animation, based on the preprocess method of level of detail technology.
Two, input data step
The simple script data of step 50, input description crowd motion, the information spinner in the script will comprise: each individual affiliated type, each individual current position, each individual current motion state in the colony.
Be an example fragment of input data below:
…
Individual sequence number: 015;
Individual type: the elderly man;
…
Time (second): 0.2
Position (rice): 10,11,11;
Motion state: walk;
Time (second): 0.3
Position (rice): 10.1,11,11;
Motion state: walk;
Time (second): 0.4
Position (rice): 10.2,11,11;
Motion state: walk;
…
Three, real-time treatment step
In real time treatment step comprises that model derivation, model-driven, colony play up, and is used for the three-dimensional visualization of virtual crowd motion is realized.
Step 60, according to the input data, from the template model storehouse, select template model, and, generate virtual individual in conjunction with the derivation of Materials Library implementation model.
Step 61, at each individuality in the colony, according to type information that should individuality in the input data, from the template model storehouse, select the template corresponding model;
Step 62, judge that whether current individuality occurs first, if, carry out next step, otherwise, execution in step 64;
Step 63, individuality occur first, and still unallocated material is selected a cover material at random, and store the material sequence number in internal memory from Materials Library, and execution in step 70 then;
Step 64, individuality have distributed material, directly read the material sequence number of this template model from internal memory, and use corresponding material, play up.
Step 70, driving model obtain the final attitude of individual current time.
Step 71, at each individuality in the colony, according to type information that should individuality in the input data and current time should individuality motion state information, from motion database, select corresponding exercise data.With the data instance of input in the step 50, be 015 the elderly man to individual sequence number, the exercise data of from motion database, selecting the elderly man to walk.
Step 72, according to should the individuality current time in the input data, last one constantly and the positional information in next moment, ask for current movement velocity of this individuality and direction of motion.Still with the data instance of input in the step 50, individual sequence number is 015 the elderly man, in its motion process, last one is 0.2 second constantly, and current time is 0.3 second, and next is 0.4 second constantly, position in the time of 0.2 second is (10,11,11), position in the time of 0.3 second is (10.1,11,11), the position in the time of 0.4 second is (10.2,11,11).Can calculate the current movement velocity of this individuality in view of the above is 1 meter per second, and current direction of motion is (1,0,0).
The motion vector of the motion vector of each moment exercise data that step 73, basis are selected from motion database, each moment emulated data of individuality, individual last selected exercise data frame index of a moment, the exercise data of calculating current time individuality.Exercise data comprises individual current position, the athletic posture of health various piece.
Concrete computing method are as follows:
Suppose { F
iI=1 ..., I} is the motion vector of i frame exercise data, wherein, I is the exercise data totalframes.{ S
jBe at time point t
jLast emulated data motion vector need be tried to achieve { N
j, promptly at time point t
jGo up selected exercise data frame index.Use mathematical induction, make initial value N
0=1, problem is converted to: at N
jUnder the known prerequisite, ask N
J+1Wherein, subscript j represents one constantly, and subscript j+1 represents current time.
Use and sound out the method for finding the solution, with N
J+1By N
jIncrease progressively exploration successively, when
The time, exploration stops, and promptly obtains N
J+1Wherein,>symbol is the comparison of exercise data and two vectors of emulated data, uses the largest component relative method, promptly when vector
In arbitrary component greater than S
J+1-S
jDuring respective component, promptly whole vector greater than.Because the exercise data frame number is limited, can't infinitely increase progressively exploration, therefore work as N
J+1During>I, N
J+1Again increase progressively exploration since 1, simultaneously,
Step 74, utilize the current time exercise data and the step 72 that obtain in the step 73) in the virtual individual that generates in the direction of motion actuation step 60 that obtains.
Whole individualities in step 75, the traversal colony generate dynamic virtual colony.
Step 80, realization are played up the colony of virtual crowd.In this step, it is ripe prior art that colony plays up, can adopt Chinese patent application number is 200610089057.9, denomination of invention: the application for a patent for invention of " a kind of virtual man real-time drawing method ", method for drafting or other method for drafting is efficiently wherein disclosed, dynamic virtual colony is carried out real-time rendering, comprise method for drafting, based on the method for drafting of point sampling, based on the method for drafting of grid animation, based on method for drafting of level of detail technology etc. based on image.